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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]