QVAC-17129 feat: add dynamic backend loading to nmtcpp GGML backend for GPU acceleration#1617
Conversation
🧪 C++ Test Coverage ReportCoverage: 📊 Detailed Coverage |
1 similar comment
🧪 C++ Test Coverage ReportCoverage: 📊 Detailed Coverage |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bare runtime does not have Node.js built-in 'path' module. All other files in the package use 'bare-path'. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lationModel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…extraction Stop erasing backendsdir/openclcachedir from config_ in TranslationModel::load so reload() re-initializes the backend with the original path instead of falling back to the default loader. Without this, GPU backends disappeared silently after any model reload on Android. Use std::get_if<std::string> for backendsdir/openclcachedir extraction in TranslationModel and PivotTranslationModel; on type mismatch log a warning and fall through instead of propagating bad_variant_access out of the load path. Default backendsDir in JS only when the field is missing (=== undefined) rather than on any falsy value, so callers passing "" to force the default system backend loader are respected. Refs QVAC-17129.
PivotTranslationModel only uses Bergamot — GGML dynamic backend loading is for the IndicTrans (GGML) path, which is a different inference engine. The earlier backendsHandle_ initialization in the pivot constructor was initializing GGML backends even when none were used. Remove the backend config extraction block, the backendsHandle_ member and the NmtLazyInitializeBackend include. Sub-model TranslationModel instances still handle their own backend init on load() for the GGML path. Refs QVAC-17129.
✅ E2E Mobile Test Results - iOSOverall Status: PASSED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
🧪 C++ Test Coverage ReportCoverage: 📊 Detailed Coverage |
✅ E2E Mobile Test Results - AndroidOverall Status: PASSED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
🧪 C++ Test Coverage ReportCoverage: 📊 Detailed Coverage |
✅ E2E Mobile Test Results - iOSOverall Status: PASSED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
✅ E2E Mobile Test Results - AndroidOverall Status: PASSED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
|
/review |
❌ E2E Mobile Test Results - iOSOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - AndroidOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - iOSOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - AndroidOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - iOSOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - AndroidOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - iOSOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
❌ E2E Mobile Test Results - AndroidOverall Status: FAILED Test Summary
Links
Automated E2E mobile testing powered by AWS Device Farm |
Summary
Changes
New files
addon/src/model-interface/NmtLazyInitializeBackend.hpp— Lazy-init singleton with RAII NmtBackendsHandleaddon/src/model-interface/NmtLazyInitializeBackend.cpp— Implementation: ggml_backend_load_all_from_path(), OpenCL cache dir, ref-counted lifecycleaddon/tests/test_nmt_lazy_init_backend.cpp— 15 GoogleTest unit testsModified files
TranslationModel.hpp/cpp— Extract backendsdir/openclcachedir from config in load(), init handle before nmt_init_from_file_with_params()PivotTranslationModel.hpp/cpp— Init backends handle in constructor before sub-model load()index.js— Default backendsDir to prebuilds pathCMakeLists.txt— Add BACKENDS_SUBDIR, BACKEND_DL_LIBS loop, new source fileTest plan
CI: https://github.com/tetherto/qvac/actions/runs/24501619382
Asana
https://app.asana.com/0/1212638335655990/1214055988275114