From a4c3d48aa94bdc7c39e46bca6310c4d31a3db744 Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Mon, 8 Dec 2025 12:07:49 -0800 Subject: [PATCH] compile-only test for IR3 actually works (#13619) --- .github/workflows/test.yml | 1 + tinygrad/helpers.py | 1 + tinygrad/runtime/ops_null.py | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b9748ce84..9df105f79f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1000,4 +1000,5 @@ jobs: shell: bash run: | python -c "from tinygrad import Device; assert Device.DEFAULT == 'NULL'" + DEBUG=4 python3 test/test_ops.py TestOps.test_add python -m pytest -n=auto test/test_ops.py --durations=20 diff --git a/tinygrad/helpers.py b/tinygrad/helpers.py index a27156de42..10bc3b3bf5 100644 --- a/tinygrad/helpers.py +++ b/tinygrad/helpers.py @@ -187,6 +187,7 @@ CPU_COUNT = ContextVar("CPU_COUNT", max(1, len(os.sched_getaffinity(0)) if hasat # Compilers CPU_LLVM, CPU_LVP, AMD_LLVM = ContextVar("CPU_LLVM", 0), ContextVar("CPU_LVP", 0), ContextVar("AMD_LLVM", 0) NV_PTX, CUDA_PTX, NV_NAK, QCOM_IR3 = ContextVar("NV_PTX", 0), ContextVar("CUDA_PTX", 0), ContextVar("NV_NAK", 0), ContextVar("QCOM_IR3", 0) +NULL_IR3 = ContextVar("NULL_IR3", 0) AMD_CC, CPU_CC, NV_CC, CUDA_CC = ContextVar("AMD_CC", ""), ContextVar("CPU_CC", ""), ContextVar("NV_CC", ""), ContextVar("CUDA_CC", "") QCOM_CC = ContextVar("QCOM_CC", "") # VIZ implies PROFILE, but you can run PROFILE without VIZ diff --git a/tinygrad/runtime/ops_null.py b/tinygrad/runtime/ops_null.py index f7bad77230..e99016d9af 100644 --- a/tinygrad/runtime/ops_null.py +++ b/tinygrad/runtime/ops_null.py @@ -4,7 +4,7 @@ from tinygrad.engine.jit import MultiGraphRunner from tinygrad.renderer.cstyle import Renderer, CStyleLanguage from tinygrad.renderer.llvmir import AMDLLVMRenderer from tinygrad.uop.ops import Ops -from tinygrad.helpers import cpu_profile, EMULATE +from tinygrad.helpers import cpu_profile, EMULATE, NULL_IR3 from tinygrad.renderer.nir import IR3Renderer from tinygrad.runtime.support.compiler_mesa import IR3Compiler @@ -40,5 +40,5 @@ class NullDevice(Compiled): case "": renderer = NullRenderer case _: raise RuntimeError(f"can't EMULATE device: {EMULATE.value}") compilers = CompilerSet([CompilerPair(renderer, Compiler), - CompilerPair(functools.partial(IR3Renderer, self), functools.partial(IR3Compiler, 0x6030001))]) # adreno 630 + CompilerPair(functools.partial(IR3Renderer, self), functools.partial(IR3Compiler, 0x6030001), NULL_IR3)]) # adreno 630 super().__init__(device, NullAllocator(self), compilers, functools.partial(NullProgram, device), NullGraph)