Skip to content

Commit

Permalink
MNN:Bugfix: Fix bug for mac os opencl init error
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaying committed Dec 20, 2024
1 parent 30c044b commit 0a7b960
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/backend/opencl/core/runtime/OpenCLRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ OpenCLRuntime::OpenCLRuntime(const BackendConfig::PrecisionMode precision, const
// Do nothing
});
}else{
context_properties.push_back(0);
mContext = std::shared_ptr<cl::Context>(new cl::Context(std::vector<cl::Device>({*mFirstGPUDevicePtr}), context_properties.data(), nullptr, nullptr, &res));
if(context_properties.size() > 0){
context_properties.push_back(0);
mContext = std::shared_ptr<cl::Context>(new cl::Context(std::vector<cl::Device>({*mFirstGPUDevicePtr}), context_properties.data(), nullptr, nullptr, &res));
}else{
mContext = std::shared_ptr<cl::Context>(new cl::Context(std::vector<cl::Device>({*mFirstGPUDevicePtr}), nullptr, nullptr, nullptr, &res));
}
}
MNN_CHECK_CL_SUCCESS(res, "context");
if (res != CL_SUCCESS) {
Expand Down

0 comments on commit 0a7b960

Please sign in to comment.