Recompiler: bound spin waits of programs without a loop at 2^12 polls #3668

Open
Prime1997 wants to merge 1 commit from upstream-pr/3668 into main
Prime1997 commented 2026-12-02 05:54:20 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Prime1997 on 2026-12-02T05:54:20Z.


Requested by Prime

In a split wave64 program, a half waits for its partner at each exchange, and a wave at the bounded s_barrier waits for the others, up to 2^20 LDS atomic polls before it gives up. In a program without a loop every wait is straight-line code and should end within microseconds, so a wait that runs out has missed its arrival and only burns time. On an RTX 3060 Ti 8 GB (wave32), two character-skinning mesh programs of a game title have no loop (15 exchanges between the halves and two s_barrier at the end) and took 133 ms for 4 groups and 228 ms for 19 groups per call, 16 calls a frame. 2^20 polls are about 40 to 100 ms on that GPU, the order of the measured times. A program without a loop now waits at most 2^12 polls (about 0.1 to 0.3 ms), in both translators (HLSL preludes and direct DXIL). A program with a loop, or with a jump the forward walk does not follow, keeps 2^20, since there a wave can rightly wait for another wave's loop.

Related: #3652 (open) also lowers the direct DXIL bounds, for every program: an exit bit for a departed half, then 2^12 polls for the spin exchange and 2^16 for the bounded barrier. This one keeps 2^20 where a program has a loop, also covers the HLSL preludes, and adds no exit bit. Both change the same two lines in dxil/lanes.rs, so whichever lands second needs a rebase. #3562 (open, opt-in XCL_WAVE64_FOLD=1) folds a wave64 compute program into one 32-lane wave, which removes the exchange and its wait for the programs it folds; it tries compute programs only, so the mesh programs here keep the split form and this bound.

What is in it

  • crates/xcl/src/gpu/recomp/emit.rs: program_shape (a forward walk: no back edge, no call or indirect jump; it also reports whether every path passes each reachable s_barrier, barriers_on_every_path, which the tests check and nothing here uses yet), the spin bound (spin_log2: 2^12 without a loop, 2^20 with one, XCL_WAVE64_SPIN_LOG2 overrides), and the HLSL preludes of the spin exchange and the bounded barrier take that bound. Three tests.
  • crates/xcl/src/gpu/dxil/kernel.rs, lower.rs, lanes.rs: the direct DXIL spin exchange and bounded barrier use the same bound.
  • crates/xcl/src/gpu/recomp/pso.rs: a set XCL_WAVE64_SPIN_LOG2 is part of the translated cache's identity, in both translators. One test.
  • docs/wave64-on-wave32.md: the new bound and the switch.
  • The translator sources change, so the translated cache is cold once.

Tested

  • RTX 3060 Ti 8 GB, Windows 11, release build: the change has been in our test builds since 1 Dec (no measured before/after on its own).
  • This branch (on main 1c8b5514): cargo check -p xcl --lib --tests --target x86_64-pc-windows-gnu passes. The test suite was not run on this exact branch.

Regression run

  • Not run yet: testers welcome.

Not tested

  • The suite and scripts/smoke.ps1 on this branch; AMD.
  • The GPU time of the two mesh programs after the change was not measured on its own.

Switches

  • XCL_WAVE64_SPIN_LOG2=<8..24>: unset by default (2^12 polls without a loop, 2^20 with one). A value sets the bound for every program; XCL_WAVE64_SPIN_LOG2=20 gives the behaviour before this change. Values outside 8 to 24 are ignored.

AI use

  • Claude Code wrote the change and this description.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5600748524 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3668). Originally posted by [Prime1997](https://github.com/Prime1997) on 2026-12-02T05:54:20Z. --- <!-- claude-projects-attribution: {"github_login":"Prime1997"} --> _Requested by **Prime**_ In a split wave64 program, a half waits for its partner at each exchange, and a wave at the bounded `s_barrier` waits for the others, up to 2^20 LDS atomic polls before it gives up. In a program without a loop every wait is straight-line code and should end within microseconds, so a wait that runs out has missed its arrival and only burns time. On an RTX 3060 Ti 8 GB (wave32), two character-skinning mesh programs of a game title have no loop (15 exchanges between the halves and two `s_barrier` at the end) and took 133 ms for 4 groups and 228 ms for 19 groups per call, 16 calls a frame. 2^20 polls are about 40 to 100 ms on that GPU, the order of the measured times. A program without a loop now waits at most 2^12 polls (about 0.1 to 0.3 ms), in both translators (HLSL preludes and direct DXIL). A program with a loop, or with a jump the forward walk does not follow, keeps 2^20, since there a wave can rightly wait for another wave's loop. Related: #3652 (open) also lowers the direct DXIL bounds, for every program: an exit bit for a departed half, then 2^12 polls for the spin exchange and 2^16 for the bounded barrier. This one keeps 2^20 where a program has a loop, also covers the HLSL preludes, and adds no exit bit. Both change the same two lines in `dxil/lanes.rs`, so whichever lands second needs a rebase. #3562 (open, opt-in `XCL_WAVE64_FOLD=1`) folds a wave64 compute program into one 32-lane wave, which removes the exchange and its wait for the programs it folds; it tries compute programs only, so the mesh programs here keep the split form and this bound. **What is in it** - `crates/xcl/src/gpu/recomp/emit.rs`: `program_shape` (a forward walk: no back edge, no call or indirect jump; it also reports whether every path passes each reachable `s_barrier`, `barriers_on_every_path`, which the tests check and nothing here uses yet), the spin bound (`spin_log2`: 2^12 without a loop, 2^20 with one, `XCL_WAVE64_SPIN_LOG2` overrides), and the HLSL preludes of the spin exchange and the bounded barrier take that bound. Three tests. - `crates/xcl/src/gpu/dxil/kernel.rs`, `lower.rs`, `lanes.rs`: the direct DXIL spin exchange and bounded barrier use the same bound. - `crates/xcl/src/gpu/recomp/pso.rs`: a set `XCL_WAVE64_SPIN_LOG2` is part of the translated cache's identity, in both translators. One test. - `docs/wave64-on-wave32.md`: the new bound and the switch. - The translator sources change, so the translated cache is cold once. **Tested** - RTX 3060 Ti 8 GB, Windows 11, release build: the change has been in our test builds since 1 Dec (no measured before/after on its own). - This branch (on main 1c8b5514): `cargo check -p xcl --lib --tests --target x86_64-pc-windows-gnu` passes. The test suite was not run on this exact branch. **Regression run** - Not run yet: testers welcome. **Not tested** - The suite and `scripts/smoke.ps1` on this branch; AMD. - The GPU time of the two mesh programs after the change was not measured on its own. **Switches** - `XCL_WAVE64_SPIN_LOG2=<8..24>`: unset by default (2^12 polls without a loop, 2^20 with one). A value sets the bound for every program; `XCL_WAVE64_SPIN_LOG2=20` gives the behaviour before this change. Values outside 8 to 24 are ignored. **AI use** - Claude Code wrote the change and this description. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Foniass commented 2026-12-02 09:12:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T09:12:38Z.


Review (head d70c1ca2, diff read, not a merge-check; checks red):

  • 2^12 polls are not a bound on how long straight-line code can keep a partner waiting. The budget counts the waiter's LDS polls, not the other wave's work. A "program without a loop" can still keep its partner busy for a long time: global or texture loads under load, and loops the translator adds itself, such as the compare-exchange loop of up to 4096 global CAS per atomic (emit.rs ~5981). When the budget runs out, the exchange marks the pair failed and every later exchange reads 0 (lanes.rs ~545-620, xcl_x_meet). At the barrier, the timed-out wave forces the generation forward for all the waves still waiting and drops out of every later barrier (lanes.rs ~703-720, xcl_s_barrier). The result is silent wrong output, and nothing logs it.
  • The barrier change is on by default for far more than split wave64. safe_barrier is used by every compute or mesh group of more than one hardware wave that has s_barrier (emit.rs ~707, kernel.rs ~832). That includes native wave64 on AMD and console wave32 programs. A straight-line program that loads to LDS, runs s_barrier, then reads LDS (a common pattern) now gives up after 4096 polls on every vendor. Nothing measures how long waves arrive apart there.
  • The motivating case is not explained or measured. By the description's own arithmetic (133 ms ≈ 2^20 polls), the skinning mesh programs run to the bound on every call. They already take the failure path (zeros, or a barrier released early), and a smaller bound makes that cheaper without making the output right. Why the partner never arrives is not identified. A departed half, which #3652's exit bit covers, is one candidate. The description also says there is "no measured before/after on its own".
  • The tests cover helpers, not the change. They check spin_log2_for, the string replacement in the preludes, program_shape and the cache identity. Nothing checks that a translated program (HLSL or direct DXIL) actually carries the 2^12 bound. No GPU test shows that a live but late partner is not cut off. Two of the tests check barriers_on_every_path, which nothing uses (new logic with no caller).
  • PR description check is red. It refuses the PR because the Regression run has no xcl-smoke blocks (main and head d70c1ca235). The suite was not run either (only cargo check). AI use names the tool but not the model.
  • Overlaps. #3652 changes the same two lines in lanes.rs (~539, ~703) with a different policy: every program, plus an exit bit, 2^12 for the exchange and 2^16 for the barrier. Only one policy can land, and this PR's barrier bound (2^12) is the lower one. #3655 moves both loops into module.rs helpers, so spin_log2 would have to be passed through them. pso.rs conflicts textually with #3669 (identity lines next to each other); there is no functional overlap with #3669 or #3667.

Fine: by reading, program_shape is conservative for the console code: any back edge, call, swappc, setpc without a resolved far target, or target that is not an instruction start keeps 2^20, and unreachable data after the last s_endpgm is skipped. The default change invalidates both caches through the source hashes (emit.rs is in TRANSLATOR_SOURCES, and dxil/ is hashed). The env override has its own identity in both translators.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7340543521 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3668#issuecomment-7340543521). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T09:12:38Z. --- Review (head d70c1ca2, diff read, not a merge-check; checks red): - **2^12 polls are not a bound on how long straight-line code can keep a partner waiting.** The budget counts the waiter's LDS polls, not the other wave's work. A "program without a loop" can still keep its partner busy for a long time: global or texture loads under load, and loops the translator adds itself, such as the compare-exchange loop of up to 4096 global CAS per atomic (`emit.rs ~5981`). When the budget runs out, the exchange marks the pair failed and every later exchange reads 0 (`lanes.rs ~545-620`, `xcl_x_meet`). At the barrier, the timed-out wave forces the generation forward for all the waves still waiting and drops out of every later barrier (`lanes.rs ~703-720`, `xcl_s_barrier`). The result is silent wrong output, and nothing logs it. - **The barrier change is on by default for far more than split wave64.** `safe_barrier` is used by every compute or mesh group of more than one hardware wave that has `s_barrier` (`emit.rs ~707`, `kernel.rs ~832`). That includes native wave64 on AMD and console wave32 programs. A straight-line program that loads to LDS, runs `s_barrier`, then reads LDS (a common pattern) now gives up after 4096 polls on every vendor. Nothing measures how long waves arrive apart there. - **The motivating case is not explained or measured.** By the description's own arithmetic (133 ms ≈ 2^20 polls), the skinning mesh programs run to the bound on every call. They already take the failure path (zeros, or a barrier released early), and a smaller bound makes that cheaper without making the output right. Why the partner never arrives is not identified. A departed half, which #3652's exit bit covers, is one candidate. The description also says there is "no measured before/after on its own". - **The tests cover helpers, not the change.** They check `spin_log2_for`, the string replacement in the preludes, `program_shape` and the cache identity. Nothing checks that a translated program (HLSL or direct DXIL) actually carries the 2^12 bound. No GPU test shows that a live but late partner is not cut off. Two of the tests check `barriers_on_every_path`, which nothing uses (new logic with no caller). - **PR description check is red.** It refuses the PR because the **Regression run** has no `xcl-smoke` blocks (main and head d70c1ca23538). The suite was not run either (only `cargo check`). **AI use** names the tool but not the model. - **Overlaps.** #3652 changes the same two lines in `lanes.rs` (~539, ~703) with a different policy: every program, plus an exit bit, 2^12 for the exchange and 2^16 for the barrier. Only one policy can land, and this PR's barrier bound (2^12) is the lower one. #3655 moves both loops into `module.rs` helpers, so `spin_log2` would have to be passed through them. `pso.rs` conflicts textually with #3669 (identity lines next to each other); there is no functional overlap with #3669 or #3667. Fine: by reading, `program_shape` is conservative for the console code: any back edge, call, swappc, setpc without a resolved far target, or target that is not an instruction start keeps 2^20, and unreachable data after the last `s_endpgm` is skipped. The default change invalidates both caches through the source hashes (`emit.rs` is in `TRANSLATOR_SOURCES`, and `dxil/` is hashed). The env override has its own identity in both translators. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-02 09:37:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T09:37:25Z.


Test report (not a merge-check: PR description red)
base: 1c8b551475
head: d70c1ca235
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2913 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none
review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3668#issuecomment-7340543521 and its findings stand. Most serious: the 2^12 bound cuts partners that are late but still running, and the barrier bound is on by default for every multi-wave group on every vendor.
performance: 60 s smoke of a retail title, main 1c8b5514 vs this merge (d70c1ca2): 1652 -> 1596 frames shown (96 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 16915 MB, 0 device removals, 0 crashes.
assessment: merges, builds and passes the whole suite on current main, and the smoke run is clean; the blocking point is in the review: the 2^12 bound cuts partners that are late but still running, and the barrier bound is on by default for every multi-wave group on every vendor
hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5

AI-written and posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7341222171 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3668#issuecomment-7341222171). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-02T09:37:25Z. --- Test report (not a merge-check: `PR description` red) base: 1c8b551475e1e7bfe48f94448492a4c3544a2e0f head: d70c1ca235385eba19cd00cb5e83355f4e9deacb merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2913 passed, 0 failed, 51 ignored; SKIPPED: 28 (20 no wave64, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 no heap windows, 1 cannot disable the driver cache, 3 others; the same set as on main); failing: none review: read by one reviewer at this same head; the review is at https://github.com/xcl-dev/xcl/pull/3668#issuecomment-7340543521 and its findings stand. Most serious: the 2^12 bound cuts partners that are late but still running, and the barrier bound is on by default for every multi-wave group on every vendor. performance: 60 s smoke of a retail title, main 1c8b5514 vs this merge (d70c1ca2): 1652 -> 1596 frames shown (96 %; last presents per 2 s: 60 60 60), peak commit 18228 -> 16915 MB, 0 device removals, 0 crashes. assessment: merges, builds and passes the whole suite on current main, and the smoke run is clean; the blocking point is in the review: the 2^12 bound cuts partners that are late but still running, and the barrier bound is on by default for every multi-wave group on every vendor hardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5 AI-written and posted by Foniass without a human check of each point.
bmjask commented 2026-12-02 20:36:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:36:27Z.

Code review location: crates/xcl/src/gpu/recomp/emit.rs; line 5045

@@ -5037,7 +5042,7 @@ impl Em {
         } else {
             h.push_str("groupshared uint xcl_bar_alive_g;\ngroupshared uint xcl_bar_state_g;\n#define XCL_BAR_ALIVE xcl_bar_alive_g\n#define XCL_BAR_STATE xcl_bar_state_g\n");
         }
-        h.push_str(PRELUDE_SAFE_BARRIER);
+        h.push_str(&with_spin_limit(PRELUDE_SAFE_BARRIER, self.spin_log2));

High: The bounded s_barrier gets the same 2^12 poll budget as a single exchange, but a wave at the barrier has to outwait every other wave's whole path, which can include up to 15 exchanges with their own 2^12 budgets plus memory latency. In the PR's own mesh shape (15 exchanges, then two s_barriers), wave A reaches the barrier early while wave B is still in exchange 10, waiting legitimately on its partner. A spends 4096 polls, takes the timeout branch, lowers XCL_BAR_ALIVE, forces the generation forward and sets xcl_bar_alive = false, then runs past the barrier and reads LDS that B hasn't written yet. The DXIL path (lanes.rs:703) does the same. Giving barriers a budget that covers the exchanges before them (or keeping 2^20 for barriers) would avoid it.

<!-- greyfinch-sync:ivall/xcl:review-comment:4775671766 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3668#discussion_r4775671766). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T20:36:27Z. **Code review location:** `crates/xcl/src/gpu/recomp/emit.rs`; line 5045 ~~~~diff @@ -5037,7 +5042,7 @@ impl Em { } else { h.push_str("groupshared uint xcl_bar_alive_g;\ngroupshared uint xcl_bar_state_g;\n#define XCL_BAR_ALIVE xcl_bar_alive_g\n#define XCL_BAR_STATE xcl_bar_state_g\n"); } - h.push_str(PRELUDE_SAFE_BARRIER); + h.push_str(&with_spin_limit(PRELUDE_SAFE_BARRIER, self.spin_log2)); ~~~~ --- **High**: The bounded `s_barrier` gets the same 2^12 poll budget as a single exchange, but a wave at the barrier has to outwait every other wave's whole path, which can include up to 15 exchanges with their own 2^12 budgets plus memory latency. In the PR's own mesh shape (15 exchanges, then two s_barriers), wave A reaches the barrier early while wave B is still in exchange 10, waiting legitimately on its partner. A spends 4096 polls, takes the timeout branch, lowers XCL_BAR_ALIVE, forces the generation forward and sets `xcl_bar_alive = false`, then runs past the barrier and reads LDS that B hasn't written yet. The DXIL path (lanes.rs:703) does the same. Giving barriers a budget that covers the exchanges before them (or keeping 2^20 for barriers) would avoid it.
bmjask commented 2026-12-02 20:36:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:36:27Z.

Code review location: crates/xcl/src/gpu/recomp/emit.rs; line 6738

@@ -6722,6 +6727,111 @@ pub(crate) fn safe_barrier_wanted() -> bool {
     std::env::var("XCL_SAFE_BARRIER").map_or(true, |v| v.trim() != "0")
 }
 
+/// Polls (log2) a split-wave64 half waits for its partner, and a wave at the bounded
+/// `s_barrier` for the others, in a program with a loop (or a jump the walk does not follow):
+/// a wait there can be as long as another wave's loop.
+pub(crate) const SPIN_LOG2_LOOPS: u32 = 20;
+/// The same in a program without a loop (`ProgramShape::straight`): every wait there is bounded
+/// by straight-line code, microseconds. A wait that runs out costs about 4096 LDS atomics
+/// (~0.1-0.3 ms) instead of 2^20 (~40-100 ms on an RTX 3060 Ti, where two character-skinning
+/// mesh programs without a loop took 133 ms for 4 groups and 228 ms for 19).
+pub(crate) const SPIN_LOG2_STRAIGHT: u32 = 12;

Medium: Not certain about this one, because it depends on real GPU timing: SPIN_LOG2_STRAIGHT = 12 counts polls, not time, and 'no loop' doesn't mean 'microseconds', so a slow but legitimate partner can now be timed out and marked failed, which changes output. Take a loop-free mesh skinning program that does dependent loads from UMA memory (system memory over PCIe, ~1–2 µs per miss) on a busy GPU. The partner half can take more than 4096 LDS-atomic polls to reach the next exchange (~20–40 µs on a fast GPU). The waiter then CASes XCL_X_FAIL into the partner's counter, both halves set xcl_x_dead and stop early, and geometry is dropped or corrupted, where before the program completed within 2^20 polls. A time-based bound, or signalling a departed half (#3652's exit bit) and keeping 2^20 as the safety net, would avoid cutting off slow partners.

<!-- greyfinch-sync:ivall/xcl:review-comment:4775671780 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3668#discussion_r4775671780). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T20:36:27Z. **Code review location:** `crates/xcl/src/gpu/recomp/emit.rs`; line 6738 ~~~~diff @@ -6722,6 +6727,111 @@ pub(crate) fn safe_barrier_wanted() -> bool { std::env::var("XCL_SAFE_BARRIER").map_or(true, |v| v.trim() != "0") } +/// Polls (log2) a split-wave64 half waits for its partner, and a wave at the bounded +/// `s_barrier` for the others, in a program with a loop (or a jump the walk does not follow): +/// a wait there can be as long as another wave's loop. +pub(crate) const SPIN_LOG2_LOOPS: u32 = 20; +/// The same in a program without a loop (`ProgramShape::straight`): every wait there is bounded +/// by straight-line code, microseconds. A wait that runs out costs about 4096 LDS atomics +/// (~0.1-0.3 ms) instead of 2^20 (~40-100 ms on an RTX 3060 Ti, where two character-skinning +/// mesh programs without a loop took 133 ms for 4 groups and 228 ms for 19). +pub(crate) const SPIN_LOG2_STRAIGHT: u32 = 12; ~~~~ --- **Medium**: Not certain about this one, because it depends on real GPU timing: SPIN_LOG2_STRAIGHT = 12 counts polls, not time, and 'no loop' doesn't mean 'microseconds', so a slow but legitimate partner can now be timed out and marked failed, which changes output. Take a loop-free mesh skinning program that does dependent loads from UMA memory (system memory over PCIe, ~1–2 µs per miss) on a busy GPU. The partner half can take more than 4096 LDS-atomic polls to reach the next exchange (~20–40 µs on a fast GPU). The waiter then CASes XCL_X_FAIL into the partner's counter, both halves set `xcl_x_dead` and stop early, and geometry is dropped or corrupted, where before the program completed within 2^20 polls. A time-based bound, or signalling a departed half (#3652's exit bit) and keeping 2^20 as the safety net, would avoid cutting off slow partners.
bmjask commented 2026-12-02 20:36:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T20:36:27Z.

Review: COMMENTED


Review of d70c1ca2: 2 finding(s) (1 high, 1 medium), most severe first.

  1. High crates/xcl/src/gpu/recomp/emit.rs:5045: The bounded s_barrier gets the same 2^12 poll budget as a single exchange, but a wave at the barrier has to outwait every other wave's whole path, which can include up to 15 exchanges with their own 2^12 budgets plus memory latency. (inline)
  2. Medium crates/xcl/src/gpu/recomp/emit.rs:6738: Not certain about this one, because it depends on real GPU timing: SPIN_LOG2_STRAIGHT = 12 counts polls, not time, and 'no loop' doesn't mean 'microseconds', so a slow but legitimate partner can now be timed out and marked failed, which .... (inline)

These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.

<!-- greyfinch-sync:ivall/xcl:review:6158526005 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3668#pullrequestreview-6158526005). Originally posted by [bmjask](https://github.com/bmjask) on 2026-12-02T20:36:27Z. **Review:** COMMENTED --- Review of `d70c1ca2`: 2 finding(s) (1 high, 1 medium), most severe first. 1. **High** `crates/xcl/src/gpu/recomp/emit.rs:5045`: The bounded `s_barrier` gets the same 2^12 poll budget as a single exchange, but a wave at the barrier has to outwait every other wave's whole path, which can include up to 15 exchanges with their own 2^12 budgets plus memory latency. (inline) 2. **Medium** `crates/xcl/src/gpu/recomp/emit.rs:6738`: Not certain about this one, because it depends on real GPU timing: SPIN_LOG2_STRAIGHT = 12 counts polls, not time, and 'no loop' doesn't mean 'microseconds', so a slow but legitimate partner can now be timed out and marked failed, which .... (inline) --- _These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it._
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3668:upstream-pr/3668'
git switch 'upstream-pr/3668'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3668'
git switch 'upstream-pr/3668'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3668'
git switch 'upstream-pr/3668'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3668'
git switch 'main'
git merge --squash 'upstream-pr/3668'
git switch 'main'
git merge --ff-only 'upstream-pr/3668'
git switch 'main'
git merge 'upstream-pr/3668'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!3668
No description provided.