Repository navigation
rdna2spirv: s_memtime / s_memrealtime via OpReadClockKHR + enable VK_KHR_shader_clock - #2817
Conversation
|
Code read of One semantic gap worth a line in AI-assisted review (Claude Code). |
|
Reviewed and tested Hardware (
Build & unit checks:
Runtime device test (
Synthetic compute pipeline check (
Notes / minor review points:
Synthetic tests only; no game files. AI-assisted. |
|
Tested 09cf8b6 on an RX 9060 XT (RDNA4, GFX1200), RADV Mesa 27.0.0-devel, Nobara Linux (Fedora 44): pass This adds AMD and RADV to the RTX 6000 runs in the description. Setup: llvm-mc 22.1.8 and SPIRV-Tools 2026.1. The PR head contains
I didn't run a draw or dispatch that reads the clock values back. The check above stops at pipeline creation. AI-assisted (Claude Code). |
Kam471
left a comment
There was a problem hiding this comment.
Verified on the PR head: python -I tests/semantic/test_smem_clock.py -> 5/5 OK; tests/test_shader_checks.py -> 69/69 OK; test_isa_coverage.py 13 OK/3 skipped, test_shader_meta.py 15 OK, test_shader_index.py 9 OK, test_fma_khr.py 9 OK. On main the new tests fail 3/5 (Unsupported: s_memtime/s_memrealtime). SPIR-V disassembly shows OpReadClockKHR with Subgroup/Device scopes and SPV_KHR_shader_clock; no game data or absolute paths. C++ was not rebuilt locally. Approve.
|
Tested
The scope mapping (s_memtime → Subgroup clock, s_memrealtime → Device clock) and the features-per-index gating (a shader asks only for the scope it reads) both test clean on the NVIDIA side. AI-assisted (ZCode agent): builds and runs executed by a coding agent on this machine. |
|
Tested 09cf8b6 on AMD Radeon RX 7600 (RDNA3), AMD 26.11.2 (LLPC), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8: pass. This driver reports VK_KHR_shader_clock with shaderSubgroupClock and shaderDeviceClock both true.
AI-assisted (Claude Code, reviewed with Codex). No game files. |
|
Tested 09cf8b6 merged onto main 77444fa on an RTX 5090 (driver 616.92), Windows 11, MSVC 19.44, Vulkan SDK 1.4.363, RelWithDebInfo:
AI-assisted (Claude Code). |
|
Tested The five synthetic scalar-clock tests passed on Linux, covering SPIR-V clock lowering and feature expectations in the unit suite. AI-assisted, synthetic inputs only. |
|
Encoding and per-scope metadata look right: I assembled and Two things need changing before this can land:
Also: the new test does not AI-assisted review, no game files, no GPU. |
…gn.md row, spirv-val in the test
|
thx @tupacfan04, all three done in c2a0be7 :)
|
|
Independent Apple Silicon / MoltenVK no-regression check of head
No code changes, no game data; counts only. AI-assisted. |
|
Tested 66643ec on Intel UHD 630 (CFL GT2), Mesa 25.2.8 ANV, Ubuntu 24.04: pass. |
|
Tested 66643ec (merge base 3eb4410) on NVIDIA GeForce RTX 5080, Linux 580.65.06: pass Tested the PR head merged with current main
Line-by-line against my main run (results that differ from main):
Not run: the full AI-assisted (Claude Code). |
|
Tested
AI-assisted (Claude Code). |
|
Tested 66643ec merged with main d974c88 on native Windows (Python 3.13.1, llvm-mc 23.1.6) and with main 98fa503 on Linux (Python 3.12.16): pass. tests/semantic/test_smem_clock.py, test_value_semantics.py and the rdna2spirv and shader_checks tests: Windows 8/8, Linux 12/12. Negative control with main's tools/rdna2spirv.py: test_smem_clock fails (7 errors). |
|
Tested 66643ec (merge base 3eb4410) on AMD Radeon 780M (RADV PHOENIX, Mesa 26.2.6, subgroup 32..64) and NVIDIA GeForce RTX 4070 Laptop (620.70.06, subgroup 32..32), CachyOS Linux 7.3.4: pass. The PR now changes no C++ (
Synthetic inputs only, no game data. AI-assisted. |
|
Tested 66643ec on AMD Radeon RX 9070 XT (RADV GFX1201) and the Ryzen 7 9800X3D iGPU (RADV RAPHAEL_MENDOCINO, gfx1036), Mesa 26.2.6, Linux 7.3.4: pass, no regressions.
No game files. AI-assisted. |
|
thx @KkelebekK, you're right, the runtime half already landed on main, description updated ^^ |
|
Tested 7488a00 (trial-merged onto main 561b65a, fast-forward) on NVIDIA GeForce RTX 5090 (610.88, subgroup 32..32) and AMD Radeon RDNA2 iGPU in a Ryzen 9 9950X3D (driver 32.0.21036.18, subgroup 32..64), Windows 11 Pro 26200, llvm-mc 23.1.6: pass.
No game files. AI-assisted. |
|
Tested 7488a00 on two Vulkan devices, Windows 11, Vulkan SDK 1.4.363, MSVC 14.50, llvm-mc 23.1.6 (AMDGPU, LLVM-MinGW build):
AI-assisted. No game files. |
shayderrr
left a comment
There was a problem hiding this comment.
Summary
rdna2spirv: s_memtime / s_memrealtime via OpReadClockKHR + enable VK_KHR_shader_clock. Changes in tests/semantic/test_smem_clock.py (+39/-3), tools/rdna2spirv.py (+8/-1), docs/design.md (+1/-0).
s_memtime / s_memrealtime -> OpReadClockKHR, behind --shader-clock khr (default off = Unsupported as before). status: the first version (translator + VK_KHR_shader_clock enable in the d3d12 device, vk_pipeline_check support, device test) is already on main. what this pr still adds on top:
Representative hunk: spv = translate_lines("ps_smem_clock", ops + EXIT)
Why merge
Keeps the touched code and its regression coverage aligned with the surrounding tools; the change is confined to tests/semantic/test_smem_clock.py (+39/-3), tools/rdna2spirv.py (+8/-1), docs/design.md (+1/-0).
Verdict: Approve
Summaryrdna2spirv: s_memtime / s_memrealtime via OpReadClockKHR + enable VK_KHR_shader_clock. Changes in tests/semantic/test_smem_clock.py (+39/-3), tools/rdna2spirv.py (+8/-1), docs/design.md (+1/-0). Why mergeKeeps the touched code and its regression coverage aligned with the surrounding tools; the change is confined to tests/semantic/test_smem_clock.py (+39/-3), tools/rdna2spirv.py (+8/-1), docs/design.md (+1/-0). Verdict: Approve |
s_memtime/s_memrealtime->OpReadClockKHR, behind--shader-clock khr(defaultoff= Unsupported as before).status: the first version (translator +
VK_KHR_shader_clockenable in the d3d12 device,vk_pipeline_checksupport, device test) is already on main. what this pr still adds on top:--shader-clock {off,khr}opt-in, so no shader can die atvkCreateShaderModuleon a device without the extension (review point from @tupacfan04)docs/design.mdrow (scope choice: s_memtime = per-CU shader clock -> Subgroup, s_memrealtime = REFCLK -> Device; what's checked)test_smem_clock.py: spirv-val + off-by-default testsno C++ changes anymore.
tested by others: RX 9060 XT (RADV), Intel UHD 630 (ANV, subgroup clock only), Radeon 780M + RTX 4070 Laptop, Apple M2 (MoltenVK, no regressions). pipeline creation only, clock values aren't measured.
AI-assisted (Claude Code).
TL;DR: shader clock reads are now opt-in behind a flag, documented and validated; the runtime half is already on main.