Skip to content

Commit dee3719

Browse files
authored
[Backport to 20] Deprecate SPV_INTEL_token_type (#3025) (#3086)
Token type will stop being generated by the writer. Yet it still be consumed by the reader. Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 68edc9d commit dee3719

File tree

4 files changed

+59
-59
lines changed

4 files changed

+59
-59
lines changed

lib/SPIRV/SPIRVWriter.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -400,16 +400,6 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
400400
if (T->isFloatingPointTy())
401401
return mapType(T, BM->addFloatType(T->getPrimitiveSizeInBits()));
402402

403-
if (T->isTokenTy()) {
404-
BM->getErrorLog().checkError(
405-
BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_token_type),
406-
SPIRVEC_RequiresExtension,
407-
"SPV_INTEL_token_type\n"
408-
"NOTE: LLVM module contains token type, which doesn't have analogs in "
409-
"SPIR-V without extensions");
410-
return mapType(T, BM->addTokenTypeINTEL());
411-
}
412-
413403
// A pointer to image or pipe type in LLVM is translated to a SPIRV
414404
// (non-pointer) image or pipe type.
415405
if (T->isPointerTy()) {
@@ -620,6 +610,14 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
620610
}
621611
}
622612

613+
if (T->isTokenTy()) {
614+
BM->getErrorLog().checkError(
615+
false, SPIRVEC_InvalidModule,
616+
"LLVM module contains token type, which doesn't have a counterpart in "
617+
"SPIR-V");
618+
return nullptr;
619+
}
620+
623621
llvm_unreachable("Not implemented!");
624622
return 0;
625623
}

test/extensions/INTEL/SPV_INTEL_token_type/token_type_intel.ll

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
; RUN: llvm-spirv %s -to-binary -o %t.spv
2+
; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
3+
; RUN: llvm-dis %t.rev.bc -o - | FileCheck %s --check-prefix=CHECK-LLVM
4+
5+
; CHECK-LLVM: declare token @llvm.tokenfoo()
6+
7+
119734787 65536 393230 13 0
8+
2 Capability Addresses
9+
2 Capability Linkage
10+
2 Capability Kernel
11+
2 Capability TokenTypeINTEL
12+
7 Extension "SPV_INTEL_token_type"
13+
5 ExtInstImport 1 "OpenCL.std"
14+
3 MemoryModel 1 2
15+
4 EntryPoint 6 10 "foo"
16+
3 Source 3 102000
17+
6 Name 4 "llvm.tokenfoo"
18+
3 Name 7 "foo"
19+
4 Name 8 "entry"
20+
3 Name 9 "tok"
21+
22+
8 Decorate 4 LinkageAttributes "llvm.tokenfoo" Import
23+
5 Decorate 7 LinkageAttributes "foo" Export
24+
2 TypeTokenINTEL 2
25+
3 TypeFunction 3 2
26+
2 TypeVoid 5
27+
3 TypeFunction 6 5
28+
29+
30+
31+
5 Function 2 4 0 3
32+
33+
1 FunctionEnd
34+
35+
5 Function 5 7 0 6
36+
37+
2 Label 8
38+
4 FunctionCall 2 9 4
39+
1 Return
40+
41+
1 FunctionEnd
42+
43+
5 Function 5 10 0 6
44+
45+
2 Label 11
46+
4 FunctionCall 5 12 7
47+
1 Return
48+
49+
1 FunctionEnd
50+

test/negative/feature_requires_extension.ll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
; Check whether the translator reports an error for a module with token type
2-
; if SPV_INTEL_token_type extension is not used.
32

43
; RUN: llvm-as < %s -o %t.bc
54
; RUN: not llvm-spirv %t.bc 2>&1 --spirv-allow-unknown-intrinsics | FileCheck %s
65

7-
; CHECK: RequiresExtension: Feature requires the following SPIR-V extension:
8-
; CHECK-NEXT: SPV_INTEL_token_type
9-
; CHECK-NEXT: NOTE: LLVM module contains token type, which doesn't have analogs
10-
; CHECK-SAME: in SPIR-V without extensions
6+
; CHECK: InvalidModule: Invalid SPIR-V module: LLVM module contains token type, which doesn't have a counterpart in SPIR-V
117

128
; ModuleID = 'token.bc'
139
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v24:32:32-v32:32:32-v48:64:64-v64:64:64-v96:128:128-v128:128:128-v192:256:256-v256:256:256-v512:512:512-v1024:1024:1024"

0 commit comments

Comments
 (0)