Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .github/actions/setup-tinygrad/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,16 @@ runs:
if: inputs.cuda == 'true'
shell: bash
run: |
sudo mkdir -p /usr/local/cuda/targets/x86_64-linux
curl -fL https://developer.download.nvidia.com/compute/cuda/redist/cuda_nvrtc/linux-x86_64/cuda_nvrtc-linux-x86_64-11.5.119-archive.tar.xz \
| sudo tar -xJ -C /usr/local/cuda/targets/x86_64-linux --strip-components=1
echo /usr/local/cuda/targets/x86_64-linux/lib | sudo tee /etc/ld.so.conf.d/cuda-nvrtc.conf
cuda_root=/usr/local/cuda/targets/x86_64-linux
sudo mkdir -p "$cuda_root"
for archive in \
cuda_nvrtc-linux-x86_64-12.9.86-archive.tar.xz \
cuda_cudart-linux-x86_64-12.9.37-archive.tar.xz; do
curl -fL "https://developer.download.nvidia.com/compute/cuda/redist/${archive%%-linux-x86_64-*}/linux-x86_64/$archive" \
| sudo tar -xJ -C "$cuda_root" --strip-components=1
done
echo "CUDA_PATH=$cuda_root" >> "$GITHUB_ENV"
echo "$cuda_root/lib" | sudo tee /etc/ld.so.conf.d/cuda-nvrtc.conf
sudo ldconfig

# **** gpuocelot ****
Expand All @@ -262,7 +268,7 @@ runs:
shell: bash
run: |
sudo mkdir -p /usr/local/lib
sudo curl --output-dir /usr/local/lib -fLO https://github.com/tinygrad/gpuocelot/releases/download/v0.1.0/libgpuocelot.${{ runner.os == 'Linux' && 'so' || 'dylib' }}
sudo curl --output-dir /usr/local/lib -fLO https://github.com/li0nr/gpuocelot/releases/download/cuda-12-support-sm86/libgpuocelot.${{ runner.os == 'Linux' && 'so' || 'dylib' }}

# **** WebGPU ****

Expand Down
2 changes: 1 addition & 1 deletion test/mockgpu/nv/nvdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def rm_control(self, argp):
else:
for i,c in enumerate(classes): params.classList[i] = c
elif struct.cmd == nv_gpu.NV2080_CTRL_CMD_GR_GET_INFO:
info = {nv_gpu.NV2080_CTRL_GR_INFO_INDEX_SM_VERSION: nv_gpu.NV2080_CTRL_GR_INFO_SM_VERSION_3_5,
info = {nv_gpu.NV2080_CTRL_GR_INFO_INDEX_SM_VERSION: nv_gpu.NV2080_CTRL_GR_INFO_SM_VERSION_8_6,
nv_gpu.NV2080_CTRL_GR_INFO_INDEX_LITTER_NUM_GPCS: 1,
nv_gpu.NV2080_CTRL_GR_INFO_INDEX_LITTER_NUM_TPC_PER_GPC: 1,
nv_gpu.NV2080_CTRL_GR_INFO_INDEX_LITTER_NUM_SM_PER_TPC: 1,
Expand Down
10 changes: 10 additions & 0 deletions tinygrad/renderer/cstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,16 @@ def __init__(self, target:Target, use_nvcc=False):
type_map = {dtypes.uint32: "uint", dtypes.bfloat16: "nv_bfloat16", dtypes.fp8e4m3: "__nv_fp8_e4m3", dtypes.fp8e5m2: "__nv_fp8_e5m2"}
extra_matcher = create_non_native_float_pats(dtypes.fp8s, casting=False) + PatternMatcher([
(UPat(Ops.CAST, dtypes.fp8s, UPat.var("x", dtypes.fp8s), name='y'), lambda x,y: x.cast(dtypes.float).cast(y.dtype) if x.dtype!=y.dtype else None),
(UPat(Ops.CAST, (dtypes.char, dtypes.uchar, dtypes.long, dtypes.ulong, dtypes.bfloat16), (UPat.var("x", dtypes.half),), name="y"),
lambda x,y: x.cast(dtypes.float).cast(y.dtype)),
(UPat(Ops.CAST, dtypes.half, (UPat.var("x", (dtypes.long, dtypes.ulong, dtypes.bfloat16)),)),
lambda x: x.cast(dtypes.float).cast(dtypes.half)),
(UPat(Ops.CAST, (dtypes.char, dtypes.uchar), (UPat.var("x", dtypes.bfloat16),), name="y"),
lambda x,y: x.cast(dtypes.float).cast(y.dtype)),
(UPat(Ops.CAST, (dtypes.long, dtypes.ulong), (UPat.var("x", dtypes.bfloat16),), name="y"),
lambda x,y: x.cast(dtypes.float).cast(y.dtype)),
(UPat(Ops.CAST, dtypes.bfloat16, (UPat.var("x", (dtypes.long, dtypes.ulong)),)),
lambda x: x.cast(dtypes.float).cast(dtypes.bfloat16)),
])
string_rewrite = PatternMatcher([
(UPat(Ops.BITCAST, name="x"), lambda ctx,x: f"tg_bitcast<{ctx.render_dtype(x.dtype)}>(({ctx.render_dtype(x.src[0].dtype)})({ctx[x.src[0]]}))"
Expand Down