xshader: add stage-aware loop guards #522

Merged
glovepost merged 1 commit from upstream-pr/522 into main 2026-12-01 14:48:36 +00:00
glovepost commented 2026-11-29 19:27:55 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T19:27:55Z.


Summary

Stage-aware loop guards for translated guest loops (split out from the earlier combined PR alongside #547 and #549 per @brcly's review):

  • Stage defaults & independent overrides (tools/shader-compiler/src/loop_guard.rs): Sets the default round budget to 65,536 for both graphics (TUXBOX_LOOP_CAP_GRAPHICS) and compute (TUXBOX_LOOP_CAP_COMPUTE) matching main, with block-dispatcher pass limits set to 16 * cap(stage) (1,048,576 default). Keeping the graphics cap configurable lets us lower graphics in a separate PR once live rounds are measured in ProjectScarlett.
  • Barrier-aware shared skip-flag budgets (hlsl/emitter/control_flow.rs):
    • tb_guard for per-lane loops without group barriers (BackEdge::Lane)
    • tb_sync_guard for group-synchronized loops (BackEdge::Group, so every lane in a group sees identical uniform exits)
    • Separate per-loop tb_copy_guard{i} at dispatch_cap(stage) for packed-root strided copies (BackEdge::Copy), and no translator cap on verified guest-bounded loops (BackEdge::Bounded).
  • Parented structured-loop guard (hlsl/structured_cfg/{emit,mod}.rs): Keeps per-loop tb_g{id} capped at cap(stage) and adds one shared tb_nested_guard capped at dispatch_cap(stage) only on loops with a parent (parent.is_some()), preventing nested structured loops from multiplying cap^2 without adding an extra counter to single-loop programs.
    • Updated dispatch any-host cs_6_5 waves=64 in tools/shader-compiler/src/tests/hlsl/host_profiles.txt (9b890279474ca108 -> 5e127d5c84740f8e) because its nested loop now emits tb_nested_guard.
  • Inline RayQuery::Proceed() templates: Bounds traversal loops via TB_LOOP_CAP in card_direct_shadow.hlsl and radiance_probe.hlsl.
  • TUXBOX_LOOP_GUARD=0: Restores the previous loop-guard behavior; all three env vars are documented in docs/ENVIRONMENT.md.

Verification

  • Command: TUXBOX_CHECK_JOBS=4 DXC=<dxc> python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc> (rebased onto main f482572a, head bc8604953381)
  • GPU / driver / backend: NVIDIA GeForce RTX 2070 SUPER (10de:1e84), driver 620.73.04, GE-Proton11-14
  • Results: 13 passed, 0 failed, 0 not run:
    • 758 Python tests passed
    • 23 synthetic DXC programs passed (3 refused, 0 slower, 0 failed)
    • Shader compiler tests: 656 lib + 3 bin + 2 integration passed
    • 120 DXBC tests, 24+7 XG tests (1 ignored), 22 storage codec tests, 9 ACP HAL tests, Windows typecheck, Windows build
    • Lanes and fixtures on the GPU: passed (lanes-bindless-compute, lanes-compute-root, lanes-compute-root-recovery, lanes-raster-tables, lanes-shader-cache)
    • Shader translator on the GPU: passed (including translated-mesh, wave-guard-*, lockstep, etc.)
  • Evidence (NVIDIA): Evidence: TuxBox check of bc8604953381, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not run
  • Still missing: AMD GPU checks (translator GPU checks + the 5 lanes-* suites) have not been run on this commit.
  • ProjectScarlett: Not run on this commit.

AI-assistance disclosure

Prepared and verified with AI-assisted coding tools (submitting contributor verified builds, diffs, and test runs).

<!-- greyfinch-sync:brcly/TuxBox:issue:5554265971 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T19:27:55Z. --- ### Summary Stage-aware loop guards for translated guest loops (split out from the earlier combined PR alongside #547 and #549 per @brcly's review): - **Stage defaults & independent overrides (`tools/shader-compiler/src/loop_guard.rs`):** Sets the default round budget to `65,536` for both graphics (`TUXBOX_LOOP_CAP_GRAPHICS`) and compute (`TUXBOX_LOOP_CAP_COMPUTE`) matching `main`, with block-dispatcher pass limits set to `16 * cap(stage)` (`1,048,576` default). Keeping the graphics cap configurable lets us lower graphics in a separate PR once live rounds are measured in ProjectScarlett. - **Barrier-aware shared skip-flag budgets (`hlsl/emitter/control_flow.rs`):** - `tb_guard` for per-lane loops without group barriers (`BackEdge::Lane`) - `tb_sync_guard` for group-synchronized loops (`BackEdge::Group`, so every lane in a group sees identical uniform exits) - Separate per-loop `tb_copy_guard{i}` at `dispatch_cap(stage)` for packed-root strided copies (`BackEdge::Copy`), and no translator cap on verified guest-bounded loops (`BackEdge::Bounded`). - **Parented structured-loop guard (`hlsl/structured_cfg/{emit,mod}.rs`):** Keeps per-loop `tb_g{id}` capped at `cap(stage)` and adds one shared `tb_nested_guard` capped at `dispatch_cap(stage)` only on loops with a parent (`parent.is_some()`), preventing nested structured loops from multiplying `cap^2` without adding an extra counter to single-loop programs. - Updated `dispatch any-host cs_6_5 waves=64` in `tools/shader-compiler/src/tests/hlsl/host_profiles.txt` (`9b890279474ca108 -> 5e127d5c84740f8e`) because its nested loop now emits `tb_nested_guard`. - **Inline `RayQuery::Proceed()` templates:** Bounds traversal loops via `TB_LOOP_CAP` in `card_direct_shadow.hlsl` and `radiance_probe.hlsl`. - **`TUXBOX_LOOP_GUARD=0`:** Restores the previous loop-guard behavior; all three env vars are documented in `docs/ENVIRONMENT.md`. ### Verification - **Command:** `TUXBOX_CHECK_JOBS=4 DXC=<dxc> python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc>` (rebased onto `main` `f482572a`, head `bc8604953381`) - **GPU / driver / backend:** NVIDIA GeForce RTX 2070 SUPER (`10de:1e84`), driver `620.73.04`, `GE-Proton11-14` - **Results:** **13 passed, 0 failed, 0 not run**: - `758` Python tests passed - `23` synthetic DXC programs passed (`3` refused, `0` slower, `0` failed) - Shader compiler tests: `656` lib + `3` bin + `2` integration passed - `120` DXBC tests, `24+7` XG tests (`1` ignored), `22` storage codec tests, `9` ACP HAL tests, Windows typecheck, Windows build - `Lanes and fixtures on the GPU`: passed (`lanes-bindless-compute`, `lanes-compute-root`, `lanes-compute-root-recovery`, `lanes-raster-tables`, `lanes-shader-cache`) - `Shader translator on the GPU`: passed (including `translated-mesh`, `wave-guard-*`, `lockstep`, etc.) - **Evidence (NVIDIA):** `Evidence: TuxBox check of bc8604953381, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not run` - **Still missing:** AMD GPU checks (translator GPU checks + the 5 `lanes-*` suites) have not been run on this commit. - **ProjectScarlett:** **Not run** on this commit. ### AI-assistance disclosure Prepared and verified with AI-assisted coding tools (submitting contributor verified builds, diffs, and test runs).
brcly commented 2026-11-29 19:48:57 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T19:48:57Z.


Thanks for this. Could you split it into separate PRs? The three parts are unrelated and would be easier to review and land on their own:

  1. the stage-aware loop guards (loop_guard.rs and its uses),
  2. the CLI --capabilities / --stride-report / --stride-hints options,
  3. the exec-masked CbDyn / tbuf_uint vector loads.

For the loop guards, two things I'd like to see before merging:

  • The 4,096 graphics cap against real shaders. tb_guard is shared by every loop in a program, so 4,096 is a budget for the whole program, not per loop: for example, a pixel shader with nested 64 × 64 loops would reach it and stop early. Could you show the cap doesn't cut off legitimate loops in ProjectScarlett's pixel and mesh shaders (for example by counting rounds on a run, or checking the recorded requests' loop bounds)?
  • Compile cost. The change alters the HLSL of nearly every program, so all cached shaders recompile. A before/after of DXC time and DXIL size on a sample of recorded requests would help, since compile time is our main focus right now.

One heads-up: it conflicts with a commit on #520 (e1d5b043) that changes the structured loop header from [loop] for (uint tb_gN = 0u; tb_gN < 65536u; ++tb_gN) to uint tb_gN = 0u; [loop] while (true) { if (tb_gN == 65536u) break; tb_gN += 1u;, which saves DXC time. Once one of them lands, the other only needs that line updated, using your loop_cap in place of 65536.

<!-- greyfinch-sync:brcly/TuxBox:comment:7261577572 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7261577572). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T19:48:57Z. --- Thanks for this. Could you split it into separate PRs? The three parts are unrelated and would be easier to review and land on their own: 1. the stage-aware loop guards (`loop_guard.rs` and its uses), 2. the CLI `--capabilities` / `--stride-report` / `--stride-hints` options, 3. the exec-masked `CbDyn` / `tbuf_uint` vector loads. For the loop guards, two things I'd like to see before merging: - **The 4,096 graphics cap against real shaders.** `tb_guard` is shared by every loop in a program, so 4,096 is a budget for the whole program, not per loop: for example, a pixel shader with nested 64 × 64 loops would reach it and stop early. Could you show the cap doesn't cut off legitimate loops in ProjectScarlett's pixel and mesh shaders (for example by counting rounds on a run, or checking the recorded requests' loop bounds)? - **Compile cost.** The change alters the HLSL of nearly every program, so all cached shaders recompile. A before/after of DXC time and DXIL size on a sample of recorded requests would help, since compile time is our main focus right now. One heads-up: it conflicts with a commit on #520 (e1d5b043) that changes the structured loop header from `[loop] for (uint tb_gN = 0u; tb_gN < 65536u; ++tb_gN)` to `uint tb_gN = 0u; [loop] while (true) { if (tb_gN == 65536u) break; tb_gN += 1u;`, which saves DXC time. Once one of them lands, the other only needs that line updated, using your `loop_cap` in place of 65536.
NickStallman commented 2026-11-29 20:08:45 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T20:08:45Z.


Some data on the loop guards (824e481f, from reading it and from recorded requests; not built or run):

  • Nested structured loops still multiply. for (uint tb_gN = 0u; tb_gN < cap; …) restarts each time the loop is entered, so two nested loops can run 4,096² rounds in graphics and 65,536² in compute (what I reported on #489). The comment in loop_guard.rs that nested loops can't multiply the cap holds for the skip form only.
  • The whole-program budget is the skip form's. There tb_guard is shared, so 4,096 covers the invocation. In the structured form it's per loop entry. The graphics dispatcher also goes from 1,000,000 passes to 65,536.
  • Constant bounds can't show that 4,096 is safe. In 45,981 recorded requests (first variant of each): pixel 8,773 have loops, 5,135 of them nested (3,145 structured); compute 3,921 and 2,562; mesh 3,091, none nested. No proven single bound exceeds 64, no proven nested product exceeds 256, but only 3 of the 7,702 nested programs have all bounds provable. So it neither shows that 4,096 is safe nor that it cuts anything; counting rounds on a run would. The non-structured graphics programs are where it matters (about 3,000 pixel and 3,000 voting mesh).
  • A prototype here keeps the per-loop 65,536 and adds one shared 1,000,000 counter only to loops that have a parent: 1,310 of 4,801 compute and 2,159 of 17,810 pixel programs change, HLSL +0.16% and +0.09%. It isn't checked on a GPU, and I haven't timed DXC. It's yours to use if you want it; I'm not opening a PR for it.
<!-- greyfinch-sync:brcly/TuxBox:comment:7261843726 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7261843726). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-29T20:08:45Z. --- Some data on the loop guards (824e481f, from reading it and from recorded requests; not built or run): - **Nested structured loops still multiply.** `for (uint tb_gN = 0u; tb_gN < cap; …)` restarts each time the loop is entered, so two nested loops can run 4,096² rounds in graphics and 65,536² in compute (what I reported on #489). The comment in `loop_guard.rs` that nested loops can't multiply the cap holds for the skip form only. - **The whole-program budget is the skip form's.** There `tb_guard` is shared, so 4,096 covers the invocation. In the structured form it's per loop entry. The graphics dispatcher also goes from 1,000,000 passes to 65,536. - **Constant bounds can't show that 4,096 is safe.** In 45,981 recorded requests (first variant of each): pixel 8,773 have loops, 5,135 of them nested (3,145 structured); compute 3,921 and 2,562; mesh 3,091, none nested. No proven single bound exceeds 64, no proven nested product exceeds 256, but only 3 of the 7,702 nested programs have all bounds provable. So it neither shows that 4,096 is safe nor that it cuts anything; counting rounds on a run would. The non-structured graphics programs are where it matters (about 3,000 pixel and 3,000 voting mesh). - A prototype here keeps the per-loop 65,536 and adds one shared 1,000,000 counter only to loops that have a parent: 1,310 of 4,801 compute and 2,159 of 17,810 pixel programs change, HLSL +0.16% and +0.09%. It isn't checked on a GPU, and I haven't timed DXC. It's yours to use if you want it; I'm not opening a PR for it.
glovepost commented 2026-11-29 21:38:52 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T21:38:52Z.


@brcly @NickStallman Thanks for the feedback — I've split #522 into three focused PRs and rebased onto main (updating the loop-guard tests for 4198b48c's while (true) loop headers):

  1. #547 — CLI --capabilities, --stride-report, and --stride-hints
  2. #549 — Exec-masked CbDyn and tbuf_uint vector MUBUF loads
  3. #522 (this PR) — Stage-aware loop guards only (9/9 host checks green on origin/main)

Next before asking for re-review, I'll follow up on #522 with:

  • before/after DXC compile-time and DXIL-size numbers on a sample of recorded ProjectScarlett requests, and
  • an evaluation of the 4,096 graphics round cap and nested structured-loop shared counter (@NickStallman's parented-loop suggestion).
<!-- greyfinch-sync:brcly/TuxBox:comment:7263040575 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7263040575). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T21:38:52Z. --- @brcly @NickStallman Thanks for the feedback — I've split #522 into three focused PRs and rebased onto `main` (updating the loop-guard tests for `4198b48c`'s `while (true)` loop headers): 1. #547 — CLI `--capabilities`, `--stride-report`, and `--stride-hints` 2. #549 — Exec-masked `CbDyn` and `tbuf_uint` vector MUBUF loads 3. #522 (this PR) — Stage-aware loop guards only (`9/9` host checks green on `origin/main`) Next before asking for re-review, I'll follow up on #522 with: - before/after DXC compile-time and DXIL-size numbers on a sample of recorded ProjectScarlett requests, and - an evaluation of the `4,096` graphics round cap and nested structured-loop shared counter (`@NickStallman`'s parented-loop suggestion).
brcly commented 2026-11-29 22:03:00 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T22:03:00Z.


Heads-up: we rewrote main's history tonight (one commit per merged PR, to drop files that came in with intermediate commits), and this branch is still based on the old main (on the old #512 merge, 39463ea5). That's why GitHub now shows it with dozens of commits that aren't yours. Your own commits are the ones after 39463ea5; this replays only those onto the new main:

git fetch origin
git rebase --onto origin/main 39463ea5
git push --force-with-lease

Sorry for the extra step.

<!-- greyfinch-sync:brcly/TuxBox:comment:7263360111 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7263360111). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T22:03:00Z. --- Heads-up: we rewrote `main`'s history tonight (one commit per merged PR, to drop files that came in with intermediate commits), and this branch is still based on the old `main` (on the old #512 merge, `39463ea5`). That's why GitHub now shows it with dozens of commits that aren't yours. Your own commits are the ones after `39463ea5`; this replays only those onto the new `main`: ```sh git fetch origin git rebase --onto origin/main 39463ea5 git push --force-with-lease ``` Sorry for the extra step.
glovepost commented 2026-11-29 22:13:58 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T22:13:58Z.


@brcly @NickStallman Follow-up on nested structured loops and the DXC compile-time / DXIL-size comparison (e03223e3 on main 97f21fad):

1. Nested structured loops (tb_nested_guard)

Per @NickStallman's note (and #489), I added a shared function-wide tb_nested_guard in hlsl/structured_cfg/{emit,mod}.rs capped at dispatch_cap(stage) (65,536 graphics / 1,048,576 compute) only on loops with parent.is_some() (and omitted when TUXBOX_LOOP_GUARD=0):

  • Single-loop programs stay untouched (no extra counter/increment).
  • Outer loops keep their per-loop tb_gN == cap(stage) check; inner/parented loops check tb_gN == cap(stage) || tb_nested_guard == dispatch_cap(stage), bounding total nested iterations instead of multiplying cap^2.
  • Updated the stale doc comment in loop_guard.rs that claimed all forms shared one counter, added nested_structured_loops_share_a_parented_budget, and blessed the one affected host_profiles.txt entry (dispatch any-host cs_6_5 waves=64).
  • tuxbox.py check --no-gpu: 9/9 passed (728 Python OK, 656+3+2 shader compiler).

2. Before / after DXC time and DXIL size (sample.json)

Measured sequentially with tools/stage_baseline.py cpu --jobs 8 across the 58 requests from tools/reference/stage-baseline/sample.json present in our local archive (31 CS -> 62 translations, 12 MS, 9 VS, 6 PS = 89 translations total):

Subset n HLSL KiB (base → #522) DXIL KiB (base → #522) DXC sum s DXC median s
Changed HLSL (32 cs, 4 ps, 4 ms, 1 vs) 41 61750.8 -> 61769.7 (+0.030%) 18103.7 -> 18150.9 (+0.261%) 253.23 -> 228.73 (-9.68%) 7.617 -> 6.671 (-12.42%)
All (compiled: 89/89 both) 89 105668.2 -> 105687.0 (+0.018%) 34958.8 -> 37330.3 (+6.784%)* 548.94 -> 545.75 (-0.58%) 7.290 -> 6.252 (-14.24%)
  • 47/89 translations had byte-identical HLSL and identical DXIL SHA-256 (ms/vs were identical DXIL bytes).
  • *The +2,324 KiB outlier in "All" is a single compute wave32 shader (b413657f5e5c) with byte-identical HLSL (7,136,495 B in both runs) that finished at 54.09s on baseline and hit the DXC -O0 fallback timeout at 86.85s (killed=1) on the candidate run.
  • Only 1 pixel shader in the sample (6a53b56d6ae8) grew DXIL (+224 B) from tb_nested_guard.

3. 4,096 graphics cap & ProjectScarlett status

ProjectScarlett has not been run with this PR yet, so I haven't done a live round-counting pass across graphics/mesh shaders to prove 4,096 never truncates a legitimate non-structured pixel/mesh loop. Before asking for a merge, would you prefer:

  • holding #522 until I instrument & count live rounds on a ProjectScarlett run, or
  • keeping the 65,536 default for graphics too (matching main's existing per-loop cap, while still gaining tb_nested_guard, tb_sync_guard, the RayQuery::Proceed()/view-cull guards, and TUXBOX_LOOP_CAP_*) and lowering graphics separately once measured?
<!-- greyfinch-sync:brcly/TuxBox:comment:7263510575 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7263510575). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T22:13:58Z. --- @brcly @NickStallman Follow-up on nested structured loops and the DXC compile-time / DXIL-size comparison (`e03223e3` on `main` `97f21fad`): ### 1. Nested structured loops (`tb_nested_guard`) Per @NickStallman's note (and `#489`), I added a shared function-wide `tb_nested_guard` in `hlsl/structured_cfg/{emit,mod}.rs` capped at `dispatch_cap(stage)` (`65,536` graphics / `1,048,576` compute) **only on loops with `parent.is_some()`** (and omitted when `TUXBOX_LOOP_GUARD=0`): - Single-loop programs stay untouched (no extra counter/increment). - Outer loops keep their per-loop `tb_gN == cap(stage)` check; inner/parented loops check `tb_gN == cap(stage) || tb_nested_guard == dispatch_cap(stage)`, bounding total nested iterations instead of multiplying `cap^2`. - Updated the stale doc comment in `loop_guard.rs` that claimed all forms shared one counter, added `nested_structured_loops_share_a_parented_budget`, and blessed the one affected `host_profiles.txt` entry (`dispatch any-host cs_6_5 waves=64`). - `tuxbox.py check --no-gpu`: `9/9` passed (`728` Python OK, `656+3+2` shader compiler). ### 2. Before / after DXC time and DXIL size (`sample.json`) Measured sequentially with `tools/stage_baseline.py cpu --jobs 8` across the `58` requests from `tools/reference/stage-baseline/sample.json` present in our local archive (`31` CS -> 62 translations, `12` MS, `9` VS, `6` PS = `89` translations total): | Subset | `n` | HLSL KiB (base → #522) | DXIL KiB (base → #522) | DXC sum s | DXC median s | | --- | ---: | --- | --- | ---: | ---: | | Changed HLSL (`32` cs, `4` ps, `4` ms, `1` vs) | 41 | `61750.8 -> 61769.7` (`+0.030%`) | `18103.7 -> 18150.9` (`+0.261%`) | `253.23 -> 228.73` (`-9.68%`) | `7.617 -> 6.671` (`-12.42%`) | | All (`compiled`: `89/89` both) | 89 | `105668.2 -> 105687.0` (`+0.018%`) | `34958.8 -> 37330.3` (`+6.784%`)\* | `548.94 -> 545.75` (`-0.58%`) | `7.290 -> 6.252` (`-14.24%`) | - `47/89` translations had byte-identical HLSL and identical DXIL SHA-256 (`ms`/`vs` were identical DXIL bytes). - \*The `+2,324 KiB` outlier in "All" is a single compute `wave32` shader (`b413657f5e5c`) with **byte-identical HLSL** (`7,136,495 B` in both runs) that finished at `54.09s` on baseline and hit the DXC `-O0` fallback timeout at `86.85s` (`killed=1`) on the candidate run. - Only `1` pixel shader in the sample (`6a53b56d6ae8`) grew DXIL (`+224 B`) from `tb_nested_guard`. ### 3. `4,096` graphics cap & ProjectScarlett status ProjectScarlett has **not** been run with this PR yet, so I haven't done a live round-counting pass across graphics/mesh shaders to prove `4,096` never truncates a legitimate non-structured pixel/mesh loop. Before asking for a merge, would you prefer: - holding #522 until I instrument & count live rounds on a ProjectScarlett run, or - keeping the `65,536` default for graphics too (matching main's existing per-loop cap, while still gaining `tb_nested_guard`, `tb_sync_guard`, the `RayQuery::Proceed()`/view-cull guards, and `TUXBOX_LOOP_CAP_*`) and lowering graphics separately once measured?
brcly commented 2026-11-29 22:20:16 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-29T22:20:16Z.


Thanks for the split and the nested budget. On your question: please keep 65,536 for graphics in this PR, matching main, and lower it in its own PR once you've counted live rounds in ProjectScarlett. That way this PR only adds bounds, and nothing that runs today gets cut short.

On the numbers: thanks for measuring. With 41 changed translations and one identical-HLSL shader landing on the -O0 timeout in only one run, the sample is too noisy to call it faster or slower, so we'll measure it here on the recorded requests when it's ready (DXC time with the runtime's flags, including -fnew-inlining-behavior, and DXIL size), and run the GPU checks on both cards. Tell us when the 65,536 change is in.

<!-- greyfinch-sync:brcly/TuxBox:comment:7263593477 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7263593477). Originally posted by [brcly](https://github.com/brcly) on 2026-11-29T22:20:16Z. --- Thanks for the split and the nested budget. On your question: please **keep 65,536 for graphics** in this PR, matching `main`, and lower it in its own PR once you've counted live rounds in ProjectScarlett. That way this PR only adds bounds, and nothing that runs today gets cut short. On the numbers: thanks for measuring. With 41 changed translations and one identical-HLSL shader landing on the `-O0` timeout in only one run, the sample is too noisy to call it faster or slower, so we'll measure it here on the recorded requests when it's ready (DXC time with the runtime's flags, including `-fnew-inlining-behavior`, and DXIL size), and run the GPU checks on both cards. Tell us when the 65,536 change is in.
glovepost commented 2026-11-30 00:05:03 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-30T00:05:03Z.


@brcly Updated and rebased onto main (f482572a, commit bc8604953381):

  • Default graphics loop cap set back to 65,536, matching main (dispatch_cap and tb_nested_guard are 1,048,576 for both graphics and compute), while keeping TUXBOX_LOOP_CAP_GRAPHICS as a separate override so graphics can be lowered later after measuring live rounds in ProjectScarlett.
  • Updated loop_guard.rs docs, docs/ENVIRONMENT.md, and tools/shader-compiler/src/tests/loop_guard.rs (keeping 4096 only as an explicit override test case).

Verified on NVIDIA GeForce RTX 2070 SUPER (10de:1e84, driver 620.73.04, GE-Proton11-14) with TUXBOX_CHECK_JOBS=4 DXC=<dxc> python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc> (758 Python tests, 656+3+2 xshader, all 5 changed lanes-* suites, and all translator GPU checks passed; AMD GPU checks still needed, ProjectScarlett not run):

Evidence: TuxBox check of bc8604953381, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not run

<!-- greyfinch-sync:brcly/TuxBox:comment:7264952901 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7264952901). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-30T00:05:03Z. --- @brcly Updated and rebased onto `main` (`f482572a`, commit `bc8604953381`): - **Default graphics loop cap set back to `65,536`**, matching `main` (`dispatch_cap` and `tb_nested_guard` are `1,048,576` for both graphics and compute), while keeping `TUXBOX_LOOP_CAP_GRAPHICS` as a separate override so graphics can be lowered later after measuring live rounds in ProjectScarlett. - Updated `loop_guard.rs` docs, `docs/ENVIRONMENT.md`, and `tools/shader-compiler/src/tests/loop_guard.rs` (keeping `4096` only as an explicit override test case). Verified on NVIDIA GeForce RTX 2070 SUPER (`10de:1e84`, driver `620.73.04`, `GE-Proton11-14`) with `TUXBOX_CHECK_JOBS=4 DXC=<dxc> python3 tuxbox.py check --changed --adapter 10de:1e84 --proton <proton> --prefix <prefix> --windows-dxc <windows-dxc>` (`758` Python tests, `656+3+2` xshader, all 5 changed `lanes-*` suites, and all translator GPU checks passed; AMD GPU checks still needed, ProjectScarlett not run): `Evidence: TuxBox check of bc8604953381, no uncommitted changes, GPU 10de:1e84: 13 passed, 0 failed, 0 not run`
NickStallman commented 2026-11-30 00:49:05 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-30T00:49:05Z.


The AMD check you asked for, on bc860495: AMD iGPU (1002:13c0, RADV, Mesa 26.0.8, GE-Proton11-14, Linux), full python tuxbox.py check: 197 pass, 2 fail. The two are d3d12-queues and d3d12-queries, each stopped by its 30 s limit, with the machine at load 18 (another check and builds were running). Run on their own straight after, at load about 7, both pass in 3 of 3 runs, so I read the timeouts as our load, not the change. It isn't a clean full check. ProjectScarlett wasn't run on it.

Evidence: TuxBox check of bc86049533, no uncommitted changes, GPU 1002:13c0: 13 passed, 1 failed, 0 not run

<!-- greyfinch-sync:brcly/TuxBox:comment:7265602403 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7265602403). Originally posted by [NickStallman](https://github.com/NickStallman) on 2026-11-30T00:49:05Z. --- The AMD check you asked for, on bc860495: AMD iGPU (`1002:13c0`, RADV, Mesa 26.0.8, GE-Proton11-14, Linux), full `python tuxbox.py check`: 197 pass, 2 fail. The two are `d3d12-queues` and `d3d12-queries`, each stopped by its 30 s limit, with the machine at load 18 (another check and builds were running). Run on their own straight after, at load about 7, both pass in 3 of 3 runs, so I read the timeouts as our load, not the change. It isn't a clean full check. ProjectScarlett wasn't run on it. Evidence: TuxBox check of bc8604953381, no uncommitted changes, GPU 1002:13c0: 13 passed, 1 failed, 0 not run
brcly commented 2026-11-30 04:12:22 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T04:12:22Z.


Heads-up: main just landed a large cleanup (up to e5d2e913), so this PR needs a rebase.

  • Formatting: the whole workspace is now formatted with rustfmt (see the new rustfmt.toml).
  • Lints: every crate denies unwrap(), lossy as casts and undocumented unsafe outside tests.
  • CI: it now also runs cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests.

The least painful way is to format your branch first, so the rebase only shows real changes:

git fetch origin
git checkout origin/main -- rustfmt.toml
cargo fmt --all && git commit -am "rustfmt"
git rebase origin/main

Then run python tuxbox.py check --no-gpu, which now includes the format step.

If clippy flags something new:

  • A cast: use From for widening, TryFrom for narrowing, and a mask for bit fields.
  • An unwrap(): use ?, or expect with the reason it can't fail.
  • An unsafe block: it needs a // SAFETY: comment.

CONTRIBUTING's "Code checks" section lists the commands. Thanks!

<!-- greyfinch-sync:brcly/TuxBox:comment:7268563082 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/522#issuecomment-7268563082). Originally posted by [brcly](https://github.com/brcly) on 2026-11-30T04:12:22Z. --- Heads-up: main just landed a large cleanup (up to e5d2e913), so this PR needs a rebase. - **Formatting:** the whole workspace is now formatted with rustfmt (see the new `rustfmt.toml`). - **Lints:** every crate denies `unwrap()`, lossy `as` casts and undocumented `unsafe` outside tests. - **CI:** it now also runs `cargo fmt --check`, rustdoc with warnings denied, and Miri on the providers' unit tests. The least painful way is to format your branch first, so the rebase only shows real changes: ```sh git fetch origin git checkout origin/main -- rustfmt.toml cargo fmt --all && git commit -am "rustfmt" git rebase origin/main ``` Then run `python tuxbox.py check --no-gpu`, which now includes the format step. If clippy flags something new: - **A cast:** use `From` for widening, `TryFrom` for narrowing, and a mask for bit fields. - **An `unwrap()`:** use `?`, or `expect` with the reason it can't fail. - **An `unsafe` block:** it needs a `// SAFETY:` comment. CONTRIBUTING's "Code checks" section lists the commands. Thanks!
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
brcly/TuxBox!522
No description provided.