From f3ff2cb406621c56372e3b664456316a724df1ca Mon Sep 17 00:00:00 2001 From: Nawid3333 <102778966+Nawid3333@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:30:08 +0100 Subject: [PATCH] test(hw-oracle): pin the v_cvt_u32_f32 rows Pin the v_cvt_u32_f32 limits beside the v_cvt_i32_f32 ones: NaN, both infinities, -1, -0.5, 2^32 and 1.5, with the values the 7600X iGPU (gfx1036) gives through HIP. Both probes run through one check with the PS5 float mode at every wave size the device can run, so the f32 to 32-bit integer conversions are covered in both signednesses. Co-Authored-By: Claude Opus 5.5 --- .../KytyShim/tests/HwOracle.cpp | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/KytyShim/tests/HwOracle.cpp b/core/libs/prx/libSceAgcDriver/KytyShim/tests/HwOracle.cpp index 2e4e0ccbe8b..ffe5eaef729 100644 --- a/core/libs/prx/libSceAgcDriver/KytyShim/tests/HwOracle.cpp +++ b/core/libs/prx/libSceAgcDriver/KytyShim/tests/HwOracle.cpp @@ -56,6 +56,7 @@ std::string Hex(uint32_t value) { } constexpr std::array CvtI32Body {0x7e141104u}; +constexpr std::array CvtU32Body {0x7e140f04u}; constexpr std::array FmaBody {0xd54b000au, 0x041a0b04u}; constexpr std::array MoveFromS4Body {0x7e140204u}; constexpr std::array MoveFromS12Body {0x7e14020cu}; @@ -84,6 +85,16 @@ constexpr std::array CvtI32Rows {{ {"neg-zero", {0x80000000u, 0u, 0u, 0u}, 0x00000000u}, }}; +constexpr std::array CvtU32Rows {{ + {"nan", {0x7fc12345u, 0u, 0u, 0u}, 0x00000000u}, + {"pos-inf", {0x7f800000u, 0u, 0u, 0u}, 0xffffffffu}, + {"neg-inf", {0xff800000u, 0u, 0u, 0u}, 0x00000000u}, + {"minus-one", {0xbf800000u, 0u, 0u, 0u}, 0x00000000u}, + {"minus-half", {0xbf000000u, 0u, 0u, 0u}, 0x00000000u}, + {"two-pow-32", {0x4f800000u, 0u, 0u, 0u}, 0xffffffffu}, + {"one-and-half", {0x3fc00000u, 0u, 0u, 0u}, 0x00000001u}, +}}; + constexpr std::array FmaRows {{ {"single-rounding-cancellation", {0x3f800001u, 0x3f7ffffeu, 0xbf800000u, 0u}, 0xa8800000u}, {"zero-times-infinity-plus-one", {0x00000000u, 0x7f800000u, 0x3f800000u, 0u}, 0xffc00000u}, @@ -398,19 +409,19 @@ std::optional> RunRows(const KytyOracle::Device& device, c } } -void CheckCvtI32Rows(const KytyOracle::Device& device) { +void CheckPs5ModeRows(const KytyOracle::Device& device, const std::string& probe, std::span body, std::span rows) { std::vector input(Threads * KytyOracle::InputDwords, 0u); for (uint32_t lane = 0; lane < Threads; ++lane) { - std::ranges::copy(CvtI32Rows[lane % CvtI32Rows.size()].input, input.begin() + lane * KytyOracle::InputDwords); + std::ranges::copy(rows[lane % rows.size()].input, input.begin() + lane * KytyOracle::InputDwords); } uint32_t runs = 0; for (const auto wave: Waves) { - const auto output = RunRows(device, MakeKernel(CvtI32Body, wave, Ps5FloatMode, false, true), input); + const auto output = RunRows(device, MakeKernel(body, wave, Ps5FloatMode, false, true), input); if (!output) continue; ++runs; - const auto prefix = "wave" + std::to_string(wave) + " v-cvt-i32-f32-limits "; + const auto prefix = "wave" + std::to_string(wave) + " " + probe + " "; for (uint32_t lane = 0; lane < Threads; ++lane) { - const auto& row = CvtI32Rows[lane % CvtI32Rows.size()]; + const auto& row = rows[lane % rows.size()]; const auto* out = &(*output)[lane * KytyOracle::OutputDwords]; Check(out[0] == row.hardware, prefix + row.name + " (lane " + std::to_string(lane) + ") is " + Hex(out[0]) + ", the hardware gives " + Hex(row.hardware)); @@ -419,7 +430,7 @@ void CheckCvtI32Rows(const KytyOracle::Device& device) { } } } - Check(runs != 0, "v-cvt-i32-f32-limits ran at no wave size"); + Check(runs != 0, probe + " ran at no wave size"); } void PrintFusedRoundingRows(const KytyOracle::Device& device) { @@ -452,7 +463,8 @@ int main(int argc, char** argv) { return NoDevice(error.what()); } device_name = device->Name(); - CheckCvtI32Rows(*device); + CheckPs5ModeRows(*device, "v-cvt-i32-f32-limits", CvtI32Body, CvtI32Rows); + CheckPs5ModeRows(*device, "v-cvt-u32-f32-limits", CvtU32Body, CvtU32Rows); PrintFusedRoundingRows(*device); } else { CodeObjectTests();