Repository navigation
Shaders: lower v_div_scale_f32, v_div_fmas_f32 and v_div_fixup_f32 - #200
n-romanovich wants to merge 1 commit into
Conversation
|
Tested
No game data used. |
|
A note from checking the open opcode PRs against AMD's ISA reference (I have #163 open, which leaves these three refused): as far as I can read this diff,
and its pseudo-code starts so a zero numerator or denominator gives NaN there. LLVM's If the roles are swapped in both the lowering and the test, the test would still pass while a real program's division scales the wrong way, so it may be worth a second look. I have not run this on hardware; this is from the documents only. No game data used. |
|
Thanks for the review, @r4tedx! Fixed in
|
… and v_div_fixup_f32) into the integration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
|
One more on this PR, for
(2^64 is the f64 form's factor.) A probe on an RTX 5070, with VCC set and inputs (1, 1, 0), returns For From the documents and synthetic probes only; I have no copy of the title and have not run this on console hardware. |
…iv_fixup_f32 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review of 1.
Swapping 2. Also: this inserts right above the AI-assisted (Claude Code), read-only review. |
|
RDNA2 hardware probe of Setup. AMD Radeon iGPU of a Ryzen 7 9800X3D, gfx1036 (RDNA2), AMD driver 32.0.21042.62, Windows 11 Pro 26200. A HIP kernel (assembled by the AMD driver's amd_comgr) runs
The other cases match: 0/0 and inf/inf give AI use: Claude Code (Claude Opus 5.5) wrote the probes, ran them on the GPU above and drafted this comment; the numbers come from the hardware run. |
|
Correction to point 2 of my review above, after @Lyrnc's RDNA2 probe: I said AI-assisted (Claude Code). |
|
Thanks for the review! Addressed the feedback and resolved the compilation issue in the latest commit. All tests pass cleanly. |
|
Checked One question, from reading the code (not run): the new AI-assisted (Claude Code). |
|
Tested head Merged onto current There's no text conflict, so GitHub still shows the PR as mergeable, but merging it as it is would break With
AI-assisted (Claude Code). |
The tester tree (upstream main ffe310e plus its PRs, update 8; see its INTEGRATION.md) ran 11-25 minutes in the world on an RTX 5070 without a device removal. Where both sides carry the same PR (the wave64 stack #223/#233/#320 with #439 and #180, #454, #336, #259, #331 and others), the tester tree's newer head is taken; our own work and the PRs only we merged are kept. Conflicts, file by file: - descriptor/host.rs: the tester layout (`spare`, the guard slot after the dynamic slots, `free_table`, the capped sampler heap). A capped view heap keeps `capped_reserve()` dynamic slots, now 2^18 by default (the tester measurement, and our 91fed158), still `VICTORY_DYNAMIC_SLOTS` in diagnostics builds; uncapped hosts keep our 2^19. Our slot statistics (TAKEN/PEAK/SHORT), the bindless plan cache (`CommittedRegions`, `timed_valid_title_address`, `timed_find`, `title_bounds`) and the revision triple are kept beside the tester's `guard_slot`. - Buffer states: the tester tree's buffer-state tracker (#334: every list moves host copies of title memory between GENERIC_READ and UNORDERED_ACCESS and back to common before it closes) and depth twins (#469) are taken. #40's enhanced/legacy indirect barriers (the indirect prelude, `use_indirect_buffers`, the title buffer handoff mirrored in `host_barrier`) cannot share buffers with that tracker and are dropped; #40's argument checks (`byte_len`, exact spans, overflow-safe clamp shader, aligned counts) stay. `indirect::bound` and #282's `rectangles` go through `buffer_state`, and `indirect::execute` (#334) replaces `done`. #178's DXC fallback compiles both of our passes. Our segments (#387: `close` ends the segment, `close_native` closes a native list) carry the tracker: each native list returns its buffers to common and its twins to their depth targets, and each prelude also holds our texture uploads. - shadow.rs: our write flow (`queue_write`, one `snapshot` after the batch's refreshes, `finish_writes`, the unchanged-page cache) with #261's copy-back that also gives the snapshot the title's bytes; its tests run through our flow. - pipeline/make.rs: #275's per-frame budget and per-pipeline wake pair, with our compute waits (a dispatch waits for its pipeline, up to 20 s). - pipeline/library.rs: the tester version (#347, #275's saver thread); our concurrent-write test kept. shader_cache.rs: our byte-returning cache API with #358's "translated, only not kept". - draw.rs: #493's root SRV tables; where no table can stand in, our drop of a draw whose root view is unset or outside title buffers. Our refusal of a table offset past the capped heap stays. - resource.rs: `HostTexture` has both our `staged` generation and the depth twin. - Shaders: the tester's lower.rs for the wave64 stack, #160's image sampling (it covers our #73 and #136 sample forms) and #453/#587; kept from our side: #136's preference for an image or buffer use of a descriptor read as data and its `s_buffer_` arm, #422's nearest-even narrowing (also for #169's d16 loads and #453's interpolation), #452's spin-wait limit, #391's LDS limit, #302's spilled root arguments (now in `NativeProgram::translation_ir`), #136's PSV0 interpolation beside the tester's row harmonisation. split_tests.rs, lane_read_loop_tests.rs and docs/wave64-on-wave32.md are the tester versions (the same PRs at newer heads). - Tests: #483's heap guard dwords filled in our GPU tests of #200 (v_div_scale) and #437 (scalar loads from a raw view), which read through the guard slot otherwise; #334's debug-layer test passes an offset to our `indirect::bound`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged onto Checked with CI's steps (both clippy runs with |
|
Thanks for testing and pointing this out, @alexdeliu! Merged latest main and updated resource::track in the test to pass Some(&st) per 6638098. Verified with cargo clippy --all-targets --locked -- -D warnings and re-ran the GPU test — both compile cleanly and pass with 0 warnings. |
|
@n-romanovich rechecked |
|
Automated triage for the maintainers. Needs work. The operand order, VCC from the S1/S2 exponents, the 2^32 factor in
What would change the verdict: implement the remaining rows (or show why each cannot affect the result) and add test lanes for a denominator above 2^126, a denormal denominator and a numerator with exponent <= 23. Not a duplicate of #166: that PR lowers different opcodes. CI: no check runs on the head commit. Generated by Claude Code |
080a307 to
8201c0e
Compare
|
@Marvisak, thanks for the review. In 8201c0e, I implemented the remaining
Added the requested GPU test lanes in On CI, |
Implements IR tracking, lane-mask structuring, and DXIL lowering for RDNA2's IEEE-754
f32division sequence (v_div_scale_f32,v_div_fmas_f32,v_div_fixup_f32) invictory-shader:ir.rs&structure.rs: marksv_div_fmas_f32(andv_div_fmas_f64) as readingVCC, and resolvesVCCthrough lane-mask joins.v_div_scale_f32: scales tiny/huge numerator or denominator operands by2^64/2^-64when needed (skipping0,Inf, andNaN), writing the uncancelled scale flag tov.carry(lane_bits).v_div_fmas_f32: computesfma(src0, src1, src2)and applies2^64/2^-64scaling based onVCCandsrc2's biased exponent (>= 128).v_div_fixup_f32: handles IEEE-754NaNpropagation (quieting sNaNs),0/0&Inf/Inf(-NaN), division by zero /Inf, and result sign.Testing
emit::tests::valu_div_f32_sequence_executes_on_gpuincrates/victory-shader/src/emit/mod.rs, running the full 9-instruction RDNA2f32division sequence across 6 lanes (7.0 / 3.0,-1.0 / 1e-40,1.0 / 1e35,1e-35 / 1e-36,0.0 / 0.0,-1.0 / 0.0).dxil.dlland executed on D3D12 (NVIDIA GeForce RTX 5060 Ti).cargo fmt -p victory-shader -- --check: passed.cargo clippy -p victory-shader --all-targets -- -D warnings: passed (0 warnings).cargo xtask policy: passed (asset policy: 151 files ok).cargo test -p victory-shader: 70 passed, 0 failed.