From 92a48f6003254fc0c9323353eafed06596326232 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 28 Jan 2025 01:32:07 -0800 Subject: Delete invalid ASSERT in `isTypeOperandEqual`. (#6196) --- tests/bugs/gh-6194.slang | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/bugs/gh-6194.slang (limited to 'tests') diff --git a/tests/bugs/gh-6194.slang b/tests/bugs/gh-6194.slang new file mode 100644 index 000000000..66d7ecd81 --- /dev/null +++ b/tests/bugs/gh-6194.slang @@ -0,0 +1,64 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv +//CHECK: OpEntryPoint + +interface IMLP +{ + associatedtype PrecisionType : __BuiltinFloatingPointType; +} +static const int kSize = 4; +float runAndSum(float base) +{ + typealias Pass0Precision = Pass0::PrecisionType; + typealias WARCastPass0 = Pass0Precision; + typealias WARActualTypePass0 = half; + + typealias Pass1Precision = Pass1::PrecisionType; + typealias WARCastPass1 = Pass1Precision; + typealias WARActualTypePass1 = half; + + Pass0Precision pass0_inputs[kSize]; + for (uint i = 0; i < kSize; ++i) + { + // pass0_inputs[i] = (base + float(i)); // Not working, WAR below + pass0_inputs[i] = (WARCastPass0)(base + float(i)); + } + + Pass0Precision pass0_outputs[kSize] = pass0_inputs; + + Pass1Precision pass1_inputs[kSize]; + + for (uint i = 0; i < kSize; ++i) + { + // Fires SLANG_ASSERT(!"Unhandled comparison"); in slang-ir.cpp, _isTypeOperandEqual + pass1_inputs[i] = __realCast(pass0_outputs[i]); + + // Working + //pass1_inputs[i] = (WARCastPass1)__realCast(pass0_outputs[i]); + } + + float result = 0; + for (uint i = 0; i < kSize; ++i) + { + result += __realCast(pass1_inputs[i]); + } + + return result; +}; + +RWStructuredBuffer result; + +struct Pass0Impl : IMLP +{ + typealias PrecisionType = half; +}; + +struct Pass1Impl : IMLP +{ + typealias PrecisionType = half; +}; + +[numthreads(1, 1, 1)] +void test() +{ + result[0] = runAndSum(3.f); +} \ No newline at end of file -- cgit v1.2.3