echuraev commented on code in PR #12711:
URL: https://github.com/apache/tvm/pull/12711#discussion_r963830132
##########
src/runtime/contrib/clml/clml_runtime.cc:
##########
@@ -146,22 +169,7 @@ class CLMLRuntime : public JSONRuntimeBase {
LOG(WARNING) << "CLML Runtime Init: Qualcomm extn not present.\n";
return;
}
-
- // Reuse the OpenCl work space from TVM Device API.
- auto func = tvm::runtime::Registry::Get("device_api.opencl");
- ICHECK(func != nullptr) << "Cannot find OpenCL device_api in registry";
- auto device_api = static_cast<cl::OpenCLWorkspace*>(((*func)()).operator
void*());
- this->context = device_api->context;
- bool queue_found = false;
- for (size_t i = 0; i < device_api->devices.size(); ++i) {
- if (device_api->devices[i] == device_id) {
- this->queue = device_api->queues[i];
- this->evts = &(device_api->events[i]);
- queue_found = true;
- }
- }
- ICHECK(queue_found != false) << "Device queue not found in OpenCL
Workspace";
-
+ this->queue = GetCommadQueue();
Review Comment:
Yes, I agree with you. One thing that I wanted to say that probably we could
unify and reuse existing code instead of writing new similar functions.
Speaking about recreation function. So, in function `recreateCommandQueue` a
new queue is creating and storing in the vector with queues. And when we call
`GetQueue` then a new (recreated) queue will be returned. I don't see any
reasons why we cannot call `cl::OpenCLWorkspace::Global()->GetQueue(device)` in
all places where we'd like to use command queue and get a new queue. What do
you think about that?
--
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]