Skip to content

Commit 4d5656b

Browse files
committed
[SPIR-V 1.4] Deprecate OpDecorationGroup, OpGroupDecorate, and OpGroupMemberDecorate
1 parent e099f77 commit 4d5656b

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

lib/SPIRV/libSPIRV/SPIRVDecorate.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ class SPIRVDecorationGroup : public SPIRVEntry {
411411
void validate() const override {
412412
assert(OpCode == OC);
413413
assert(WordCount == WC);
414+
getModule()->getErrorLog().checkError(
415+
getModule()->getSPIRVVersion() < VersionNumber::SPIRV_1_4,
416+
SPIRVEC_InvalidModule,
417+
"OpDecorationGroup is deprecated starting from SPIR-V 1.4");
414418
}
415419
};
416420

@@ -433,6 +437,13 @@ class SPIRVGroupDecorateGeneric : public SPIRVEntryNoIdGeneric {
433437
}
434438
virtual void decorateTargets() = 0;
435439
_SPIRV_DCL_ENCDEC
440+
void validate() const override {
441+
getModule()->getErrorLog().checkError(
442+
this->getModule()->getSPIRVVersion() < VersionNumber::SPIRV_1_4,
443+
SPIRVEC_InvalidModule,
444+
"OpGroup(Member)Decorate is deprecated starting from SPIR-V 1.4");
445+
}
446+
436447
protected:
437448
SPIRVDecorationGroup *DecorationGroup;
438449
std::vector<SPIRVId> Targets;

test/negative/group-decorate.spt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
; This is a copy of test/group-decorate.spt with the changed SPIR-V version.
2+
; Verify that we don't accept OpDecorationGroup and OpGroupDecorate in SPIR-V 1.4 or higher
3+
119734787 66560 393230 15 0
4+
2 Capability Addresses
5+
2 Capability Kernel
6+
2 Capability Int8
7+
5 ExtInstImport 1 "OpenCL.std"
8+
3 MemoryModel 1 2
9+
5 EntryPoint 6 7 "test"
10+
13 String 12 "kernel_arg_type.test.char4*,char4*,char4*,"
11+
3 Source 3 102000
12+
4 Name 8 "src1"
13+
4 Name 9 "src2"
14+
3 Name 10 "dst"
15+
4 Name 11 "entry"
16+
4 Decorate 13 FuncParamAttr 5
17+
2 DecorationGroup 13
18+
5 GroupDecorate 13 8 9 10
19+
4 TypeInt 3 8 0
20+
2 TypeVoid 2
21+
4 TypeVector 4 3 4
22+
4 TypePointer 5 5 4
23+
6 TypeFunction 6 2 5 5 5
24+
25+
26+
5 Function 2 7 4 6
27+
3 FunctionParameter 5 8
28+
3 FunctionParameter 5 9
29+
3 FunctionParameter 5 10
30+
31+
2 Label 11
32+
1 Return
33+
34+
1 FunctionEnd
35+
36+
; RUN: not llvm-spirv %s -to-binary -o %t.spv
37+
; 2>&1 | FileCheck %s
38+
; CHECK: InvalidModule: Invalid SPIR-V module: OpDecorationGroup is deprecated starting from SPIR-V 1.4

0 commit comments

Comments
 (0)