summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-04-15 15:57:45 -0600
committerGitHub <noreply@github.com>2025-04-15 14:57:45 -0700
commitd0b6a0b1ab49b5958015f31364c5ad73d9cd03eb (patch)
treee419bb3c89fa8c389eb0ccbbe8aaa29a1dcd515f /source/slang/slang-ir-util.cpp
parenta6174ff9443507dece534aa193f8c45e8f0ce7db (diff)
Add cooperative matrix 1 support (#6565)
* initial wip for spirv * working tiled example * clean up store and load * minor fixes * fix loadAny name * add initial tests, including broken/unimplemented intrinsics * fix subscript * run tests at 16x16, remove not supported arithmetic tests * minor fixups on implementation * rename CoopMatMatrixUse * Update tests to pass validation layers locally * Add mat-mul-add test and minor fixes * Add more tests * Remove dead code * Add coopMatLoad function and tests, enforce constexpr for matrix layout * Use getVectorOrCoopMatrixElementType in place of getVectorElementType
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index 58bb7aaf2..4919850eb 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -23,6 +23,18 @@ IRType* getVectorElementType(IRType* type)
return vectorType->getElementType();
if (auto coopVecType = as<IRCoopVectorType>(type))
return coopVecType->getElementType();
+ if (auto coopMatType = as<IRCoopMatrixType>(type))
+ return coopMatType->getElementType();
+ return type;
+}
+
+IRType* getVectorOrCoopMatrixElementType(IRType* type)
+{
+ auto vectorElementType = getVectorElementType(type);
+ if (vectorElementType != type)
+ return vectorElementType;
+ if (auto coopMatrixType = as<IRCoopMatrixType>(type))
+ return coopMatrixType->getElementType();
return type;
}