thneed: add flag to enable optimizer (#24568)

* improve the thneed compiler

* only init thneed if we are using the GPU

Co-authored-by: Comma Device <device@comma.ai>
This commit is contained in:
George Hotz
2022-05-17 17:39:18 -07:00
committed by GitHub
parent 06b4466388
commit 0fc4b4df98
7 changed files with 53 additions and 22 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ common_model = lenv.Object(common_src)
if use_thneed and arch == "larch64":
fn = File("models/supercombo").abspath
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs)
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} {fn}.dlc {fn}_badweights.thneed --binary"
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} --in {fn}.dlc --out {fn}_badweights.thneed --binary --optimize"
lib_paths = ':'.join(Dir(p).abspath for p in lenv["LIBPATH"])
kernel_path = os.path.join(Dir('.').abspath, "thneed", "kernels")