benchmark.yml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. name: Benchmarks
  2. env:
  3. RUN_PROCESS_REPLAY: "1"
  4. ASSERT_PROCESS_REPLAY: "0"
  5. PYTHONPATH: .
  6. on:
  7. push:
  8. branches:
  9. - master
  10. - update_benchmark
  11. - update_benchmark_staging
  12. workflow_dispatch:
  13. inputs:
  14. run_process_replay:
  15. description: "Run process replay tests"
  16. required: false
  17. default: false
  18. type: boolean
  19. jobs:
  20. testmacbenchmark:
  21. name: Mac Benchmark
  22. runs-on: [self-hosted, macOS]
  23. defaults:
  24. run:
  25. shell: bash -o pipefail {0}
  26. if: github.repository_owner == 'tinygrad'
  27. steps:
  28. - name: Checkout Code
  29. uses: actions/checkout@v4
  30. - name: Symlink models and datasets
  31. run: |
  32. mkdir -p weights
  33. ln -s ~/tinygrad/extra/disassemblers/applegpu extra/disassemblers/applegpu
  34. ln -s ~/tinygrad/weights/sd-v1-4.ckpt weights/sd-v1-4.ckpt
  35. ln -s ~/tinygrad/weights/bpe_simple_vocab_16e6.txt.gz weights/bpe_simple_vocab_16e6.txt.gz
  36. ln -s ~/tinygrad/weights/LLaMA weights/LLaMA
  37. ln -s ~/tinygrad/extra/datasets/cifar-10-python.tar.gz extra/datasets/cifar-10-python.tar.gz
  38. - name: Run Stable Diffusion
  39. run: JIT=2 python3 examples/stable_diffusion.py --seed 0 --noshow --timing | tee sd.txt
  40. - name: Run Stable Diffusion with fp16
  41. run: JIT=2 python3 examples/stable_diffusion.py --fp16 --seed 0 --noshow --timing | tee sd_fp16.txt
  42. - name: Run SDXL
  43. run: JIT=2 python3 examples/sdxl.py --seed 0 --noshow --timing | tee sdxl.txt
  44. - name: Run model inference benchmark
  45. run: METAL=1 python3 test/external/external_model_benchmark.py
  46. - name: Test speed vs torch
  47. run: BIG=2 MPS=1 python3 test/test_speed_v_torch.py | tee torch_speed.txt
  48. - name: Test tensor cores
  49. run: METAL=1 python3 test/test_linearizer.py TestLinearizer.test_tensor_cores TestLinearizer.test_tensor_cores_padded
  50. - name: Run Tensor Core GEMM
  51. run: |
  52. DEBUG=2 python3 extra/gemm/simple_matmul.py | tee matmul.txt
  53. DEBUG=2 HALF=1 python3 extra/gemm/simple_matmul.py | tee matmul_half.txt
  54. - name: Fuzz Padded Tensor Core GEMM
  55. run: METAL=1 M_START=6 M_STOP=10 M_STEP=1 N_START=6 N_STOP=10 N_STEP=1 K_START=6 K_STOP=24 K_STEP=1 TC_OPT=2 DEBUG=2 python3 ./extra/gemm/fuzz_matmul.py
  56. - name: Run LLaMA
  57. run: |
  58. JIT=0 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_unjitted.txt
  59. JIT=1 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_jitted.txt
  60. - name: Run LLaMA with BEAM
  61. run: JITBEAM=2 IGNORE_BEAM_CACHE=1 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_beam.txt
  62. - name: Run quantized LLaMA
  63. run: |
  64. python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing --quantize int8 | tee llama_int8.txt
  65. python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing --quantize nf4 | tee llama_nf4.txt
  66. - name: Run LLaMA 7B on 4 (virtual) GPUs
  67. run: python3 examples/llama.py --gen 1 --size 7B --shard 4 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_four_gpu.txt
  68. - name: Run GPT2
  69. run: |
  70. JIT=0 python3 examples/gpt2.py --prompt "Hello." --count 10 --temperature 0 --timing | tee gpt2_unjitted.txt
  71. JIT=1 python3 examples/gpt2.py --prompt "Hello." --count 10 --temperature 0 --timing | tee gpt2_jitted.txt
  72. - name: Run GPT2 w HALF
  73. run: HALF=1 python3 examples/gpt2.py --count 10 --temperature 0 --timing | tee gpt2_half.txt
  74. - name: Run GPT2 w HALF/BEAM
  75. run: HALF=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 CAST_BEFORE_VIEW=0 python3 examples/gpt2.py --count 10 --temperature 0 --timing | tee gpt2_half_beam.txt
  76. - name: Train MNIST
  77. run: time PYTHONPATH=. TARGET_EVAL_ACC_PCT=97.3 python3 examples/beautiful_mnist.py | tee beautiful_mnist.txt
  78. - name: Run 10 CIFAR training steps
  79. run: JIT=2 STEPS=10 python3 examples/hlb_cifar10.py | tee train_cifar.txt
  80. - name: Run 10 CIFAR training steps w HALF
  81. run: JIT=2 STEPS=10 DEFAULT_FLOAT=HALF python3 examples/hlb_cifar10.py | tee train_cifar_half.txt
  82. #- name: Run 10 CIFAR training steps w BF16
  83. # run: STEPS=10 DEFAULT_FLOAT=BFLOAT16 python3 examples/hlb_cifar10.py | tee train_cifar_bf16.txt
  84. - name: Run 10 CIFAR training steps w winograd
  85. run: JIT=2 WINO=1 STEPS=10 python3 examples/hlb_cifar10.py | tee train_cifar_wino.txt
  86. - name: Run process replay tests
  87. if: env.RUN_PROCESS_REPLAY == '1'
  88. run: cp test/external/process_replay/process_replay.py ./process_replay.py && git fetch origin master && git -c advice.detachedHead=false checkout origin/master && PYTHONPATH=. python3 process_replay.py
  89. - uses: actions/upload-artifact@v4
  90. with:
  91. name: Speed (Mac)
  92. path: |
  93. onnx_inference_speed.csv
  94. torch_speed.txt
  95. llama_unjitted.txt
  96. llama_jitted.txt
  97. llama_beam.txt
  98. llama_int8.txt
  99. llama_nf4.txt
  100. llama_four_gpu.txt
  101. gpt2_unjitted.txt
  102. gpt2_jitted.txt
  103. gpt2_half.txt
  104. gpt2_half_beam.txt
  105. matmul.txt
  106. matmul_half.txt
  107. sd.txt
  108. sd_fp16.txt
  109. sdxl.txt
  110. beautiful_mnist.txt
  111. train_cifar.txt
  112. train_cifar_half.txt
  113. train_cifar_bf16.txt
  114. train_cifar_wino.txt
  115. testnvidiabenchmark:
  116. name: tinybox green Benchmark
  117. runs-on: [self-hosted, Linux, tinyboxgreen]
  118. defaults:
  119. run:
  120. shell: bash -o pipefail {0}
  121. if: github.repository_owner == 'tinygrad'
  122. steps:
  123. - name: Checkout Code
  124. uses: actions/checkout@v4
  125. - name: Print nvidia-smi
  126. run: nvidia-smi
  127. - name: Symlink models and datasets
  128. run: |
  129. mkdir -p weights
  130. ln -s ~/tinygrad/weights/LLaMA weights/LLaMA
  131. ln -s /raid/weights/mixtral-8x7b-32kseqlen weights/mixtral-8x7b-32kseqlen
  132. ln -s /raid/weights/LLaMA-2 weights/LLaMA-2
  133. ln -s /raid/weights/LLaMA-3 weights/LLaMA-3
  134. mkdir -p extra/datasets
  135. ln -s /raid/datasets/imagenet extra/datasets/imagenet
  136. - name: Run model inference benchmark
  137. run: NV=1 NOCLANG=1 python3 test/external/external_model_benchmark.py
  138. - name: Test speed vs torch
  139. run: NV=1 BIG=2 TORCHCUDA=1 python3 test/test_speed_v_torch.py | tee torch_speed.txt
  140. - name: Test tensor cores
  141. run: |
  142. NV=1 python3 test/test_linearizer.py TestLinearizer.test_tensor_cores TestLinearizer.test_tensor_cores_padded
  143. PTX=1 NV=1 python3 test/test_linearizer.py TestLinearizer.test_tensor_cores TestLinearizer.test_tensor_cores_padded
  144. - name: Run Tensor Core GEMM (CUDA)
  145. run: |
  146. CUDA=1 HALF=1 DEBUG=2 python3 extra/gemm/simple_matmul.py | tee matmul.txt
  147. CUDA=1 BFLOAT16=1 DEBUG=2 python3 extra/gemm/simple_matmul.py | tee matmul_bfloat16.txt
  148. - name: Run Tensor Core GEMM (PTX)
  149. run: NV=1 PTX=1 HALF=1 DEBUG=2 python3 extra/gemm/simple_matmul.py | tee matmul_ptx.txt
  150. - name: Run Tensor Core GEMM (NV)
  151. run: NV=1 HALF=1 DEBUG=2 python3 extra/gemm/simple_matmul.py | tee matmul_nv.txt
  152. - name: Run Tensor Core GEMM (NV) with BEAM
  153. run: BEAM=4 NV=1 HALF=1 IGNORE_BEAM_CACHE=1 DEBUG=2 python3 extra/gemm/simple_matmul.py
  154. - name: Fuzz Padded Tensor Core GEMM (NV)
  155. run: NV=1 M_START=12 M_STOP=20 M_STEP=1 N_START=6 N_STOP=10 N_STEP=1 K_START=28 K_STOP=36 K_STEP=1 HALF=1 TC_OPT=2 python3 ./extra/gemm/fuzz_matmul.py
  156. - name: Fuzz Padded Tensor Core GEMM (PTX)
  157. run: NV=1 PTX=1 M_START=12 M_STOP=20 M_STEP=1 N_START=6 N_STOP=10 N_STEP=1 K_START=28 K_STOP=36 K_STEP=1 HALF=1 TC_OPT=2 python3 ./extra/gemm/fuzz_matmul.py
  158. - name: Run Stable Diffusion
  159. run: NV=1 python3 examples/stable_diffusion.py --seed 0 --noshow --timing | tee sd.txt
  160. - name: Run SDXL
  161. run: NV=1 python3 examples/sdxl.py --seed 0 --noshow --timing | tee sdxl.txt
  162. - name: Run LLaMA
  163. run: |
  164. NV=1 JIT=0 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_unjitted.txt
  165. NV=1 JIT=1 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_jitted.txt
  166. - name: Run LLaMA with BEAM
  167. run: NV=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_beam.txt
  168. - name: Run LLaMA 7B on 4 GPUs
  169. run: NV=1 python3 examples/llama.py --gen 1 --size 7B --shard 4 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_four_gpu.txt
  170. - name: Run LLaMA 7B on 6 GPUs
  171. run: NV=1 python3 examples/llama.py --gen 1 --size 7B --shard 6 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_six_gpu.txt
  172. # TODO: this is flaky
  173. # - name: Run LLaMA-3 8B BEAM
  174. # run: NV=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 python3 examples/llama3.py --model weights/LLaMA-3/8B-SF-DPO/ --benchmark | tee llama3_beam.txt
  175. - name: Run LLaMA-3 8B on 4 GPUs
  176. run: NV=1 python3 examples/llama3.py --shard 4 --model weights/LLaMA-3/8B-SF-DPO/ --benchmark | tee llama3_four_gpu.txt
  177. - name: Run LLaMA-3 8B on 6 GPUs
  178. run: NV=1 python3 examples/llama3.py --shard 6 --model weights/LLaMA-3/8B-SF-DPO/ --benchmark | tee llama3_six_gpu.txt
  179. # - name: Run LLaMA-2 70B
  180. # run: CUDA=1 python3 examples/llama.py --gen 2 --size 70B --shard 6 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_2_70B.txt
  181. - name: Run Mixtral 8x7B
  182. run: time NV=1 python3 examples/mixtral.py --temperature 0 --count 10 --timing | tee mixtral.txt
  183. - name: Run GPT2
  184. run: |
  185. NV=1 JIT=0 python3 examples/gpt2.py --prompt "Hello." --count 10 --temperature 0 --timing | tee gpt2_unjitted.txt
  186. NV=1 JIT=1 python3 examples/gpt2.py --prompt "Hello." --count 10 --temperature 0 --timing | tee gpt2_jitted.txt
  187. - name: Run GPT2 w HALF
  188. run: NV=1 HALF=1 python3 examples/gpt2.py --count 10 --temperature 0 --timing | tee gpt2_half.txt
  189. - name: Run GPT2 w HALF/BEAM
  190. run: NV=1 HALF=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 CAST_BEFORE_VIEW=0 python3 examples/gpt2.py --count 10 --temperature 0 --timing | tee gpt2_half_beam.txt
  191. - name: Run process replay tests
  192. if: env.RUN_PROCESS_REPLAY == '1'
  193. run: cp test/external/process_replay/process_replay.py ./process_replay.py && git fetch origin master && git -c advice.detachedHead=false checkout origin/master && PYTHONPATH=. python3 process_replay.py
  194. - uses: actions/upload-artifact@v4
  195. with:
  196. name: Speed (NVIDIA)
  197. path: |
  198. onnx_inference_speed.csv
  199. torch_speed.txt
  200. matmul.txt
  201. matmul_bfloat16.txt
  202. matmul_ptx.txt
  203. matmul_nv.txt
  204. sd.txt
  205. sdxl.txt
  206. llama_unjitted.txt
  207. llama_jitted.txt
  208. llama_beam.txt
  209. llama_four_gpu.txt
  210. llama_six_gpu.txt
  211. llama3_beam.txt
  212. llama3_four_gpu.txt
  213. llama3_six_gpu.txt
  214. # llama_2_70B.txt
  215. mixtral.txt
  216. gpt2_unjitted.txt
  217. gpt2_jitted.txt
  218. gpt2_half.txt
  219. gpt2_half_beam.txt
  220. testmorenvidiabenchmark:
  221. name: tinybox green Training Benchmark
  222. runs-on: [self-hosted, Linux, tinyboxgreen]
  223. defaults:
  224. run:
  225. shell: bash -o pipefail {0}
  226. if: github.repository_owner == 'tinygrad'
  227. steps:
  228. - name: Checkout Code
  229. uses: actions/checkout@v4
  230. - name: Symlink models and datasets
  231. run: |
  232. mkdir -p weights
  233. ln -s ~/tinygrad/weights/bpe_simple_vocab_16e6.txt.gz weights/bpe_simple_vocab_16e6.txt.gz
  234. ln -s ~/tinygrad/weights/LLaMA weights/LLaMA
  235. ln -s ~/tinygrad/extra/datasets/cifar-10-python.tar.gz extra/datasets/cifar-10-python.tar.gz
  236. ln -s /raid/weights/mixtral-8x7b-32kseqlen weights/mixtral-8x7b-32kseqlen
  237. ln -s /raid/weights/LLaMA-2 weights/LLaMA-2
  238. mkdir -p extra/datasets
  239. ln -s /raid/datasets/imagenet extra/datasets/imagenet
  240. - name: Train MNIST
  241. run: time PYTHONPATH=. NV=1 TARGET_EVAL_ACC_PCT=97.3 python3 examples/beautiful_mnist.py | tee beautiful_mnist.txt
  242. - name: Run 10 CIFAR training steps
  243. run: NV=1 STEPS=10 python3 examples/hlb_cifar10.py | tee train_cifar.txt
  244. - name: Run 10 CIFAR training steps w HALF
  245. run: NV=1 STEPS=10 DEFAULT_FLOAT=HALF python3 examples/hlb_cifar10.py | tee train_cifar_half.txt
  246. - name: Run 10 CIFAR training steps w BF16
  247. run: NV=1 STEPS=10 DEFAULT_FLOAT=BFLOAT16 python3 examples/hlb_cifar10.py | tee train_cifar_bf16.txt
  248. - name: Run 10 CIFAR training steps w winograd
  249. run: NV=1 WINO=1 STEPS=10 python3 examples/hlb_cifar10.py | tee train_cifar_wino.txt
  250. - name: Run full CIFAR training w 1 GPU
  251. run: time NV=1 DEFAULT_FLOAT=HALF LATEWINO=1 STEPS=1000 TARGET_EVAL_ACC_PCT=93.2 python3 examples/hlb_cifar10.py | tee train_cifar_one_gpu.txt
  252. - name: Run full CIFAR training steps w 6 GPUS
  253. run: time NV=1 DEFAULT_FLOAT=HALF STEPS=350 BS=1536 GPUS=6 TARGET_EVAL_ACC_PCT=93.2 python3 examples/hlb_cifar10.py | tee train_cifar_six_gpu.txt
  254. - name: Run MLPerf resnet eval on training data
  255. run: time NV=1 MODEL=resnet python3 examples/mlperf/model_eval.py
  256. - name: Run 10 MLPerf ResNet50 training steps (1 gpu)
  257. run: NV=1 DEFAULT_FLOAT=HALF BENCHMARK=10 BS=256 GPUS=1 MODEL=resnet python3 examples/mlperf/model_train.py | tee train_resnet_one_gpu.txt
  258. - name: Run 10 MLPerf ResNet50 training steps (6 gpu)
  259. run: NV=1 DEFAULT_FLOAT=HALF BENCHMARK=10 BS=1536 GPUS=6 MODEL=resnet python3 examples/mlperf/model_train.py | tee train_resnet.txt
  260. - name: Run process replay tests
  261. if: env.RUN_PROCESS_REPLAY == '1'
  262. run: cp test/external/process_replay/process_replay.py ./process_replay.py && git fetch origin master && git -c advice.detachedHead=false checkout origin/master && PYTHONPATH=. python3 process_replay.py
  263. - uses: actions/upload-artifact@v4
  264. with:
  265. name: Speed (NVIDIA Training)
  266. path: |
  267. beautiful_mnist.txt
  268. train_cifar.txt
  269. train_cifar_half.txt
  270. train_cifar_bf16.txt
  271. train_cifar_wino.txt
  272. train_cifar_one_gpu.txt
  273. train_resnet.txt
  274. train_resnet_one_gpu.txt
  275. train_cifar_six_gpu.txt
  276. testamdbenchmark:
  277. name: tinybox red Benchmark
  278. runs-on: [self-hosted, Linux, tinybox]
  279. defaults:
  280. run:
  281. shell: bash -o pipefail {0}
  282. if: github.repository_owner == 'tinygrad'
  283. steps:
  284. - name: Checkout Code
  285. uses: actions/checkout@v4
  286. - name: Symlink models and datasets
  287. run: |
  288. mkdir -p weights
  289. ln -s ~/tinygrad/weights/bpe_simple_vocab_16e6.txt.gz weights/bpe_simple_vocab_16e6.txt.gz
  290. ln -s ~/tinygrad/weights/LLaMA weights/LLaMA
  291. ln -s ~/tinygrad/extra/datasets/cifar-10-python.tar.gz extra/datasets/cifar-10-python.tar.gz
  292. ln -s /raid/weights/mixtral-8x7b-32kseqlen weights/mixtral-8x7b-32kseqlen
  293. ln -s /raid/weights/LLaMA-2 weights/LLaMA-2
  294. ln -s /raid/weights/LLaMA-3 weights/LLaMA-3
  295. mkdir -p extra/datasets
  296. ln -s /raid/datasets/imagenet extra/datasets/imagenet
  297. - name: Show off tinybox
  298. run: /opt/rocm/bin/rocm-bandwidth-test
  299. # TODO: unstable on AMD
  300. #- name: Run model inference benchmark
  301. # run: LD_PRELOAD="/opt/rocm/lib/libhsa-runtime64.so" HSA=1 NOCLANG=1 python3 test/external/external_model_benchmark.py
  302. # TODO: unstable on AMD
  303. #- name: Test speed vs torch
  304. # run: |
  305. # python3 -c "import torch; print(torch.__version__)"
  306. # LD_PRELOAD="/opt/rocm/lib/libhsa-runtime64.so" HSA=1 BIG=2 TORCHCUDA=1 python3 test/test_speed_v_torch.py | tee torch_speed.txt
  307. - name: Test tensor cores
  308. run: |
  309. AMD=1 python3 test/test_linearizer.py TestLinearizer.test_tensor_cores TestLinearizer.test_tensor_cores_padded
  310. - name: Run Tensor Core GEMM (AMD)
  311. run: AMD=1 HALF=1 DEBUG=2 python3 extra/gemm/simple_matmul.py | tee matmul_amd.txt
  312. # TODO: AMD compiler bug causes this to fail
  313. #- name: Fuzz Padded Tensor Core GEMM
  314. # run: HSA=1 M_START=12 M_STOP=20 M_STEP=1 N_START=12 N_STOP=20 N_STEP=1 K_START=28 K_STOP=36 K_STEP=1 HALF=1 TC_OPT=2 DEBUG=2 python3 ./extra/gemm/fuzz_matmul.py
  315. - name: Run Stable Diffusion
  316. run: AMD=1 python3 examples/stable_diffusion.py --seed 0 --noshow --timing | tee sd.txt
  317. - name: Run SDXL
  318. run: AMD=1 python3 examples/sdxl.py --seed 0 --noshow --timing | tee sdxl.txt
  319. - name: Run LLaMA 7B
  320. run: |
  321. AMD=1 JIT=0 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_unjitted.txt
  322. AMD=1 JIT=1 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_jitted.txt
  323. - name: Run LLaMA 7B with BEAM
  324. run: AMD=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 python3 examples/llama.py --gen 1 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_beam.txt
  325. - name: Run LLaMA 7B on 4 GPUs
  326. run: AMD=1 python3 examples/llama.py --gen 1 --size 7B --shard 4 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_four_gpu.txt
  327. - name: Run LLaMA 7B on 6 GPUs
  328. run: AMD=1 python3 examples/llama.py --gen 1 --size 7B --shard 6 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_six_gpu.txt
  329. - name: Run LLaMA-3 8B BEAM
  330. run: AMD=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 python3 examples/llama3.py --model weights/LLaMA-3/8B-SF-DPO/ --benchmark | tee llama3_beam.txt
  331. - name: Run LLaMA-3 8B on 4 GPUs
  332. run: AMD=1 python3 examples/llama3.py --shard 4 --model weights/LLaMA-3/8B-SF-DPO/ --benchmark | tee llama3_four_gpu.txt
  333. - name: Run LLaMA-3 8B on 6 GPUs
  334. run: AMD=1 python3 examples/llama3.py --shard 6 --model weights/LLaMA-3/8B-SF-DPO/ --benchmark | tee llama3_six_gpu.txt
  335. - name: Run LLaMA-2 70B
  336. run: AMD=1 python3 examples/llama.py --gen 2 --size 70B --shard 6 --prompt "Hello." --count 10 --temperature 0 --timing | tee llama_2_70B.txt
  337. - name: Run Mixtral 8x7B
  338. run: time AMD=1 python3 examples/mixtral.py --temperature 0 --count 10 --timing | tee mixtral.txt
  339. - name: Run GPT2
  340. run: |
  341. AMD=1 JIT=0 python3 examples/gpt2.py --prompt "Hello." --count 10 --temperature 0 --timing | tee gpt2_unjitted.txt
  342. AMD=1 JIT=1 python3 examples/gpt2.py --prompt "Hello." --count 10 --temperature 0 --timing | tee gpt2_jitted.txt
  343. - name: Run GPT2 w HALF
  344. run: AMD=1 HALF=1 python3 examples/gpt2.py --count 10 --temperature 0 --timing | tee gpt2_half.txt
  345. - name: Run GPT2 w HALF/BEAM
  346. run: AMD=1 HALF=1 JITBEAM=2 IGNORE_BEAM_CACHE=1 CAST_BEFORE_VIEW=0 python3 examples/gpt2.py --count 10 --temperature 0 --timing | tee gpt2_half_beam.txt
  347. - name: Run process replay tests
  348. if: env.RUN_PROCESS_REPLAY == '1'
  349. run: cp test/external/process_replay/process_replay.py ./process_replay.py && git fetch origin master && git -c advice.detachedHead=false checkout origin/master && PYTHONPATH=. python3 process_replay.py
  350. - uses: actions/upload-artifact@v4
  351. with:
  352. name: Speed (AMD)
  353. path: |
  354. onnx_inference_speed.csv
  355. torch_speed.txt
  356. llama_unjitted.txt
  357. llama_jitted.txt
  358. llama_beam.txt
  359. llama_four_gpu.txt
  360. llama_six_gpu.txt
  361. llama3_beam.txt
  362. llama3_four_gpu.txt
  363. llama3_six_gpu.txt
  364. llama_2_70B.txt
  365. gpt2_unjitted.txt
  366. gpt2_jitted.txt
  367. gpt2_half.txt
  368. gpt2_half_beam.txt
  369. matmul.txt
  370. matmul_amd.txt
  371. sd.txt
  372. sdxl.txt
  373. mixtral.txt
  374. testmoreamdbenchmark:
  375. name: tinybox red Training Benchmark
  376. runs-on: [self-hosted, Linux, tinybox]
  377. defaults:
  378. run:
  379. shell: bash -o pipefail {0}
  380. if: github.repository_owner == 'tinygrad'
  381. steps:
  382. - name: Checkout Code
  383. uses: actions/checkout@v4
  384. - name: Symlink models and datasets
  385. run: |
  386. mkdir -p weights
  387. ln -s ~/tinygrad/weights/bpe_simple_vocab_16e6.txt.gz weights/bpe_simple_vocab_16e6.txt.gz
  388. ln -s ~/tinygrad/weights/LLaMA weights/LLaMA
  389. ln -s ~/tinygrad/extra/datasets/cifar-10-python.tar.gz extra/datasets/cifar-10-python.tar.gz
  390. ln -s /raid/weights/mixtral-8x7b-32kseqlen weights/mixtral-8x7b-32kseqlen
  391. ln -s /raid/weights/LLaMA-2 weights/LLaMA-2
  392. mkdir -p extra/datasets
  393. ln -s /raid/datasets/imagenet extra/datasets/imagenet
  394. - name: Train MNIST
  395. run: time PYTHONPATH=. AMD=1 TARGET_EVAL_ACC_PCT=97.3 python3 examples/beautiful_mnist.py | tee beautiful_mnist.txt
  396. - name: Run 10 CIFAR training steps
  397. run: AMD=1 STEPS=10 python3 examples/hlb_cifar10.py | tee train_cifar.txt
  398. - name: Run 10 CIFAR training steps w HALF
  399. run: AMD=1 STEPS=10 DEFAULT_FLOAT=HALF python3 examples/hlb_cifar10.py | tee train_cifar_half.txt
  400. - name: Run 10 CIFAR training steps w BF16
  401. run: AMD=1 STEPS=10 DEFAULT_FLOAT=BFLOAT16 python3 examples/hlb_cifar10.py | tee train_cifar_bf16.txt
  402. - name: Run 10 CIFAR training steps w winograd
  403. run: AMD=1 WINO=1 STEPS=10 python3 examples/hlb_cifar10.py | tee train_cifar_wino.txt
  404. - name: Run full CIFAR training w 1 GPU
  405. run: time AMD=1 DEFAULT_FLOAT=HALF LATEWINO=1 STEPS=1000 TARGET_EVAL_ACC_PCT=93.2 python3 examples/hlb_cifar10.py | tee train_cifar_one_gpu.txt
  406. - name: Run full CIFAR training steps w 6 GPUS
  407. run: time AMD=1 DEFAULT_FLOAT=HALF STEPS=350 BS=1536 GPUS=6 TARGET_EVAL_ACC_PCT=93.2 python3 examples/hlb_cifar10.py | tee train_cifar_six_gpu.txt
  408. - name: Run MLPerf resnet eval
  409. run: time AMD=1 MODEL=resnet python3 examples/mlperf/model_eval.py
  410. - name: Run 10 MLPerf ResNet50 training steps (1 gpu)
  411. run: AMD=1 DEFAULT_FLOAT=HALF BENCHMARK=10 BS=256 GPUS=1 MODEL=resnet python3 examples/mlperf/model_train.py | tee train_resnet_one_gpu.txt
  412. - name: Run 10 MLPerf ResNet50 training steps (6 gpu)
  413. run: AMD=1 DEFAULT_FLOAT=HALF BENCHMARK=10 BS=1536 GPUS=6 MODEL=resnet python3 examples/mlperf/model_train.py | tee train_resnet.txt
  414. - name: Run process replay tests
  415. if: env.RUN_PROCESS_REPLAY == '1'
  416. run: cp test/external/process_replay/process_replay.py ./process_replay.py && git fetch origin master && git -c advice.detachedHead=false checkout origin/master && PYTHONPATH=. python3 process_replay.py
  417. - uses: actions/upload-artifact@v4
  418. with:
  419. name: Speed (AMD Training)
  420. path: |
  421. beautiful_mnist.txt
  422. train_cifar.txt
  423. train_cifar_half.txt
  424. train_cifar_bf16.txt
  425. train_cifar_wino.txt
  426. train_cifar_one_gpu.txt
  427. train_resnet.txt
  428. train_resnet_one_gpu.txt
  429. train_cifar_six_gpu.txt