Repository navigation
Conversation
KelboLive
left a comment
There was a problem hiding this comment.
PR #2926 by @pigalot — startup: read linear (0x100) textures in slot 70
What works
- Linear mode derivation from AMD addrlib HwlComputeSurfaceInfoLinear is clearly documented in both experiment notes and gfx10_layout.h comments
- Mip ordering (smallest to largest) is explicitly coded and tested
- Array slice handling: slice index * bytes_per_slice, consistent with tiled modes
- Excellent control test: linear-largest-first order control with WILL_FAIL ensures the ordering is necessary, not coincidental
- Unpadded control in startup_address_console_check correctly writes rows at native pitch to produce mismatched draws
- addrlib round-trip comparison (every element address) provides strong correctness guarantee
Issues
- swizzle_mode() returning 0 for linear mode is correct (0x100 & 0xff == 0), but block_log2/block_width/block_height for mode 0 could trigger division-by-zero or shift-by-zero if any code path assumes mode > 0 in block calculations; verify no switch falls through to block ops without a linear-mode guard
- The refusal in check_refusals tests linear mode only for 3D (volume). Consider adding linear mode refusal for 1D too to prevent accidental acceptance before #2929 lands
- For block-compressed linear textures (BC1 in the test suite), the largest-mip-whole-blocks guard applies but is not re-stated in the new layout section of gfx10_layout.h; the tiled-mode docs reference it, linear-mode does not
Recommendations
- Add an inline guard in the layout path: if (mode == linear_mode) ... skip block dimension calculations; this documents the invariant and prevents future regressions if someone adds a fallback switch case
- Ensure address_texture.h comments for linear mode mention the 256-byte pitch rule (currently only the comment update references it briefly)
- Consider adding a linear-mode 2D array test slice to the round-trip shapes in startup_gfx10_layout_check.cpp (currently the linear shapes are single-slice)
Overall
Very solid foundation for linear texture readback. The addrlib-based layout derivation is well-tested with order control, addrlib cross-check, and unpadded mismatch. The 256-byte pitch invariant is clearly enforced. Note that #2929 (1D linear) stacks on this and the PR is safe to merge once the test gap for linear-mode refusals is closed.
KelboLive
left a comment
There was a problem hiding this comment.
PR #2926 by @pigalot -- startup: read linear (0x100) textures in slot 70
What works
- Solid foundational work establishing the 0x100 linear layout in gfx10_layout.h with careful derivation from AMD addrlib
- The linear_mode = 0 constant elegantly extends block_log2() to accept mode 0 without changing the tiled modes switch logic
- supports() check is correct: mode == linear_mode bypasses the block_log2 >= 12 requirement since linear has no tail
- Test infrastructure is excellent -- linear_order_control (expected failure with largest mip first), linear_addrlib (338K element addresses), and the unpadded negative control all add strong coverage
- Documentation accurately restates addrlib's linear mode algorithm in clear, testable terms
Issues
- supports() currently allows block-compressed formats (BC1-BC7) in linear mode via the fallthrough -- BC formats are block-based and don't have linear row semantics; consider gating them out explicitly like 1D does in #2929
- The check script in startup_address_console_check.py builds linear backing bytes from addrlib equations. This is correct but the linear path could break if the hardcoded equations drift from addrlib; a comment linking to the Mesa commit that derives these equations would help
Recommendations
- Good discipline in including the negative control (unpadded rows test) to verify the 256-byte pitch requirement
- Consider adding a TODO or assert in supports() that blocks linear mode for BC formats until explicitly validated against addrlib
Overall
A well-researched, well-tested implementation. The linear layout extension is cleanly separated from tiled modes. Minor concern about BC format handling in linear mode, but the existing refusal behavior is safe. Ready for merge.
KelboLive
left a comment
There was a problem hiding this comment.
PR #2926 by @pigalot -- startup: read linear (0x100) textures in slot 70
What works
- Solid foundational work establishing the 0x100 linear layout in gfx10_layout.h with careful derivation from AMD addrlib
- The linear_mode = 0 constant elegantly extends block_log2() to accept mode 0 without changing the tiled modes switch logic
- supports() check is correct: mode == linear_mode bypasses the block_log2 >= 12 requirement since linear has no tail
- Test infrastructure is excellent -- linear_order_control (expected failure with largest mip first), linear_addrlib (338K element addresses), and the unpadded negative control all add strong coverage
- Documentation accurately restates addrlib's linear mode algorithm in clear, testable terms
Issues
- supports() currently allows block-compressed formats (BC1-BC7) in linear mode via the fallthrough -- BC formats are block-based and don't have linear row semantics; consider gating them out explicitly like 1D does in #2929
- The check script in startup_address_console_check.py builds linear backing bytes from addrlib equations. This is correct but the linear path could break if the hardcoded equations drift from addrlib; a comment linking to the Mesa commit that derives these equations would help
Recommendations
- Good discipline in including the negative control (unpadded rows test) to verify the 256-byte pitch requirement
- Consider adding a TODO or assert in supports() that blocks linear mode for BC formats until explicitly validated against addrlib
Overall
A well-researched, well-tested implementation. The linear layout extension is cleanly separated from tiled modes. Minor concern about BC format handling in linear mode, but the existing refusal behavior is safe. Ready for merge.
Slot 70 refused a 2D texture whose Layout is the ADDR_SW_LINEAR word 0x100 because the extent of its rows was not established. Restate addrlib's Gfx10Lib::HwlComputeSurfaceInfoLinear in gfx10_layout.h: each mip's pitch is its rounded-up width aligned to 256 bytes, and the mips are packed from the smallest to the largest with no tail. Such textures then take the existing console-layout path. 1D and 3D linear textures stay refused. Tests: linear round trips, a hand-worked chain with a mip-order control, an optional comparison of every element address with addrlib, four exact linear draws in startup_address_console and an unpadded-pitch control.
ce2d6f5 to
80443a7
Compare
Summary
Device slot 70 refused a texture description whose
Layoutis0x100(theADDR_SW_LINEARswizzlemode word) unless it was a single texel, with
reason=unsupported_description. The extent of itsrows was not established. AMD addrlib's
Gfx10Lib::HwlComputeSurfaceInfoLineargives the extent:GetMipSize), then aligned to 256 bytes.This change restates that rule in
src/startup_stubs/gfx10_layout.h. Two-dimensional lineartextures then go through the existing console-layout path: view checks, XG holds and upload as
desktop footprint rows. One-dimensional and three-dimensional linear textures stay refused.
gfx10_layout.h:supportsaccepts mode 0 for 2D textures.Layoutcomputes the linear pitch andmip offsets, and
addressreads rows.address_texture.h: comment only (linear is now one of the console layouts).tests/startup_gfx10_layout_check.cpp:--addrlibrun compares every element address and the surface size of 11 linear textures with addrlib itself.tests/startup_address_console_check.py:linear-unpaddednegative control.tests/cmake/startup_gfx10_linear.cmake: the order control, the addrlib run (skips with 77 without addrlib) and the unpadded control on WARP and hardware.docs/startup-runtime.md:0x100moves from the refused list to the accepted list.docs/experiments/startup-gfx10-linear.md: the note.This is independent of #1469, which models
SW_LINEARin its own XG texture computer and does not touch the slot-70 path. Its linear rule is the same one.Tests
Commit 80443a7, rebased on main 3e9542a on 27 Nov to resolve a conflict with #2949 in
tests/startup_address_console_check.py(both added test modes to the same list; the list now has both). The results below were measured at ce2d6f5 on main 6ee878d. Regression on the rebased stack (d190f0d):ctest --preset dev --no-tests=error -R 'address|gfx10|memory_srv|xg_|bc64|tile64|small_texture|bc7|slot70|texture|console|1d|draw|translated|sampler|d16' -E '_hardware$|startup_audio' -j 8: 228 of 228 passed, 9 capability skips (spirv_*_warp,bc7_mode6_multiblock_warp). The same filter on_hardwaretests at-j 1: 130 of 130 passed, 9 capability skips. The--addrlibcomparison was not rerun after the rebase (that build had no addrlib); the layout code it checks did not change in the rebase.Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088), Microsoft WARP. Debug layer
on (dev preset). addrlib: Mesa 25.1.0 via
tools/fetch_addrlib.py.startup_gfx10_layout: PASS (13 round trips, 1 linear chain, ...).startup_gfx10_layout_display_control: expected failure (unchanged).startup_gfx10_layout_linear_order_control: expected failure. With the largest mip first, all 6 offset and address checks fail.startup_gfx10_layout_linear_addrlib: PASS,338763 linear sizes and addresses compared, 0 mismatches (Mesa 25.1.0 addrlib, SW_LINEAR).startup_address_console_warp,_hardware: PASS. The 4 linear draws match all 65,536 pixels exactly; the 7 earlier draws and the 3 held/late cases are unchanged.startup_address_console_linear_unpadded_warp,_hardware: PASS. The texture is published and 63,488 of 65,536 pixels differ.00000000, and010300ffwas expected.ctest --preset dev -R 'address|gfx10|memory_srv|xg_|bc64|tile64|small_texture|bc7|slot70|texture|console'.-j 8,_hardwareexcluded): 121 tests, 0 failed, 7 skipped. The skips are 6spirv_address_window_*_warpandbc7_mode6_multiblock_warp, all capability skips (77).-j 1): 47 tests, 0 failed, 6 skipped, the same capability skips.A local 600 s real-world run (release build, same change on top of the slot-70 stack) ended at the
timeout with exit 0. The two 2D
0x100shapes three earlier runs refused asunsupported_description(R32_FLOAT with 7 mips, and R16G16B16A16_FLOAT with one mip) were not refused. Two 1D
0x100shapesremain refused, as intended.
The addressing rule is addrlib's desktop GFX10 rule. That console memory uses the same 256-byte
pitch for
0x100is inferred from the layout word, not measured on console hardware.This change was AI-assisted.