Skip to content

Commit 30f5b3b

Browse files
MrSidimsFreddyLeaf
authored andcommitted
Add an option for NonSemantic.Shader.DebugInfo.100 (intel#1855)
Under this option this extended instruction set will be implemented Spec: https://github.com/KhronosGroup/SPIRV-Registry/blob/main/nonsemantic/NonSemantic.Shader.DebugInfo.100.asciidoc TODO: to rename NonSemantic.Kernel.DebugInfo.100 to NonSemantic.Shader.DebugInfo.200 when the name is stable Signed-off-by: Sidorov, Dmitry <[email protected]> Original commit: KhronosGroup/SPIRV-LLVM-Translator@a8c3ba2
1 parent 645ce31 commit 30f5b3b

File tree

9 files changed

+25
-0
lines changed

9 files changed

+25
-0
lines changed

llvm-spirv/include/LLVMSPIRVOpts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ enum class FPContractMode : uint32_t { On, Off, Fast };
8383
enum class DebugInfoEIS : uint32_t {
8484
SPIRV_Debug,
8585
OpenCL_DebugInfo_100,
86+
NonSemantic_Shader_DebugInfo_100,
8687
NonSemantic_Kernel_DebugInfo_100
8788
};
8889

llvm-spirv/lib/SPIRV/SPIRVToLLVMDbgTran.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ SPIRVExtInst *SPIRVToLLVMDbgTran::getDbgInst(const SPIRVId Id) {
9292
SPIRVExtInst *EI = static_cast<SPIRVExtInst *>(E);
9393
if (EI->getExtSetKind() == SPIRV::SPIRVEIS_Debug ||
9494
EI->getExtSetKind() == SPIRV::SPIRVEIS_OpenCL_DebugInfo_100 ||
95+
EI->getExtSetKind() ==
96+
SPIRV::SPIRVEIS_NonSemantic_Shader_DebugInfo_100 ||
9597
EI->getExtSetKind() == SPIRV::SPIRVEIS_NonSemantic_Kernel_DebugInfo_100)
9698
return EI;
9799
}

llvm-spirv/lib/SPIRV/SPIRVToLLVMDbgTran.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ class SPIRVToLLVMDbgTran {
7171
T *transDebugInst(const SPIRVExtInst *DebugInst) {
7272
assert((DebugInst->getExtSetKind() == SPIRVEIS_Debug ||
7373
DebugInst->getExtSetKind() == SPIRVEIS_OpenCL_DebugInfo_100 ||
74+
DebugInst->getExtSetKind() ==
75+
SPIRVEIS_NonSemantic_Shader_DebugInfo_100 ||
7476
DebugInst->getExtSetKind() ==
7577
SPIRVEIS_NonSemantic_Kernel_DebugInfo_100) &&
7678
"Unexpected extended instruction set");

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVEnum.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ enum SPIRVExtInstSetKind {
7878
SPIRVEIS_OpenCL,
7979
SPIRVEIS_Debug,
8080
SPIRVEIS_OpenCL_DebugInfo_100,
81+
SPIRVEIS_NonSemantic_Shader_DebugInfo_100,
8182
SPIRVEIS_NonSemantic_Kernel_DebugInfo_100,
8283
SPIRVEIS_Count,
8384
};
@@ -130,6 +131,8 @@ template <> inline void SPIRVMap<SPIRVExtInstSetKind, std::string>::init() {
130131
add(SPIRVEIS_OpenCL, "OpenCL.std");
131132
add(SPIRVEIS_Debug, "SPIRV.debug");
132133
add(SPIRVEIS_OpenCL_DebugInfo_100, "OpenCL.DebugInfo.100");
134+
add(SPIRVEIS_NonSemantic_Shader_DebugInfo_100,
135+
"NonSemantic.Shader.DebugInfo.100");
133136
add(SPIRVEIS_NonSemantic_Kernel_DebugInfo_100,
134137
"NonSemantic.Kernel.DebugInfo.100");
135138
}

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVFunction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,16 @@ bool SPIRVFunction::decodeBB(SPIRVDecoder &Decoder) {
162162
} else {
163163
if (Inst->isExtInst(SPIRVEIS_Debug, SPIRVDebug::Scope) ||
164164
Inst->isExtInst(SPIRVEIS_OpenCL_DebugInfo_100, SPIRVDebug::Scope) ||
165+
Inst->isExtInst(SPIRVEIS_NonSemantic_Shader_DebugInfo_100,
166+
SPIRVDebug::Scope) ||
165167
Inst->isExtInst(SPIRVEIS_NonSemantic_Kernel_DebugInfo_100,
166168
SPIRVDebug::Scope)) {
167169
DebugScope = Inst;
168170
} else if (Inst->isExtInst(SPIRVEIS_Debug, SPIRVDebug::NoScope) ||
169171
Inst->isExtInst(SPIRVEIS_OpenCL_DebugInfo_100,
170172
SPIRVDebug::NoScope) ||
173+
Inst->isExtInst(SPIRVEIS_NonSemantic_Shader_DebugInfo_100,
174+
SPIRVDebug::NoScope) ||
171175
Inst->isExtInst(SPIRVEIS_NonSemantic_Kernel_DebugInfo_100,
172176
SPIRVDebug::NoScope)) {
173177
DebugScope = nullptr;

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,7 @@ class SPIRVExtInst : public SPIRVFunctionCallGeneric<OpExtInst, 5> {
17621762
ExtSetKind = Module->getBuiltinSet(ExtSetId);
17631763
assert((ExtSetKind == SPIRVEIS_OpenCL || ExtSetKind == SPIRVEIS_Debug ||
17641764
ExtSetKind == SPIRVEIS_OpenCL_DebugInfo_100 ||
1765+
ExtSetKind == SPIRVEIS_NonSemantic_Shader_DebugInfo_100 ||
17651766
ExtSetKind == SPIRVEIS_NonSemantic_Kernel_DebugInfo_100) &&
17661767
"not supported");
17671768
}
@@ -1773,6 +1774,7 @@ class SPIRVExtInst : public SPIRVFunctionCallGeneric<OpExtInst, 5> {
17731774
break;
17741775
case SPIRVEIS_Debug:
17751776
case SPIRVEIS_OpenCL_DebugInfo_100:
1777+
case SPIRVEIS_NonSemantic_Shader_DebugInfo_100:
17761778
case SPIRVEIS_NonSemantic_Kernel_DebugInfo_100:
17771779
getEncoder(O) << ExtOpDebug;
17781780
break;
@@ -1791,6 +1793,7 @@ class SPIRVExtInst : public SPIRVFunctionCallGeneric<OpExtInst, 5> {
17911793
break;
17921794
case SPIRVEIS_Debug:
17931795
case SPIRVEIS_OpenCL_DebugInfo_100:
1796+
case SPIRVEIS_NonSemantic_Shader_DebugInfo_100:
17941797
case SPIRVEIS_NonSemantic_Kernel_DebugInfo_100:
17951798
getDecoder(I) >> ExtOpDebug;
17961799
break;

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVModule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ void SPIRVModuleImpl::layoutEntry(SPIRVEntry *E) {
656656
SPIRVExtInst *EI = static_cast<SPIRVExtInst *>(E);
657657
if ((EI->getExtSetKind() == SPIRVEIS_Debug ||
658658
EI->getExtSetKind() == SPIRVEIS_OpenCL_DebugInfo_100 ||
659+
EI->getExtSetKind() == SPIRVEIS_NonSemantic_Shader_DebugInfo_100 ||
659660
EI->getExtSetKind() == SPIRVEIS_NonSemantic_Kernel_DebugInfo_100) &&
660661
EI->getExtOp() != SPIRVDebug::Declare &&
661662
EI->getExtOp() != SPIRVDebug::Value &&

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVModule.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,8 @@ class SPIRVModule {
529529
return SPIRVEIS_Debug;
530530
case DebugInfoEIS::OpenCL_DebugInfo_100:
531531
return SPIRVEIS_OpenCL_DebugInfo_100;
532+
case DebugInfoEIS::NonSemantic_Shader_DebugInfo_100:
533+
return SPIRVEIS_NonSemantic_Shader_DebugInfo_100;
532534
case DebugInfoEIS::NonSemantic_Kernel_DebugInfo_100:
533535
return SPIRVEIS_NonSemantic_Kernel_DebugInfo_100;
534536
}

llvm-spirv/tools/llvm-spirv/llvm-spirv.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ static cl::opt<SPIRV::DebugInfoEIS> DebugEIS(
236236
"Emit debug info compliant with the OpenCL.DebugInfo.100 "
237237
"extended instruction set. This version of SPIR-V debug "
238238
"info format is compatible with the SPIRV-Tools"),
239+
clEnumValN(
240+
SPIRV::DebugInfoEIS::NonSemantic_Shader_DebugInfo_100,
241+
"nonsemantic-shader-100",
242+
"Emit debug info compliant with the "
243+
"NonSemantic.Shader.DebugInfo.100 extended instruction set. This "
244+
"version of SPIR-V debug info format is compatible with the rules "
245+
"regarding non-semantic instruction sets."),
239246
clEnumValN(
240247
SPIRV::DebugInfoEIS::NonSemantic_Kernel_DebugInfo_100,
241248
"nonsemantic-kernel-100",

0 commit comments

Comments
 (0)