From 7515824a6d7dee3b244ca38ee3258107eebdad9e Mon Sep 17 00:00:00 2001 From: Christopher Milan Date: Mon, 18 May 2026 16:06:43 -0700 Subject: [PATCH] ci: actually use clang-20, enable bfloat16 (#16249) --- .github/workflows/test.yml | 4 ++-- test/backend/test_dtype_alu.py | 4 ++++ tinygrad/device.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9070b58cea..dab523e886 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -794,10 +794,10 @@ jobs: key: ${{ matrix.backend }}-minimal deps: testing_unit opencl: ${{ matrix.backend == 'opencl' && 'true' }} - llvm: ${{ matrix.backend == 'llvm' || matrix.backend == 'lvp' }} + llvm: ${{ matrix.backend != 'opencl' }} mesa: ${{ matrix.backend == 'lvp' && 'true' }} - name: Set env - run: printf "${{ matrix.backend == 'llvm' && 'DEV=CPU:LLVM' || matrix.backend == 'cpu' && 'DEV=CPU\nCPU_COUNT=2' || matrix.backend == 'opencl' && 'DEV=CL' || matrix.backend == 'lvp' && 'DEV=CPU:LVP' }}" >> $GITHUB_ENV + run: printf "${{ matrix.backend == 'llvm' && 'DEV=CPU:LLVM' || matrix.backend == 'cpu' && 'CC=clang-20\nDEV=CPU\nCPU_COUNT=2' || matrix.backend == 'opencl' && 'DEV=CL' || matrix.backend == 'lvp' && 'DEV=CPU:LVP' }}" >> $GITHUB_ENV - name: Check Device.DEFAULT and print some source run: | python3 -c "from tinygrad import Device; assert Device.DEFAULT in ['CPU','CL'], Device.DEFAULT" diff --git a/test/backend/test_dtype_alu.py b/test/backend/test_dtype_alu.py index 8d61cdcd86..bef294ca40 100644 --- a/test/backend/test_dtype_alu.py +++ b/test/backend/test_dtype_alu.py @@ -7,6 +7,7 @@ from tinygrad.device import is_dtype_supported from tinygrad.runtime.ops_python import from_storage_scalar from tinygrad.renderer.ptx import PTXRenderer from tinygrad.renderer.nir import NIRRenderer +from tinygrad.uop import Ops import numpy as np import pytest from hypothesis import assume, given, strategies as strat, settings @@ -37,6 +38,9 @@ if ((DEV.interface.startswith("MOCK") and Device.DEFAULT in {"NV", "CUDA"}) unary_operations.remove((Tensor.sin, np.sin)) unary_operations.remove((Tensor.cos, np.cos)) +# transcendental isn't accurate enough +if Ops.SQRT not in Device[Device.DEFAULT].renderer.code_for_op: unary_operations.remove((Tensor.sqrt, np.sqrt)) + class ht: float64 = strat.floats(width=64, allow_subnormal=False) float32 = strat.floats(width=32, allow_subnormal=False) diff --git a/tinygrad/device.py b/tinygrad/device.py index 0b3e275b9f..9ed7df5d62 100644 --- a/tinygrad/device.py +++ b/tinygrad/device.py @@ -345,7 +345,7 @@ def is_dtype_supported(dtype:DType, target:Target|None=None) -> bool: case "METAL": target.arch.startswith("Apple") and int(target.arch[5:]) >= 6 case "CUDA": return (not CI or BENCHMARKS) and target.renderer != "PTX" case "NV": return (not CI or BENCHMARKS) and target.renderer not in ("PTX", "NAK") - case "CPU": return (not CI or BENCHMARKS) and platform.machine() in {"arm", "arm64", "aarch64", "x86_64", "amd64"} and target.renderer != "LVP" + case "CPU": return platform.machine() in {"arm", "arm64", "aarch64", "x86_64", "amd64"} and target.renderer != "LVP" case "AMD" | "CL" | "PYTHON" | "NULL": return True case _: return False if dtype in dtypes.fp8_ocp: