tinygrad: update to new version (#27067)

* tinygrad: bump and retain OPENCL behavior

* add graph.py to release, bump tiny

* update files_common and read from it in scons

* bump with typo fix

* switch tinygrad backend to GPU

* update ref commit

Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 64ed44e3b5
This commit is contained in:
George Hotz
2023-01-24 14:06:56 -08:00
committed by GitHub
parent 5c9299c6a2
commit 94fc9ef358
4 changed files with 15 additions and 35 deletions

View File

@@ -70,30 +70,14 @@ lenv.Program('_dmonitoringmodeld', [
if use_thneed and arch == "larch64" or GetOption('pc_thneed'):
fn = File("models/supercombo").abspath
if GetOption('pc_thneed'):
cmd = f"cd {Dir('#').abspath}/tinygrad_repo && GPU=1 NATIVE_EXPLOG=1 OPTWG=1 UNSAFE_FLOAT4=1 DEBUGCL=1 python3 openpilot/compile.py {fn}.onnx {fn}.thneed"
else:
cmd = f"cd {Dir('#').abspath}/tinygrad_repo && FLOAT16=1 MATMUL=1 PYOPENCL_NO_CACHE=1 NATIVE_EXPLOG=1 OPTWG=1 UNSAFE_FLOAT4=1 DEBUGCL=1 python3 openpilot/compile.py {fn}.onnx {fn}.thneed"
tinygrad_opts = ["NATIVE_EXPLOG=1", "VALIDHACKS=1", "OPTWG=1", "IMAGE=2", "GPU=1", "CLCACHE=0"]
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"
# is there a better way then listing all of tinygrad?
lenv.Command(fn + ".thneed", [fn + ".onnx",
"#tinygrad_repo/openpilot/compile.py",
"#tinygrad_repo/accel/opencl/conv.cl",
"#tinygrad_repo/accel/opencl/matmul.cl",
"#tinygrad_repo/accel/opencl/ops_opencl.py",
"#tinygrad_repo/accel/opencl/preprocessing.py",
"#tinygrad_repo/extra/onnx.py",
"#tinygrad_repo/extra/thneed.py",
"#tinygrad_repo/extra/utils.py",
"#tinygrad_repo/tinygrad/llops/ops_gpu.py",
"#tinygrad_repo/tinygrad/llops/ops_opencl.py",
"#tinygrad_repo/tinygrad/helpers.py",
"#tinygrad_repo/tinygrad/mlops.py",
"#tinygrad_repo/tinygrad/ops.py",
"#tinygrad_repo/tinygrad/shapetracker.py",
"#tinygrad_repo/tinygrad/tensor.py",
"#tinygrad_repo/tinygrad/nn/__init__.py"
], cmd)
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)
llenv = lenv.Clone()
if GetOption('pc_thneed'):
@@ -116,4 +100,4 @@ llenv.Program('_modeld', [
lenv.Program('_navmodeld', [
"navmodeld.cc",
"models/nav.cc",
]+common_model, LIBS=libs + transformations)
]+common_model, LIBS=libs + transformations)