Repository navigation
borealis: leave M5 R16 storage images uncompressed by default - #1425
Conversation
The M5 storage-compression rule admits shader-written images by format class, one ASAHI_M5_STORAGE_COMPRESSION bit per class, and its default selected every class. Clear the bit of the R16 UNORM, SNORM, UINT and SINT class (bit 10) in the default, so these images stay plain. R16F and the other classes are unchanged, and the environment variable still selects any mask (32767 restores the old default). A single-channel 16-bit texel saves little bandwidth compressed, while each shader store merges into a compressed tile and each read decodes one. In Cyberpunk 2077 the screen-space reflection march point-samples a 640x400 R16_UNORM image, written by a compute shader, about a hundred times per pixel. The class was admitted together with mipmapped storage images, and the one measurement behind the two (SCP: Secret Laboratory on an M5 Pro) was taken with both at once. Signed-off-by: Erik Bourget <erik@ebourget.net>
There was a problem hiding this comment.
Verdict: MERGE at 3582830c
Blockers: none.
Checked:
src/asahi/vulkan/hk_g17p_compression.h&hk_image.c(+33/-3across 4 files):HK_M5_STORAGE_R16(1u << 10, matching1024) is cleared fromHK_M5_STORAGE_COMPRESSION_DEFAULT(0x7fffu & ~HK_M5_STORAGE_R16 = 31743), leavingR16_{UNORM,SNORM,UINT,SINT}storage images uncompressed by default while keepingR16Fand all other storage classes compressed and preservingASAHI_M5_STORAGE_COMPRESSION=32767override support.- Scoped strictly to M5 (
hk_chip_supports_compressed_storage_pbe()); M4 and earlier generations are unaffected. src/asahi/vulkan/tests/test-hk-g17p-compression.c(check_m5_storage_default()) andvulkan_storage_compression.ccomments align with the new default.- Exact-head
3582830cf1cbhardware verification onJ716c(M5 Max,G17C): Cyberpunk 2077 T249.27 -> 51.37 FPS(+2.07 FPS,+4.2%,se 0.11, 4 head / 5 base interleaved),110,791dEQP-VK runs (101,632distinct cases) identical to base with 0 new failures/crashes/timeouts,vulkan-storage-compression(35 formats) andvulkan-storage-alias(41/41 groups) passing under both default (compressed=0) and32767(compressed=1),hk_g17p_compression(8,366checks) passing, 0 GPU kernel errors.
Evidence
- Single-generation M5-only conservative policy change (disabling compression on one 16-bit single-channel storage class) with thorough exact-head
J716cA/B and conformance coverage; M5 Pro / base M5 follow-up rows can be requested without holding merge.
|
@DjDeveloperr, code-owner heads-up: App approval at |
|
Merge-train landing at
Revert: |
|
Base M5 row (MacBook Air 15" M5, J815, G17G), kernel 7.3.0-aurora-j815-dev, PR head on aurora-wip 6e153e5 vs that base, release builds, dEQP-VK 1.4.7.1 (+ KhronosGroup/VK-GL-CTS@c2c05e95f97f):
|
What: The M5 storage-compression default no longer compresses R16 UNORM/SNORM/UINT/SINT images that shaders write: bit 10 of
ASAHI_M5_STORAGE_COMPRESSIONis now clear in the default (32767 → 31743). This gives up compression of a class that saves little bandwidth, in exchange for speed where such an image is sampled heavily. In Cyberpunk 2077 a 640x400 R16 image is point-sampled up to 96 times per pixel, and the T2 benchmark on the M5 Max goes from 49.27 to 51.37 FPS (+2.07, +4.2 %). R16F and every other class keep compressing, and the environment variable still selects any mask (32767 restores the old default).Tested: J716c (M5 Max) at 3582830: Cyberpunk 2077 T2 49.27 → 51.37 FPS (4 head samples interleaved with 5 base samples, se 0.11). 110,791 CTS case runs per arm over two lists (101,632 distinct cases) identical to the base build (0 new fail/crash/timeout).
vulkan-storage-compression(35 formats) andvulkan-storage-alias(41 groups) are exact with the new default and with 32767. 0 GPU kernel error lines.Risk: two-way door · every M5 the storage rule applies to (M5, M5 Pro, M5 Max: G17G, G17S, G17C). M4 and older never compress storage images and are unaffected.
Not yet: M5 Pro and base M5 rows: we have neither Mac. The workload the R16 class was added for (SCP: Secret Laboratory, M5 Pro) was not re-measured. Its one number was taken together with mipmapped storage images, so the R16 share of it is unknown.
Details
The rule.
hk_m5_storage_compression_eligible()(hk_image.c) admits a storage image to lossless compression on chips whose PBE merges shader stores into compressed tiles (hk_chip_supports_compressed_storage_pbe(): the M5 family). It decides by format class, one bit ofASAHI_M5_STORAGE_COMPRESSIONper class, and the default selected all 15 classes. On M5 a compressed storage image has no decompress pass or driver detour. Each shader store merges into a compressed tile in the PBE, and each read decodes one in the texture unit, so the cost or saving comes with every access.This class. Bit 10 covers R16_UNORM, R16_SNORM, R16_UINT and R16_SINT (one 16-bit channel). A two-byte texel saves little bandwidth compressed, but every store and every read still goes through the compressed path. The rule already keeps storage-only R8/RG8 images plain for the same reason (BeamNG ran about 1.6 % slower with them compressed). Usage cannot tell the costly case apart here. vkd3d-proton creates these images with storage, sampled, transfer and colour-attachment usage (0x1f), the same usage as the RGBA16F targets where compression wins. A texel-size rule would also change R16F and the R8/RG8 render targets, which were not measured. So the class bit is the narrowest selector.
History. The class was admitted before the public history begins, in one commit together with mipmapped storage images (bit 12). That commit's one measurement covers both changes together: SCP: Secret Laboratory at 3024x1964 on the M5 Pro (the rule then ran on G17S only), 51.3/55.6 FPS against 50.0/53.3. Its text names Unity HDRP's 12-level RGBA16 colour pyramid (bits 7 and 12) as the workload. Nothing measured the R16 class on its own, on any chip. The M5 Max has used the rule since #693 extended it to every M5.
What changes. On every M5, R16 UNORM/SNORM/UINT/SINT storage images are created plain, whether single-level or mipmapped. Nothing else changes: R16F (bit 2), RG16 (bit 8), the R8/RG8 colour-attachment class (bit 13) and the rest behave as before. In Cyberpunk 2077's T2 frame the class holds three images. Two are 640x400 R16_UNORM: one is written by a compute shader and then point-sampled by the screen-space reflection march: up to 96 reads per pixel (3 rays, 8 steps of 4 samples, before early exits). The third is an 80x50 R16_UINT image.
Code. The bit and the default are named in
hk_g17p_compression.h(HK_M5_STORAGE_R16,HK_M5_STORAGE_COMPRESSION_DEFAULT).test-hk-g17p-compressionchecks that the default leaves exactly that bit clear. The header ofvulkan-storage-compressionnow notes that its R16 cases needASAHI_M5_STORAGE_COMPRESSION=32767to run compressed.Evidence
Machine: J716c (M5 Max, G17C), kernel
7.3.0-ewb417+ #1 SMP PREEMPT_DYNAMIC Mon Nov 30 14:50:30 UTC 2026, default command line, on AC.Driver identities (both built with the same builder and options, release,
-mcpu=apple-m5):libvulkan_asahi.sosha256717a7d62e004489553aee578926cf418022e2eb9(aurora-wip)Mesa 26.3.0-devel (git-717a7d62e0)c4a35ee5b34fdd58c87d9ce742f907fe8584ba448ddcdf60c10e228c760956f33582830cf1cb86bc132381ad7584fc354aadea44Mesa 26.3.0-devel (git-3582830cf1)d388b7d432e7c78ea2a939953b1de6e11ffe85ad86ac2348f050e7cce4023b29Game A/B at the head. Cyberpunk 2077 built-in benchmark, 2560x1600 High (T2 tier of issue #457), Proton build
cur-fex-main-vkmain, the same harness and tuning for both arms, and a per-build shader cache warmed by one discarded run per arm. Runs alternate A B A B … A. Each head sample is compared with the mean of the base runs on either side of it. There was no early stop.GPU compute time per frame (fdinfo, base → head) was about 19.3 → 18.4 ms; vertex and fragment time were unchanged (2.15 / 7.0 ms). The battery charged from 59 % to 66 % during the session (AC, no power clamp).
The same switch on earlier builds (the environment variable on unchanged builds, not the head; listed only to show the effect is stable):
89ddabbf72c+ a default-off diagnostic switchWith the system-level cache on, clearing the whole mask (0) gained less, +1.46 (se 0.30): 53.69 53.13 52.99. Turning off all compression on
5e89c89ce5dlost 0.97 FPS (se 0.15). So the rest of the rule is a net gain in this game, and only the R16 class costs.Conformance (dEQP-VK
7ba03cdac7ae, 6 workers, base first, then head, same process boundaries):image,api.copy_and_blit,api.image_clearing,texture,compute, the first 3,000 ofrenderpasses; all ofimage.load_store,image.store,image.load_store_lod,image.qualifiers; noimage.host_image_copy)image(nohost_image_copy),compute.pipeline,texture.shadow0 cases differ. The 8 failures are the same on both arms:
compute.pipeline.cooperative_matrix.khr_r.subgroupscope.reduce_sum_rowcol{,_changedim}.float16_float16.*, not related to images. NotSupported sets are identical.Storage tests (
vulkan-storage-compression300x200,vulkan-storage-alias):Compression state of the test's R16_UNORM image (usage 0x1f), from the driver's image-creation log: base default
compressed=1, base 32767compressed=1, head defaultcompressed=0, head 32767compressed=1. The R16 cases therefore cover both the plain path (new default) and the compressed path (32767).Unit test:
hk_g17p_compressionpasses (8,366 checks).System health over the window: 0 GPU kernel error lines (faults, recoveries, timeouts, lost devices) in the streamed kernel log; 0
lost devicelines this boot. Failed units:aurora-peripherals.service, a standing failure on this Mac with both builds. Alsosystemd-networkd-wait-online.service, which timed out at boot, 2 minutes after power-on and before any of these runs.