shader: lower mesh small ALU forms and v_pack_b32_f16 constant sources (Part of #3703) #3829
No reviewers
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows!3829
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3827"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@timbot103 on GitHub · 2026-12-02 07:04 UTC · original
timbot103:shader/mesh-small-alu-and-pack-f16→main· +603 −23 · 6 files · 3 commits · openPart of #3705. Refs #3418, #2413.
Clears two self-contained #3705 mesh census walls (~393 mesh programs total):
unsupported v_pack_b32_f16 constant source(132 programs) and the small ALU cluster (261 programs).Summary
v_pack_b32_f16constant sources (src/gfx1013_direct_compute.inl):240..248) read their binary16 encoding frominline_half_words(1.0->0x3c00).128..208) read their value truncated to 16 bits (0->0x0000,1->0x0001,-1->0xffff), matching the existingv_cvt_norm_*_f16lowering.255) readsliteral & 0xffff.absclears bit 15, thennegtoggles it.op_selon any constant source, non-constant special operands (209..239,249..254), clamp, omod, dst/src2op_sel, src2abs/neg, SDWA, and DPP.src/gfx1013_direct_mesh.inl, addsv_pack_b32_f16to 2-source uniformity tracking so two uniform/constant inputs produce a uniform result.src/gfx1013_direct_mesh.inl):v_cmpx_<p>_f32: all 14fcmppredicates (ordered predicateseq/lt/le/gt/ge/lg/odrop NaN lanes; unorderedneq/nlt/nle/ngt/nge/nlg/ukeep them);f,tru,class,abs/neg, clamp, DPP, and SDWA stay refused.s_cmpk_{eq,lg,gt,ge,lt,le}_{i32,u32}: sign-extendsSIMM16fori32(0xffff->-1), zero-extends foru32(0x8000->32768); refuses comparing special registers (>= 106).s_bcnt0_i32_b32/s_bcnt1_i32_b32:dx.op.unaryBits.i32(31)(on~S0forbcnt0),SCC = (D != 0); refuses special-register sources (VCC/EXEC/M0) andVCC/EXECdestinations.v_min_f32:dx.op.binary.f32(36)(FMin) withabs/negsign-bit ops; DPP, SDWA,op_sel, clamp, and omod refused.v_bfi_b32:(S0 & S1) | (~S0 & S2)with 3-source uniformity tracking; DPP, SDWA,op_sel, clamp, omod, andabs/negrefused.Verification (source-built fixtures only)
Environment: Windows 11 (
26200.9974), MSVC19.44(C++20/W4, zero new warnings in edited files), Ninja, Windows SDK10.0.26100.0.tests/native_mesh_small_alu_pack_check.py+tests/cmake/native_mesh_small_alu_pack.cmake: 14 bit-exactv_pack_b32_f16constant cases (+neg-before-abscontrol), 30v_cmpx_*_f32cases (with0.5and NaN), 36s_cmpkcases (verifying opposite extension absent), 4s_bcnt, 3v_min_f32, 5v_bfi_b32, 8 uniformity cases, and 48 fail-closed refusals.tests/native_pack_b32_f16_check.py: moved inline float/integer and literal cases to positive bit-exact evaluated checks (269 results total) and replaced their refusal entries with high-halfop_selon constant/literal, SCC (253), and reserved209.dev) & Release (release):native_direct_container: Passed (13.4 s Debug / 12.2 s Release)native_direct_mesh: Passed (18.4 s Debug / 16.9 s Release)native_mesh_small_alu_pack: Passed (7.0 s Debug / 6.4 s Release)native_pack_b32_f16_ir: Passed (9.4 s Debug / 9.3 s Release)docs_links_check.py,bidi_controls_check.py, andgit diff --check origin/main..HEADall passed.AI-assisted.
s_bitset1_b32, then stop at a scalar loop #3705@lukaslw-lab on GitHub · 2026-12-02 07:30 UTC · original · approved these changes
Reviewed
be88a585by reading the diff; not built or run.Verdict: approve. Each new form follows its RDNA2 definition, and every modifier outside it is refused. No MUST.
native_mesh_small_alu_packis not matched by theprpreset filter. Onlynative_pack_b32_f16_irandnative_direct_meshran, so thev_cmpx,s_cmpk,s_bcnt,v_min_f32andv_bfi_b32checks and their refusals were run only locally. It is IR-only and needs no GPU, so adding it to the filter is cheap.v_pack_b32_f16or the small ALU group can stop at the next wall. Anm86census onf365f125before and after would give the real gain. This can come in a follow-up.v_pack_b32_f16constants (gfx1013_direct_compute.inl:2583):inline_half_wordscovers 240–248. The value 193 + n gives(192-r)&0xffff(-1 →0xffff), and a literal keeps its low 16 bits. A high-halfop_selon a constant is refused, andabsbeforenegis unchanged from the register path.float_cmpx: all 14 names map through the sharedpredicatestable (:3730). Ordered and unordered match the ISA (neq→une,nlg→ueq,o/u).f/tru/classstay out.s_cmpk_*: the shared SOPK path zero-extends_u32and sign-extends_i32(:4868). The mesh guard refuses S0 ≥ 106.s_bcnt0/1: special-register sources are refused unless constant. VCC/EXEC destinations are refused as for the other scalar ops.v_bfi_b32abs/negreach the shared integer refusal (:4819, "direct ALU operand modifiers"), and the fixture pins it.Tests:
native_mesh_small_alu_packproves the IR for each form, with the opposite-extension and NaN controls and 48 refusals.native_pack_b32_f16_irnow evaluates the constant cases bit-exactly. CI ran only the latter andnative_direct_mesh.@timbot103 on GitHub · 2026-12-02 07:34 UTC · original
@lukaslw-lab Thanks for the review! Renamed
native_mesh_small_alu_packtonative_mesh_small_alu_pack_irin287e321dso it matches the existingnative_.*_(ir|dxil|controls)filter inCMakePresets.json'sprpreset without editingCMakePresets.json. Verifiedctest --preset pr --no-tests=error -R '^native_mesh_small_alu_pack_ir$'passes (6.61 s Debug, 6.03 s Release).Re: census counts — understood, keeping this PR source-fixture-only; a follow-up census against
f365f125can measure the exact netm86gain.@lukaslw-lab on GitHub · 2026-12-02 07:37 UTC · original · approved these changes
Reviewed
287e321dby reading the diff; not built or run.Verdict: approve. The new commit closes the CI-coverage SHOULD. No MUST.
287e321donly renames the test tonative_mesh_small_alu_pack_irin the CMake file and the docs. The new name matches theprpreset'snative_.*_(ir|…)filter, so Windows CI now runs it. I checked the filter at this head.src/and the test scripts are byte-identical tobe88a585, so the findings of the previous pass stand: the constants, the 14 predicates, thes_cmpkextension and the modifier refusals.Tests: CI for this head was still running at review time.
s_bitset1_b32, then stop at a scalar loop #3705@R0Y00 on GitHub · 2026-12-02 10:09 UTC · original · reviewed
The reviewed revision is green, but the current merge conflicts in
src/gfx1013_direct_mesh.inlat the VALU dispatch. Please retain main'svector_execgating and existingv_trunc_f32/v_floor_f32path while adding the min/bitfield/FP16 shapes. Please runnative_mesh_small_alu_pack_irandnative_direct_meshon the rebased head, and retain the renamed CI test registration.e143824cinto shader/mesh-small-alu-and-pack-f16 ba31921b1dd90685c232toc1adc4ddc5@R0Y00 on GitHub · 2026-12-02 12:47 UTC · original · approved these changes
I checked the rebase at
c1adc4dd. It keeps main'svector_execcondition and the existing truncation, floor and literal-FMA dispatch while adding the new operands and arity. The renamed IR test is registered and ran in the hosted Windows job. The trial merge is clean.On Windows 11 26300.9974 and SDK/DXC 10.0.26100 in Debug, I built
compile_dxilandnative_pixel_ir_dump, then ranctest --preset dev --no-tests=error -j 1 -V -R '^native_(pack_b32_f16_ir|mesh_small_alu_pack_ir)$'. Both passed. The pack check matched 269 results and rejected the swapped-half and neg-before-abs variants. The small ALU check also passed its 48 refusal controls.native_direct_meshindependently reproduced the only failing hosted Windows case,+0x34: unmapped graphics export, which #3853 fixes. Please rerun required CI after that fix lands.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.