Repository navigation
Return the startup error when Hexagon session rollback fails - #265
Merged
Merged
Conversation
Carry llama.cpp patch 0010: a session that has not finished construction logs a failed dspqueue_close or htp_iface_stop and keeps rolling back instead of aborting, so llama_dart_ggml_backend_dev_init reports the original startup error. Sessions that finished construction keep the upstream abort. A host test with stubbed FastRPC calls covers a clean cleanup, a failed queue close and a grouped-session rollback. Fixes #264
leehack
marked this pull request as ready for review
December 2, 2026 01:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #264. When pinned llama.cpp's Hexagon backend fails during session setup and FastRPC cleanup also fails,
GGML_ABORTinggml_hexagon_session::release()killed the process beforellama_dart_ggml_backend_dev_initcould report the startup error.0010-hexagon-startup-rollback.patch(~16 lines, one file): a session setsstartup_completeonly after its constructor succeeds. Before that, a faileddspqueue_close/htp_iface_stopis logged (startup rollback: ... failed) and rollback continues. A failed group rollback demotes already-started siblings the same way. Fully constructed sessions keep the upstream abort on the destructor path.llamadart_hexagon_startup_test: the pinned Hexagon host source (patched copy) built against stubbed FastRPC headers/calls on Linux and macOS hosts, run throughllama_dart_ggml_backend_dev_init. Scenarios:cleanup-ok,cleanup-fail(faileddspqueue_closeafter faileddspqueue_export),group-rollback(3-session group, failed export on the third, failed close/stop on a started sibling) must each return no backend, the originaldspqueue export failederror and a close of every queue and handle.constructed-abortconstructs a session, failsdspqueue_closeon teardown in a child process and requires the upstreamGGML_ABORT.docs/android_hexagon.mddocuments the patch, its removal condition and the device-qualification note.patches/llama.cpp/README.mdrecords the "Exception for native Hexagon session startup can abort during queue rollback #264" for 0010 only.CMakeLists.txt/cmake/llama_cpp_patches.cmake: expose the patched-source list so the test compiles the patched copy; the test is skipped when cross-compiling or off Linux/macOS.validate_wrapper.ymlbuilds the new target (the existingcteststep runs it);android_hexagon_candidate.ymlalso triggers on patch, CMake and submodule-pin paths. The candidate'svalidate_android_artifacts.pystep fails whenlibggml-hexagon.solacks the series markerstartup rollback: dspqueue_close failed.Eligibility: the Hexagon candidate is not yet a released artifact, so
patches/llama.cpp/README.md's "released artifact crashes" condition is met only by #264's P1 triage. The maintainer approved this exception for 0010 only on 2026-12-01; the README now records it.Validation
ctest -R hexagon_startup(Debug, macOS arm64, patched)cleanup-fail,group-rollbackabort;cleanup-okpassesgroup-rollbackaborts; others passconstructed-abortfails; others passpython3 -m unittest discover -s tests -p 'test_*.py'Build-identity patch digest changes with this patch. No ABI or export change.
Deferred gates
htp_iface_stopduring startup rollback, teardown now unmaps and frees the session buffers and closes the handle instead of aborting. The host test cannot verify the DSP side; confirm no stuck DSP state or leaked mapping and that the next session start succeeds (docs/android_hexagon.md).High-risk classification
High-risk: native FFI/runtime patch to a backend teardown path and a CI/build change (
classify_high_risk_changes.dart:high-risk, surfaceregressionPolicy). Independentauditor-deepaudit of the exact head required before ready. Headac0e1e85audited clean (no blocking code findings); a delta audit of the follow-up head is pending. This PR is a draft.Changelog
N/A: unreleased opt-in Hexagon candidate. Build identity (patch digest) changes on every platform and the next release manifest lists 0010, but there is no runtime behavior change in default artifacts.