You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "XYZboom (via GitHub)" <gi...@apache.org> on 2026/07/28 10:56:50 UTC

[I] [Bug] CUDA Check failed: scope != "global" when using `argmin` [tvm]

XYZboom opened a new issue, #20060:
URL: https://github.com/apache/tvm/issues/20060

   ### Expected behavior
   
   `relax.build(mod, target="cuda")` should compile successfully for any valid Relax IR module, including `relax.op.argmin` with any valid input shape. The compiled module should execute and produce correct argmin results.
   
   ### Actual behavior
   
   
   `relax.build` crashes with an `InternalError` during CUDA codegen:
   
   ```
   tvm.error.InternalError: Check failed: scope != "global" (global vs. global) : Cannot allocate global memory when targeting CUDA. You must pass all global arrays as input instead
   ```
   
   ### Environment
   
   - **OS**: Linux (x86_64, conda environment)
   - **GPU**: NVIDIA GeForce RTX 3080 Ti (12GB VRAM, CUDA 580.76.05)
   - **TVM version**: 0.25.0.post1
   - **Target**: `cuda` (GPU compilation)
   - **Python**: 3.12
   
   ### Steps to reproduce
   
   ```python
   import tvm
   from tvm import relax
   
   bb = relax.BlockBuilder()
   v = relax.Var("x", relax.TensorStructInfo(shape=[1], dtype="float32"))
   with bb.function("f", [v]):
       out = bb.emit(relax.op.astype(relax.op.argmin(v, axis=-1), dtype="float32"))
       bb.emit_func_output(out)
   mod = bb.get()
   
   # Crashes here during CUDA codegen
   ex = relax.build(mod, target="cuda")
   ```
   
   ### Triage
   
   * bug
   * cuda
   * needs-triage
   


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [I] [Bug] CUDA Check failed: scope != "global" when using `argmin` [tvm]

Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex closed issue #20060: [Bug] CUDA Check failed: scope != "global" when using `argmin`
URL: https://github.com/apache/tvm/issues/20060


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [I] [Bug] CUDA Check failed: scope != "global" when using `argmin` [tvm]

Posted by "XYZboom (via GitHub)" <gi...@apache.org>.
XYZboom commented on issue #20060:
URL: https://github.com/apache/tvm/issues/20060#issuecomment-5103232929

   error log:
   ```python
   Traceback (most recent call last):
     File "/root/Code/python/tmp/main.py", line 12, in <module>
       ex = relax.build(mod, target="cuda")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/root/miniconda3/lib/python3.12/site-packages/tvm/relax/vm_build.py", line 276, in build
       return _vmlink(
              ^^^^^^^^
     File "/root/miniconda3/lib/python3.12/site-packages/tvm/relax/vm_build.py", line 157, in _vmlink
       lib = tvm.tirx.build(tir_mod, target=target, pipeline=tir_pipeline)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/root/miniconda3/lib/python3.12/site-packages/tvm/tirx/build.py", line 240, in build
       return tir_to_runtime(host_mod, device_mod_dict, target_host)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/root/miniconda3/lib/python3.12/site-packages/tvm/tirx/build.py", line 146, in tir_to_runtime
       device_modules.append(codegen_build(device_mod, target))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/root/miniconda3/lib/python3.12/site-packages/tvm/tirx/build.py", line 130, in codegen_build
       return bf(mod, target)
              ^^^^^^^^^^^^^^^
     File "python/tvm_ffi/cython/function.pxi", line 968, in tvm_ffi.core.Function.__call__
     File "/project/src/backend/cuda/codegen/codegen_cuda.cc", line 759, in virtual void tvm::codegen::CodeGenCUDA::PrintStorageScope(const std::string&, std::ostream&)
   tvm.error.InternalError: Check failed: scope != "global" (global vs. global) : Cannot allocate global memory when targeting CUDA. You must pass all global arrays as input instead
   
   ```


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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org