Summary
grid.memfence() in python/quadrants/lang/simt/grid.py lacks a Python-level arch check, unlike every other SIMT primitive in block.py.
Details
The current implementation:
def memfence():
return impl.call_internal("grid_memfence", with_runtime_context=False)
Every other op in block.py checks impl.get_runtime().prog.config().arch and raises a clear ValueError when the op is not supported on the current backend. grid.memfence() skips this check entirely.
According to the documentation in #638, grid.memfence() is CUDA-only. A user calling it on AMDGPU or SPIR-V will get a confusing error from the C++ runtime rather than a clean Python-level ValueError with a helpful message.
Suggested fix
Add an arch guard consistent with the pattern used in block.py:
def memfence():
arch = impl.get_runtime().prog.config().arch
if arch == _qd_core.cuda:
return impl.call_internal("grid_memfence", with_runtime_context=False)
raise ValueError(f"qd.simt.grid.memfence is not supported for arch {arch}")
Found during
Review of #638 (docs for qd.simt.block.*).
Summary
grid.memfence()inpython/quadrants/lang/simt/grid.pylacks a Python-level arch check, unlike every other SIMT primitive inblock.py.Details
The current implementation:
Every other op in
block.pychecksimpl.get_runtime().prog.config().archand raises a clearValueErrorwhen the op is not supported on the current backend.grid.memfence()skips this check entirely.According to the documentation in #638,
grid.memfence()is CUDA-only. A user calling it on AMDGPU or SPIR-V will get a confusing error from the C++ runtime rather than a clean Python-levelValueErrorwith a helpful message.Suggested fix
Add an arch guard consistent with the pattern used in
block.py:Found during
Review of #638 (docs for
qd.simt.block.*).