engine/rr: cheaper bounds checks and conversion guards in the translated passes
- ptx2rr.py fetch0 (the translation's bounds-checked texel fetch): one unsigned comparison per axis instead of two signed ones; a negative coordinate is above every size. enc0's gather fetches 102 times: 231 instructions fewer, scalar spills 200 -> 176. - The output passes (post, down, downp, pooled) also go through spv_exact_convert.py now and take ptx2rr.py --exact-convert's single f32 guard on binary16 conversions, as the hybrid stages do. Their ISA already uses v_fma_mix*_f16 for plain conversions, so the check is the whole instruction mix: only v_and_or_b32 / v_or / v_perm / shifts go (post -16 VALU, down -9, downp -73); every v_fma_f32 / v_mul_f32 / v_add_f32 / conversion / v_exp / v_log count is unchanged. Every image byte-identical on the replay inputs (also robustness2 and the split gather build). RX 9070 XT, 720p -> 1440p: enc0 745 -> 738 us, output 673 -> 665 us. Signed-off-by: itchyfeetleech <[email protected]>
This commit is contained in:
1 parent
e46c589c68
commit
69a4f6ae2f
3 files changed
+16
-6
No files matched your search
+2
-1
@@ -70,7 +70,8 @@ uint HU2_(u16vec2 u) { return uint(u.x) | (uint(u.y) << 16); }
|
||||
uint H2U(f16vec2 h) { return HU2_(float16BitsToUint16(h)); }
|
||||
int s16(uint u) { return (int(u) << 16) >> 16; }
|
||||
float rcp_a(float x) { return 1.0 / x; }
|
||||
vec4 fetch0(sampler2D t, ivec2 c) { const ivec2 n = textureSize(t, 0); return (c.x < 0 || c.y < 0 || c.x >= n.x || c.y >= n.y) ? vec4(0.0) : texelFetch(t, c, 0); }
|
||||
// (one unsigned comparison per axis: a negative coordinate is above every size)
|
||||
vec4 fetch0(sampler2D t, ivec2 c) { const ivec2 n = textureSize(t, 0); return any(greaterThanEqual(uvec2(c), uvec2(n))) ? vec4(0.0) : texelFetch(t, c, 0); }
|
||||
// x + copysign(0.5, x) rounded toward zero and then truncated: round half away from zero, exactly
|
||||
float round_half_away(float x) { float t = trunc(x); return abs(x - t) >= 0.5 ? t + sign(x) : t; }
|
||||
uint PARAM32(uint o) { return param.w[o >> 2]; }
|
||||
|
||||
Reference in new issue
Block a user