echuraev commented on code in PR #12711:
URL: https://github.com/apache/tvm/pull/12711#discussion_r964623519
##########
src/runtime/contrib/clml/clml_runtime.cc:
##########
@@ -499,15 +483,18 @@ class CLMLRuntime : public JSONRuntimeBase {
uint32_t n, c, h, w;
};
- bool ExtensionStringPresent(cl_device_id device_id) {
+ bool ExtensionStringPresent(void) {
cl_int result = 0;
-
+ if (workspace->platform_id == nullptr) {
+ return 0;
+ }
size_t reqd_size = 0;
- result = clGetDeviceInfo(device_id, CL_DEVICE_EXTENSIONS, 0, NULL,
&reqd_size);
+ result = clGetDeviceInfo(workspace->devices[0], CL_DEVICE_EXTENSIONS, 0,
NULL, &reqd_size);
Review Comment:
I agree with you that in current implementation, `device_id` is always zero.
So, we can just get the first device in the vector.
But I have one point for a discussion. I'm afraid that if we change
something in the `OpenCLWorkspace` related to the list of the devices in the
future, then we can break this piece of code. So, this is why I prefer to get
the device in this way:
`workspace->devices[workspace->GetThreadEntry()->device.device_id]`. To make it
more safe and readable, I proposed to introduce a new method. What do you think
about it?
--
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]