This is an automated email from the ASF dual-hosted git repository.

mshr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 5989ef57a6 [BugFix][OpenCL] Guard QCOM perf hint behind 
USE_OPENCL_EXTN_QCOM to avoid undefined symbol on non-QCOM runtimes (#18589)
5989ef57a6 is described below

commit 5989ef57a6c9e845b2ab4851195de3e0f7997304
Author: ping-ee <[email protected]>
AuthorDate: Wed Dec 17 15:32:11 2025 +0800

    [BugFix][OpenCL] Guard QCOM perf hint behind USE_OPENCL_EXTN_QCOM to avoid 
undefined symbol on non-QCOM runtimes (#18589)
    
    This PR is a re-open of #18581
    
    The previous PR was created while Jenkins CI was experiencing a disk
    space issue and the CI job did not trigger.
    
    ## PR Description
    Recent OpenCL-Headers update
    (https://github.com/KhronosGroup/OpenCL-Headers/pull/277
    ) added QCOM perf-hint definitions (`CL_CONTEXT_PERF_HINT_QCOM`,
    `clSetPerfHintQCOM`) to `cl_ext.h`.
    
    These macros are now defined even on platforms whose OpenCL runtimes
    (e.g., PoCL, ICD loaders) do not implement the QCOM extension.
    
    TVM previously enabled the perf-hint code path solely based on the
    presence of `CL_CONTEXT_PERF_HINT_QCOM`, causing link errors such as:
    
    ```
    undefined symbol: clSetPerfHintQCOM
    ```
    
    This PR guards the QCOM perf-hint logic behind `USE_OPENCL_EXTN_QCOM`,
    matching the behavior of other QCOM-specific OpenCL paths (e.g.,
    `SetNativePtr`).
    
    ## Effects
    Prevents accidental linking against unsupported QCOM symbols on non-QCOM
    runtimes.
    Keeps QCOM builds fully functional when `USE_OPENCL_EXTN_QCOM` is
    explicitly enabled.
    Aligns TVM’s extension handling across OpenCL code paths.
    
    ---------
    
    Co-authored-by: gemini-code-assist[bot] 
<176961590+gemini-code-assist[bot]@users.noreply.github.com>
---
 src/runtime/opencl/opencl_device_api.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/runtime/opencl/opencl_device_api.cc 
b/src/runtime/opencl/opencl_device_api.cc
index 8b6fba2498..63e0890f70 100644
--- a/src/runtime/opencl/opencl_device_api.cc
+++ b/src/runtime/opencl/opencl_device_api.cc
@@ -472,7 +472,7 @@ void OpenCLWorkspace::SetNativePtr(const 
tvm::runtime::Tensor& narr, void* host_
 }
 
 void OpenCLWorkspace::SetPerfHint(Device dev, cl_uint perf_hint) {
-#ifdef CL_CONTEXT_PERF_HINT_QCOM
+#if defined(USE_OPENCL_EXTN_QCOM) && defined(CL_CONTEXT_PERF_HINT_QCOM)
   cl_device_id device_id = GetCLDeviceID(dev.device_id);
   auto platform = device_info[device_id].platform_id;
   OPENCL_CALL(clSetPerfHintQCOM(this->contexts[platform], perf_hint));

Reply via email to