You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "echuraev (via GitHub)" <gi...@apache.org> on 2023/01/26 12:37:57 UTC

[GitHub] [tvm] echuraev commented on a diff in pull request #13843: [RUNTIME][CLML] OpenCLML tuning and profiling enhanced

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


##########
src/runtime/opencl/opencl_common.h:
##########
@@ -508,26 +531,11 @@ class OpenCLTimerNode : public TimerNode {
   Device dev_;
 
   void recreateCommandQueue() {
-    cl_command_queue_properties prop;
-
     if (!cl::OpenCLWorkspace::Global()->IsProfiling(dev_)) {
-      prop = CL_QUEUE_PROFILING_ENABLE;
+      cl::OpenCLWorkspace::Global()->EnableQueueProfiling(dev_, true);

Review Comment:
   Probably it will be better to do in such way:
   ```c++
   cl::OpenCLWorkspace::Global()->EnableQueueProfiling(dev_, !cl::OpenCLWorkspace::Global()->IsProfiling(dev_));
   ```



##########
src/runtime/contrib/clml/clml_runtime.cc:
##########
@@ -281,32 +310,34 @@ class CLMLRuntime : public JSONRuntimeBase {
       }
     }
 
+    int64_t duration = 0;
     for (size_t i = 0; i < this->layer_.function.size(); ++i) {
       // Make CLML subgraphs accounted by OpenCLTimerNode.
-      if (getenv("CLML_PROFILING") || workspace->IsProfiling(tentry->device)) {
+
+      // if (workspace->IsProfiling(tentry->device)) {

Review Comment:
   This comment can be removed?



##########
src/runtime/opencl/opencl_common.h:
##########
@@ -284,6 +284,29 @@ class OpenCLWorkspace : public DeviceAPI {
 
     return prop & CL_QUEUE_PROFILING_ENABLE;
   }
+  // Enable queue profiling, recreate if required
+  void EnableQueueProfiling(Device dev, bool enable) {
+    bool is_enabled = cl::OpenCLWorkspace::Global()->IsProfiling(dev);
+    if (is_enabled == enable) {
+      return;
+    }
+    cl_command_queue_properties prop = 0;
+    if (enable) {
+      prop = CL_QUEUE_PROFILING_ENABLE;
+    } else {
+      prop = 0;
+    }

Review Comment:
   ```suggestion
       cl_command_queue_properties prop = (enable) ? CL_QUEUE_PROFILING_ENABLE : 0;
   ```



-- 
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