From d0b6a0b1ab49b5958015f31364c5ad73d9cd03eb Mon Sep 17 00:00:00 2001 From: Darren Wihandi <65404740+fairywreath@users.noreply.github.com> Date: Tue, 15 Apr 2025 15:57:45 -0600 Subject: 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 --- source/slang/slang-ir-util.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/slang/slang-ir-util.cpp') 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(type)) return coopVecType->getElementType(); + if (auto coopMatType = as(type)) + return coopMatType->getElementType(); + return type; +} + +IRType* getVectorOrCoopMatrixElementType(IRType* type) +{ + auto vectorElementType = getVectorElementType(type); + if (vectorElementType != type) + return vectorElementType; + if (auto coopMatrixType = as(type)) + return coopMatrixType->getElementType(); return type; } -- cgit v1.2.3