|
|
@ -65,22 +65,14 @@ common_model = lenv.Object(common_src) |
|
|
|
if use_thneed and arch == "larch64": |
|
|
|
if use_thneed and arch == "larch64": |
|
|
|
fn = File("models/supercombo").abspath |
|
|
|
fn = File("models/supercombo").abspath |
|
|
|
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs) |
|
|
|
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs) |
|
|
|
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} --in {fn}.dlc --out {fn}_badweights.thneed --binary --optimize" |
|
|
|
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} --in {fn}.dlc --out {fn}.thneed --binary --optimize" |
|
|
|
|
|
|
|
|
|
|
|
lib_paths = ':'.join(Dir(p).abspath for p in lenv["LIBPATH"]) |
|
|
|
lib_paths = ':'.join(Dir(p).abspath for p in lenv["LIBPATH"]) |
|
|
|
kernel_path = os.path.join(Dir('.').abspath, "thneed", "kernels") |
|
|
|
kernel_path = os.path.join(Dir('.').abspath, "thneed", "kernels") |
|
|
|
cenv = Environment(ENV={'LD_LIBRARY_PATH': f"{lib_paths}:{lenv['ENV']['LD_LIBRARY_PATH']}", 'KERNEL_PATH': kernel_path}) |
|
|
|
cenv = Environment(ENV={'LD_LIBRARY_PATH': f"{lib_paths}:{lenv['ENV']['LD_LIBRARY_PATH']}", 'KERNEL_PATH': kernel_path}) |
|
|
|
|
|
|
|
|
|
|
|
kernels = [os.path.join(kernel_path, x) for x in os.listdir(kernel_path) if x.endswith(".cl")] |
|
|
|
kernels = [os.path.join(kernel_path, x) for x in os.listdir(kernel_path) if x.endswith(".cl")] |
|
|
|
cenv.Command(fn + "_badweights.thneed", [fn + ".dlc", kernels, compiler], cmd) |
|
|
|
cenv.Command(fn + ".thneed", [fn + ".dlc", kernels, compiler], cmd) |
|
|
|
|
|
|
|
|
|
|
|
from selfdrive.modeld.thneed.weights_fixup import weights_fixup |
|
|
|
|
|
|
|
def weights_fixup_action(target, source, env): |
|
|
|
|
|
|
|
weights_fixup(target[0].abspath, source[0].abspath, source[1].abspath) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
env = Environment(BUILDERS = {'WeightFixup' : Builder(action = weights_fixup_action)}) |
|
|
|
|
|
|
|
env.WeightFixup(target=fn + ".thneed", source=[fn+"_badweights.thneed", fn+".dlc"]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lenv.Program('_dmonitoringmodeld', [ |
|
|
|
lenv.Program('_dmonitoringmodeld', [ |
|
|
|
"dmonitoringmodeld.cc", |
|
|
|
"dmonitoringmodeld.cc", |
|
|
|