Repository navigation
accel/ane: pipeline bounded H16/H17 EXECUTEs by request key - #1234
Merged
Merged
Conversation
Keep publication, acknowledgment and completion dispatch under the session mutex, but release it while waiting between terminal-report polls. Reserve a bounded session slot and each program's surfaces through copy-out so other fds can overlap preparation and submission with engine execution. Default to two slots; a read-only execute_depth parameter permits 1-4. Dispatch reports and timing to their own pending keys. Fail every pending request on quarantine, retain the command arena on uncertain outcomes, and drain owners before lifecycle traffic and sleep. Reclaim successful batches only after the last running request ends, with backpressure when a sustained pipeline fills the arena. Hold the gate and performance vote while any request runs, preserving the existing idle gate hold. Allow H16 program switching through the queued BAR-context setup already used on H17. Queue overlapping requests and invalidate speculative direct context after an overlapping batch, whose completion order can differ. Keep one program per fd with a file mutex protecting its lifetime. Exercise out-of-order completion on H16/H17, same-program exclusion, the default bound, arena pressure, surface ownership, timeout, quarantine and sleep with concurrent KUnit callers. Only the poll pause runs without the session lock. On H16 the backend relax also drains the ASC mailbox (two reads pop one entry), steps RTKit and checks faults; two waiters doing that at once could tear a message. A new optional service op does that part under the lock before the pause. A request that already completed keeps its own status even if the session is quarantined before its owner re-takes the lock. Signed-off-by: Ryan Murray <[email protected]> Assisted-by: LLM
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.
What
The ANE driver now lets up to
execute_depthEXECUTEs from different file descriptors be in flight together.execute_depthis a read-only module parameter ofane_h16_program; it defaults to 2 and accepts 1-4.H16_LOADreturned-EBUSYwhile another program was loaded..servicetransport op, which runs under the lock before the pause.KUnit covers out-of-order completion on H16 and H17, same-program exclusion, the depth bound, arena pressure, surface ownership, timeout, quarantine, and sleep with concurrent callers.
Benchmark
Method: MobileNetV1 running as 1, 2 or 4 concurrent processes, each doing 1000 EXECUTEs (
ane-run.py), two rounds./lib/modules/<rel>/updatesoverride withexecute_depthset by modprobe.d.J616s (M4 Pro, H16), 26-resident L2 MobileNet, EXECUTE/s (round 1 / round 2):
Neo (J700, H17), EXECUTE/s (round 1 / round 2):
What the numbers show:
h16-mobilenet.pyhost p50 was 0.264-0.273 ms in every arm, against 0.271 ms on stock.Review fix
An independent review of the first version found that it released the session lock around the whole H16
relax(). Thatrelax()also drains the mailbox: tworeadqs pop one entry. Two waiters doing this concurrently could tear an RTKit message. In this version only the pause runs unlocked.Tests
🤖 Generated with Claude Code