From 4791c0c701da050d4df4ed25846907971b7851b0 Mon Sep 17 00:00:00 2001 From: Andrey Kasaurov Date: Tue, 14 Jul 2015 15:44:02 +0300 Subject: [PATCH] Add -timeout option to overwrite the default if needed --- src/hexl/hexl_exe/HexlRunner.cpp | 1 + src/hexl/hexl_hsaruntime/HsailRuntime.cpp | 8 ++++---- src/hexl/hexl_hsaruntime/HsailRuntime.hpp | 2 ++ src/hsail_conformance/exe/HsailConformanceRunner.cpp | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hexl/hexl_exe/HexlRunner.cpp b/src/hexl/hexl_exe/HexlRunner.cpp index 6b4c1c1..22aa6d4 100644 --- a/src/hexl/hexl_exe/HexlRunner.cpp +++ b/src/hexl/hexl_exe/HexlRunner.cpp @@ -90,6 +90,7 @@ int HexlRunner::ParseOptions() optReg.RegisterOption("match"); optReg.RegisterOption("testlog"); optReg.RegisterOption("rtlib"); + optReg.RegisterOption("timeout"); int n; if ((n = hexl::ParseOptions(argc, argv, optReg, options)) != 0) { std::cout << "Invalid option: " << argv[n] << std::endl; diff --git a/src/hexl/hexl_hsaruntime/HsailRuntime.cpp b/src/hexl/hexl_hsaruntime/HsailRuntime.cpp index 82e0b24..7f8be8d 100644 --- a/src/hexl/hexl_hsaruntime/HsailRuntime.cpp +++ b/src/hexl/hexl_hsaruntime/HsailRuntime.cpp @@ -146,11 +146,11 @@ void HsaQueueErrorCallback(hsa_status_t status, hsa_queue_t *source, void *data) HostThreads hostThreads; std::vector keys; - const static uint32_t TIMEOUT = 120; + const uint32_t TIMEOUT; public: - HsailRuntimeContextState(HsailRuntimeContext* runtime_, Context* context_) - : runtime(runtime_), context(context_), hostThreads(this) { } + HsailRuntimeContextState(HsailRuntimeContext* runtime_, Context* context_, uint32_t timeout) + : runtime(runtime_), context(context_), hostThreads(this), TIMEOUT(timeout) { } ~HsailRuntimeContextState() { @@ -998,7 +998,7 @@ HsailRuntimeContext::HsailRuntimeContext(Context* context) runtime::RuntimeState* HsailRuntimeContext::NewState(Context* context) { this->context = context; - return new HsailRuntimeContextState(this, context); + return new HsailRuntimeContextState(this, context, context->Opts()->GetUnsigned("timeout", HSAILRUNTIMEDEFAULTTIMEOUT)); } void HsailRuntimeContext::QueueDestroy() diff --git a/src/hexl/hexl_hsaruntime/HsailRuntime.hpp b/src/hexl/hexl_hsaruntime/HsailRuntime.hpp index 3f9c9f3..322656e 100644 --- a/src/hexl/hexl_hsaruntime/HsailRuntime.hpp +++ b/src/hexl/hexl_hsaruntime/HsailRuntime.hpp @@ -27,6 +27,8 @@ #include "HSAILBrigContainer.h" #include +#define HSAILRUNTIMEDEFAULTTIMEOUT 120 + namespace hexl { class EnvContext; diff --git a/src/hsail_conformance/exe/HsailConformanceRunner.cpp b/src/hsail_conformance/exe/HsailConformanceRunner.cpp index 485d417..c69fdf5 100644 --- a/src/hsail_conformance/exe/HsailConformanceRunner.cpp +++ b/src/hsail_conformance/exe/HsailConformanceRunner.cpp @@ -200,6 +200,7 @@ void HCRunner::Run() optReg.RegisterBooleanOption("dump.dispatchsetup"); optReg.RegisterBooleanOption("XtestFtzF16"); // eXperimental optReg.RegisterOption("match"); + optReg.RegisterOption("timeout"); { int n = hexl::ParseOptions(argc, argv, optReg, options); if (n != 0) {