Commit 37988ad3 by MORITA Kazutaka Committed by Tianqi Chen

[RUNTIME][OPENCL] delay device check (#1657)

parent cfc848a7
...@@ -108,10 +108,10 @@ python run.py ...@@ -108,10 +108,10 @@ python run.py
Synthesis Synthesis
--------- ---------
- Run synthesis with the following script. `XCL_EMULATION_MODE` must be set to 1 at this stage. - Run synthesis with the following script.
```bash ```bash
export XCL_EMULATION_MODE=1 unset XCL_EMULATION_MODE
export XCL_TARGET=hw export XCL_TARGET=hw
python build.py python build.py
......
...@@ -34,6 +34,7 @@ class OpenCLWrappedFunc { ...@@ -34,6 +34,7 @@ class OpenCLWrappedFunc {
void operator()(TVMArgs args, void operator()(TVMArgs args,
TVMRetValue* rv, TVMRetValue* rv,
void** void_args) const { void** void_args) const {
CHECK(w_->context != nullptr) << "No OpenCL device";
cl::OpenCLThreadEntry* t = w_->GetThreadEntry(); cl::OpenCLThreadEntry* t = w_->GetThreadEntry();
// get the kernel from thread local kernel table. // get the kernel from thread local kernel table.
if (entry_.kernel_id >= t->kernel_table.size()) { if (entry_.kernel_id >= t->kernel_table.size()) {
...@@ -157,7 +158,6 @@ std::string OpenCLModuleNode::GetSource(const std::string& format) { ...@@ -157,7 +158,6 @@ std::string OpenCLModuleNode::GetSource(const std::string& format) {
void OpenCLModuleNode::Init() { void OpenCLModuleNode::Init() {
workspace_ = GetGlobalWorkspace(); workspace_ = GetGlobalWorkspace();
workspace_->Init(); workspace_->Init();
CHECK(workspace_->context != nullptr) << "No OpenCL device";
device_built_flag_.resize(workspace_->devices.size(), false); device_built_flag_.resize(workspace_->devices.size(), false);
// initialize the kernel id, need to lock global table. // initialize the kernel id, need to lock global table.
std::lock_guard<std::mutex> lock(workspace_->mu); std::lock_guard<std::mutex> lock(workspace_->mu);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment