upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:10:30 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 23:10:30 -0500
commitcf3ec424c4fac2a3ea3ad4e73baa4ec99e9277ae (patch)
tree6c466055267ae463df6afdce84eb32b761101346
parentf82e9d747a9ad715792ce15c99ed7aefd17c1402 (diff)
parent96c1d557601f4087d7238eda2c4ee82a5bb93a8b (diff)
Merge pull request #4024 from tedin7
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rw-r--r--tools/rdna2spirv.py37
1 files changed, 29 insertions, 8 deletions
diff --git a/tools/rdna2spirv.py b/tools/rdna2spirv.py
index 4e54728d8..cc33f469c 100644
--- a/tools/rdna2spirv.py
+++ b/tools/rdna2spirv.py
@@ -16,6 +16,7 @@ Writes <name>.spvasm for each translated shader and <name>.spv only for validate
16Prints coverage and validation results. 16Prints coverage and validation results.
17""" 17"""
18import argparse 18import argparse
19import bisect
19import hashlib 20import hashlib
20import os 21import os
21import re 22import re
@@ -14877,6 +14878,14 @@ def interp_ij_analysis(insns, g):
14877 (g.pixel_interpolants[1] >> s["attr"]) & 1: 14878 (g.pixel_interpolants[1] >> s["attr"]) & 1:
14878 raise Unsupported("computed I/J on 16-bit interpolant through v_interp_*_f32") 14879 raise Unsupported("computed I/J on 16-bit interpolant through v_interp_*_f32")
14879 14880
14881 # Sites by (op, anchor register, attribute, channel), in program order, for partner(): the f16 p2 is
14882 # keyed by its partial (the p1's vdst it names), every other op by its vdst.
14883 by_key = defaultdict(list)
14884 for t in sites:
14885 anchor_reg = t["partial"] if t["op"] == "v_interp_p2_f16" else t["vdst"]
14886 by_key[(t["op"], anchor_reg, t["attr"], t["chan"])].append(t)
14887 n_by_key = {key: [t["n"] for t in ts] for key, ts in by_key.items()}
14888
14880 def partner(k, s): 14889 def partner(k, s):
14881 """The other op of the pair: the p1 the p2 completes (nearest before), or the p2 that reads the 14890 """The other op of the pair: the p1 the p2 completes (nearest before), or the p2 that reads the
14882 p1's vdst as its partial (nearest after). Same attribute channel; the f32 pair's vdst is shared, 14891 p1's vdst as its partial (nearest after). Same attribute channel; the f32 pair's vdst is shared,
@@ -14891,14 +14900,26 @@ def interp_ij_analysis(insns, g):
14891 want = ("v_interp_p1ll_f16", "v_interp_p1lv_f16") 14900 want = ("v_interp_p1ll_f16", "v_interp_p1lv_f16")
14892 anchor = s["partial"] 14901 anchor = s["partial"]
14893 # The f32 pair shares the vdst; the f16 p2 names the p1's vdst as its fourth operand (its 14902 # The f32 pair shares the vdst; the f16 p2 names the p1's vdst as its fourth operand (its
14894 # partial), and its own vdst is just where the f16 result goes. 14903 # partial), and its own vdst is just where the f16 result goes. by_key holds each kind's sites in
14895 cand = [t for t in sites if t["op"] in want 14904 # program order, so the nearest one after (p1) or before (p2) the site is a binary search.
14896 and (t["partial"] if t["op"] == "v_interp_p2_f16" else t["vdst"]) == anchor 14905 found = []
14897 and t["attr"] == s["attr"] and t["chan"] == s["chan"]] 14906 for op in want:
14898 if s["op"] in P1: 14907 key = (op, anchor, s["attr"], s["chan"])
14899 after = [t for t in cand if t["n"] > k] 14908 ts = by_key.get(key)
14900 return min(after, key=lambda t: t["n"]) if after else None 14909 if not ts:
14901 return max((t for t in cand if t["n"] < k), key=lambda t: t["n"], default=None) 14910 continue
14911 ns = n_by_key[key]
14912 if s["op"] in P1:
14913 i = bisect.bisect_right(ns, k)
14914 if i < len(ts):
14915 found.append(ts[i])
14916 else:
14917 i = bisect.bisect_left(ns, k)
14918 if i:
14919 found.append(ts[i - 1])
14920 if not found:
14921 return None
14922 return (min if s["op"] in P1 else max)(found, key=lambda t: t["n"])
14902 14923
14903 # Which pairs are computed (either operand is): both ops then take the computed model, so a p2 whose 14924 # Which pairs are computed (either operand is): both ops then take the computed model, so a p2 whose
14904 # own operand is pristine still weights with the I its p1 held. 14925 # own operand is pristine still weights with the I its p1 held.