Skip to content

[codex] Extract core loop lifecycle hooks#436

Draft
mark14wu wants to merge 3 commits into
race-detector-z3-demofrom
codex/extract-core-loop-lifecycle
Draft

[codex] Extract core loop lifecycle hooks#436
mark14wu wants to merge 3 commits into
race-detector-z3-demofrom
codex/extract-core-loop-lifecycle

Conversation

@mark14wu

@mark14wu mark14wu commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

What changed

This PR extracts the loop-lifecycle and assumption/assertion support out of race-detector-z3-demo into a separate review unit.

Core runtime support:

  • Adds abandoned_loop_callback plumbing for loop clients.
  • Rewrites Triton loop instrumentation to run through a context-managed LoopIter, so break, early return, and exceptions can trigger deterministic loop teardown.
  • Adds DeviceAssert and Assume op records and registers Triton builder create_assert / create_assume hooks.
  • Finalizes Triton traces on mid-launch exceptions so per-launch client state is cleaned up before re-raising.

Consumer support moved with it:

  • Symbolic engine registers overriders for DeviceAssert / Assume.
  • Symbolic race detector collects tl.assume / tl.device_assert conditions as solver assumptions.
  • Race detector handles abandoned loops as unsupported instead of leaving stale loop state.
  • Tests covering abandoned-loop teardown and tl.assume behavior are included here rather than remaining in the base branch.

Why

The race detector consumer changes depend directly on the new core APIs. Keeping them together avoids leaving race-detector-z3-demo with dangling imports or callback fields while still making this runtime hook work reviewable independently.

Validation

  • uv run python -c "import triton_viz.clients.symbolic_engine; import triton_viz.clients.race_detector.race_detector"
  • uv run pytest tests/unit/test_race_detector.py -k abandoned_loop
  • uv run pytest tests/end_to_end/test_race_detector.py -k assume

@mark14wu mark14wu force-pushed the codex/extract-core-loop-lifecycle branch from a31f9ee to a61615f Compare June 14, 2026 05:49
@Jokeren

Jokeren commented Jun 20, 2026

Copy link
Copy Markdown
Member

Closing as stale during PR cleanup.

@Jokeren Jokeren closed this Jun 20, 2026
@Jokeren Jokeren deleted the codex/extract-core-loop-lifecycle branch June 20, 2026 01:24
@Jokeren Jokeren restored the codex/extract-core-loop-lifecycle branch June 20, 2026 13:33
@Jokeren Jokeren reopened this Jun 20, 2026
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