echuraev commented on code in PR #13972:
URL: https://github.com/apache/tvm/pull/13972#discussion_r1105290023
##########
src/runtime/contrib/clml/clml_runtime.cc:
##########
@@ -581,9 +583,6 @@ class CLMLRuntime : public JSONRuntimeBase {
bool ExtensionStringPresent(void) {
cl_int result = 0;
- if (workspace->platform_id == nullptr) {
- return 0;
- }
size_t reqd_size = 0;
cl_device_id device_id =
workspace->devices[workspace->GetThreadEntry()->device.device_id];
Review Comment:
For now, you don't check that the OpenCL device is available. So it might be
a runtime error. I suppose that you can add a new method to `OpenCLWorkspace`
e.g.:
```c++
bool IsDeviceExists(int device_id) {
return device_id < devices.size();
}
```
In this case, you'll be able to softly check if OpenCL device available. And
use this method instead of removed if condition.
Also, you can use `GetCLDeviceID` for getting `device_id`:
```suggestion
cl_device_id device_id =
GetCLDeviceID(workspace->GetThreadEntry()->device.device_id);
```
##########
src/runtime/contrib/clml/clml_runtime.cc:
##########
@@ -144,6 +144,8 @@ class CLMLRuntime : public JSONRuntimeBase {
workspace = cl::OpenCLWorkspace::Global();
workspace->Init();
tentry = workspace->GetThreadEntry();
+ device_id = workspace->GetCLDeviceID(tentry->device.device_id);
+ platform_id = workspace->device_to_platform[device_id];
Review Comment:
If there is no OpenCL devices presented, then an exception will be generated
here. Is it ok to you? Or I suggest moving these two lines after if condition
`if (!ExtensionStringPresent())`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]