[Mlir-commits] [mlir] [NVGPU] Fix nvdsl examples (PR #156830)

Giacomo Castiglioni llvmlistbot at llvm.org
Wed Oct 8 09:45:56 PDT 2025


castigli wrote:

> I feel like we should enable LIT testing without running for these test so at least they can get compiled.

In principle I agree, but I don't have good ideas to check both compile-only and compile-and-run without mucking the code too much.
What about something like
```
...
# RUN: env MLIR_RUN_CUDA_SM90_TESTS=%mlir_run_cuda_sm90_tests
...
if run_if_cuda_sm90_enabled(lambda: saxpy(x, y, alpha)) is None:
    #  4. Verify MLIR with reference computation
    ref = np.ones((M, N), np.float32)
    ref += x * alpha
    np.testing.assert_allclose(y, ref, rtol=5e-03, atol=1e-01)
print("PASS")
# CHECK: PASS
```
with the util defined as
```
def run_if_cuda_sm90_enabled(func, *args, **kwargs):
    """Execute a function if CUDA SM90 tests are enabled, otherwise print a warning."""
    mlir_run_cuda_sm90_tests = os.getenv("MLIR_RUN_CUDA_SM90_TESTS")
    if mlir_run_cuda_sm90_tests == "1" or mlir_run_cuda_sm90_tests is None:
        return func(*args, **kwargs)
    else:
        print("warning: skipping test execution")
        return -1
```

https://github.com/llvm/llvm-project/pull/156830


More information about the Mlir-commits mailing list