Skip to content

Commit

Permalink
Add OpExtension SPV_INTEL_subgroups
Browse files Browse the repository at this point in the history
OpenCL file compiled by Khronos OpenCL Clang compiler+SPIRV-LLVM using cl_intel_subgroups+cl_intel_subgroups_short omits needed OpExtension SPV_INTEL_subgroups

Signed-off-by: Ilya Mashkov ilya.mashkov@intel.com
  • Loading branch information
imashkov authored and AlexeySachkov committed Aug 30, 2019
1 parent 1c6ae9d commit 78adccf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions lib/SPIRV/libSPIRV/SPIRVInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2319,6 +2319,10 @@ class SPIRVSubgroupShuffleINTELInstBase : public SPIRVInstTemplateBase {
SPIRVCapVec getRequiredCapability() const override {
return getVec(CapabilitySubgroupShuffleINTEL);
}

SPIRVExtSet getRequiredExtensions() const override {
return getSet(ExtensionID::SPV_INTEL_subgroups);
}
};

#define _SPIRV_OP(x, ...) \
Expand All @@ -2337,6 +2341,10 @@ class SPIRVSubgroupBufferBlockIOINTELInstBase : public SPIRVInstTemplateBase {
SPIRVCapVec getRequiredCapability() const override {
return getVec(CapabilitySubgroupBufferBlockIOINTEL);
}

SPIRVExtSet getRequiredExtensions() const override {
return getSet(ExtensionID::SPV_INTEL_subgroups);
}
};

#define _SPIRV_OP(x, ...) \
Expand All @@ -2353,6 +2361,10 @@ class SPIRVSubgroupImageBlockIOINTELInstBase : public SPIRVInstTemplateBase {
SPIRVCapVec getRequiredCapability() const override {
return getVec(CapabilitySubgroupImageBlockIOINTEL);
}

SPIRVExtSet getRequiredExtensions() const override {
return getSet(ExtensionID::SPV_INTEL_subgroups);
}
};

#define _SPIRV_OP(x, ...) \
Expand Down
5 changes: 3 additions & 2 deletions test/transcoding/cl_intel_sub_groups.ll
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
;}

; RUN: llvm-as %s -o %t.bc
; RUN: llvm-spirv %t.bc -o - -spirv-text | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %t.bc -o %t.spv
; RUN: llvm-spirv %t.bc -o - -spirv-text --spirv-ext=+SPV_INTEL_subgroups | FileCheck %s --check-prefix=CHECK-SPIRV
; RUN: llvm-spirv %t.bc -o %t.spv --spirv-ext=+SPV_INTEL_subgroups
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
; RUN: llvm-dis < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM

; CHECK-SPIRV: Capability SubgroupShuffleINTEL
; CHECK-SPIRV: Capability SubgroupBufferBlockIOINTEL
; CHECK-SPIRV: Capability SubgroupImageBlockIOINTEL
; CHECK-SPIRV: Extension "SPV_INTEL_subgroups"
; CHECK-SPIRV: Extension "cl_intel_subgroups"
; CHECK-SPIRV: Extension "cl_intel_subgroups_short"

Expand Down

0 comments on commit 78adccf

Please sign in to comment.