Commit 37988ad3 by MORITA Kazutaka Committed by Tianqi Chen

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

parent cfc848a7
......@@ -108,10 +108,10 @@ python run.py
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
export XCL_EMULATION_MODE=1
unset XCL_EMULATION_MODE
export XCL_TARGET=hw
python build.py
......
......@@ -34,6 +34,7 @@ class OpenCLWrappedFunc {
void operator()(TVMArgs args,
TVMRetValue* rv,
void** void_args) const {
CHECK(w_->context != nullptr) << "No OpenCL device";
cl::OpenCLThreadEntry* t = w_->GetThreadEntry();
// get the kernel from thread local kernel table.
if (entry_.kernel_id >= t->kernel_table.size()) {
......@@ -157,7 +158,6 @@ std::string OpenCLModuleNode::GetSource(const std::string& format) {
void OpenCLModuleNode::Init() {
workspace_ = GetGlobalWorkspace();
workspace_->Init();
CHECK(workspace_->context != nullptr) << "No OpenCL device";
device_built_flag_.resize(workspace_->devices.size(), false);
// initialize the kernel id, need to lock global table.
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