AGC: on gfx1100 image_sample_c compares only 16_UNORM and 32_FLOAT; every other color format answers 0 (emulated color comparison unmeasured on gfx103x) #7934

Closed
opened 2026-10-19 14:47:34 +00:00 by DavidAmsellem · 3 comments
DavidAmsellem commented 2026-10-19 14:47:34 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidAmsellem on 2026-10-19T14:47:34Z.


What

On a gfx1100, image_sample_c* compares at only two of the 63 GFX11 color formats, 16_UNORM and 32_FLOAT. Every other format reads its texels normally but answers 0 for every compare function, ALWAYS included. Measured with the hardware oracle.

AnyPS5 emulates a real comparison for every float, unorm and snorm format except 8-bit UNORM and sRGB (Color comparison descriptor forms). That design follows #668, which says "AMD hardware compares a sample_c reference against the red channel of a colour texture". As far as I can find, that sentence was never measured. What was measured is the exception: on gfx1035, 8-bit UNORM and sRGB return 0 (#3438, #4267).

#4267 moved the real-compare rows of agc_driver_emulated_color_compare to 16_16_UNORM, on the assumption that this format compares. On gfx1100, 16_16_UNORM answers 0.

This is RDNA3, not the console's gfx1013. The 8-bit result matches gfx1035, but whether gfx103x compares 16-bit, float or snorm color formats is still open. I'm reporting it so someone with an RDNA2 GPU can run the sweep below. I have not changed anything.

Results (gfx1100)

image_sample_c_lz on a 4x4 TYPE 9 (2D) T#, point and bilinear S#, clamp-to-last-texel, wave32 and wave64:

GFX11 code Format ALWAYS NEVER EQUAL, ref = the texel image_sample_lz reads
7 16_UNORM 1.0 0.0 1.0
22 32_FLOAT 1.0 0.0 1.0
the other 61 codes 1–63 8/16/32-bit UNORM, SNORM, USCALED, SSCALED, UINT, SINT, FLOAT, packed 10_11_11, 2_10_10_10, …, up to 4 channels 0.0 0.0 0.0

Among the formats that answer 0: 16_FLOAT, 16_SNORM, 16_16_UNORM, 16_16_FLOAT, 32_32_FLOAT, 16_16_16_16_UNORM, 8_8_8_8_SNORM, 11_11_10_FLOAT. In every one of them image_sample_lz returns the expected texel through the same T# and S# (for example 0.129854 at 16_16_UNORM, 0.0102386 at 16_FLOAT), so the descriptor is valid and the zero comes from the compare.

I checked nine of these formats again with image_sample_c_l (explicit LOD 0) and plain image_sample_c. Both match image_sample_c_lz: only 16_UNORM and 32_FLOAT compare. wave32 and wave64 agree on every row.

GFX11 renumbers the formats past 29, so the codes are not the console's. The names come from llvm-mc -mcpu=gfx1100 -disassemble on tbuffer encodings, whose format field shares the image numbering on GFX11. As a check, code 42 reads correct 8_8_8_8_UNORM texels.

Also measured: native comparisons through a 2D T# with a 2D-array or 3D DIM

At 32_FLOAT, which does compare, I also measured the cases that two shader.md entries leave unmeasured: "Emulated comparison of a 2D-array access through a 2D T#", and comparisons of "3D image accesses bound to a 2D or 2D-array T#".

Setup: image_sample_c_lz with DIM 2D_ARRAY and with DIM 3D on a 2D T#, against DIM 2D with the same reference and (u, v). Slices and r values were 0, 1, 2, 2.7, 3, -1, 5, 0.25 and 0.5, with u at texel centres, between texels and past both edges. The functions were LESS, EQUAL, LEQUAL, GREATER, NOTEQUAL and GEQUAL. The references were the texel's value, the requested layer's texel value, 0.5 above and below them, the bilinear value, 0.5 and 1000. Point and bilinear, wave32 and wave64: 14,400 rows.

  • DIM 2D_ARRAY and DIM 3D on the 2D T# match DIM 2D on every row, point and bilinear: the slice and r are ignored.
  • Positive control: the same rows through a real 2D-array T# (TYPE 13, 4 layers) differ from DIM 2D in 210–345 rows per function. With the point sampler, all of them match a comparison against the requested layer's texel, so the kernel does see a slice when the T# has one.
  • The point-sampled result is reference OP texel on all 1,200 rows of each function. The reversed operand order only matches on ties.

For the emulated formats, the hardware here answers 0 whatever the slice. So on gfx1100 the 2D-array entry's model ("samples the 2D image and ignores the slice") only matters at 16_UNORM and 32_FLOAT.

Sweep script (for RDNA2 owners)

Run it from the repository root with the oracle's requirements met: python3 color_compare_sweep.py <gfx target, e.g. gfx1035>. It needs llvm-mc in PATH to name the formats. It prints every code with its ALWAYS, NEVER and EQUAL answers, then the list of formats that compare. Check whether the target numbers formats like GFX10 (gfx103x does): 16_16_UNORM is code 23 on both generations, but 8_8_8_8_UNORM is 56 on GFX10 and 42 on GFX11.

color_compare_sweep.py
import struct
import subprocess
import sys

sys.path.insert(0, "tools/hw-oracle")
from hw_oracle import run

ROWS = 512
OFFSET = 16 * ROWS
TEXEL_BYTES = bytes([0x3e, 0x21, 0x3c, 0x40]) * 16384
FLOAT_MODE = dict(ieee=0, dx10_clamp=1, denorm32=3, denorm16=3, round32=0, round16=0, fp16_overflow=0)
FUNCS = {"never": 0, "equal": 2, "always": 7}


def f2u(x):
    return struct.unpack("<I", struct.pack("<f", x))[0]


def u2f(x):
    return struct.unpack("<f", struct.pack("<I", x))[0]


def format_name(target, code):
    word = 0xE8000000 | (code << 19)
    data = ",".join(f"0x{b:02x}" for b in struct.pack("<I", word) + bytes([0, 0, 0, 0x80]))
    text = subprocess.run(["llvm-mc", "-triple=amdgcn", f"-mcpu={target}", "-disassemble"], input=data, capture_output=True, text=True).stdout
    for token in text.replace("[", " ").replace("]", " ").split():
        if token.startswith("BUF_FMT_"):
            return token[8:]
    return "8_UNORM" if code == 1 else f"code {code}"


def body(code, func):
    w1 = (code << 20) | (3 << 30)
    w2 = 0 | (3 << 14)
    w3 = 0xFAC | (9 << 28)
    s0 = 2 | (2 << 3) | (2 << 6) | (FUNCS[func] << 12)
    text = (f"  s_add_u32 s40, s4, {OFFSET}\n  s_addc_u32 s41, s5, 0\n  s_lshr_b64 s[40:41], s[40:41], 8\n"
            "  s_mov_b32 s8, s40\n  s_and_b32 s9, s41, 0xff\n"
            f"  s_or_b32 s9, s9, 0x{w1:08x}\n  s_mov_b32 s10, 0x{w2:08x}\n  s_mov_b32 s11, 0x{w3:08x}\n"
            "  s_mov_b32 s12, 0\n  s_mov_b32 s13, 0\n  s_mov_b32 s14, 0\n  s_mov_b32 s15, 0\n"
            f"  s_mov_b32 s16, 0x{s0:08x}\n  s_mov_b32 s17, 0\n  s_mov_b32 s18, 0\n  s_mov_b32 s19, 0\n")
    return text + ("  image_sample_c_lz v10, v[4:6], s[8:15], s[16:19] dmask:0x1 dim:SQ_RSRC_IMG_2D\n"
                   "  image_sample_lz v11, v[5:6], s[8:15], s[16:19] dmask:0x1 dim:SQ_RSRC_IMG_2D\n"
                   "  s_waitcnt vmcnt(0)\n")


def answers(code, func, refs, wave64):
    rows = [(refs[i % 4], f2u((i % 4 + 0.5) / 4), f2u(0.125), 0) for i in range(ROWS)]
    return run(body(code, func), rows, TEXEL_BYTES, wave64=wave64, **FLOAT_MODE)


def main():
    target = sys.argv[1]
    for wave64 in (False, True):
        comparing = []
        for code in range(1, 64):
            base = answers(code, "always", [0] * 4, wave64)
            texels = [o[1] for o in base[:4]]
            never = answers(code, "never", [0] * 4, wave64)
            equal = answers(code, "equal", texels, wave64)
            always = sorted({u2f(o[0]) for o in base})
            row = f"{code:2} {format_name(target, code):22} texel {u2f(texels[0]):<12.6g} always {always} never {sorted({u2f(o[0]) for o in never})} equal {sorted({u2f(o[0]) for o in equal})}"
            print(f"wave{64 if wave64 else 32} {row}", flush=True)
            if always != [0.0]:
                comparing.append(format_name(target, code))
        print(f"wave{64 if wave64 else 32}: image_sample_c_lz compares at {', '.join(comparing) or 'no format'}")


main()

Environment

AMD Radeon RX 7900 XT (gfx1100), Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, ROCm HSA runtime through tools/hw-oracle. Float controls on every run: ieee=0 dx10_clamp=1 denorm32=3 denorm16=3 round32=0 round16=0 fp16_overflow=0.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5926089681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7934). Originally posted by [DavidAmsellem](https://github.com/DavidAmsellem) on 2026-10-19T14:47:34Z. --- ### What On a gfx1100, `image_sample_c*` compares at only two of the 63 GFX11 color formats, 16_UNORM and 32_FLOAT. Every other format reads its texels normally but answers **0 for every compare function, ALWAYS included**. Measured with the [hardware oracle](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/HW_ORACLE.md). AnyPS5 emulates a real comparison for every float, unorm and snorm format except 8-bit UNORM and sRGB ([Color comparison descriptor forms](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/debt/shader.md)). That design follows #668, which says "AMD hardware compares a `sample_c` reference against the red channel of a colour texture". As far as I can find, that sentence was never measured. What was measured is the exception: on gfx1035, 8-bit UNORM and sRGB return 0 (#3438, #4267). #4267 moved the real-compare rows of `agc_driver_emulated_color_compare` to `16_16_UNORM`, on the assumption that this format compares. On gfx1100, `16_16_UNORM` answers 0. **This is RDNA3, not the console's gfx1013.** The 8-bit result matches gfx1035, but whether gfx103x compares 16-bit, float or snorm color formats is still open. I'm reporting it so someone with an RDNA2 GPU can run the sweep below. I have not changed anything. ### Results (gfx1100) `image_sample_c_lz` on a 4x4 TYPE 9 (2D) T#, point and bilinear S#, clamp-to-last-texel, wave32 and wave64: | GFX11 code | Format | ALWAYS | NEVER | EQUAL, ref = the texel `image_sample_lz` reads | |---|---|---|---|---| | 7 | 16_UNORM | 1.0 | 0.0 | 1.0 | | 22 | 32_FLOAT | 1.0 | 0.0 | 1.0 | | the other 61 codes 1–63 | 8/16/32-bit UNORM, SNORM, USCALED, SSCALED, UINT, SINT, FLOAT, packed 10_11_11, 2_10_10_10, …, up to 4 channels | **0.0** | 0.0 | **0.0** | Among the formats that answer 0: `16_FLOAT`, `16_SNORM`, `16_16_UNORM`, `16_16_FLOAT`, `32_32_FLOAT`, `16_16_16_16_UNORM`, `8_8_8_8_SNORM`, `11_11_10_FLOAT`. In every one of them `image_sample_lz` returns the expected texel through the same T# and S# (for example 0.129854 at 16_16_UNORM, 0.0102386 at 16_FLOAT), so the descriptor is valid and the zero comes from the compare. I checked nine of these formats again with `image_sample_c_l` (explicit LOD 0) and plain `image_sample_c`. Both match `image_sample_c_lz`: only 16_UNORM and 32_FLOAT compare. wave32 and wave64 agree on every row. GFX11 renumbers the formats past 29, so the codes are not the console's. The names come from `llvm-mc -mcpu=gfx1100 -disassemble` on `tbuffer` encodings, whose format field shares the image numbering on GFX11. As a check, code 42 reads correct `8_8_8_8_UNORM` texels. ### Also measured: native comparisons through a 2D T# with a 2D-array or 3D DIM At 32_FLOAT, which does compare, I also measured the cases that [two `shader.md` entries](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/debt/shader.md) leave unmeasured: "Emulated comparison of a 2D-array access through a 2D T#", and comparisons of "3D image accesses bound to a 2D or 2D-array T#". Setup: `image_sample_c_lz` with DIM 2D_ARRAY and with DIM 3D on a 2D T#, against DIM 2D with the same reference and (u, v). Slices and r values were 0, 1, 2, 2.7, 3, -1, 5, 0.25 and 0.5, with u at texel centres, between texels and past both edges. The functions were LESS, EQUAL, LEQUAL, GREATER, NOTEQUAL and GEQUAL. The references were the texel's value, the requested layer's texel value, 0.5 above and below them, the bilinear value, 0.5 and 1000. Point and bilinear, wave32 and wave64: 14,400 rows. - DIM 2D_ARRAY and DIM 3D on the 2D T# match DIM 2D on **every row**, point and bilinear: the slice and r are ignored. - Positive control: the same rows through a real 2D-array T# (TYPE 13, 4 layers) differ from DIM 2D in 210–345 rows per function. With the point sampler, all of them match a comparison against the requested layer's texel, so the kernel does see a slice when the T# has one. - The point-sampled result is `reference OP texel` on all 1,200 rows of each function. The reversed operand order only matches on ties. For the emulated formats, the hardware here answers 0 whatever the slice. So on gfx1100 the 2D-array entry's model ("samples the 2D image and ignores the slice") only matters at 16_UNORM and 32_FLOAT. ### Sweep script (for RDNA2 owners) Run it from the repository root with the oracle's requirements met: `python3 color_compare_sweep.py <gfx target, e.g. gfx1035>`. It needs `llvm-mc` in `PATH` to name the formats. It prints every code with its ALWAYS, NEVER and EQUAL answers, then the list of formats that compare. Check whether the target numbers formats like GFX10 (gfx103x does): 16_16_UNORM is code 23 on both generations, but 8_8_8_8_UNORM is 56 on GFX10 and 42 on GFX11. <details><summary>color_compare_sweep.py</summary> ```python import struct import subprocess import sys sys.path.insert(0, "tools/hw-oracle") from hw_oracle import run ROWS = 512 OFFSET = 16 * ROWS TEXEL_BYTES = bytes([0x3e, 0x21, 0x3c, 0x40]) * 16384 FLOAT_MODE = dict(ieee=0, dx10_clamp=1, denorm32=3, denorm16=3, round32=0, round16=0, fp16_overflow=0) FUNCS = {"never": 0, "equal": 2, "always": 7} def f2u(x): return struct.unpack("<I", struct.pack("<f", x))[0] def u2f(x): return struct.unpack("<f", struct.pack("<I", x))[0] def format_name(target, code): word = 0xE8000000 | (code << 19) data = ",".join(f"0x{b:02x}" for b in struct.pack("<I", word) + bytes([0, 0, 0, 0x80])) text = subprocess.run(["llvm-mc", "-triple=amdgcn", f"-mcpu={target}", "-disassemble"], input=data, capture_output=True, text=True).stdout for token in text.replace("[", " ").replace("]", " ").split(): if token.startswith("BUF_FMT_"): return token[8:] return "8_UNORM" if code == 1 else f"code {code}" def body(code, func): w1 = (code << 20) | (3 << 30) w2 = 0 | (3 << 14) w3 = 0xFAC | (9 << 28) s0 = 2 | (2 << 3) | (2 << 6) | (FUNCS[func] << 12) text = (f" s_add_u32 s40, s4, {OFFSET}\n s_addc_u32 s41, s5, 0\n s_lshr_b64 s[40:41], s[40:41], 8\n" " s_mov_b32 s8, s40\n s_and_b32 s9, s41, 0xff\n" f" s_or_b32 s9, s9, 0x{w1:08x}\n s_mov_b32 s10, 0x{w2:08x}\n s_mov_b32 s11, 0x{w3:08x}\n" " s_mov_b32 s12, 0\n s_mov_b32 s13, 0\n s_mov_b32 s14, 0\n s_mov_b32 s15, 0\n" f" s_mov_b32 s16, 0x{s0:08x}\n s_mov_b32 s17, 0\n s_mov_b32 s18, 0\n s_mov_b32 s19, 0\n") return text + (" image_sample_c_lz v10, v[4:6], s[8:15], s[16:19] dmask:0x1 dim:SQ_RSRC_IMG_2D\n" " image_sample_lz v11, v[5:6], s[8:15], s[16:19] dmask:0x1 dim:SQ_RSRC_IMG_2D\n" " s_waitcnt vmcnt(0)\n") def answers(code, func, refs, wave64): rows = [(refs[i % 4], f2u((i % 4 + 0.5) / 4), f2u(0.125), 0) for i in range(ROWS)] return run(body(code, func), rows, TEXEL_BYTES, wave64=wave64, **FLOAT_MODE) def main(): target = sys.argv[1] for wave64 in (False, True): comparing = [] for code in range(1, 64): base = answers(code, "always", [0] * 4, wave64) texels = [o[1] for o in base[:4]] never = answers(code, "never", [0] * 4, wave64) equal = answers(code, "equal", texels, wave64) always = sorted({u2f(o[0]) for o in base}) row = f"{code:2} {format_name(target, code):22} texel {u2f(texels[0]):<12.6g} always {always} never {sorted({u2f(o[0]) for o in never})} equal {sorted({u2f(o[0]) for o in equal})}" print(f"wave{64 if wave64 else 32} {row}", flush=True) if always != [0.0]: comparing.append(format_name(target, code)) print(f"wave{64 if wave64 else 32}: image_sample_c_lz compares at {', '.join(comparing) or 'no format'}") main() ``` </details> ### Environment AMD Radeon RX 7900 XT (gfx1100), Linux Mint 22.3 (Ubuntu 24.04 base), kernel 7.0.0-38, ROCm HSA runtime through `tools/hw-oracle`. Float controls on every run: `ieee=0 dx10_clamp=1 denorm32=3 denorm16=3 round32=0 round16=0 fp16_overflow=0`. AI-assisted: yes
simonbbby commented 2026-10-19 16:26:32 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-19T16:26:32Z.


Native RDNA2 result for the requested sweep: gfx1036 agrees with the two-format split. This is the Ryzen 9 9950X iGPU (1002:13c0), Linux kernel 7.0.0-38-generic, using the HSA hardware oracle. The detected target is gfx1036; this is not the console's gfx1013, and no Vulkan sampling or emulated shader result is used here.

I ran the supplied kernel for codes 1–63, then extended it through 77, since GFX10 also names codes 64–77 (32_32_FLOAT through 32_32_32_32_FLOAT). Format names came from the local llvm-mc -mcpu=gfx1036 disassembly. Point sampler, 4×4 TYPE 9 T#, 512 lanes per dispatch, both wave32 and wave64:

GFX10 code / format ALWAYS NEVER EQUAL, reference from ordinary sample
7 / 16_UNORM 1.0 0.0 1.0
22 / 32_FLOAT 1.0 0.0 1.0
Other 75 named codes, including 23 / 16_16_UNORM, 64 / 32_32_FLOAT, 65 / 16_16_16_16_UNORM 0.0 0.0 0.0

Additional controls:

  • image_sample_c_lz, explicit-LOD-zero image_sample_c_l, and image_sample_c agree in both wave sizes for 11 formats: 16_UNORM, 16_SNORM, 16_FLOAT, 32_FLOAT, 16_16_UNORM, 16_16_FLOAT, 8_8_8_8_UNORM, 32_32_FLOAT, 16_16_16_16_UNORM, 16_16_16_16_FLOAT, 32_32_32_32_FLOAT.
  • For those rows, the accompanying ordinary image_sample_lz reads the expected component from the supplied bytes, checked per coordinate and format stride against CPU decoding within one f32 ULP. Thus the zero comparison at 16_16_UNORM, for example, is not a zero/invalid ordinary texel read.
  • Preloading v10 with 0x7fc01234 before the compare still gives 1.0 at codes 7/22 and 0 at 23/65, across all three opcodes and both waves. The zero results overwrite the sentinel rather than leaving an untouched zero-initialized result register.

Every dispatch used ieee=0, dx10_clamp=1, denorm32=3, denorm16=3, round32=0, round16=0, fp16_overflow=0. Oracle sources are pinned at 7220d35b77985454693538c78175493e5aa201a5; no repository source was changed. Full sweep output, control JSON and scripts retained.

Scope: point sampling and the 2D descriptor above. I have not checked bilinear filtering, the 2D-array/3D-DIM cases, other float modes, a title, or gfx1013. No implementation change or console-equivalence claim is proposed.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271978515 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7934#issuecomment-6271978515). Originally posted by [simonbbby](https://github.com/simonbbby) on 2026-10-19T16:26:32Z. --- Native RDNA2 result for the requested sweep: **gfx1036 agrees with the two-format split**. This is the Ryzen 9 9950X iGPU (`1002:13c0`), Linux kernel `7.0.0-38-generic`, using the HSA hardware oracle. The detected target is `gfx1036`; this is not the console's gfx1013, and no Vulkan sampling or emulated shader result is used here. I ran the supplied kernel for codes 1–63, then extended it through **77**, since GFX10 also names codes 64–77 (`32_32_FLOAT` through `32_32_32_32_FLOAT`). Format names came from the local `llvm-mc -mcpu=gfx1036` disassembly. Point sampler, 4×4 TYPE 9 T#, 512 lanes per dispatch, both wave32 and wave64: | GFX10 code / format | ALWAYS | NEVER | EQUAL, reference from ordinary sample | |---|---|---|---| | 7 / `16_UNORM` | 1.0 | 0.0 | 1.0 | | 22 / `32_FLOAT` | 1.0 | 0.0 | 1.0 | | Other 75 named codes, including 23 / `16_16_UNORM`, 64 / `32_32_FLOAT`, 65 / `16_16_16_16_UNORM` | 0.0 | 0.0 | 0.0 | Additional controls: - `image_sample_c_lz`, explicit-LOD-zero `image_sample_c_l`, and `image_sample_c` agree in both wave sizes for 11 formats: `16_UNORM`, `16_SNORM`, `16_FLOAT`, `32_FLOAT`, `16_16_UNORM`, `16_16_FLOAT`, `8_8_8_8_UNORM`, `32_32_FLOAT`, `16_16_16_16_UNORM`, `16_16_16_16_FLOAT`, `32_32_32_32_FLOAT`. - For those rows, the accompanying ordinary `image_sample_lz` reads the expected component from the supplied bytes, checked per coordinate and format stride against CPU decoding within one f32 ULP. Thus the zero comparison at `16_16_UNORM`, for example, is not a zero/invalid ordinary texel read. - Preloading `v10` with `0x7fc01234` before the compare still gives 1.0 at codes 7/22 and 0 at 23/65, across all three opcodes and both waves. The zero results overwrite the sentinel rather than leaving an untouched zero-initialized result register. Every dispatch used `ieee=0, dx10_clamp=1, denorm32=3, denorm16=3, round32=0, round16=0, fp16_overflow=0`. Oracle sources are pinned at `7220d35b77985454693538c78175493e5aa201a5`; no repository source was changed. Full sweep output, control JSON and scripts retained. Scope: point sampling and the 2D descriptor above. I have not checked bilinear filtering, the 2D-array/3D-DIM cases, other float modes, a title, or gfx1013. No implementation change or console-equivalence claim is proposed.
thuanquang commented 2026-10-19 18:48:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by thuanquang on 2026-10-19T18:48:27Z.


The discrete RDNA 2 result agrees too: RX 6700 XT (gfx1031) through the HIP runtime of AMD's Windows driver, so the ISA runs as written. I used your kernel (4x4 TYPE 9 T#, point S#, clamp to the last texel, your texel bytes) for GFX10 codes 1 to 77, in wave32 and wave64, with a NaN sentinel preloaded in the result VGPR.

  • image_sample_c_lz compares at codes 7 (16_UNORM) and 22 (32_FLOAT) only, in both wave sizes. Every other code answers 0 for ALWAYS, NEVER and EQUAL, while image_sample_lz through the same descriptors reads the expected texel. Examples: 0.129854 at 16_16_UNORM and 16_16_16_16_UNORM, 0.0102386 at 16_FLOAT, 16_16_FLOAT and 16_16_16_16_FLOAT, 0.259713 at 16_SNORM, 2.93953 at 32_32_FLOAT and 32_32_32_32_FLOAT.

The open questions about the two formats that compare, point sampler. "ref" is the image_sample_c reference, "texel" the value image_sample_lz returns:

function 16_UNORM, texel 0.1299 32_FLOAT, texel 2.9395
LESS 1 for ref -1, -0.12, 0 and NaN; 0 for ref 0.13, 0.38, 2, 1000 1 for ref -1, 0, 2, 2.69; 0 for ref 2.94, 3.19, 1000 and NaN
GREATER 1 for ref 0.38, 2, 1000; 0 for ref -1, -0.12, 0, 0.13 and NaN 1 for ref 3.19, 1000; 0 for ref -1, 0, 2, 2.69, 2.94 and NaN
EQUAL 1 only for ref = texel 1 only for ref = texel
NOTEQUAL 0 only for ref = texel (1 for NaN) 0 only for ref = texel (1 for NaN)
LEQUAL, GEQUAL as LESS and GREATER, plus 1 at ref = texel the same
NEVER, ALWAYS 0, 1 0, 1

So the result is ref OP texel. At 16_UNORM a NaN reference behaves as 0 (LESS, LEQUAL and NOTEQUAL are true), so the reference is converted to the format's range before the compare. These references don't show whether -1 and 2 are clamped. At 32_FLOAT a NaN reference is unordered, so only NOTEQUAL is true.

Bilinear S# at 32_FLOAT, texels 0, 0.25, 0.5, 1.0 along x: the result is the bilinear blend of the four per-texel comparisons, not a comparison of the filtered value. For example, LESS with ref 0.3 between the texels 0.25 and 0.5 gives 0, 0.125, 0.25, 0.375 as u moves toward the 0.5 texel, while the point result stays 0.

So gfx1031, gfx1036 and gfx1100 agree: only the two depth formats compare, and every other format answers 0 whatever the function. That differs from the emulated color comparisons for the 16-bit, float and snorm color formats, and from agc_driver_emulated_color_compare's real-compare rows at 16_16_UNORM.

Desktop RDNA 2, not the console's gfx1013. 2D T# only; I didn't repeat your 2D-array and 3D DIM cases.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6274712902 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7934#issuecomment-6274712902). Originally posted by [thuanquang](https://github.com/thuanquang) on 2026-10-19T18:48:27Z. --- The discrete RDNA 2 result agrees too: RX 6700 XT (gfx1031) through the HIP runtime of AMD's Windows driver, so the ISA runs as written. I used your kernel (4x4 TYPE 9 T#, point S#, clamp to the last texel, your texel bytes) for GFX10 codes 1 to 77, in wave32 and wave64, with a NaN sentinel preloaded in the result VGPR. - `image_sample_c_lz` compares at codes 7 (`16_UNORM`) and 22 (`32_FLOAT`) only, in both wave sizes. Every other code answers 0 for ALWAYS, NEVER and EQUAL, while `image_sample_lz` through the same descriptors reads the expected texel. Examples: 0.129854 at `16_16_UNORM` and `16_16_16_16_UNORM`, 0.0102386 at `16_FLOAT`, `16_16_FLOAT` and `16_16_16_16_FLOAT`, 0.259713 at `16_SNORM`, 2.93953 at `32_32_FLOAT` and `32_32_32_32_FLOAT`. The open questions about the two formats that compare, point sampler. "ref" is the `image_sample_c` reference, "texel" the value `image_sample_lz` returns: | function | `16_UNORM`, texel 0.1299 | `32_FLOAT`, texel 2.9395 | |---|---|---| | LESS | 1 for ref -1, -0.12, 0 and NaN; 0 for ref 0.13, 0.38, 2, 1000 | 1 for ref -1, 0, 2, 2.69; 0 for ref 2.94, 3.19, 1000 and NaN | | GREATER | 1 for ref 0.38, 2, 1000; 0 for ref -1, -0.12, 0, 0.13 and NaN | 1 for ref 3.19, 1000; 0 for ref -1, 0, 2, 2.69, 2.94 and NaN | | EQUAL | 1 only for ref = texel | 1 only for ref = texel | | NOTEQUAL | 0 only for ref = texel (1 for NaN) | 0 only for ref = texel (1 for NaN) | | LEQUAL, GEQUAL | as LESS and GREATER, plus 1 at ref = texel | the same | | NEVER, ALWAYS | 0, 1 | 0, 1 | So the result is `ref OP texel`. At `16_UNORM` a NaN reference behaves as 0 (LESS, LEQUAL and NOTEQUAL are true), so the reference is converted to the format's range before the compare. These references don't show whether -1 and 2 are clamped. At `32_FLOAT` a NaN reference is unordered, so only NOTEQUAL is true. Bilinear S# at `32_FLOAT`, texels 0, 0.25, 0.5, 1.0 along x: the result is the bilinear blend of the four per-texel comparisons, not a comparison of the filtered value. For example, LESS with ref 0.3 between the texels 0.25 and 0.5 gives 0, 0.125, 0.25, 0.375 as u moves toward the 0.5 texel, while the point result stays 0. So gfx1031, gfx1036 and gfx1100 agree: only the two depth formats compare, and every other format answers 0 whatever the function. That differs from the emulated color comparisons for the 16-bit, float and snorm color formats, and from `agc_driver_emulated_color_compare`'s real-compare rows at `16_16_UNORM`. Desktop RDNA 2, not the console's gfx1013. 2D T# only; I didn't repeat your 2D-array and 3D DIM cases.
MarcZX10 commented 2026-10-20 19:54:51 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T19:54:51Z.


I opened #8642 with the measured GFX10 color-comparison format split. It keeps codes 7 (16_UNORM) and 22 (32_FLOAT) on the native path and returns zero for the other supported floating-sampled formats. The PR depends on #8625 for the separate array-layer, NaN and TRUNC_COORD corrections. Eligibility, intake, conventions, labels and report checks passed; automatic platform build jobs were skipped by path filtering, and my manual build dispatch was denied by repository permissions. The PR description records that no local runtime test was run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300108094 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7934#issuecomment-6300108094). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-20T19:54:51Z. --- I opened #8642 with the measured GFX10 color-comparison format split. It keeps codes 7 (`16_UNORM`) and 22 (`32_FLOAT`) on the native path and returns zero for the other supported floating-sampled formats. The PR depends on #8625 for the separate array-layer, NaN and TRUNC_COORD corrections. Eligibility, intake, conventions, labels and report checks passed; automatic platform build jobs were skipped by path filtering, and my manual build dispatch was denied by repository permissions. The PR description records that no local runtime test was run.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#7934
No description provided.