summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-28 01:32:07 -0800
committerGitHub <noreply@github.com>2025-01-28 01:32:07 -0800
commit92a48f6003254fc0c9323353eafed06596326232 (patch)
tree021a515481f6ac021c3b70124ca70203add10202
parent4b9a34249d560a86d1333420f6cd06f6fe502c9d (diff)
Delete invalid ASSERT in `isTypeOperandEqual`. (#6196)
-rw-r--r--source/slang/slang-ir.cpp2
-rw-r--r--tests/bugs/gh-6194.slang64
2 files changed, 64 insertions, 2 deletions
diff --git a/source/slang/slang-ir.cpp b/source/slang/slang-ir.cpp
index a328057ac..32acc7baa 100644
--- a/source/slang/slang-ir.cpp
+++ b/source/slang/slang-ir.cpp
@@ -7394,8 +7394,6 @@ static bool _isTypeOperandEqual(IRInst* a, IRInst* b)
{
return _areTypeOperandsEqual(a, b);
}
- SLANG_ASSERT(!"Unhandled comparison");
-
// We can't equate any other type..
return false;
}
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<Pass0 : IMLP, Pass1 : IMLP>(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<Pass1Precision>(pass0_outputs[i]);
+
+ // Working
+ //pass1_inputs[i] = (WARCastPass1)__realCast<WARActualTypePass0>(pass0_outputs[i]);
+ }
+
+ float result = 0;
+ for (uint i = 0; i < kSize; ++i)
+ {
+ result += __realCast<WARActualTypePass1>(pass1_inputs[i]);
+ }
+
+ return result;
+};
+
+RWStructuredBuffer<float> result;
+
+struct Pass0Impl : IMLP
+{
+ typealias PrecisionType = half;
+};
+
+struct Pass1Impl : IMLP
+{
+ typealias PrecisionType = half;
+};
+
+[numthreads(1, 1, 1)]
+void test()
+{
+ result[0] = runAndSum<Pass0Impl, Pass1Impl>(3.f);
+} \ No newline at end of file