Skip to content

Add: support native HBG capture and serial replay - #2862

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
zxx0288:design/native-capture-from-main
Nov 5, 2026
Merged

ChaoWao merged 1 commit into
hw-native-sys:mainfrom
zxx0288:design/native-capture-from-main

Conversation

@zxx0288

@zxx0288 zxx0288 commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Enable cold native HBG capture through the existing simpler_prepare_run and simpler_launch_run_on_stream path. RTS records and serially replays device work without an eager warmup or another Simpler host prepare/reset between replays. Program remains eager-only.

Related to #2666 and #2773. This PR supplies the common preparation-resource/use ownership and HBG reconstruction; #2625 can consume the same execution and retention contracts for TMR rather than introducing another model/resource owner.

API and execution

  • NativeRunDescriptor.prepare_purpose declares eager or capture preparation before Host orchestration. There is one current descriptor and one prepare/run entry family; native clients rebuild together. No ABI-version field, PreparedCall cache or separate capture executor is added.
  • Capture-purpose prepare rejects Program mode and writable HOST/NONE effects before user orchestration. Read-only Host controls determine fixed prepared task arguments; later changes to their source do not update replay. Kernel does not implicitly transfer user tensors.
  • Retain the prepared backing before RTS CaptureBegin, call the common stream launch, end capture and finalize the original Host run. RTS owns model execution/destruction. Release the resource reference only after every external use ends.
  • Python Worker/ChipWorker continue to submit eager runs. Native C capture is not presented as a delivered Python/framework capture API.

Ownership, device state and errors

  • Separate immutable preparation backing from per-use obligations. Retain actual image/scheduler/arena/staging/argument/stream/event/callable backing beyond the original run, and detach successor storage before writing retained versions.
  • Preserve merged main's per-call completion, original-stream strong observation and controlled output delivery. Recording finalization does not synchronize recorded work or copy outputs. Completion, functional success and reclamation remain distinct.
  • Release preserves its token on ordinary cleanup failure. Managed backing is selected by allocation identity: retry only this reference's eligible failed frees; keep live/current/mapped/quarantined allocations protected; preserve unrelated failure debt. Confirmed owned Program reset remains a separate retirement boundary. Kernel never resets the caller's device.
  • Restore HBG mutable scheduler/task state at device entry on A3 and A5 legacy, preserving task kinds, arguments and initially completed tasks. A5 resident uses its scheduler metadata publication. No extra host reset task or cross-invocation Execute/Skip epoch is required.
  • Aggregate every identified AICPU callback, including filtered participants, after its work/cleanup. Required completion errors reach RTS; optional private publication does not gate a healthy invocation. Callback count is not physical-exit proof. Fault evidence does not decide whether an independent invocation executes.
  • Share main's checked SIM thread binding and single startup gate: release only after the full cohort is bound; cancel/join partial creation and retain its launch error. Native callbacks keep their per-run initialization/completion rendezvous. Retain complete fault evidence through its explicit lifetime.

Current contracts: execution/API, resource lifetime, HBG restoration. These are English product contracts. This PR adds no Chinese counterpart; preexisting Chinese Graph-task documentation is unchanged.

Earlier review-repair validation (b9797366f)

  • Public managed-staging/arena release regression failed before the fix on both A3 HBG and TMR host implementations with CPU RTS substitutes. It checks repeated free errors, retained token, exact failed-address attempts, charge/proof recovery, duplicate-release refusal and successful subsequent growth.
  • Six CPU CTest targets pass: both architectures × HBG/TMR native admission, workspace and prepared resources (386 internal cases). Workspace controls preserve unrelated debt, mapped/unknown-use quarantine and allocation identity across address reuse.
  • Seven entry/completion/caller-order/fence/stream CPU targets pass. The actual onboard affinity filter suite also passes all six cases with the non-Linux lookup path selected. The original macOS undeclared-sched_getcpu failure was reproduced by compiling that non-Linux source path; the corrected guard preserves the test target.
  • Rebuilt the local Python extension after rebase. Worker/caller-stream/error Python checks: 246 passed, 24 hardware cases skipped. Current descriptor layout and CPU teardown-shim controls: 3 passed; native prototype/default-eager compile controls pass.
  • Strict MkDocs and normal full-feature hooks pass. Independent host-lifetime, device and public-API reviews cover these repairs. No new local hardware task was issued for them; current-head CI must confirm remote platforms.

Integration validation (30e365db3)

Rebased onto main a19801e86 (#2826). Preserve its retryable incomplete-wait result, undrained SIM carrier/claim retention and ChipWorker observation/finalize retry behavior. Resolve both architecture SIM startup conflicts using one shared definition of the existing main startup gate, with native callback initialization/completion layered inside successful startup. The gate is relocated to the common host include directory without implementation changes; the duplicate gate and obsolete staging wrapper are removed.

The A5 retirement wiring fixture uses one timeout provider. Only the missing-handshake regression enables the short watchdog; normal retirement cases retain their default timeout. This closes the duplicate-definition build failure observed in the preceding macOS job and independently reproduced locally.

  • Fresh full default CPU C++ build passes; 456/456 nonhardware CTest entries pass, including the retirement test and new-main wait/startup controls.
  • Axis coverage and stub-linkage checks pass. Full-feature normal hooks pass. Independent conflict, lifetime and public-API source reviews found no remaining introduced defect within their inspected scope.
  • Rebuilt the current Python extension, SIM context library and all four architecture/runtime SIM triples. Their source stamps and artifact hashes were verified; the actual-library startup/legacy/configuration regression sweep passed 29/29 cases across both architectures and runtimes (245.85 seconds).
  • No local hardware query or task was issued for this integration. That revision subsequently passed native macOS compilation and Python tests; its one CTest segmentation fault is addressed by the MPI repair below.

MPI timeout repair and current validation (ea2f2fb6d)

Current base is main 89278fff3. The macOS UT job at 30e365db3 compiled successfully and passed Python tests, then failed only test_remote_endpoint (449/450 CTest entries passed).

MPI group timed waits now recheck their protected predicates after reacquiring the mutex. A completed leader can have moved the frame vector before a waiter reports timeout; completed replies must bypass arrival withdrawal. A retired predecessor similarly must not be rejected as still active. Production deadlines, batching, error cleanup and public APIs are unchanged.

  • Two state-controlled regressions fail against the original code: one with the matching null-vector segmentation fault, one with a false predecessor timeout. Both pass with the predicate checks. Only the new synthetic fixtures use a wider setup margin; the original timeout test and production budgets are unchanged.
  • Final rebased full CPU build, 456/456 nonhardware CTests, axis/stub checks and all normal hooks pass. The endpoint target passes 29/29 cases; the original case plus the two regressions pass 60 repeated executions. ASAN covers all 29 cases, 20 repeated synthetic cases and 20 executions of the original controlled interleaving.
  • Independent source review found no remaining issue in the two-file repair. The final source/pin were reconfigured and validated; no fresh runtime/SIM/hardware qualification is inferred from these CPU checks.
  • Native macOS endpoint validation passed at this exact source SHA in the personal-fork diagnostic job: all 29 endpoint cases, the original failed case repeated 20 times, and both new regressions repeated 20 times each (60 repeated case executions). Uploaded identity confirms zxx0288/simpler@ea2f2fb6de1e7bfd39e7d3dc2817cda8616d4d1e, macOS ARM64 and Apple Clang. This is targeted native acceptance, not a rerun of all 450 macOS CTest entries. Main now schedules macOS under Daily; its absence from PR CI was not used as a fix. The diagnostic workflow is not part of this PR and books no hardware.

Hardware evidence and limits

Pre-repair head 81e3cea59 actually executed and passed all 14 A3 HBG native capture scenarios in CI job 127026853292. They include numerical ordinary/early/nested replay, readonly Host snapshots, model lifetime beyond Host finalize, cancellation/invalidated/partial capture cleanup, two bounded scheduler timeouts and controlled post-handshake boot failure recovery. That evidence remains tied to its tested revision; it is not a new hardware run of these repairs.

A5/TMR capture hardware, DFX capture, concurrent replay, model parameter/address updates, zero-user-task/persistent-INOUT hardware cases and a retained-model-A/prepare-B/replay-A hardware case remain unqualified. Permanent missing callbacks, unknown physical exit and arbitrary device faults do not have a claimed recovery guarantee. CPU/Host substitutes do not establish silicon behavior or physical retirement. No performance or full-platform qualification is claimed.

The earlier A3 queue/client-budget interruption is tracked separately in #2887; it is not treated as a hung kernel or as a substitute for passing CI.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 111 files, which is 11 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

Check out review usage here.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d7ba98e7-e533-4069-9436-4f10ed99fca6
Commits

Reviewing files that changed from the base of the PR and between 3f4b554 and ea2f2fb.

Files selected for processing: 111

  • docs/design/native-capture-common-contract.md
  • docs/design/native-hbg-prepared-lifetime.md
  • docs/design/native-hbg-resource-reset.md
  • docs/design/run-completion-fence.md
  • mkdocs.yml
  • src/a2a3/platform/onboard/aicpu/kernel.cpp
  • src/a2a3/platform/onboard/host/device_runner.cpp
  • src/a2a3/platform/onboard/host/device_runner.h
  • src/a2a3/platform/sim/host/device_runner.cpp
  • src/a2a3/platform/sim/host/device_runner.h
  • src/a2a3/runtime/host_build_graph/aicpu/aicpu_executor.cpp
  • src/a2a3/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a2a3/runtime/host_build_graph/runtime/scheduler/scheduler_cold_path.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/runtime.h
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/scheduler/scheduler_cold_path.cpp
  • src/a2a3/runtime/tensormap_and_ringbuffer/runtime/shared/runtime_init.cpp
  • src/a5/platform/onboard/aicpu/kernel.cpp
  • src/a5/platform/onboard/host/device_runner.cpp
  • src/a5/platform/onboard/host/device_runner.h
  • src/a5/platform/sim/host/device_runner.cpp
  • src/a5/platform/sim/host/device_runner.h
  • src/a5/runtime/host_build_graph/aicore/aicore_executor.cpp
  • src/a5/runtime/host_build_graph/aicpu/aicore_lifecycle.cpp
  • src/a5/runtime/host_build_graph/aicpu/aicpu_executor.cpp
  • src/a5/runtime/host_build_graph/aicpu/aicpu_legacy_executor.cpp
  • src/a5/runtime/host_build_graph/host/runtime_maker.cpp
  • src/a5/runtime/host_build_graph/runtime/scheduler/scheduler_cold_path.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/aicpu/aicpu_executor.cpp
  • src/a5/runtime/tensormap_and_ringbuffer/runtime/shared/runtime_init.cpp
  • src/common/hierarchical/remote_endpoint.cpp
  • src/common/host_build_graph/host/orchestrator.cpp
  • src/common/host_build_graph/runtime.h
  • src/common/host_build_graph/runtime_types.h
  • src/common/host_build_graph/shared/runtime_init.cpp
  • src/common/host_build_graph/shared/shared_memory.cpp
  • src/common/host_build_graph/shared_memory.h
  • src/common/platform/include/aicpu/device_run_result_aicpu.h
  • src/common/platform/include/aicpu/device_run_result_base_aicpu.h
  • src/common/platform/include/aicpu/native_invocation_completion.h
  • src/common/platform/include/aicpu/native_invocation_entry.h
  • src/common/platform/include/aicpu/platform_aicpu_affinity.h
  • src/common/platform/include/common/device_run_result.h
  • src/common/platform/include/common/native_invocation_evidence.h
  • src/common/platform/include/host/aligned_image_storage.h
  • src/common/platform/include/host/prepared_run_resources.h
  • src/common/platform/include/host/run_caller_order.h
  • src/common/platform/include/host/run_completion_fence.h
  • src/common/platform/include/host/run_stream_pair.h
  • src/common/platform/include/host/sim_native_launch.h
  • src/common/platform/include/host/sim_thread_start_gate.h
  • src/common/platform/include/host/workspace_manager.h
  • src/common/platform/onboard/aicpu/platform_aicpu_affinity.cpp
  • src/common/platform/onboard/host/c_api_shared.cpp
  • src/common/platform/onboard/host/device_runner_base.cpp
  • src/common/platform/onboard/host/device_runner_base.h
  • src/common/platform/onboard/host/device_runner_helpers.cpp
  • src/common/platform/onboard/host/device_runner_helpers.h
  • src/common/platform/onboard/host/run_retention_probe.cpp
  • src/common/platform/shared/aicpu/device_run_result_base_aicpu.cpp
  • src/common/platform/sim/aicpu/platform_aicpu_affinity.cpp
  • src/common/platform/sim/host/c_api_shared.cpp
  • src/common/platform/sim/host/device_runner_base.cpp
  • src/common/platform/sim/host/device_runner_base.h
  • src/common/utils/retained_scheduler_storage.h
  • src/common/worker/native_run_context.h
  • src/common/worker/runtime_c_api.h
  • tests/st/a2a3/kernel_capture/native/capture_submit_fault.cpp
  • tests/st/a2a3/kernel_capture/native/capture_submit_fault.h
  • tests/st/a2a3/kernel_capture/native/hbg_driver.cpp
  • tests/st/a2a3/kernel_capture/native/hbg_orchestration.cpp
  • tests/st/a2a3/kernel_capture/native/hbg_step.cpp
  • tests/st/a2a3/kernel_capture/test_hbg_capture.py
  • tests/ut/cpp/a2a3/runtime/tensormap_and_ringbuffer/test_entry_cache_projection.cpp
  • tests/ut/cpp/a2a3/runtime/tensormap_and_ringbuffer/test_shared_memory.cpp
  • tests/ut/cpp/a2a3/runtime/test_scheduler_retirement.cpp
  • tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_nonce_exit.cpp
  • tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_report_epoch.cpp
  • tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_resident_entry_result.cpp
  • tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_resident_late_aicore_error.cpp
  • tests/ut/cpp/a5/runtime/host_build_graph/test_hbg_retirement_wiring.cpp
  • tests/ut/cpp/common/hierarchical/test_remote_endpoint.cpp
  • tests/ut/cpp/common/host_build_graph/CMakeLists.txt
  • tests/ut/cpp/common/host_build_graph/test_hbg_bind_ledger.cpp
  • tests/ut/cpp/common/host_build_graph/test_hbg_ready_queue_seed.cpp
  • tests/ut/cpp/common/host_build_graph/test_hbg_slot_claim.cpp
  • tests/ut/cpp/common/platform/CMakeLists.txt
  • tests/ut/cpp/common/platform/test_aicpu_entry_gate.cpp
  • tests/ut/cpp/common/platform/test_aicpu_filter_entry_gate.cpp
  • tests/ut/cpp/common/platform/test_kernel_args_helper.cpp
  • tests/ut/cpp/common/platform/test_lane_mask.cpp
  • tests/ut/cpp/common/platform/test_native_admission.cpp
  • tests/ut/cpp/common/platform/test_native_invocation_completion.cpp
  • tests/ut/cpp/common/platform/test_native_invocation_entry.cpp
  • tests/ut/cpp/common/platform/test_prepared_run_resources.cpp
  • tests/ut/cpp/common/platform/test_retained_scheduler_storage.cpp
  • tests/ut/cpp/common/platform/test_run_caller_order.cpp
  • tests/ut/cpp/common/platform/test_run_completion_fence.cpp
  • tests/ut/cpp/common/platform/test_run_stream_pair.cpp
  • tests/ut/cpp/common/platform/test_run_terminal_record.cpp
  • tests/ut/cpp/common/platform/test_sim_callable_pool.cpp
  • tests/ut/cpp/common/platform/test_workspace_manager.cpp
  • tests/ut/cpp/support/aicpu_entry_gate_cases.h
  • tests/ut/cpp/support/native_admission/fixture.h
  • tests/ut/cpp/support/native_admission/transport.cpp
  • tests/ut/cpp/support/native_admission/transport.h
  • tests/ut/py/kernel_close_faults.cpp
  • tests/ut/py/support/kernel_close_fake_rts.cpp
  • tests/ut/py/support/run_caller_launch_probe.cpp
  • tests/ut/py/test_kernel_mode_c_api.py
  • tests/ut/py/test_runtime_publication_launch.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@ChaoWao

ChaoWao commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Review and concrete convergence with #2625

Reviewed fixed head ece1f73465c54f75be8abad0829e4a5f2cc5031d, including the common launch, per-execution HBG restore, retained preparation/use ownership and partial-cleanup paths. I also read your complete #2773 proposal; my contract correction withdraws the earlier mandatory sticky-Skip and all-N-counter presumptions. It does not approve this implementation or hardware scope.

Proposed delivery ownership

Use this PR's PreparedRunResources / PreparedRunUse separation as the convergence starting point for the one common owner, after the corrections below and integration with merged main. This PR can deliver that common foundation together with working HBG capture, not an empty interface-only prerequisite.

Owner Scope
#2862 author Common preparation-resource/use retention, partial/unknown-use cleanup, shared platform-entry/callback completion contract, and HBG restoration on A3/A5 legacy/resident within explicitly tested scope
#2625 author TMR reconstruction and TMR functional error reporting, consuming the same retained-resource and entry/completion mechanism; no separate context-wide graph owner
Our local Core2/integration work Migrate missing multi-node, immutable source/generation protections and real consumer tests into this common implementation; preserve main's completion/delivery behavior and verify the combined source

Our local Core2 is an overlapping implementation, not a mandatory third PR to stack after the two author PRs. We will not introduce another retain/release or model registry. In particular, your existing image/scheduler detachment already covers some of its duties. Choose the authoritative writer and order for each restored region: do not combine its pristine DMA with your device reset indiscriminately.

Common+HBG is the proposed first complete delivery; TMR can develop against that shared foundation before merge. Please confirm this coordination boundary; the user will coordinate with the original authors. No assignment change or request for an additional Worker is implied.

Required fixes

1. Reject Program capture before publishing recording state. simpler_launch_run_on_stream accepts ACTIVE capture without a Kernel-mode restriction; DeviceRunnerBase::admit_recording checks diagnostics, predecessor and external references, but not this mode boundary. The caller-launch probe deliberately verifies successful recording with borrowed=false / PROGRAM. Our contract is Program eager only. Reject unsupported recording before modifying caller/recording/claim state, preserve Program eager on the same executor, and invert that probe into a no-side-effect refusal regression.

2. Handle Host orchestration effects before they escape preparation. validate_kernel_run_args accepts HOST/NONE, including writable arguments. HBG registers the caller address with HostTensorAccessor, invokes Host orchestration during prepare (runtime_maker.cpp:1604–1613), and HostTensorAccessor::write directly changes those caller bytes. HBG's empty launch-entry plan does not pass through TMR's DEVICE-only normalization. Recording admission has no effect check. Thus a HOST INOUT increment can happen once during prepare and disappear from subsequent raw replays, despite successful recording.

Provide an equivalent ordered replay effect, or reject unsupported effects before caller-visible writes. A pre-effect capability check or private staging/deferred effects may establish that boundary; finding the effect only at retain/record after it happened does not. Preserve read-only Host-control snapshots separately, and do not introduce implicit Kernel IO H2D/D2H or a requirement to rerun Host orchestration for replay. Add a writable-HOST negative control and a read-only snapshot positive control. Our old Core2 effect flag was recorded after the underlying operation, so copying it alone is not a solution either.

3. Preserve merged #2829's completion/observation/delivery behavior during rebase. This branch is based on 70499ab1, before merged main 313499d61. Port capture ownership onto the new common lifecycle rather than restoring old whole-file drain/finalizer logic. This is a required integration action, not a claim those older-base differences are newly introduced defects.

Clarifications / small corrections

  • NativeInvocationCompletion::finish turns successful execution into INTERNAL when publish is false. The actual publisher rejects invalid bindings/malformed states; this review has not established an ordinary reachable publication/DMA failure. Please distinguish a genuine functional invariant failure from optional-detail unavailability. Keep real functional failure propagation; optional DFX/private detail must not become a normal-success gate. This is a contract question, not an asserted reproduced hardware defect.
  • NativeInvocationEvidence crosses the copy boundary: add the required std::is_standard_layout_v guard alongside is_trivially_copyable. No ABI/version field is requested.
  • The new hardcoded HBG hardware scene lacks the runtime-selection marker consumed by root conftest; tag it so a TMR-only scene selection does not silently run the HBG case. This is source-confirmed routing, not an assertion that current CI already failed there.

Acceptance and review status

Keep one common native prepare/launch, no eager user warmup, no separate capture executor or AICore ABI. The initial delivery must prove DFX-off capture does not compute, stable input addresses give repeated full-array numerical results, original-run retirement does not end model-held lifetimes, caller-stream observation is the RTS error route, and partial/failed cleanup preserves live resources. HBG initial task states may be nonzero; keep the existing inline/nested restore semantics and do not clear persistent user IO.

Your declared limited A3 evidence is useful; A5, SDK capture/cancel/destroy failures and newer-main integration must retain their actual qualification boundaries. The proposed common callback aggregation is not rejected by name, but its necessity and coverage must follow the real callbacks and error-return behavior.

Changes requested on the concrete Program and Host-effect boundaries, plus the shared-main integration above. This is pinned-source review; no new build/hardware run or blanket capture approval is claimed.

@zxx0288
zxx0288 force-pushed the design/native-capture-from-main branch from ece1f73 to d7087cb Compare November 4, 2026 06:59
@zxx0288
zxx0288 force-pushed the design/native-capture-from-main branch 12 times, most recently from 3a1aa6b to 2b2ac4d Compare November 4, 2026 13:21
@ChaoWao
ChaoWao force-pushed the design/native-capture-from-main branch 2 times, most recently from 08b31dd to 452d028 Compare November 4, 2026 13:47
@zxx0288
zxx0288 force-pushed the design/native-capture-from-main branch 4 times, most recently from b0fa3af to fdea665 Compare November 4, 2026 17:06
@ChaoWao
ChaoWao force-pushed the design/native-capture-from-main branch from fdea665 to 81e3cea Compare November 5, 2026 01:12
Retain preparation backing independently of a host run and record Kernel
capture through the common native submission path. Restore HBG execution
state at device entry without an extra host reset task.

Integrate retention with per-call completion, original-stream observation
and controlled output delivery. Keep old observations alive across slot
reuse, preserve unknown-use cleanup and block owned reset on explicit
external obligations. Reject Program capture before mutating run state.

Declare capture preparation before Host orchestration and reject writable
HOST/NONE arguments before effects escape. Preserve eager writes and
readonly control snapshots; disallow upgrading eager preparation to capture.

Distinguish optional private publication from invalid producer state and
verify A5 runtime results through the common native completion owner.

Aggregate native AICPU callbacks, preserve bounded fault evidence and
retain cleanup failures for retry. Add lifetime, observation and callback
regressions plus A3 capture tests with changed inputs and repeated replay.
Document the current native API, ownership and support boundaries in
English.

Value-initialize arena preparation objects in place so A3 default Werror
builds preserve object lifetime and arena reuse without warning overrides.

Exercise real RTS capture cancellation, recoverable End argument rejection,
retained-resource release retry and subsequent capture on the same context.

Qualify real RTS capture conflicts and unjoined End failures, and instrument
test-only partial submission to verify retention, stop and recovery.

Preserve unlaunched run cleanup ownership when thread attachment fails.
Separate external release requests from device completion so confirmed
owned reset can retire faulted resources without resetting borrowed ones.
Invalidate TMR handshake reports only after acknowledged core retirement.

Use per-run simulated callback rendezvous and stage the entire thread
cohort before releasing any device work. Cancel partial thread creation
without stranding callbacks or simulated cores. Share native invocation
initialization, completion and required-symbol loading across backends.

Use one current prepare/run descriptor and entry family for eager and
capture preparation, with native callers rebuilt against that layout.
Retain complete simulation fault evidence until explicit acknowledgement
or backing destruction. Recover owned close from sticky device errors
through confirmed reset and centralize aligned storage and result ownership.

Keep ordinary Program reset failures reachable for close retry after
resource release, without unloading a retired binary again. Report
call-owned failure diagnostics after output bindings have retired, without
copying user outputs or using diagnostics as physical completion proof.

Value-initialize A5 arena objects and include CANN profiling headers in
the capture driver fixture. Cover staged unload/reset failure and
post-retirement error observation in regression tests.

Qualify teardown fault injection by resource identity and outermost reset
requests, excluding SDK-internal ACL-to-RT delegation and unrelated frees.
Exercise both SDK reset shapes and failed-allocation retry accounting
without hardware, while retaining real-device lifecycle regressions.

Release obsolete managed backing by retained allocation identity and retry
its unmapped free failures without consuming unresolved resource tokens.
Preserve unrelated failure, mapping and unknown-use debt; do not retry
successfully freed or reused addresses. Cover staging and arena cleanup
through the public API on both architectures and runtimes.

Keep affinity-gate tests portable by restricting Linux CPU lookup to
Linux. State eager, consumed Host-control and captured device-resource
lifetimes at the native API boundary.

Provide one scheduler-timeout fixture for the A5 retirement wiring tests.
Use a bounded override only for the missing-handshake case, preserving
normal retirement tests' default watchdog and avoiding duplicate symbols.

Recheck MPI group predicates after timed waits reacquire their mutex.
An already-completed reply does not withdraw frames moved by its leader,
and a retired predecessor does not reject the next batch as still active.
Regression cases hold the mutex across each deadline without changing
production timeout budgets.
@ChaoWao
ChaoWao force-pushed the design/native-capture-from-main branch from 30e365d to ea2f2fb Compare November 5, 2026 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants