You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/09/06 13:18:21 UTC

[GitHub] [tvm] echuraev commented on a diff in pull request #12711: [OpenCLML] CLML Profiling fixes corresponding to OpenCL Timer recent …

echuraev commented on code in PR #12711:
URL: https://github.com/apache/tvm/pull/12711#discussion_r963695735


##########
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:
   Sorry, probably I missed something. Could you please explain why you didn't reuse code from OpenCL runtime?
   Won't this pseudocode work in the same way?
   ```suggestion
     void InitCLML() {
       // Setup CLML Context
       cl_int result = 0;
       // Initialize Context and Command Queue
       OpenCLWorkspace* workspace = OpenCLWorkspace::Global();
       workspace->Init();
       OpenCLThreadEntry* t = workspace->GetThreadEntry();
       cl_device_id did = workspace->devices[t->device.device_id];
       
       if (!ExtensionStringPresent(did)) {
         LOG(WARNING) << "CLML Runtime Init: Qualcomm extn not present.\n";
         return;
       }
       this->queue = workspace->GetQueue(t->device);
   ```
   
   If it works, it won't be necessary to implement function `GetCommadQueue`.



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org