tinygrad icon indicating copy to clipboard operation
tinygrad copied to clipboard

Don't assume all devices with the same runtime have compatible binaries

Open Yexo opened this issue 9 months ago • 3 comments

python examples\beautiful_mnist_multigpu.py fails on my machine. After adding some logging in opg_gpu.py I got this output: Error: The program ISA amdgcn-amd-amdhsa--gfx1103 is not compatible with the device ISA amdgcn-amd-amdhsa--gfx1102

I'm running this under windows, my laptop has two GPUs: an integrated AMD Radeon(TM) 780M and also an AMD Radeon(TM) RX 7700S. Looks like the ISAs for both aren't compatible, so an OpenCL program compiled for one will not run on the other.

Yexo avatar Apr 16 '25 18:04 Yexo

Changes

Name                          Lines    Diff    Tokens/Line    Diff
--------------------------  -------  ------  -------------  ------
tinygrad/engine/realize.py      151      +0           14.8    +0.1


total lines changes: 0

github-actions[bot] avatar Apr 16 '25 18:04 github-actions[bot]

Needs tests

geohot avatar Apr 17 '25 07:04 geohot

What this needs is a (fake?) device that uses a cachekey for the Compiler that's different for each instance. Ideally with some overlap to also verify that, so "FAKE:0" -> cachekey "0" "FAKE:1" -> cachekey "1" "FAKE:2" -> cachekey "0"

This compiler should make sure that the cachekey is part of the returned "compiled" bytes, so that the the runtime can verify it's called correctly. To round it out the fake compiler can be used to count how often it compiles, which is a good check that the cache actually works as intended.

I just found some code in test/external/external_test_speed_llama.py overriding part of the default device, I think I can get something similar to work for testing this change.

Yexo avatar Apr 23 '25 12:04 Yexo

stale

chenyuxyz avatar Sep 12 '25 22:09 chenyuxyz