Skip to content

cua-s1: accelerate resident screenshot questions with matched prefix Graphs - #183

Merged
MrDongsls merged 9 commits into
InferMatrixLab:mainfrom
Levius-Fubuki:codex/cua-device-language-graph
Nov 2, 2026
Merged

MrDongsls merged 9 commits into
InferMatrixLab:mainfrom
Levius-Fubuki:codex/cua-device-language-graph

Conversation

@Levius-Fubuki

@Levius-Fubuki Levius-Fubuki commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Repeated questions about one screenshot repeat most language computation. This update combines GPU-resident features, ordinary-compatible request-local prefix reuse, and window Graphs. Fresh GPU qualification at a43f37001 on the frozen 12-screenshot HTTP workload measures 248.418 → 148.437 ms (40.25%) mean latency, with exact ordinary outputs; sampled process maximum increases 438 MiB.

Dependency/scope: PR #184's foundation is now merged into main; this PR adds resident windows and Graph integration on top. The large gain includes prefix computation reuse; window Graphs alone add a measured 2.10% mean reduction over prefix eager on this real workload. All controls remain opt-in. This PR is ready for review and remains unmerged.

Required human contributor answers

The contributor explicitly reviewed and confirmed these answers and PR necessity in the implementation task on 2026-10-25.

  1. What outcome are you trying to achieve?

    Enable language CUDA Graphs when Cua-S1 vision features stay on the GPU, preserving screenshot preparation, prompts, probabilities and decision semantics. The goal is lower repeated-decision latency where measurements justify it; capture cost and fallback remain explicit.

  2. What is the highest-leverage variable for that outcome?

    CPU operator submission and kernel-launch overhead in language forward. The primary outcome is warmed complete-request p50/p95, with first-capture cost and GPU memory reported separately. Correct current-input execution is a prerequisite.

  3. How will this work move that variable rather than create busywork?

    Combine the existing resident-feature path and existing multimodal Graph path by staging current input into owned scratch before replay. Use matched eager/Graph evidence; keep the opt-in and do not claim every shape improves.

  4. Who is the customer or user, and what do they actually need?

    GUI/browser-agent operators serving Cua-S1 and native-worker maintainers. They need predictable screenshot decisions with unchanged API behavior, current data after screenshot/shape changes, safe cache retirement and recoverable capture failure, backed by focused tests and reproducible evidence.

After answering the four questions: is a PR needed at all to achieve this outcome?

Yes. The contributor confirmed this scope and requested submission after validation. It requires the shared execution change, root regressions and recipe updates.

For a bug fix: link actual observed failure evidence.

This is a capability extension. The new GPU test fails on main because resident execution makes no capture, then passes here. The exact red/green logs are in the qualification package below.

Purpose

Original #183 enables ordinary language Graphs over resident vision features. The follow-on routes matched-prefix execution through one host/device planner, copying current checked device rows into owned language scratch outside capture. Full-prompt GEMM descriptors must match for every question and support each window; incompatible/no-prefix/single-question requests retain ordinary independent execution.

Window cache keys include begin/end, both prefix source and capture destination allocation identities, and GEMM handle. Entries retain both allocations until retirement, bounded at 128. Scratch growth, FIFO eviction and matched-workspace retirement synchronize before freeing addresses. Recording failure retains the warmed eager result, disables language Graphs and clears caches. No schema, scheduler, prompt, precision or default change. No cross-request screenshot/answer cache.

Test plan and provenance

OmniJev review follow-up (2026-11-01, 781730089520ffd5735b9eac02d1d26b222a1efb): shared Model::readout_window also enables OmniJev window Graphs when CUA_S1_GRAPH=1. This is now documented and directly tested; production inference behavior and defaults are unchanged. The new regression selects eager/Graph models without mutating process-wide environment, requires actual capture and stable warm replay, and compares raw FP32 head bits plus finished Choice/Noul/Score answers excluding timing fields. It covers same-layout new pixels, changed questions/options, geometry and scratch growth, return to earlier requests and malformed-input recovery. Six recorded visits show 13 captures, 203 replays, one scratch invalidation and zero capture fallbacks. The identical test over main e573260cc fails at the intended “OmniJev windows must capture a Graph” assertion.

Fresh author-run RTX 4090 / driver 580.76.05 / CUDA 13.0.88 / cuBLASLt 13.1.1.3 qualification passed 19 actual GPU test executions (new regression 1; existing OmniJev worker 4; canonical Qwen prefix/readout 8/6 at Graph 0/1) and 2 export-dependent CPU checks. The 826-file build tree is unchanged before/after; all Rust/CUDA/Cargo files at this commit match it exactly, with only three documentation-file differences in the final commit. The fixed model revisions, exported-file hashes, binaries, raw logs, portable audit and source binding are in the OmniJev evidence release. Archive SHA256: 97143e5c277af178eef79a954d23635c8b364109d4caa5c1c52b46af2bcbd836. Local OmniJev tests: 12 passed / 0 failed / 5 ignored; strict Clippy, formatting and pinned strict MkDocs passed. This is parity/lifecycle evidence, with no OmniJev performance or general accuracy claim. The CPU export used PyTorch 2.12.1 rather than the recipe's historical 2.14.0; all controls use that same verified export. Two external harness errors (shared Cargo-target reuse and a missing prefix-test model environment variable), invalid attempts and corrections are preserved; no test/production source or tolerance was changed to obtain a pass. After local verification of 106 evidence files and binary/model/source bindings, the platform was shut down and two fresh SSH probes confirmed endpoint closure.

Exact-head 781730089 CI passed Rust, benchmarks, CUDA contract and compilation of every declared CUDA backend. Docs passed; deployment is intentionally skipped. CUDA compilation is separate from the 19 actual GPU test executions above.

Cua-S1 GPU qualification at a43f37001 (2026-10-30): author-run qualification now covers exact head a43f37001d2066b77b577b0b67d446755e1fa157 on RTX 4090 / SM8.9, driver 595.71.05, CUDA 13.0.88 / cuBLASLt 13.1.1.3, Rust 1.98. All 825 committed files match the frozen archive before and after execution, and all 23 fixed model artifact hashes were rechecked. The diagnostic public-API harness is an external crate; its registry dependencies match committed Cargo.lock. No production/test overlay or tolerance change.

  • 69 actual GPU test executions passed: kernel and language/window Graph checks, resident prefix/features at vision Graph 0/1, canonical prefix/readout at language Graph 0/1 (including main's fixed-prefix cache), resident/transient lifecycle, and three real fault-injection recovery tests. Wrapper compilation is not counted as GPU execution.
  • 960 numerical records across five fresh profiles exactly match ordinary-control raw FP32 logits, full responses, token IDs, positions and grids. Individual-question extraction and malformed-input recovery passed.
  • 480 formal HTTP calls, 300 excluded growth/stabilization/warmup calls and 135 separate feasibility calls repeat the frozen workloads and O/E/G/G/E/O protocol. No timed recapture/capture failure or foreign GPU process. O is immutable original cua-s1: accelerate resident screenshot questions with matched prefix Graphs #183 resident-Graph baseline 911faa0d, freshly executed; E/G are this head's matched resident eager/Graph paths, with vision Graph on.
Current-head real workload / mode Mean ms p50 ms p95 ms Sampled maximum MiB
O 248.418 257.230 263.658 10256
E 151.624 152.171 158.056 10606
G 148.437 149.416 154.964 10694

Real G/O mean/p95 reductions are 40.25% / 41.23%; G/E reductions are 2.10% / 1.96%. The large O/G gain includes prefix reuse. Synthetic G/O mean reduction is 18.83%; synthetic G p95 is 2.00% worse than E. Cold costs, per-case regressions and sampled memory remain separate; no other-hardware, concurrency, throughput or general accuracy claim.

Cua-S1 evidence release at a43f37001 contains raw outputs/timings, portable audit, source/model/runtime-library hashes, measured binaries, protocol and an endpoint-redacted shutdown receipt. Public archive SHA256: c04c813692293665396254d2a1c24d243a70a921186496bc400a6891ffc245ca. Screenshot payloads and credentials are omitted. The complete raw archive is preserved locally; per-file verification, all 825 source-file hashes, binary binding and offline recomputation passed before platform shutdown, confirmed by two fresh SSH probes. Two harness metadata errors (test-count expectation and report commit-ID text) and their corrections are preserved; production/test sources and raw outputs/timings were unchanged. Earlier 48dfc6ffa evidence remains immutable and is historical.

Conflict-resolution update (2026-10-30): merged latest main at e573260cc467a3bf4119311ebda2bfc351667e1a into head a43f37001d2066b77b577b0b67d446755e1fa157 in response to the review. The only manual conflict was Model::alloc_prefix: retain #183's Arc<PrefixBuffers> ownership and use main's prefix_layout / prefix_bytes accounting. The remerge diff is limited to that conflict; current-input staging, window Graph keys, synchronized retirement and fixed-prefix capture/continuation were reviewed after integration. GitHub reports this head conflict-free.

Local macOS checks at a43f37001: cargo test --workspace --locked --features omni-laya/serve (394 passed / 0 failed / 96 ignored), strict all-target Clippy, workspace release build with omni-laya/serve, formatting, git diff --check, strict MkDocs, CUDA contract plus 68 checker / 26 backend tests, 133 benchmark tests, 8 vision-export tests, 22 Decider helper tests, and 36 Clef tests passed. The initial local benchmark run had one loopback failure during concurrent compilation; that test and the unchanged complete 133-test suite passed on rerun. Ignored CUDA/model tests are not GPU passes. At that earlier local-only stage, no new CUDA execution or performance measurement had been run; the fresh GPU qualification above supersedes that limitation for a43f37001.

Historical exact-head a43f37001 CI passed Rust, benchmarks, CUDA contract and compilation of every declared CUDA backend; Docs passed. Deployment is intentionally skipped for this PR. CUDA compilation is not device execution.

Conflict-resolution update (2026-10-27): merged main through 32346fcb2b88a10ffa7c8d456ae74d0543972d03; updated head c4f68282b9d33ae6e2f1adefe01fd2f6843e0dc5. Preserved both the startup-symbol guard and resident window-Graph lifecycle logic; resolved the recipe/test whitespace conflicts. Local macOS verification: workspace Rust tests 379 passed / 0 failed / 94 ignored, strict all-target Clippy, release build with omni-laya/serve, formatting, strict MkDocs, CUDA contract plus 68 checker / 26 backend tests, and 135 Vela tests passed. The final Vela merge changes no Rust sources or Cua/Qwen fixtures. GPU/HTTP measurements and CI links below are historical qualification at 48dfc6ffa; no new CUDA execution or performance measurement is claimed. GitHub reports the updated PR conflict-free; new CI runs are separate from the historical results.

  • Historical GPU qualification: review base 28f4957a6; original PRbase 05075d0f; previous cua-s1: accelerate resident screenshot questions with matched prefix Graphs #183 911faa0d22753be56c8bf513a23741dfa6d00593; final head 48dfc6ffa42aaa4c6c72a077f70b1ecc6c870b46. Main’s shared-executor refactor is integrated, with Cua retaining its ordinary arithmetic and optional text packing disabled. That integration was conflict-free at qualification time; current merge status and checks are recorded in the 2026-10-30 update above.
  • RTX 4090 / SM8.9 / CUDA 13.0 / driver 595.71.05 / ABI9 / Rust1.98. Pinned original BF16 vision, FP32 vision adapter and merged BF16 language; 23 artifact-file hashes verified. No tolerance change.
  • Exact frozen source qualification: all 783 committed files at final head match the candidate archive byte-for-byte, verified before and after execution. The 143 production/build source files and relevant tests match. The only build-tree change is the documented public-API example harness registration; no inference patch or tolerance change. Source/archive/worker/library/model hashes are included.
  • Five native public-API profiles each run 80 layouts twice plus 32 single extracts: 960 regular records, exact raw logits, complete responses, IDs/T-H-W and grids. Also 15 malformed-input rejections and 10 valid before/after recovery executions. Host/device and Graph/eager comparisons pass; individual answers match multi-question extraction.
  • 54 actual GPU test executions:27 kernels,7 language Graph,2 device-boundary,4 Cua prefix tests at each visionGraph0/1, plus2 canonical Qwen prefix and3 readout tests at each languageGraph0/1. Covers current data, producer release, simultaneous continue/capture destinations, scratch growth, actual recording failure/recovery,129th-entry FIFO release, live matched-workspace retirement, recapture/replay and positive resident admission.
  • Local: 376 passed /0 failed /92 default ignored, workspace all-target strict Clippy, workspace release with omni-laya/serve, format, strict MkDocs, CUDA contract plus68checker/26backend tests. Ignored tests are not device passes.

Historical full HTTP result (48dfc6ffa)

Clock: native /v1/systemone POST through complete JSON/schema validation; concurrency1. Each suite visits O/E/G/G/E/O, four shuffled timed traversals per worker. Exclude one growth traversal, one stabilization traversal and5warmups per visit. 480 formal timed,300excluded and135feasibility calls remain separate. Timed regions contain no recapture/failure or foreign GPU process. p50=median,p95=pooled nearest rank; process GPU memory sampled about100ms, not allocator-exact peak.

O=original183 resident Graph; E=resident matched prefix eager; G=resident matched prefix Graph. VisionGraph1 for all. Cache synthetic8/1024MiB, real16/2048MiB: workload controls, not new defaults.

Workload / mode Mean ms p50 ms p95 ms Sampled maximum MiB
8 synthetic /64 calls / O 130.086 117.070 270.064 10202
8 synthetic /64 calls / E 106.349 102.571 169.042 10448
8 synthetic /64 calls / G 104.981 100.919 171.937 10538
12 real /96 calls / O 249.244 258.318 263.885 10256
12 real /96 calls / E 150.812 151.246 157.745 10606
12 real /96 calls / G 148.656 149.528 154.843 10694

G/O real mean/p95 reductions 40.4%/41.3%; descriptive paired complete-round mean bootstrap95% 40.2%–40.5%, describing this repeated workload only. Synthetic mean/p95 reductions 19.3%/36.3%. The small case-1 regresses4.2%; G synthetic p95 is1.7% worse than E. All per-case values are retained.

Cold costs remain separate: real worker readiness20.07–21.07s; initial growth traversal mean milliseconds across the two visits: O253.2/253.8; E157.5/156.7; G159.5/159.8; no cold-start speedup claimed. Matched workspaces are bounded at16×32MiB, window Graphs at128 plus retained prefix allocations and vision budgets. Formal real matched profiles show48 admissions/visit and0 descriptor fallbacks; direct single-question/no-prefix fallback is separate and not counted by the descriptor trace.

Real quality is unchanged 119/192 correlated choice permutations over48screenshots, not official ScreenSpot accuracy or general GUI task success. Existing ordinary native-vs-FP32-reference limitations remain. No arbitrary-workload, other-hardware, throughput or concurrency claim.

Demo / evidence

Qualification release contains the sealed raw archive, portable audit, per-case table, protocol/reproduction, source/build/model identities, and shutdown verification. Public delivery cua183-verified-raw-20261026.tar.xz SHA256 e0bda4602cf48484ef41381b9dfe3d54a93daef9b6d00b8ade05ebcf5d29006c contains both raw evidence directories with unchanged per-file inventories. The local original integrated gzipcontainer SHA256 is e7801ab180c331a950f22242339404b43ac39ec518b9a0131bd4c6cfccfbdac5; DELIVERY.json maps the packaging change. Local verification checks all193file hashes, all783source files, measured executable/library bindings and raw-data recomputation. The pre-main c764 archive (SHA256e2cf87494c703f542e8acadc91616a5017ee6414f0acc764487a18b58fa22121,219files) is retained as its unchanged raw-directory payload alongside it; the recipe table records that historical measurement, while the table above is the fresh integrated result. Original screenshot pixels and credentials are omitted. Video:N/A; actual API measurements are retained.

Historical initial/follow-up Graph evidence remains unchanged, including its original small/no general gain finding; it is not reused as evidence for this new implementation.

Platform shutdown has been acknowledged after verified local copy; two fresh SSH connections failed. An endpoint-free shutdown receipt is published. Exact-head CI and Docs passed; deployment is intentionally skipped for this PR.

Self-review

Full diff reviewed, independent ownership/admission findings resolved and covered. 1210 authored-code /1413 total changed lines against main at e573260cc. Shared foundation is from #184; new orchestration stays in Cua/Qwen Rust, device operators in CUDA, tests under root tests/, one-off evidence external. Agent-assisted self-review and evidence verification are complete. The checked items below record that work; independent human review remains pending.

  • I have reviewed the full diff and addressed the issues I found.
  • I have checked that the change follows the project's architecture and stays focused on the stated purpose.
  • I have run the checks appropriate to this change and reported commands, results, and anything I could not verify above.
  • I have checked that the PR description, documentation, and any accuracy or performance claims match the implementation and available evidence.

Current-main / RTX4090 qualification (2026-11-01)

Current head 5361eda2ebdda4b2a69fabe63ca5d6d31dede950 merges main 5fa5179d57f9267bb0d20162004d8ce26352aa9d; this integration changes only Cargo package-version/lock entries. All 826 tracked source files match the qualified archive before and after execution. Diff against main remains 1,210 authored-code / 1,413 total changed lines.

Personally executed on one RTX4090 24GB / SM8.9, driver595.71.05, CUDA13.0.88, rustc1.98.0:

  • Workspace fmt, strict all-target Clippy with omni-laya/serve, release build and tests: 394 passed / 0 failed / 97 ordinarily ignored. Benchmark tooling133, CUDA checker68/backend26, manifest smoke and strict MkDocs passed.
  • 72 actual GPU test executions passed: kernels/state, language/window Graphs, checked device subviews, resident prefix/features at vision Graph0/1, canonical prefix/readout at language Graph0/1, lifetimes and all three injected failure/recovery cases; regenerated OmniJev window-Graph and worker regressions also pass. One additional real-export CPU head check passed and is not counted as GPU execution.
  • OmniJev export uses pinned base/release and the recipe's Torch2.14.0+cu130 / Transformers5.17.0 / PEFT0.19.1. The source/weight/export/runtime bindings and capture/replay output are archived. This establishes current-head correctness/lifecycle coverage; the real-screenshot performance campaign above retains its historical measured revision.
  • A separate cua-s1: accelerate resident screenshot questions with matched prefix Graphs #183 + cuda: add an eager prefix-bidirectional Qwen baseline #200 + perf(cua): batch screenshot questions and accelerate opt-in resize #201 integration at ba5dd2b5552999c0592557551595a37fe244a8fd passed 409 ordinary Rust tests and 19 actual GPU executions. Its patch resolves the four documented pairwise conflicts, adapts shared prefix ownership, includes perf(cua): batch screenshot questions and accelerate opt-in resize #201's first-byte feature identity fix, and preserves the intentional matched-mode admission tests. This is an external integration artifact; apply and revalidate against the actual eventual merge order.

Observed current-head CI and Docs passed. CI Rust, benchmarks, CUDA contract and compilation all passed; compilation is separate from GPU execution.

Current-device evidence and reproduction retains source archives, per-file identities, actual executables/libraries, raw checks/calls, all failed attempts and their corrections. Archive SHA256: 7d75a73dafa39b0481ba93c345fcbd34ab5c8934a4494d9999ce6472d7c6c149. Local download verification checks every archived payload and recomputes the HTTP summary. Final qualification uses empty independent Cargo targets per source and verifies the actual test inventory; the earlier shared/copy-target attempts are explicitly rejected. No numerical tolerance was changed.

No upstream merge, reviewer request or checklist-state change was performed by this follow-up.

@Levius-Fubuki Levius-Fubuki changed the title cua-s1: replay language Graphs with GPU-resident vision features cua-s1: accelerate resident screenshot questions with matched prefix Graphs Oct 26, 2026
@Levius-Fubuki
Levius-Fubuki marked this pull request as ready for review October 26, 2026 14:03
Copilot AI balanced review requested due to automatic review settings October 26, 2026 14:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@MrDongsls

Copy link
Copy Markdown
Collaborator

Reviewed at 48dfc6ff. Some findings:

  • P3: omnijev's readout_window path picks up window-Graph behavior under CUA_S1_GRAPH=1 — no direct test, no body disclosure.

Minor:

  • Window-Graph entries retain prefix allocations via Arc until retirement; the residency ceiling is structural.
  • A repo doc still says "PR184" without a number.
  • Matched's "identical to ordinary output" rests on per-hardware row invariance (author-disclosed caveat).

Since 911faa0d: the #184 cross-reference is numbered, the overlap dissolved into true shared commits, and an exact-head GPU evidence release now exists (author-run; no local GPU to reproduce).

Copy link
Copy Markdown
Collaborator Author

@psv666 @MrDongsls The merge conflicts are resolved. Could you please review this PR when you have a chance? Thanks!

@psv666

psv666 commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Reviewed 32346fcb2...c4f68282. I found no new actionable correctness issue in the resident-feature/window-Graph diff.

The reviewed paths stage current token/position/image inputs before capture or replay, retain both prefix source and capture destination allocations, and drain the stream before scratch growth, FIFO eviction or matched-workspace retirement. Capture failure falls back through the existing drain/disable path. The changed inventory is 1,022 code/test lines and 171 documentation lines (1,193 total); the added regressions cover these ownership and reuse cases.

Validation was source inspection, git diff --check, matching-head CI inspection and review of the published qualification protocol. I did not run the Rust suite or CUDA/model tests locally. The published GPU qualification is pinned to 48dfc6ffa, so I am not counting it as a current-head GPU pass or an independent reproduction of the latency numbers.

GitHub currently reports conflicts with main again. Please resolve those and rerun the affected checks before merging; the conflict-resolution delta will need another look.

Levius-Fubuki commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator Author

@psv666 @MrDongsls @hsliuustc0106 Updated in 781730089: added OmniJev Graph regressions/docs and clarified self-review. Fresh RTX 4090 validation passed 19 GPU checks, including bitwise eager/Graph head parity; CI is green. New evidence · Previous Cua-S1 qualification. Could you please review the updated PR?

@hsliuustc0106 hsliuustc0106 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #183 review — "cua-s1: accelerate resident screenshot questions with matched prefix Graphs"

Review date 2026-10-31. Head a43f37001d2066b77b577b0b67d446755e1fa157, base main e573260cc467a3bf4119311ebda2bfc351667e1a, merge-base = main tip. State OPEN, non-draft, GitHub reports MERGEABLE. 14 files, +1070/−123 (1193 total changed lines — verified; matches body claim "1193 total changed lines"). ## Relationship to #189 (just-merged cua-s1-prefix-cache)

Sibling/extension, not duplicate, not conflicting. Verified:

  • merge-base of PR head and origin/main IS e573260cc (the #189 merge commit), so the PR head contains #189.
  • #189's touched files (src/models/cua_s1/native/src/executor.rs, src/models/qwen3_5/native/src/prefix_cache.rs, recipe/cua_s1/native.md, docs/architecture.md startup-guard wording) are untouched by this PR's diff; the PR touches a disjoint set (resident windows, window Graphs, device row staging).
  • The body's "Conflict-resolution update (2026-10-30)" is accurate: merge commit a43f3700 (parents c4f68282 / e573260cc) had exactly 1 git merge-tree conflict, and actual-tree vs auto-merge-tree differs ONLY in the Model::alloc_prefix hunk (7 deletions, src/models/qwen3_5/native/src/model.rs ~line 2168): retains #183's Arc<PrefixBuffers> ownership plus main's bytes: self.prefix_bytes(len) accounting — exactly as the body describes.

Commit-by-commit (7 commits)

Commit Type Review
a14e1027 feat: replay language Graphs with resident vision features Splits forward_multimodal into staging + run_multimodal so host/device paths share capture; current-input staged into owned scratch before capture; producer addresses never recorded. Clean.
911faa0d docs: qualify Graph warmup and cache measurements Honest disclosure: original aggregate latency comparison "is not a pure warmed-replay measurement"; cold growth/stabilization reported separately. Good.
c7645615 feat: matched prefix Graphs (the main commit) Adds window_graph.rs, Arc refactor, readout_window_device, slice_rows, cua-s1 matched/device routing, tests. Reviewed in depth below.
48dfc6ff merge main (28f4957) merge-tree: 2 conflicts. Resolution hunks: keep run_window_graph wrapper over main's extended run_window(..., reuse) signature; route prefix field access through .buffers; drop a stray conflict marker in tests/qwen3_5/kernels.rs. Coherent; verified run_window_graph call present at head line 1935.
553cb2a6 merge main (978a077) merge-tree: 2 conflicts; resolution limited to recipe whitespace/tests mod declarations. Clean.
c4f68282 merge main (32346fc, Vela) merge-tree: 0 conflicts; actual tree equals auto-merge. Hygienic.
a43f3700 merge main (e573260 incl. #189) See above — single alloc_prefix resolution, matches body claim.

Contract analysis (source inspected)

Graph lifetimes (native/FFI) — PASS

  • Cache key: [begin, end, Arc::as_ptr(prefix_buffers), Arc::as_ptr(capture_buffers), gemm] (src/models/qwen3_5/native/src/model/window_graph.rs:12-25). Shapes + both allocation identities + GEMM handle. No ABA: every cached Entry holds Arc clones (_states), so recorded buffers cannot be freed and their addresses reused while the entry exists.
  • Buffer lifetimes: Entry field order puts cuda::Graph before _states, so the Graph is destroyed before recorded allocations release (window_graph.rs:5-10). Eviction at 128 entries synchronizes the stream before pop_front (window_graph.rs:70-73). Matched-workspace drain (model/matched.rs:41-46) synchronizes, then clears window_graphs, then destroys the 16 bounded 32 MiB handles — no replay against a freed workspace is possible.
  • Scratch growth: prepare_scratch (model.rs:1331-1360) synchronizes, counts an invalidation, clears graphs/mm_graphs/window_graphs, then reallocates — no stale replay against freed scratch. Covered by GPU test asserting window_graphs.is_empty() and Arc released after growth.
  • Per-request isolation: prefix_storage reuses the allocation only; contents are re-captured every request ("Reuse allocation only. Every request captures fresh contents", vision_engine/prefix.rs:164-166). Capture kernels get s_in = null when no prefix source (model.rs:3389-3395), so they overwrite, never accumulate into a prior request's state. Replay recomputes from scratch staged with the current request's rows (eager prelude runs before every replay). GPU test asserts changed input yields changed outputs across requests.
  • Failure recovery: capture records without executing after a synchronized eager miss, so the warmed result is preserved; Err routes to cache_graph which sets graph_enabled = false and clears all three caches (model.rs:1773-1779). Pre-capture cuda::synchronize means the stream is drained when caches drop. In-tree fault-injection tests cover recording failure, recovery, and eager equivalence.
  • Cancellation: Model::Drop synchronizes before clearing caches (model.rs:896-901); readout_window_device drains on every exit path before releasing the producer borrow (model.rs:1826-1854).

Runtime admission / cancellation — PASS

  • SerialScheduler::run (src/runtime/src/lib.rs:27-49): permit is held by the spawn_blocking closure until it returns "even when its caller stops waiting"; cancellation while waiting removes pre-dispatch work only. A cancelled request therefore cannot abandon mid-flight GPU work or leave poisoned entries: the closure either completes execute_prepared (per-exit device sync) or errors with a drained, disabled cache state. Cache entries are computation records only; data is restaged per call, so a failed request cannot poison a reused entry. The GPU recovery test (malformed token mid-request, then exact bitwise recovery) exercises this.
  • with_matched_prefix is panic-safe: catch_unwind + synchronize + matched_ref = 0 on every exit path; matched handles leak only to Model::Drop on unwind, which drains.

Numerical — disciplined

  • Replayed prefix path parity: bitwise (f32::to_bits) GPU-gated tests, e.g. tests/cua_s1/multimodal_prefix.rs resident_matched_windows_equal_ordinary_with_changed_requests_and_error_recovery and tests/qwen3_5/multimodal_graph.rs assert_hidden_eq capture/replay checks.
  • The code itself declares the tolerance discipline: matched.rs:9-11 "Descriptor equality is an admission check, not a portable cuBLAS numerical guarantee: requalify row invariance on each GPU/library/model combination," and the kernels test carries #[ignore = "...requalify on other libraries/devices"]. Recipe repeats it.
  • Hardware/checkpoint pins declared (RTX 4090/SM8.9, driver 595.71.05, CUDA 13.0.88, cuBLASLt 13.1.1.3, ABI9, Rust 1.98, 23 artifact hashes). No tolerance relaxation anywhere in the diff.

Performance claims — correctly separated

  • Body's current-head table (O 248.418 / E 151.624 / G 148.437 ms mean) separates the prefix-reuse gain (O→G 40.25%) from the window-Graph-only gain (E→G 2.10% mean, 1.96% p95); synthetic G p95 disclosed 2.00% worse than E; real case-1 regression 4.2% disclosed (historical table).
  • Cold vs warm separated: readiness 20.07–21.07 s, growth-traversal means listed, 300 excluded + 135 feasibility vs 480 formal timed; O/E/G/G/E/O protocol; p50/p95 defined; memory sampled ~100 ms disclosed as not allocator-exact; +438 MiB disclosed. Denominator preserved (12 real / 96 calls per mode = 480 formal).
  • Evidence is author-reported-with-disclosure with named public release archives and SHA256 (cua183-head-a43f37001-20261030, c04c8136…) — acceptable per contract, but not independently re-executed by this review (no GPU here).

Registration / docs — consistent

  • docs/architecture.md:71-80: fixed/shared = host features + Graph off; matched = resident + bounded replay, current rows staged outside capture — matches Mode::from_env gating in vision_engine/prefix.rs:20-31.
  • recipe/cua_s1/native_screenshot.md new section documents key contents, 128-entry bound with drain-first eviction, scratch-growth and matched-retirement invalidation, recording-failure behavior — all match code. Historical vs fresh measurement tables are explicitly labeled as such.
  • src/models/cua_s1/README.md and native_vision_graph.md updated consistently; anchor #gpu-resident-vision-features resolves (heading at native_vision_graph.md:125); mkdocs build --strict passes locally.
  • git ls-tree -r head = 825 files — matches body claim exactly. No Cargo.lock change (external harness claim consistent).

Observed CI (verified by this review)

  • gh pr checks 183 at head a43f37001…: benchmarks pass (42s), build pass, cuda-compile pass (4m17s), cuda-contract pass (9s), rust pass (2m32s), deploy skipped (intentional, body discloses).
  • Actions API confirms both runs (41023691167, 41023691160) status=completed, conclusion=success, head_sha=a43f37001d2066b77b577b0b67d446755e1fa157.

Commands run locally (no cargo/GPU; /Users/hsliu/miniconda3/bin/python, worktree at origin/pr/183, removed after)

  • PYTHONPATH=. python -m pytest tests/benchmarks -q → 133 passed (matches body claim).
  • PYTHONPATH=src python -m pytest tests/cua_s1/test_text_contract.py tests/cua_s1/test_text_server.py -q → 20 passed, 1 skipped (weight-free cua-s1 Python tests; PYTHONPATH must be src, per .github/workflows/ci.yml).
  • python -m mkdocs build --strict → passed (0.54 s).
  • git merge-tree --write-tree hygiene on all 4 merge commits (results above); git diff of resolution hunks read.

Author-reported (not independently verified — no GPU/cargo in this environment)

All GPU/HTTP numbers, the 69 GPU test executions, 960 numerical records, 480 formal calls, archive SHA256 values, 23 artifact-hash checks, local cargo suite (394 passed / 0 failed / 96 ignored), strict Clippy, and the two "harness metadata errors and corrections" disclosures. Two evidence generations are correctly kept separate (current head vs historical 48dfc6ffa).

Findings

P3-1 (PR body text, self-review section) — internal contradiction

Trigger: body line "Agent self-review and evidence verification are complete; the human checklist remains unchecked" immediately followed by all four checklist boxes rendered [x].
Consequence: a reader cannot tell whether a human actually confirmed the checklist; the checked boxes and the sentence contradict each other. Template structure is otherwise complete (four human-contributor answers with 2026-10-25 confirmation date, necessity decision present, capability-extension evidence in lieu of bug links, test plan/provenance, demo/evidence with named archives). Not a code defect; fix the sentence or uncheck boxes that no human verified.

Notes (informational, no action required)

  1. GPU memory growth is real but bounded and disclosed: up to 128 window Graphs each retaining both prefix allocations + 16×32 MiB matched workspaces + vision budgets; measured +438 MiB sampled.
  2. Matched-handle drain over-invalidates (clears all window Graphs when the 17th distinct prompt length appears) — conservative, correctness-preserving, perf-only.
  3. CUA_S1_GRAPH_TRACE/CUA_S1_PREFIX use std::env::var per call on hot paths — consistent with existing trace style; negligible.
  4. Replay hit lookup is a linear scan of ≤128 entries — negligible.
  5. The 40.25% headline is prefix-reuse-dominated; the body and recipe both attribute it correctly (window Graphs alone 2.10% mean). Good claim hygiene.

Verdict: COMMENTED

Non-draft, template structurally complete, zero code findings after full contract review (lifetimes, isolation, eviction, failure recovery, admission/cancellation, numerical discipline, claims separation all check out), CI green at the exact head, local non-GPU checks pass. The single P3 body-text contradiction (self-review checkbox vs "human checklist remains unchecked") plus author-reported-only GPU evidence keep this at COMMENTED rather than APPROVE. Recommended: clarify the self-review sentence, then this is approvable on code merits.

@psv666 psv666 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up to my c4f68282 review at current head 781730089: the added OmniJev window-Graph regression addresses the previously missing consumer coverage.

The test compares eager/Graph hidden-head bits and finished decisions, revisits changed images/questions/geometry, forces scratch growth, checks capture/replay counters, and exercises recovery after an invalid token. The test is wired to the real executor helper. I found no new actionable correctness issue in this follow-up.

Personally run: 12 OmniJev Rust tests passed / 5 ignored, strict MkDocs passed. The new model/GPU regression compiled but remained ignored locally. I acknowledge the submitted RTX4090 19-check evidence and green current-head CI as author-reported/observed results respectively; I did not independently reproduce the GPU run. Reconcile the shared executor with #200/#201 at the actual merge order.

Review scope and provenance

Head 781730089520ffd5735b9eac02d1d26b222a1efb; PR API base e573260cc467a3bf4119311ebda2bfc351667e1a; diff merge-base e573260cc467a3bf4119311ebda2bfc351667e1a. Inspected scope: incremental OmniJev regression/docs changes since my prior review and surrounding graph/executor ownership. Complete changed-file inventory: 18 files, 1,210 changed authored-code lines / 1,413 total text lines (binary fixtures counted as files, not text lines).

Loaded trusted InferMatrixLab/system1-omni@5fa5179d57f9267bb0d20162004d8ce26352aa9d:.agents/skills/system1-omni-review/SKILL.md, SHA256 3a4b876162da14eee8db56af86664576aa5755b8f3e80b3072e944018647c3bc, plus architecture, repository contracts, CONTRIBUTING, self-review artifact requirements and CI/Docs workflows. Personally executed checks are distinguished above from author-reported GPU evidence. No GPU inference was run in this review; no approval or readiness transition is implied.

@MrDongsls
MrDongsls merged commit aec1540 into InferMatrixLab:main Nov 2, 2026
6 checks passed
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.

5 participants