Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/SPIRV/SPIRVToOCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,13 @@ void SPIRVToOCLBase::visitCallGenericCastToPtrExplicitBuiltIn(CallInst *CI,

void SPIRVToOCLBase::visitCallSPIRVCvtBuiltin(CallInst *CI, Op OC,
StringRef DemangledName) {
if (auto *TET =
dyn_cast<TargetExtType>(CI->getFunctionType()->getReturnType())) {
// Preserve any cooperative matrix type conversions as SPIR-V calls.
if (TET->getName() == "spirv.CooperativeMatrixKHR") {
return;
}
}
std::string CastBuiltInName;
if (isCvtFromUnsignedOpCode(OC))
CastBuiltInName = "u";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
; RUN: llvm-dis %t.rev.bc
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM

; Ensure cooperative matrix conversions are mapped to SPIR-V friendly IR calls.
; RUN: llvm-spirv -r --spirv-target-env=CL2.0 %t.spv -o %t.rev.bc
; RUN: llvm-dis %t.rev.bc
; RUN: FileCheck < %t.rev.ll %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV: TypeInt [[#TypeInt32:]] 32 0
; CHECK-SPIRV: TypeInt [[#TypeInt16:]] 16 0
; CHECK-SPIRV: TypeInt [[#TypeInt8:]] 8 0
Expand Down