fix(a2a3/tensormap): flag alloc-tensor creators so they don't block early-dispatch#1292
Conversation
…arly-dispatch Follow-up to the direct-only early-dispatch model (hw-native-sys#1285). Under that model an unflagged producer disqualifies its consumer from early-dispatch, and a pre-completed producer only seeds dispatch_fanin when flagged. alloc_tensors builds a hidden task that completes INLINE at submit (pto_orchestrator.cpp), so it is a pre-completed producer — and it carried no allow_early_resolve flag (defaulted false). Every consumer that reads an alloc'd buffer therefore had an unflagged pre-completed producer, which disqualified it from early-dispatch entirely. Since a buffer allocation is pure memory whose output is ready at creation, it must be transparent, never a barrier. Flag the creator unconditionally (allow_early_resolve = true) on the inline-complete path. Unlike a codegen task there is no Arg-driven hint to honor — an alloc creator should never suppress its consumers' early-dispatch. This keeps the "unflagged = suppress" invariant clean and deterministic (a consumer early-dispatches iff every producer is flagged, independent of which producers raced to completion). Intentional barriers still use a dummy task, which is scheduled (not inline-completed) and can be left unflagged. Tests: add WiringTest.FlaggedPrecompletedCreatorTransparentToEarlyDispatch — a flagged pre-completed creator + a flagged pending compute producer: the creator is seeded (transparent) and the consumer reaches the candidate once the compute producer dispatches. cpput WiringTest 19/19 pass; a2a3 tensormap onboard smoke passes; runtime compiles clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe orchestrator now marks hidden/inline alloc task slot states with ChangesEarly Resolve Flag for Alloc Tasks
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Orchestrator as PTO2OrchestratorState
participant SlotState
participant Consumer
Orchestrator->>SlotState: allow_early_resolve = true
Orchestrator->>SlotState: mark PTO2_TASK_COMPLETED
Consumer->>SlotState: seed dispatch_fanin (transparent creator)
Consumer->>Consumer: propagate_dispatch_fanin(compute producer)
Consumer->>Consumer: dispatch_fanin == fanin_actual_count
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #1285 (direct-only early-dispatch).
Problem
Under the direct-only model, an unflagged producer disqualifies its consumer
from early-dispatch, and a pre-completed producer only seeds
dispatch_faninwhen flagged.
alloc_tensorsbuilds a hidden task that completes INLINE at submit(
pto_orchestrator.cpp), so it is a pre-completed producer — and it carried noallow_early_resolveflag (defaultedfalse). Every consumer that reads analloc'd buffer therefore had an unflagged pre-completed producer, which
disqualified it from early-dispatch entirely. Because alloc'd buffers are
pervasive inputs, this silently defeats early-dispatch for most real graphs.
A buffer allocation is pure memory whose output is ready at creation — it must
be transparent, never a barrier.
Fix
Flag the creator unconditionally (
allow_early_resolve = true) on theinline-complete path. Unlike a codegen task there is no
Arg-driven hint tohonor: an alloc creator should never suppress its consumers' early-dispatch.
This keeps the "unflagged = suppress" invariant clean and deterministic
— a consumer early-dispatches iff every producer is flagged, independent of
which producers happened to race to completion before wiring. Intentional
barriers still use a dummy task, which is scheduled (not inline-completed)
and can be left unflagged to suppress.
Testing
WiringTest.FlaggedPrecompletedCreatorTransparentToEarlyDispatch: a flaggedpre-completed creator + a flagged pending compute producer — the creator is
seeded (transparent) and the consumer reaches the candidate once the compute
producer dispatches. cpput
WiringTest19/19 pass.tensormap_and_ringbufferonboard smoke passes; runtime compiles clean.