Skip to content

Commit

Permalink
Up max SPIR-V version to 1.4 (intel#1161)
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Sidorov <dmitry.sidorov@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@65b5d1b
  • Loading branch information
MrSidims authored and vmaksimo committed Aug 23, 2021
1 parent c98ce7a commit b3e77af
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion llvm-spirv/include/LLVMSPIRVOpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ enum class VersionNumber : uint32_t {
SPIRV_1_1 = 0x00010100,
SPIRV_1_2 = 0x00010200,
SPIRV_1_3 = 0x00010300,
SPIRV_1_4 = 0x00010400,
// TODO: populate this enum with the latest versions (up to 1.5) once
// translator get support of corresponding features
MinimumVersion = SPIRV_1_0,
MaximumVersion = SPIRV_1_3
MaximumVersion = SPIRV_1_4
};

enum class ExtensionID : uint32_t {
Expand Down
3 changes: 3 additions & 0 deletions llvm-spirv/lib/SPIRV/libSPIRV/SPIRVModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,9 @@ static std::string to_string(uint32_t Version) {
case static_cast<uint32_t>(VersionNumber::SPIRV_1_3):
Res = "1.3";
break;
case static_cast<uint32_t>(VersionNumber::SPIRV_1_4):
Res = "1.4";
break;
default:
Res = "unknown";
}
Expand Down
4 changes: 2 additions & 2 deletions llvm-spirv/test/negative/spirv-version-controls-1.spt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
119734787 66560 393230 12 0
119734787 66816 393230 12 0
2 Capability Addresses
2 Capability Kernel
5 ExtInstImport 1 "OpenCL.std"
Expand Down Expand Up @@ -29,5 +29,5 @@

; RUN: not llvm-spirv %s -to-binary -o - 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
;
; CHECK-ERROR: Invalid SPIR-V module: unsupported SPIR-V version number 'unknown (66560)'. Range of supported/known SPIR-V versions is 1.0 (65536) - 1.3 (66304)
; CHECK-ERROR: Invalid SPIR-V module: unsupported SPIR-V version number 'unknown (66816)'. Range of supported/known SPIR-V versions is 1.0 (65536) - 1.4 (66560)

2 changes: 1 addition & 1 deletion llvm-spirv/test/negative/spirv-version-controls-2.spt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@

; RUN: not llvm-spirv %s -to-binary -o - 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR
;
; CHECK-ERROR: Invalid SPIR-V module: unsupported SPIR-V version number 'unknown (1024)'. Range of supported/known SPIR-V versions is 1.0 (65536) - 1.3 (66304)
; CHECK-ERROR: Invalid SPIR-V module: unsupported SPIR-V version number 'unknown (1024)'. Range of supported/known SPIR-V versions is 1.0 (65536) - 1.4 (66560)


3 changes: 2 additions & 1 deletion llvm-spirv/tools/llvm-spirv/llvm-spirv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ static cl::opt<VersionNumber> MaxSPIRVVersion(
cl::values(clEnumValN(VersionNumber::SPIRV_1_0, "1.0", "SPIR-V 1.0"),
clEnumValN(VersionNumber::SPIRV_1_1, "1.1", "SPIR-V 1.1"),
clEnumValN(VersionNumber::SPIRV_1_2, "1.2", "SPIR-V 1.2"),
clEnumValN(VersionNumber::SPIRV_1_3, "1.3", "SPIR-V 1.3")),
clEnumValN(VersionNumber::SPIRV_1_3, "1.3", "SPIR-V 1.3"),
clEnumValN(VersionNumber::SPIRV_1_4, "1.4", "SPIR-V 1.4")),
cl::init(VersionNumber::MaximumVersion));

static cl::list<std::string>
Expand Down

0 comments on commit b3e77af

Please sign in to comment.