Skip to content

Commit e80a21c

Browse files
authored
[intel] Fix test_debuginfo.py by using SPIRVOpts.setAllowExtraDIExpressionsEnabled (#5240)
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent b870f9b commit e80a21c

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

python/test/unit/test_debuginfo.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ def test_triton_debuginfo_on():
1515
diLocalVarKey = "LLVM_EXTRACT_DI_LOCAL_VARIABLES"
1616

1717
isEnvSet = lambda env, str: env.get(str, None) is not None
18-
hasOrigLineInfo = ( # noqa: F841
19-
not isEnvSet(os.environ, lineInfoKey) or os.environ[lineInfoKey].lower() not in ["on", "true", "1"])
18+
hasOrigLineInfo = (not isEnvSet(os.environ, lineInfoKey)
19+
or os.environ[lineInfoKey].lower() not in ["on", "true", "1"])
2020
envs = [
2121
# expect no dbginfo if unset
2222
{lineInfoKey: None, diLocalVarKey: None, "hasDbgInfo": False},
2323
# expect dbginfo based on parent proccess' TRITON_DISABLE_LINE_INFO
24-
# FIXME: enable after https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/3372 is fixed
25-
# {lineInfoKey: None, diLocalVarKey: "1", "hasDbgInfo": hasOrigLineInfo},
26-
# {lineInfoKey: "0", diLocalVarKey: "1", "hasDbgInfo": True},
24+
{lineInfoKey: None, diLocalVarKey: "1", "hasDbgInfo": hasOrigLineInfo},
25+
{lineInfoKey: "0", diLocalVarKey: "1", "hasDbgInfo": True},
2726
{lineInfoKey: "1", diLocalVarKey: "1", "hasDbgInfo": False},
2827
{lineInfoKey: "0", diLocalVarKey: "0", "hasDbgInfo": False},
2928
{lineInfoKey: "1", diLocalVarKey: "0", "hasDbgInfo": False},

third_party/intel/lib/Target/SPIRV/SPIRVTranslation.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ static SPIRV::TranslatorOpts getSPIRVOpts() {
132132
SPIRVOpts.setPreserveAuxData(false);
133133
SPIRVOpts.setSPIRVAllowUnknownIntrinsics({"llvm.genx.GenISA."});
134134

135+
int extraDIExpressions = 0;
136+
if (const char *extraDIExpressionsEnvVar =
137+
std::getenv("LLVM_EXTRACT_DI_LOCAL_VARIABLES")) {
138+
llvm::StringRef(extraDIExpressionsEnvVar)
139+
.getAsInteger(10, extraDIExpressions);
140+
SPIRVOpts.setAllowExtraDIExpressionsEnabled(true);
141+
}
142+
135143
for (auto &Ext : AllowedExtensions)
136144
SPIRVOpts.setAllowedToUseExtension(Ext, true);
137145
return SPIRVOpts;

0 commit comments

Comments
 (0)