Some cleanup in modeld sconscript

pull/29605/head
mitchellgoffpc 2 years ago
parent a184d40b7a
commit fc8c97e7a9
  1. 32
      selfdrive/modeld/SConscript

@ -6,15 +6,6 @@ lenv = env.Clone()
libs = [cereal, messaging, common, visionipc, gpucommon, libs = [cereal, messaging, common, visionipc, gpucommon,
'OpenCL', 'SNPE', 'capnp', 'zmq', 'kj', 'yuv'] 'OpenCL', 'SNPE', 'capnp', 'zmq', 'kj', 'yuv']
def get_dlsym_offset():
"""Returns the offset between dlopen and dlsym in libdl.so"""
import ctypes
libdl = ctypes.PyDLL('libdl.so')
dlopen = ctypes.cast(libdl.dlopen, ctypes.c_void_p).value
dlsym = ctypes.cast(libdl.dlsym, ctypes.c_void_p).value
return dlsym - dlopen
common_src = [ common_src = [
"models/commonmodel.cc", "models/commonmodel.cc",
"runners/snpemodel.cc", "runners/snpemodel.cc",
@ -36,9 +27,7 @@ if arch == "larch64":
if use_thneed: if use_thneed:
common_src += thneed_src common_src += thneed_src
dlsym_offset = get_dlsym_offset()
lenv['CXXFLAGS'].append("-DUSE_THNEED") lenv['CXXFLAGS'].append("-DUSE_THNEED")
lenv['CXXFLAGS'].append(f"-DDLSYM_OFFSET={dlsym_offset}")
else: else:
libs += ['pthread'] libs += ['pthread']
@ -60,12 +49,9 @@ else:
del libs[libs.index('SNPE')] del libs[libs.index('SNPE')]
del common_src[common_src.index('runners/snpemodel.cc')] del common_src[common_src.index('runners/snpemodel.cc')]
onnxrunner_path = File("runners/onnx_runner.py").abspath for pathdef, fn in {'TRANSFORM': 'transforms/transform.cl', 'LOADYUV': 'transforms/loadyuv.cl', 'ONNXRUNNER': 'runners/onnx_runner.py'}.items():
transform_path = File("transforms/transform.cl").abspath path = File(fn).abspath
loadyuv_path = File("transforms/loadyuv.cl").abspath lenv['CXXFLAGS'].append(f'-D{pathdef}_PATH=\\"{path}\\"')
lenv['CXXFLAGS'].append(f'-DTRANSFORM_PATH=\\"{transform_path}\\"')
lenv['CXXFLAGS'].append(f'-DLOADYUV_PATH=\\"{loadyuv_path}\\"')
lenv['CXXFLAGS'].append(f'-DONNXRUNNER_PATH=\\"{onnxrunner_path}\\"')
common_model = lenv.Object(common_src) common_model = lenv.Object(common_src)
@ -74,8 +60,13 @@ lenv.Program('_dmonitoringmodeld', [
"models/dmonitoring.cc", "models/dmonitoring.cc",
]+common_model, LIBS=libs) ]+common_model, LIBS=libs)
lenv.Program('_navmodeld', [
"navmodeld.cc",
"models/nav.cc",
]+common_model, LIBS=libs)
# build thneed model # build thneed model
if use_thneed and arch == "larch64" or GetOption('pc_thneed'): if (use_thneed and arch == "larch64") or GetOption('pc_thneed'):
fn = File("models/supercombo").abspath fn = File("models/supercombo").abspath
tinygrad_opts = ["NATIVE_EXPLOG=1", "VALIDHACKS=1", "OPTLOCAL=1", "IMAGE=2", "GPU=1", "ENABLE_METHOD_CACHE=1"] tinygrad_opts = ["NATIVE_EXPLOG=1", "VALIDHACKS=1", "OPTLOCAL=1", "IMAGE=2", "GPU=1", "ENABLE_METHOD_CACHE=1"]
@ -104,8 +95,3 @@ llenv.Program('_modeld', [
"modeld.cc", "modeld.cc",
"models/driving.cc", "models/driving.cc",
]+common_model, LIBS=libs + transformations) ]+common_model, LIBS=libs + transformations)
lenv.Program('_navmodeld', [
"navmodeld.cc",
"models/nav.cc",
]+common_model, LIBS=libs + transformations)

Loading…
Cancel
Save