Skip to content
Merged
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
2 changes: 2 additions & 0 deletions lib/SPIRV/SPIRVInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ const static char ConstantPipeStorage[] = "ConstantPipeStorage";
const static char VmeImageINTEL[] = "VmeImageINTEL";
const static char JointMatrixINTEL[] = "JointMatrixINTEL";
const static char CooperativeMatrixKHR[] = "CooperativeMatrixKHR";
const static char BufferSurfaceINTEL[] = "BufferSurfaceINTEL";
} // namespace kSPIRVTypeName

namespace kSPR2TypeName {
Expand Down Expand Up @@ -976,6 +977,7 @@ template <> inline void SPIRVMap<std::string, Op, SPIRVOpaqueType>::init() {
_SPIRV_OP(AvcRefResultINTEL)
_SPIRV_OP(AvcSicResultINTEL)
_SPIRV_OP(VmeImageINTEL)
_SPIRV_OP(BufferSurfaceINTEL)
_SPIRV_OP(CooperativeMatrixKHR)
#undef _SPIRV_OP
add("JointMatrixINTEL", internal::OpTypeJointMatrixINTEL);
Expand Down
6 changes: 5 additions & 1 deletion lib/SPIRV/SPIRVWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,8 +814,12 @@ SPIRVType *LLVMToSPIRVBase::transSPIRVOpaqueType(StringRef STName,
return SaveType(BM->addQueueType());
else if (TN == kSPIRVTypeName::PipeStorage)
return SaveType(BM->addPipeStorageType());
else if (TN == kSPIRVTypeName::JointMatrixINTEL) {
else if (TN == kSPIRVTypeName::JointMatrixINTEL)
return SaveType(transSPIRVJointMatrixINTELType(Postfixes));
else if (BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_vector_compute) &&
TN == kSPIRVTypeName::BufferSurfaceINTEL) {
auto Access = getAccessQualifier(STName);
return SaveType(BM->addBufferSurfaceINTELType(Access));
} else
return SaveType(
BM->addOpaqueGenericType(SPIRVOpaqueTypeOpCodeMap::map(TN)));
Expand Down
23 changes: 23 additions & 0 deletions test/transcoding/spirv-target-types-buffer.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
; Check translation of the buffer surface target extension type
;
; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv -spirv-ext=+SPV_INTEL_vector_compute %t.bc -spirv-text -o %t.spv.txt
; RUN: FileCheck < %t.spv.txt %s --check-prefix=CHECK-SPIRV
target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

; CHECK-SPIRV: Capability VectorComputeINTEL
; CHECK-SPIRV: Extension "SPV_INTEL_vector_compute"
; CHECK-SPIRV: Name [[#FuncName:]] "foo"
; CHECK-SPIRV: Name [[#ParamName:]] "a"
; CHECK-SPIRV: TypeVoid [[#VoidT:]]
; CHECK-SPIRV: TypeBufferSurfaceINTEL [[#BufferID:]]
; CHECK-SPIRV: Function [[#VoidT]] [[#FuncID:]]
; CHECK-SPIRV-NEXT: FunctionParameter [[#BufferID]] [[#ParamName]]

define spir_kernel void @foo(target("spirv.BufferSurfaceINTEL", 0) %a) #0 {
entry:
ret void
}

attributes #0 = { noinline norecurse nounwind readnone "VCFunction"}
Loading