yams/plugins/onnx/meson.build
Trevon 0dd3985db4
refactor: simplify runtime paths and harden retrieval (#61)
* refactor(tuning): prune dormant runtime knobs

Remove unused tuning controls and adaptive search budget state. Extract testable ONNX slot reconciliation and search telemetry hydration seams, and correct the Apple Silicon sysctl value width.

* refactor(vector): retire dormant backends

Remove unused FAISS, model-infrastructure, VectorIndexManager, and TurboQuant paths while keeping Simeon PQ and float-vector storage.

Migrate unused V2.2 quantized schemas transactionally to V2.3. Databases containing non-default quantized formats or packed-code blobs fail closed with recovery guidance and no mutation.

* refactor(plugins): remove legacy SDK tooling

Remove the Ghidra and SDK submodules, their bespoke tests, and stale scan exclusions. Retain generic PluginProcess coverage against the repository mock fixture.

* build(vector): remove stale FAISS overrides

* refactor(ipc): remove dormant FSM snapshots

* refactor(ingest): unify bounded KG enqueue

* fix(plugins): harden allocation contracts

Keep ABI outputs null or fully initialized when allocations fail, and represent empty object payloads without relying on malloc(0).

* fix(storage): define empty object reads

Return a null buffer with zero length for successful empty-object reads instead of treating malloc(0) as an allocation contract.

* refactor(storage): trim through string views

* test: prune dormant harness helpers

Remove unused readiness and fixture helpers, and keep benchmark client-count doubling in a wide integer domain.

* chore(cpp): initialize analyzer-facing locals

* build(simeon): advance analyzer cleanup

* refactor(config): drop dead daemon client keys

* refactor(ipc): inject daemon client transport

Socket and in-process execution now share DaemonClient request dispatch, so CLI fallbacks do not need alternate service paths.

* refactor(retrieval): route CLI through daemon

Search and grep now use the same daemon handlers over socket or in-process transport. Live grep remains an explicit freshness inspection.

* refactor(graph): move CLI scope into daemon

Graph CLI requests now share daemon handlers across socket and in-process transports. CWD filtering occurs before pagination so scoped totals and pages stay correct.

* build: isolate test-only runtime controls

* refactor(metadata): decouple lock telemetry

* fix(services): return on request timeout

* fix(retrieval): enforce workspace scope

* fix(graph): scope nodes before pagination

* fix(grep): drop binary result lines

* fix(daemon): bound checkpoint wait

* fix(repair): use KG health checks

* fix(storage): always verify compressed CRC

* perf(vector): skip unchanged PQ snapshots

* build(zyp): exclude bench from default build

* build: protect Meson files from formatter

* refactor: remove unreachable production APIs

* refactor(daemon): remove dormant runtime state

* fix(vector): harden daemon provider calls

Timed-out coroutines must own their client and requests. Provider discovery must also fail instead of returning synthetic embeddings in production.

* refactor(storage): remove unusable adapters

* fix(cli): unify in-process add requests

* fix(tsan): preserve async worker progress

* test(cli): isolate daemon-dependent suites

* fix(repair): expose queue backoff progress
2026-07-31 14:16:45 -04:00

117 lines
4 KiB
Meson

fs = import('fs')
onnx_dep = onnxruntime_resolved_dep
spdlog_dep = dependency('spdlog', required: false)
json_dep = dependency('nlohmann_json', required: false)
yams_core = dependency('yams_core', required: false)
yams_onnx_resource = dependency('yams_onnx_resource', required: false)
# Boost.Asio is header-only; its runtime needs (boost::system) are already
# in the top-level boost_dep. Use that variable directly to bypass meson's
# Windows Boost finder, which can't reconcile Conan's MSVC layout. See
# meson #14146 for the override_dependency+modules limitation.
win_extra_deps = []
if host_machine.system() == 'windows'
cpp = meson.get_compiler('cpp')
win_extra_deps += [cpp.find_library('dxgi', required: true)]
endif
onnx_opt = get_option('enable-onnx')
onnx_feature_requested = not onnx_opt.disabled()
if not get_option('plugin-onnx')
subdir_done()
endif
if not onnx_feature_requested
message('enable-onnx disabled; skipping yams_onnx_plugin build')
subdir_done()
endif
# Gracefully skip when ONNX Runtime is not discoverable in this environment.
if not onnx_dep.found()
message('ONNX Runtime not found in search paths; skipping yams_onnx_plugin')
subdir_done()
endif
yams_onnx_plugin_srcs = [
'onnx_plugin.cpp',
'model_provider.cpp',
'onnx_text_processing.cpp',
'ort_runtime_loader.cpp',
'onnx_model_pool.cpp',
'onnx_colbert_session.cpp',
]
plugin_cppargs = []
if get_option('build-tests') or get_option('build-benchmarks')
plugin_cppargs += ['-DYAMS_TEST_PROVIDER_CONTROLS=1']
endif
# GPU provider defines - these MUST be passed to the plugin for GPU acceleration to work.
# Conan sets these in pkg-config Cflags, but CMake method may not propagate them.
# Check if already present via onnx_dep, otherwise use platform detection.
onnx_cflags = onnx_dep.get_variable(pkgconfig: 'Cflags', default_value: '')
if onnx_cflags.contains('YAMS_ONNX_COREML_ENABLED')
plugin_cppargs += ['-DYAMS_ONNX_COREML_ENABLED=1']
message('ONNX CoreML GPU support enabled (from pkg-config)')
elif onnx_cflags.contains('YAMS_ONNX_CUDA_ENABLED')
plugin_cppargs += ['-DYAMS_ONNX_CUDA_ENABLED=1']
message('ONNX CUDA GPU support enabled (from pkg-config)')
elif onnx_cflags.contains('YAMS_ONNX_DIRECTML_ENABLED')
plugin_cppargs += ['-DYAMS_ONNX_DIRECTML_ENABLED=1']
message('ONNX DirectML GPU support enabled (from pkg-config)')
elif onnx_cflags.contains('YAMS_ONNX_MIGRAPHX_ENABLED')
plugin_cppargs += ['-DYAMS_ONNX_MIGRAPHX_ENABLED=1']
message('ONNX MIGraphX GPU support enabled (from pkg-config)')
elif host_machine.system() == 'darwin'
# Fallback: macOS always has CoreML support in prebuilt ONNX Runtime
plugin_cppargs += ['-DYAMS_ONNX_COREML_ENABLED=1']
message('ONNX CoreML GPU support enabled (macOS platform detection)')
endif
onnx_plugin_deps = [
spdlog_dep,
json_dep,
yams_core,
dependency('yams_vector'),
yams_onnx_resource,
boost_dep,
] + win_extra_deps
onnx_compile_dep = onnx_dep.partial_dependency(compile_args: true, includes: true)
onnx_plugin_deps += [onnx_compile_dep]
onnx_plugin_link_args = []
if host_machine.system() == 'linux'
# Fail link on unresolved symbols to avoid runtime dlopen failures.
onnx_plugin_link_args += ['-Wl,-z,defs']
endif
onnx_plugin_install_rpath = ''
if host_machine.system() == 'darwin'
onnx_plugin_install_rpath = '@loader_path/../..'
elif host_machine.system() == 'linux'
onnx_plugin_install_rpath = '$ORIGIN/../..'
endif
yams_onnx_plugin = shared_module('yams_onnx_plugin',
yams_onnx_plugin_srcs,
include_directories: [include_directories('../../include')],
dependencies: onnx_plugin_deps,
link_args: onnx_plugin_link_args,
cpp_args: plugin_cppargs,
install: true,
install_dir: plugins_dir,
install_rpath: onnx_plugin_install_rpath,
)
set_variable('yams_onnx_plugin_target', [yams_onnx_plugin])
# --- Windows: Copy runtime DLLs next to the ONNX plugin ---
if host_machine.system() == 'windows' and windows_runtime_dlls.length() > 0
foreach dll_info : windows_runtime_dlls
dll_name = dll_info[0]
dll_src = dll_info[1]
fs.copyfile(dll_src, dll_name, install: false)
endforeach
endif