gemini-code-assist[bot] commented on code in PR #19787:
URL: https://github.com/apache/tvm/pull/19787#discussion_r3418076056


##########
tests/python/relax/backend/adreno/utils.py:
##########
@@ -56,49 +56,19 @@ def __call__(self):
         return self.check
 
 
-def _adreno_requires(predicate, reason):
-    """Tag a GPU test with the ``gpu`` marker plus an eager runtime skip.
-
-    The predicate is evaluated when the decorator is applied (at collection
-    time), so the skip condition is resolved eagerly.
-    """
-
-    def decorator(func):
-        func = pytest.mark.skipif(not predicate(), reason=reason)(func)
-        return pytest.mark.gpu(func)
-
-    return decorator
-
+# Eager skips for Adreno GPU tests, resolved at import time. Pair each with
+# ``@pytest.mark.gpu`` at the test site so CI's ``-m gpu`` filter selects it.
 
 # OpenCL or Vulkan
-requires_adreno_opencl_vulkan = _adreno_requires(
-    run_time_check("any").check,
-    "need adreno opencl or vulkan",
-)
-
-# Any Vulkan
-requires_adreno_vulkan = _adreno_requires(
-    lambda: tvm.runtime.enabled("vulkan") and run_time_check("vulkan").check(),
-    "need adreno vulkan",
-)
-
-# Any OpenCL
-requires_adreno_opencl = _adreno_requires(
-    lambda: tvm.runtime.enabled("opencl") and run_time_check("opencl").check(),
-    "need adreno opencl",
-)
-
-# Real Adreno GPU OpenCL Target
-requires_adreno_opencl_real = _adreno_requires(
-    lambda: tvm.runtime.enabled("opencl") and run_time_check("real").check(),
-    "need real adreno opencl",
+skip_unless_adreno_opencl_vulkan = pytest.mark.skipif(
+    not run_time_check("any").check(),
+    reason="need adreno opencl or vulkan",
 )

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   Calling `tvm.opencl().exist` or `tvm.vulkan().exist` directly can raise a 
`TVMError` during test collection if TVM was compiled without OpenCL or Vulkan 
support (i.e., `USE_OPENCL=OFF` or `USE_VULKAN=OFF`). To make test collection 
robust across different build configurations, we should guard these checks with 
`tvm.runtime.enabled`.
   
   ```python
   skip_unless_adreno_opencl_vulkan = pytest.mark.skipif(
       not (
           (tvm.runtime.enabled("opencl") and tvm.opencl().exist)
           or (tvm.runtime.enabled("vulkan") and tvm.vulkan().exist)
       ),
       reason="need adreno opencl or vulkan",
   )
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to