From c9fae805bc53e732109fb9e5c36d9674deed0475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Sch=C3=A4fer?= Date: Tue, 7 Nov 2023 12:54:48 -0500 Subject: [PATCH] Tinygrad: use compile2 (#30400) * Tinygrad: use compile2 * unused * compile2 file * slightly different * Revert "slightly different" This reverts commit 8a470ecab40c295f3b8c777b82cb7a22890d116e. * slightly different ref * add release file * rm default args --- release/files_common | 4 ++-- selfdrive/modeld/SConscript | 4 ++-- selfdrive/test/process_replay/model_replay_ref_commit | 2 +- tinygrad_repo | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/release/files_common b/release/files_common index 1e16cb943..9076f440d 100644 --- a/release/files_common +++ b/release/files_common @@ -582,15 +582,15 @@ opendbc/tesla_can.dbc opendbc/tesla_radar.dbc opendbc/tesla_powertrain.dbc -tinygrad_repo/openpilot/compile.py +tinygrad_repo/openpilot/compile2.py tinygrad_repo/extra/onnx.py tinygrad_repo/extra/onnx_ops.py tinygrad_repo/extra/thneed.py tinygrad_repo/extra/utils.py tinygrad_repo/tinygrad/codegen/kernel.py tinygrad_repo/tinygrad/codegen/linearizer.py -tinygrad_repo/tinygrad/codegen/optimizer.py tinygrad_repo/tinygrad/features/image.py +tinygrad_repo/tinygrad/features/search.py tinygrad_repo/tinygrad/nn/* tinygrad_repo/tinygrad/renderer/cstyle.py tinygrad_repo/tinygrad/renderer/opencl.py diff --git a/selfdrive/modeld/SConscript b/selfdrive/modeld/SConscript index 286f3a0a4..2d15223d1 100644 --- a/selfdrive/modeld/SConscript +++ b/selfdrive/modeld/SConscript @@ -58,11 +58,11 @@ lenv.Command(fn + "_metadata.pkl", [fn + ".onnx"]+files, cmd) # Build thneed model if arch == "larch64" or GetOption('pc_thneed'): - tinygrad_opts = ["NOLOCALS=1", "IMAGE=2", "GPU=1"] + tinygrad_opts = [] if not GetOption('pc_thneed'): # use FLOAT16 on device for speed + don't cache the CL kernels for space tinygrad_opts += ["FLOAT16=1", "PYOPENCL_NO_CACHE=1"] - cmd = f"cd {Dir('#').abspath}/tinygrad_repo && " + ' '.join(tinygrad_opts) + f" python3 openpilot/compile.py {fn}.onnx {fn}.thneed" + cmd = f"cd {Dir('#').abspath}/tinygrad_repo && " + ' '.join(tinygrad_opts) + f" python3 openpilot/compile2.py {fn}.onnx {fn}.thneed" tinygrad_files = sum([lenv.Glob("#"+x) for x in open(File("#release/files_common").abspath).read().split("\n") if x.startswith("tinygrad_repo/")], []) lenv.Command(fn + ".thneed", [fn + ".onnx"] + tinygrad_files, cmd) diff --git a/selfdrive/test/process_replay/model_replay_ref_commit b/selfdrive/test/process_replay/model_replay_ref_commit index 2785ca71a..ddf515181 100644 --- a/selfdrive/test/process_replay/model_replay_ref_commit +++ b/selfdrive/test/process_replay/model_replay_ref_commit @@ -1 +1 @@ -ca18755cd1a1bc28c06e85a280d79d7e48a8438c +d1212a1ac9119a1be33f2e375b1421344379ec08 diff --git a/tinygrad_repo b/tinygrad_repo index 5a4a62eca..ae5d1407e 160000 --- a/tinygrad_repo +++ b/tinygrad_repo @@ -1 +1 @@ -Subproject commit 5a4a62ecaecb2bfd8bb0f77033aca46df4e668bd +Subproject commit ae5d1407ee844a97a52ad3756835d38e7e2b9e1b