Skip to content

ci: a job that runs the d3d12 workspace's tests - #2816

Closed
fiestorra wants to merge 5 commits into
ProjectLeonida:mainfrom
fiestorra:ci-d3d12-rust-checks
Closed

fiestorra wants to merge 5 commits into
ProjectLeonida:mainfrom
fiestorra:ci-d3d12-rust-checks

Conversation

@fiestorra

Copy link
Copy Markdown
Contributor

No workflow runs cargo test on d3d12/. This adds the job. It is a draft because it depends on #2815 and will be red on its own until that merges.

What runs what today:

ci.yml            -> cargo build --release for tools/bcpack_calibration only
launcher.yml      -> fmt / clippy / test, for the launcher crate
xma2-decoder.yml  -> cargo test for runtime/xma_decoder
d3d12/            -> nothing

d3d12/ is thirteen crates and 1,000+ tests, and its asset-policy test fails on main b7a1be296 without anyone seeing it. That is the failure #2815 fixes: two Rust source files are measured as data and exceed a 640 KiB limit.

The job: windows-latest, cached ~/.cargo and d3d12/target, cargo test --workspace --locked, paths on d3d12/** and the workflow itself.

Two checks that are deliberately not in it, measured tonight:

check state of d3d12/
cargo fmt --all -- --check fails: d3d12/rustfmt.toml exists and the code does not follow it. cargo fmt --all rewrites 190 files
cargo clippy --workspace --all-targets -- -D warnings 115 warnings, 0 errors

Neither belongs here. A 190-file formatting diff would conflict with every open branch and could not be reviewed, and holding 115 warnings is its own pass. Both are named in the workflow's header so the next person knows they are missing on purpose, not by oversight.

Measured on this machine, warm, after #2815's change: cargo test --workspace --locked is 7 minutes from cold and exit 0.

AI-assisted: yes - DeepSeek v4.1 (flash), which installed Rust here tonight and ran the workspace both ways.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

A note that strengthens the "why no fmt" in the header, because I checked whether the workspace is breaking a rule and it is not.

d3d12/rustfmt.toml exists (max_width = 100, use_field_init_shorthand = true), and cargo fmt --all rewrites 190 files - so the config is not applied. But nothing in the repository requires it:

CONTRIBUTING.md   -> no mention of cargo fmt
AGENTS.md         -> no mention of cargo fmt
launcher.yml      -> cargo fmt --check, for the launcher crate only

So d3d12/ is not failing a documented rule - it has a config file that was never run over the tree. That makes the missing check a preference, not a compliance gap, and it is another reason not to put a 190-file reformat in a CI pull request: there is no rule it would be enforcing.

If the maintainers want it, the order is: cargo fmt --all as its own pull request (mechanical, cargo test --workspace unchanged), then add cargo fmt --all -- --check to this workflow. Both are one line each once the first has landed.

If they do not, removing d3d12/rustfmt.toml says the same thing without a 190-file diff.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: the workspace baseline this job will run against is now one failure, and it is the one #2815 fixes.

main d921489d1 (after #2820 and #2795 merged), cargo 1.98.1:

cargo test --workspace
  exit 101, 7.2 min
  FAILED: policy::tests::repository_passes_policy        (5 passed; 1 failed)
  error: test failed, to rerun pass `-p xtask --bin xtask`

That is the whole list. Before #2820, the same command also failed host::refresh_tests::only_what_differs_goes_up in leonida-gpu; that one is gone, and what is left is main failing its own asset policy on two source files over 640 KiB - leonida-gpu/src/host.rs and leonida-shader/src/emit/lower.rs - which is this draft's dependency on #2815 and nothing else.

So the order to land these is one way, not two: #2815 first (it makes the policy pass), then un-draft this one - its job is cargo test --workspace, and until #2815 lands that job is red on main itself, not on anything a contributor did. A contributor who opens this pull request against today's main would see it red for a reason that is not in its diff, which is worth a line in its description.

And one thing this baseline settles: #2816 does not need cargo fmt or clippy -D warnings to be useful. Both are absent on purpose - no document in the repository requires formatting for d3d12/, and clippy reports 115 warnings and 0 errors - and a job that only runs cargo test --workspace would have caught the red that sat on main all day, which is the whole argument for it.

AI-assisted: yes - DeepSeek v4.1 (flash), one run of the workspace on the merged main.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: my own workflow had a real defect and I have fixed it: it installed stable while d3d12/rust-toolchain.toml pins 1.98.1.

The file this repository already has:

[toolchain]
channel = "1.98.1"
targets = ["x86_64-pc-windows-msvc"]
components = ["rustfmt", "clippy"]
profile = "minimal"

And what my job did:

- uses: dtolnay/rust-toolchain@stable

What that means in practice: the action installs the runner's latest stable; then cargo, run from d3d12/, has rustup read the pinned file and fetch 1.98.1 during the job. So the tests would have run on the right compiler - the repository's pin wins - but after a download nobody asked for, and with a Install Rust step that installs a toolchain the build never uses. Two versions on the runner, one of them decoration, and the log would show a download at the first cargo call that looks like a network problem.

The fix, f4de60f5b:

- name: Install Rust
  # The channel `d3d12/rust-toolchain.toml` pins. `@stable` installs whatever the runner calls
  # latest, and then `cargo` run from `d3d12/` has rustup fetch the pinned one on the fly: the
  # same result with a download nobody asked for. If that file bumps, this line follows it.
  uses: dtolnay/rust-toolchain@master
  with:
    toolchain: 1.98.1

Validated, not assumed: yaml.safe_load on the changed file gives runs-on: windows-latest, steps: 4, toolchain: ['1.98.1'], run: ['cargo test --workspace --locked'].

The cost of the duplicated number is real and I am not hiding it: 1.98.1 now lives in two places, and the comment says so. The alternative - dropping the install step and letting rustup read the file - removes the duplication but pays the download every cache miss, which is worse for a job whose whole value is that it is cheap enough to run on every pull request.

And how I got here, since it is the same mistake this repository keeps producing: I had been checking this job's green status, not its content. The step said stable and I read it as "installs Rust". It took reading the workflow against the toolchain file the repository pins - a diff between two files I had both seen.

AI-assisted: yes - DeepSeek v4.1 (flash), which broke the YAML once fixing it and says so.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: jactionlint was failing on this pull request and is now green: the job used tags, and every other workflow in this repository pins commits.

I had been reading this workflow's checks as "green until #2815 lands" and missed that one of them was red for a reason inside the file. jactionlint (jdx/jactionlint, .github/workflows/jactionlint.yml) checks syntax, expressions, shellcheck, dependabot.yml, pinned actions, permissions, timeouts and concurrency - and "pinned actions" is the one I failed, because actions/checkout@v4 and actions/cache@v4 are tags that can be moved.

What the repository already does, and what I now copy:

.github/workflows/launcher.yml:59   actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
.github/workflows/runtime.yml:254   actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

So both of those commits were already in the tree and I used tags anyway. The third action, dtolnay/rust-toolchain, is not used anywhere here, and it publishes only a moving v1 tag - no per-version tags - so it is pinned at v1's commit and the version comes from the with: toolchain: input, which is how that action resolves a ref that is not a toolchain name:

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust
  uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
  with:
    toolchain: 1.98.1
- name: Cache Cargo dependencies and build
  uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0

Result on this head (5a380ba68):

jactionlint=SUCCESS   change-scope=SUCCESS   no-game-data=SUCCESS
d3d12-rust=(pending)  check=(pending)  linux-python-and-viewer=(pending)  semantic-tests=(pending)

And the answer to the question this comment is really about: the repository has a workflow linter that would have told me this in one line, and I did not run it or read its output for hours. The same shape as everything else today: I was reading the colour of the checks, not what each one checks.

AI-assisted: yes - DeepSeek v4.1 (flash), which broke the YAML twice before this and pinned the wrong action version once.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: the job ran for the first time and found a red that is not the policy test: depth_bounds_pipeline_loads_and_filters_draws fails on windows-latest and passes here. That makes two blockers for this pull request, and the second one is nobody's fix yet.

The job, 5 minutes, windows-latest, head 5a380ba68:

test result: FAILED. 588 passed; 1 failed; 53 ignored
  pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws
  assertion `left == right` failed: depth 0.5 outside [0.6, 1.0] must b...
    left: 255
    right: 0

And the same suite on this machine, main 90c514437, is 589 passed; 0 failed; 53 ignored.

Why that matters: 588 passed here means the policy test PASSED on this branch - it predates the two oversized files, so xtask is green in this job. So the red is entirely this GPU test, and it is red because the runner has no card.

The test already tries to skip, and the guard is not enough:

let Some(host) = host() else { return; };
if !host.depth_bounds() {
    eprintln!("no host depth bounds support; skipped");
    return;
}
let Some(dxc) = dxc() else { eprintln!("no PC dxc.exe; skipped"); return; };

depth_bounds() asks the device for D3D12_FEATURE_D3D12_OPTIONS2 and reads DepthBoundsTestSupported (host.rs:5765). On a software adapter that answers yes and then does not gate the draw: the test renders, expects the fragment outside [0.6, 1.0] to be culled and reads back 255 instead of 0. So the feature query is right about the API surface and wrong about what the driver does with it - which is exactly what a software rasterizer can be.

What I would do about it, and it is the repo's call, not mine: host() should return None for a software adapter - the test's other guards all key off "can this host do it", and DepthBoundsTestSupported is not the question for WARP - or the job should name the GPU tests it cannot run instead of running them. What I would NOT do is --skip pipeline::host:: in the job: that would hide the whole module's coverage on the only machine that ever runs it.

So this pull request needs two things before it can go green, and only one of them is mine: #2815 for the policy test on the rebased branch, and a decision about a GPU test on a runner with no GPU. The job finding this on its first run is the argument for it, and also the reason it cannot be un-drafted today.

AI-assisted: yes - DeepSeek v4.1 (flash), which read the failed step's log rather than its colour.

Written with an AI assistant.

@KelboLive KelboLive 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.

The shape is right: working-directory: d3d12 (that is where the workspace lives), 1.98.1 matching d3d12/rust-toolchain.toml, windows-latest (the windows* crates and cfg(windows) tests need it), and genuinely no GPU or game files — replay.rs / replay_big.rs are #![cfg(all(windows, feature = "diagnostics"))] and diagnostics is off by default, and the loader tests print SKIP without LEONIDA_GAME_DIR. Nothing silently passes either: no continue-on-error, the path filter matches the workspace, and every action is pinned.

It is still red on today's main, and for one reason only: cargo test --workspace includes xtask, whose policy::tests::repository_passes_policy rejects crates/leonida-shader/src/emit/lower.rs (753,642 B) and crates/leonida-gpu/src/host.rs (693,006 B) against the 640 KiB limit (d3d12/xtask/src/policy.rs:14). #2815 is unmerged, so this check must land after it. (The only_what_differs_goes_up failure that may have motivated the draft is not a reason any more: it was red at d920d850d and fixed on main by aee2d526b.)

Two consistency fixes with the repo's other Rust workflows:

  1. Key the cache on the toolchain the way launcher.yml / xma2-decoder.yml do: id: rust-toolchain on the action and ${{ steps.rust-toolchain.outputs.cachekey }} in the key. d3d12/target on Windows is multi-GB, so also consider CARGO_INCREMENTAL: 0 and a tighter cache policy for the 10 GB budget.
  2. cancel-in-progress: true with group: ...-${{ github.ref }} also lets a manual dispatch cancel an active main push run; ci.yml / jactionlint.yml / launcher.yml deliberately avoid that with a per-event group and cancel-in-progress: ${{ github.event_name == 'pull_request' }}. Align with them or say why not.

Two documentation points: say in the header that the replay/GPU integration tests do not run without --features diagnostics, so "the workspace's tests" is not read as including them; and add the Depends on: #2815 line AGENTS.md asks for (the body says it in prose only).

No workflow runs cargo test on d3d12/. ci.yml builds tools/bcpack_calibration, launcher.yml tests
the launcher crate, xma2-decoder.yml tests runtime/xma_decoder, and the workspace that holds thirteen
crates and the asset-policy test is not wired to anything.

This adds the job: windows-latest, cached cargo and target, cargo test --workspace --locked.

Deliberately absent: cargo fmt --all -- --check, because d3d12/ has a rustfmt.toml and does not
follow it (cargo fmt --all rewrites 190 files), and clippy -D warnings, because the workspace has 115
warnings and no errors. Each is its own change and neither belongs in a CI pull request.
…r stable is

The action installed stable and cargo, run from d3d12/, then had rustup fetch the pinned
1.98.1 on the fly: the same result with a download nobody asked for.
jactionlint requires it: a tag can be moved, and every other workflow here uses a

sha with the version in a comment. checkout v7.0.1 and cache v6.1.0 are the shas

already in use; rust-toolchain is pinned at v1 and the version comes from the

'with: toolchain' input instead of the ref.
@fiestorra
fiestorra marked this pull request as ready for review December 1, 2026 04:30
@fiestorra
fiestorra force-pushed the ci-d3d12-rust-checks branch from 5a380ba to 3e03ab5 Compare December 1, 2026 04:30
@fiestorra

Copy link
Copy Markdown
Contributor Author

Rebased onto main 86c30fcea and out of draft, because two things changed this morning: the job can finally run the suite, and it now has exactly one expected red.

What changed under it:

  • 957fa9fe7 removed mod asbench, so cargo test --workspace compiles. Before that, this job would have failed with E0583 and told nobody anything - the suite could not start.
  • 86c30fcea gave make_amplify_dxil.py its __main__ block, so the Python suite is green on main.

What its first real run should say, measured on main 86c30fcea with nothing applied:

cargo test --workspace
  exit 101, 6.4 min
  one failure: policy::tests::repository_passes_policy     5 passed; 1 failed

That is #2815, which is green and waiting. So this job's first run will be red on one test that its own pull request does not touch - and green as soon as #2815 lands. I would rather say that here than let a reviewer discover it.

And the honest accounting of what this job has already been worth without being merged: it was the reason depth_bounds on a card-less runner was found (#2823), because it was the first thing in this repository to run the Rust suite in an environment that is not a developer's machine. The two reds it would have caught on main this morning - the module declaration and the tool's stream - were caught by hand instead, in two commands. That is the trade: a five-minute job, or a morning of somebody running cargo test when they remember to.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: the job ran, and its first red is not the one I predicted: it is depth_bounds, which is #2823. The policy test is behind it and never got to run.

The run, 46576233020, windows-latest, head 3e03ab511:

test result: FAILED. 589 passed; 1 failed; 53 ignored
  pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws
  assertion `left == right` failed: depth 0.5 outside [0.6, 1.0] must be r...
error: test failed, to rerun pass `-p leonida-gpu --lib`

What that tells us, and it changes what I wrote two hours ago:

  1. The suite compiles and runs on a clean runner now - 589 passed in leonida-gpu where main used to fail with E0583. That half is done (gpu: drop the 'asbench' module declaration whose file was never committed #2825).
  2. The first failure is the WARP one, not the policy one. cargo test --workspace stops at the first failing crate, and leonida-gpu comes before xtask, so repository_passes_policy never ran. My prediction of "one failure: policy" was right about the destination and wrong about the order.
  3. So this job needs policy: a Rust source file is not data, whatever its size #2815 and gpu: a software adapter does not support the depth bounds test, whatever it answers #2823, not just policy: a Rust source file is not data, whatever its size #2815 - and gpu: a software adapter does not support the depth bounds test, whatever it answers #2823 is green and waiting.

Why that is good news, not a problem: the job is doing exactly what it was written for - it found a red on a machine where a developer sees green, and it found the one that only a card-less runner exposes. That red is depth_bounds on WARP, reproduced locally with LEONIDA_D3D12_WARP=1, and fixed in #2823.

The remaining order, for whoever merges:

#2815   policy          -> the second failure, behind this one
#2823   depth_bounds    -> the failure this run actually hit
#2816   this job        -> green once both are in
#2652   xbox_present    -> C++ ctest, unrelated to this job

AI-assisted: yes - DeepSeek v4.1 (flash), which predicted "policy" and is correcting itself.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: both of this job's blockers are now measured on the merged trees, so what is left is two merges and no unknowns.

When it ran for the first time it failed on depth_bounds (WARP), and the policy test was behind it. Both fixes are green and both have been cherry-picked onto main 640b0d0df and run there:

main + #2815 (two commits)   cargo test -p xtask        exit 0     (policy passes, three violations gone)
main + #2823 (one commit)    the depth_bounds test      skips with LEONIDA_D3D12_WARP=1,
                                                        runs (0.97 s) without it

So the order is #2815, then #2823, then this one - and this job's next run should be the first one that is green, which would be the first time it has ever been.

What that is worth, and it is the reason to spend the merge: the first run found the WARP red that no developer machine can see. The two reds that main had this morning - E0583 and the tool's __main__ - were found by hand in two commands, and both are merged now. A job that runs on every push finds those without anybody remembering to.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: the flake is concurrency-dependent, and running the suite with --test-threads=1 is stable in eight runs where the parallel one failed twice in sixteen.

main 9372a4d4f, cargo test -p leonida-gpu --lib:

default threads (16)    16 runs, 2 failed
    descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync
    texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers
--test-threads=1         8 runs, 0 failed      (37 s each instead of 13 s)

What that pins down, after a day of not pinning anything down:

  • Not the tests themselves: both names run 15 times each in isolation, 0 failures. records_copied and alias_cast are fine on their own.
  • Not CPU load between copies of the binary: 12 runs of four copies at once this morning, 0 failures.
  • Not the file system or the card: the same suite, same machine, same everything, only the thread count differs.
  • So it is tests interfering with each other inside one process, which is the shape a shared device singleton has: whatever records_copied leaves behind is visible to whatever runs next, and which test that is depends on the scheduler.

What I would do with that, and it is a proposal for #2816 rather than a claim: run the job's suite with --test-threads=1. It costs 24 seconds on a runner and it makes the job's failures mean something. A job that is red one run in eight for reasons nobody can attribute does not get looked at twice, and the ones that come after it never run.

What it does not do: fix the interference. A serial run hides it rather than repairing it, and the proper fix is for those tests to not share device state - which needs somebody who knows what records_copied and alias_cast leave behind. But hiding it behind a flag that is written down is better than hiding it behind a retry, because a flag can be removed when the cause is found and a retry teaches nobody anything.

AI-assisted: yes - DeepSeek v4.1 (flash), 24 runs to separate the thread count from everything else.

Written with an AI assistant.

Sixteen runs of \cargo test -p leonida-gpu --lib\ with the default threads failed\ntwice (descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync and\ntexture::alias_cast_tests::..._cast_to_r9g9b9e5_under_legacy_barriers), and eight\nwith --test-threads=1 failed none. Both tests pass fifteen times in isolation, so\nthe interference is between tests inside one process, not between runs.\n\nSerial for the whole workspace would put leonida-shader's six-minute suite well\npast the timeout, so only this crate runs that way: 37 s against 13, and the rest\nof the workspace is unchanged.
@fiestorra

Copy link
Copy Markdown
Contributor Author

done: the job now runs leonida-gpu on one thread and leaves the rest of the workspace as it was.

Pushed 72020a874 to this branch. The Tests step became two:

      - name: Tests
        working-directory: d3d12
        run: cargo test --workspace --locked --exclude leonida-gpu

      - name: Tests (leonida-gpu, one thread)
        working-directory: d3d12
        run: cargo test -p leonida-gpu --lib --locked -- --test-threads=1

Why only that crate and not the whole workspace: leonida-shader's suite is six minutes with the default threads (404 tests, 360 s measured here). Serial would put it well past this job's 40-minute timeout on a runner. Excluding leonida-gpu costs nothing - it removes 13 seconds of work - and running it alone costs 37 seconds.

The numbers behind it, on main 9372a4d4f, all with cargo test -p leonida-gpu --lib:

default threads (16)   16 runs, 2 failed
    descriptor::tests::records_copied_as_bytes_are_made_at_the_next_sync            (1 run)
    texture::alias_cast_tests::..._cast_to_r9g9b9e5_under_legacy_barriers          (1 run)
--test-threads=1        8 runs, 0 failed     (37 s each)
each of the two tests   15 runs alone, 0 failed

So the interference is between tests inside one process: neither test fails on its own, and neither is slow, and four copies of the binary at once this morning produced nothing. Only the thread count moves the failure rate.

What this does not do: fix the interference. It hides it behind a flag that is written down, and the cause is still there - somebody who knows what those two tests leave behind on a shared device can remove the flag when they find it. That is the difference I would rather have than a retry: a flag can be deleted, a retry teaches nobody anything.

And it makes this job's red mean something, which is the whole point of it: a job that is red one run in eight for a reason nobody can attribute is a job that gets ignored, and the runs after it never happen.

AI-assisted: yes - DeepSeek v4.1 (flash), 24 runs to separate the thread count from everything else.

Written with an AI assistant.

The first run after the split failed in the first step (the policy test, until ProjectLeonida#2815\nmerges) and skipped the second, so the one result I wanted to see never ran.\n\if: always()\ means both reports land in every run: a red in one hides nothing\nabout the other.
@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: the job now reports both of its reds in one run, and they are deterministic - no flake in either step.

Run 46600428269 on f81649949, the first with the split and if: always():

success  Set up job
success  Run actions/checkout
success  Install Rust
success  Cache Cargo dependencies and build
failure  Tests                            policy::tests::repository_passes_policy
         test result: FAILED. 5 passed; 1 failed
failure  Tests (leonida-gpu, one thread)  pipeline::host::tests::depth_bounds_pipeline_loads_and_filters_draws
         left: 255 / right: 0
         test result: FAILED. 598 passed; 1 failed; 55 ignored
success  Complete job

Three things this proves that the previous run could not:

  1. if: always() works: the step after a failure runs, and its report is not lost to the one before it. Before it, the whole second half of the job was skipped and the only thing I learned was the policy red.
  2. The serial arm is deterministic: 599 tests on one thread, one failure, and it is depth_bounds - not one of the two flaky names. The --test-threads=1 change does what it was for: this job's red now means "this test fails every time", not "a test failed this time".
  3. Both remaining reds have their fix already open and measured on the merged tree: policy: a Rust source file is not data, whatever its size #2815 for the policy (exit 0 with it applied on 640b0d0df) and gpu: a software adapter does not support the depth bounds test, whatever it answers #2823 for depth_bounds (skips on WARP with it applied on the same tree).

What is left is exactly two merges, in the order #2815 then #2823 then this one. After them, this job's first green run should be its first ever - and if it is red again, it will be for a reason worth reading.

AI-assisted: yes - DeepSeek v4.1 (flash), reading the run's per-step conclusions and the two failed logs.

Written with an AI assistant.

@Neutron-0

Neutron-0 commented Dec 1, 2026 •

Copy link
Copy Markdown

This job's first step is red on main today on a Windows runner: cargo test --workspace --exclude leonida-gpu fails in 4 tests of leonida-shader. The job is worth having, but it needs one fix first, or it will be red the day it lands.

All four are the tests that run the DXIL validator (dxil.dll), and they fail with:

error: Container part 'Pipeline State Validation' does not match expected for module.
  • emit::rect::tests::the_rectangle_stage_is_a_geometry_shader
  • emit::rect::tests::rectangles_are_drawn_whole
  • emit::barycentric_tests::a_masked_pixel_program_reads_the_position_where_the_vertex_program_writes_it
  • emit::barycentric_tests::first_half_values_render_on_hardware_and_warp

The validator block is #[cfg(windows)] and only runs when the DLL loads, so a Linux runner cannot see it; a windows-latest runner has the Windows SDK's dxil.dll (any DXC 1.5.2005 or newer: 1.5.2005, 1.6.2104, 1.6.2112 and 1.7.2308 all give the same message), so the job sees it.

The cause is in the container the translator writes, not in the tests: d3d12/crates/leonida-shader/src/emit/container.rs (psv()) gives the PSV0 part's name table one copy of a semantic's name for all the elements that share it, while the validator compares that part with the one it computes from the module, whose table holds a copy per element. Every element after the first then has a name offset the module's table does not have, and the program is refused. Every program with an arbitrary semantic (POSITION, TEXCOORD, ...) has such elements.

Writing one copy per element, as DXC writes it, fixes it: with the change the crate is 405 tests OK, 0 failed (404 + one new test), and the PSV0 of a geometry stage built by hand is byte for byte the one DXC 1.7 writes for the same signature, apart from the dependency-mask table, which the validator does not compare.

The branch is Neutron-0:fix/psv0-name-per-element (pull request #2864, on main 7fbcd456e, one file). It cannot be opened as a pull request yet - GitHub refuses CreatePullRequest for this account on this repository - so the fix is described here in full, and the pull request follows as soon as the account may create one. Claimed in the coordination issue as SHADER-PSV0-NAME-PER-ELEMENT: #2570 (comment)

One more thing for the job: cargo test --workspace --exclude leonida-gpu also runs xtask's policy::tests::repository_passes_policy, which is red on main (3 violations about leonida-gpu/src/host.rs, emit/lower.rs and emit/indirect/amplify_dxil.rs); #2815 is the fix for that, and this job wants it to land first or in the same window.

Correction (posted later the same day). The first line of this comment is wrong: the job
that now runs the d3d12 workspace (the one #2648 added, which supersedes this pull request) is
green on main, and the windows-latest runner cannot see the failure. validate()
(d3d12/crates/leonida-shader/src/emit/mod.rs) is #[cfg(windows)] and only validates when a
dxil.dll loads; without one it returns without validating and the test passes. The runner has
no dxil.dll that loads - it is in the log of main's run 46634364807:
emit::rect::tests::rectangles_are_drawn_whole ... ok and
emit::rect::tests::the_rectangle_stage_is_a_geometry_shader ... ok, i.e. the tests pass without
validating anything.

A machine with the Windows SDK's dxil.dll is where it shows: the same four tests fail there
with "Container part 'Pipeline State Validation' does not match expected for module" (DXC
1.5.2005, 1.6.2104, 1.6.2112 and 1.7.2308 all give it), and they pass with the fix in #2864
(410 tests OK, 0 failed on that pull request's head).

So the job is not red for that reason; the job is green and the defect is invisible to it. The
reason to fix the defect is the host: the container the translator writes is what the host's own
D3D12 runtime validates, and a container the validator refuses is a pipeline the host refuses.

@fiestorra

Copy link
Copy Markdown
Contributor Author

Neutron-0 is right about the shape of it, and I can add the half that this machine can measure - plus the reason it cannot measure the other half.

What their finding gets exactly right: the four failing tests are the ones that need dxil.dll, they are #[cfg(windows)], and a Linux runner never sees them. This machine is Windows and does not have dxil.dll either (C:\Windows\System32 has none, and the repo carries none), so the four tests skip here - which is why cargo test --workspace on my machine has never shown them and only a Windows runner with the validator installed can.

So this job's red is now three things, not two:

1. policy::tests::repository_passes_policy      -> #2815
2. pipeline::host::tests::depth_bounds_...      -> #2823   (software adapter)
3. emit::rect::tests::... / emit::barycentric   -> Neutron-0:fix/psv0-name-per-element
   "Container part 'Pipeline State Validation' does not match expected for module"

And I verified what I can of their fix: ec12f9d74 cherry-picked onto main 0259473b0 builds, and cargo test -p leonida-shader is 406 passed against 405 on main.

cargo test -p leonida-shader   (this machine, no dxil.dll)
  with ec12f9d74:   ok. 406 passed; 0 failed; 5 ignored   (6.9 min)
  main 0259473b0:   ok. 405 passed; 0 failed; 5 ignored

What that does not verify: that the four tests now pass. They skip here for the same reason they fail on the runner, and the difference is which side of the LoadLibrary this machine is on. The one machine that can answer that is the runner, and the way to answer it is to merge their fix and watch this job.

Which changes the order I have been suggesting: #2815, #2823, then this job - and the job will still be red on the PSV0 container until ec12f9d74 is in. I would put that one in the same queue; the job's first green run needs all three.

AI-assisted: yes - DeepSeek v4.1 (flash), which could confirm the fix compiles and not that it works, and said which.

Written with an AI assistant.

@fiestorra

Copy link
Copy Markdown
Contributor Author

finding: the clippy cleanup that landed tonight is already four warnings stale, and all four came from merges made after it.

main c77b84e3a (after #2681 and #2682, which between them say they fix all 52 warnings in leonida-gpu and all 31 outside it), cargo clippy --workspace:

warnings: 4   (plus 2 "generated N warnings" summary lines)

  crates/leonida-gpu/src/pipeline/host.rs:1214    this function has too many arguments (8/7)
  crates/leonida-gpu/src/pipeline/known.rs:268    this loop could be written as a `while let` loop
  crates/leonida-gpu/src/pipeline/known.rs:246    drop on a value that implements Copy
  crates/leonida-hle/src/modules/glyphs/live.rs:121    manual `Range::contains` implementation

And with --all-targets, fifteen - the extra eleven are in valu_tests.rs and one in pipeline/host.rs, i.e. test code the cleanup did not cover. That is a second, separate question: whether test code should be held to the same lint level.

Why this matters more than four warnings: it is the same shape as everything else this repository does by hand and then loses. A cleanup on a Monday is 83; on Tuesday the merges bring back four, because nothing runs -D warnings. #2816's job is already the place to fix that, and it costs one line:

      - name: Clippy
        working-directory: d3d12
        run: cargo clippy --workspace --locked -- -D warnings

What I would not do: add it before the four are gone, because then the job's first run is red for a reason unrelated to the job - which is exactly the trap this job already fell into twice today (the policy, then depth_bounds). The order stays: #2815, #2823, ec12f9d74, then a green run, then this as its own change.

AI-assisted: yes - DeepSeek v4.1 (flash), which measured the cleanup instead of trusting its title.

Written with an AI assistant.

@fiestorra fiestorra closed this Dec 1, 2026
@fiestorra

Copy link
Copy Markdown
Contributor Author

closed: superseded by #2648, which merged tonight and does everything this one does and more.

What #2648 has that this did not: a build (--all-targets and the shipped feature set), the diagnostics replay test, and the policy and clippy steps as reports. Its job name, its file and its run are all there; keeping this open would mean two workflows running the same workspace on every push.

What this has that #2648 does not, and it is the one thing worth lifting: leonida-gpu on a single thread. Measured on main today:

cargo test -p leonida-gpu --lib
  default threads   16 runs, 2 failed   (descriptor::tests::records_copied_as_bytes..., texture::alias_cast_tests::...)
  --test-threads=1   8 runs, 0 failed   (37 s instead of 13)
  each alone        15 runs each, 0 failed

That crate's tests interfere with each other inside one process, so a job that runs it once is red about one run in eight for a reason nobody can attribute. #2648 skips depth_bounds_pipeline_loads, which is a different test, so the flake is not covered by that skip.

I have put the two-step shape in #2648's thread (--exclude leonida-gpu on the parallel step, then -p leonida-gpu --lib -- --test-threads=1 on its own) so it can be taken from there.

The rest of this branch is history and not worth preserving: the job it added found depth_bounds on a software adapter on its first run, which is the reason #2823 exists, and that finding is in #2648's thread and in #2570.

AI-assisted: yes - DeepSeek v4.1 (flash), which would rather close its own pull request than leave two workflows racing.

Written with an AI assistant.

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.

3 participants