diff --git a/selfdrive/modeld/SConscript b/selfdrive/modeld/SConscript index 76fef75ba..40b30b8c1 100644 --- a/selfdrive/modeld/SConscript +++ b/selfdrive/modeld/SConscript @@ -36,11 +36,10 @@ if 'CUDA' in available: tg_flags = f'DEV={tg_backend}' elif 'QCOM' in available: tg_backend = 'QCOM' - tg_flags = f'DEV={tg_backend} FLOAT16=1 NOLOCALS=1 JIT_BATCH_SIZE=0 OPENPILOT_HACKS=1' + tg_flags = f'DEV={tg_backend} IMAGE=1 FLOAT16=1 NOLOCALS=1 JIT_BATCH_SIZE=0 OPENPILOT_HACKS=1' else: tg_backend = 'CPU' if arch == 'Darwin' else 'CPU:LLVM' - # THREADS=0 is need to prevent bug: https://github.com/tinygrad/tinygrad/issues/14689 - tg_flags = f'DEV={tg_backend} THREADS=0' + tg_flags = f'DEV={tg_backend}' def write_tg_compiled_flags(target, source, env): with open(str(target[0]), "w") as f: @@ -63,9 +62,6 @@ for model_name in ['driving_vision', 'driving_policy', 'dmonitoring_model']: cmd = f'{tg_flags} {mac_brew_string} python3 {Dir("#selfdrive/modeld").abspath}/get_model_metadata.py {fn}.onnx' lenv.Command(fn + "_metadata.pkl", [fn + ".onnx"] + tinygrad_files + script_files + [compiled_flags_node], cmd) -image_flag = { - 'larch64': 'IMAGE=2', -}.get(arch, 'IMAGE=0') modeld_dir = Dir("#selfdrive/modeld").abspath compile_modeld_script = [File(f"{modeld_dir}/compile_modeld.py")] compile_dm_warp_script = [File(f"{modeld_dir}/compile_dm_warp.py")] @@ -75,7 +71,7 @@ driving_metadata_deps = [File(f"models/{m}_metadata.pkl").abspath for m in ['dri model_w, model_h = MEDMODEL_INPUT_SIZE frame_skip = ModelConstants.MODEL_RUN_FREQ // ModelConstants.MODEL_CONTEXT_FREQ for cfg in MODELD_CONFIGS: - cmd = (f'{tg_flags} {mac_brew_string} {image_flag} python3 {modeld_dir}/compile_modeld.py ' + cmd = (f'{tg_flags} {mac_brew_string} python3 {modeld_dir}/compile_modeld.py ' f'--model-size {model_w}x{model_h} ' f'--nv12 {",".join(str(x) for x in cfg.nv12)} ' f'--vision-onnx {File("models/driving_vision.onnx").abspath} ' @@ -91,7 +87,7 @@ for cfg in MODELD_CONFIGS: dm_w, dm_h = DM_INPUT_SIZE for cfg in DM_WARP_CONFIGS: - cmd = (f'{tg_flags} {mac_brew_string} {image_flag} python3 {modeld_dir}/compile_dm_warp.py ' + cmd = (f'{tg_flags} {mac_brew_string} python3 {modeld_dir}/compile_dm_warp.py ' f'--nv12 {",".join(str(x) for x in cfg.nv12)} --warp-to {dm_w}x{dm_h} ' f'--output {cfg.pkl_path}') lenv.Command(cfg.pkl_path, tinygrad_files + compile_dm_warp_script + compile_modeld_script + [compiled_flags_node], cmd) @@ -105,7 +101,7 @@ def tg_compile(flags, model_name): compile_node = lenv.Command( pkl, [onnx_path] + tinygrad_files + [chunker_file, compiled_flags_node], - f'{pythonpath_string} {flags} {image_flag} python3 {Dir("#tinygrad_repo").abspath}/examples/openpilot/compile3.py {fn}.onnx {pkl}', + f'{pythonpath_string} {flags} python3 {Dir("#tinygrad_repo").abspath}/examples/openpilot/compile3.py {fn}.onnx {pkl}', ) def do_chunk(target, source, env): chunk_file(pkl, chunk_targets)