mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:30:52 +01:00
[PR #1181] rdna2spirv: f16 interp deltas and toward-zero p2 narrow (SHADER-468) #1214
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1214
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1181
Author: @whoalin1
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:shader-468-f16-varying📝 Commits (2)
5657240rdna2spirv: f16 interp deltas and toward-zero p2 narrow (SHADER-468)e4eed02f16_interp_probe: reconfigure stdout with errors="replace" (test_tool_stdout_encoding)📊 Changes
6 files changed (+520 additions, -40 deletions)
View changed files
📝
docs/design.md(+2 -2)📝
runtime/test/vk_harness.cpp(+76 -15)➕
tests/semantic/test_interp_f16_round.py(+55 -0)📝
tests/semantic/test_interp_p1lv_f16.py(+46 -21)➕
tools/f16_interp_probe.py(+317 -0)📝
tools/rdna2spirv.py(+24 -2)📄 Description
Claimed in the coordination issue as: SHADER-468 (claim)
Depends on: none
What and why
For a 16-bit (
f16) interpolation channel, the SPI writes the P10/P20 delta words as per-half f16 differences of the two packed halves, andv_interp_p2_f16narrows its result toward zero (the driver's ISA runs the pair insides_round_mode 0x000c, MODE.FP16_ROUND toward zero — LLVM's SIModeRegister documents the same requirement). The translation used the f32 difference of the decoded halves and narrowed to nearest even.Measured on real RDNA2 hardware (
tools/f16_interp_probe.py, 12 hand-written draws, 98,304 pixel samples, Ryzen 5 7600 iGPU / gfx1036, AMD Windows driver 24.10.24):The remaining 30 misses are documented in the
docs/design.mdrow (26 f16-subnormal boundary cases, 4 exact-grid-boundary perspective cases).Changes:
tools/rdna2spirv.py:Gen.f16_roundrounds an f32 to the nearest f16 value via integer-built bits +UnpackHalf2x16(unfooldable per OLD-512/OLD-513); the interpolation weighting rounds P1−P0 / P2−P0 to f16 for 16-bit-channel reads;v_interp_p2_f16narrows withf16_bits(rtz=True).runtime/test/vk_harness.cpp:VKH_PC_BYTESmust be a multiple of 4 (VkPushConstantRange), both-stage capability scan covers Float16/StorageInputOutput16/Float64,VKH_SHADER_INFO=1dumps driver ISA.tools/f16_interp_probe.py(new measurement tool, hand-written GLSL only),tests/semantic/test_interp_f16_round.py(new),test_interp_p1lv_f16.pyoracle updated to the measured model,docs/design.mdcontract row updated.Tested
py -3.14 -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6,170 tests, 0 failedpy -3.14 -m unittest discover -s tests/semantic -p "test_interp*.py": 207 tests OK;-p "test_f16*.py": 49 OK (40 env skips)scripts/check_no_game_data.pyon all changed files: cleantools/f16_interp_probe.py --gpu amdre-run after the change: rdna2 model 98,274/98,304 (identical measurement)run_gpu_tests.py):--filter interp3/3 and--filter f1620/20 on both GPUs below,LEONIDA_VK_VALIDATION=1on AMD: 0 validation errorsGPUs tested: AMD Radeon Graphics (Ryzen 5 7600 iGPU, gfx1036-class RDNA2, driver 24.10.24, Vulkan 1.3.280, Windows 11); NVIDIA GeForce RTX 4070 SUPER (driver 610.88, Windows 11)
AI-assisted: yes (Devin)
Checklist
mainand merges cleanlydocs/design.mdcontract table with how it was confirmed (on-hardware measurement)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.