Skip to content

Commit 3c12558

Browse files
matborzyszkowskipszymich
authored andcommitted
Add flag to control dumping spvasm file
We need spvasm file only for debugging purposes, so we can disable it by default. (cherry picked from commit fc186d8)
1 parent d88c4f6 commit 3c12558

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

IGC/AdaptorOCL/dllInterfaceCompute.cpp

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,20 @@ bool ProcessElfInput(
607607
DumpShaderFile(pOutputFolder, pSPIRVBitcode, size, hash, suffix + ".spv");
608608

609609
#if defined(IGC_SPIRV_TOOLS_ENABLED)
610-
spv_text spirvAsm = nullptr;
611-
// Similarly replace any spvasm dump from GetSpecConstantsInfo
612-
std::string prevSpvAsmPath = pOutputFolder;
613-
prevSpvAsmPath += "OCL_asm" + spvHashString + ".spvasm";
614-
llvm::sys::fs::remove(prevSpvAsmPath);
615-
if (DisassembleSPIRV(pSPIRVBitcode, size, &spirvAsm) == SPV_SUCCESS)
610+
if (IGC_IS_FLAG_ENABLED(SpvAsmDumpEnable))
616611
{
617-
DumpShaderFile(pOutputFolder, spirvAsm->str, spirvAsm->length, hash, suffix + ".spvasm");
612+
spv_text spirvAsm = nullptr;
613+
// Similarly replace any spvasm dump from GetSpecConstantsInfo
614+
std::string prevSpvAsmPath = pOutputFolder;
615+
prevSpvAsmPath += "OCL_asm" + spvHashString + ".spvasm";
616+
llvm::sys::fs::remove(prevSpvAsmPath);
617+
if (DisassembleSPIRV(pSPIRVBitcode, size, &spirvAsm) == SPV_SUCCESS)
618+
{
619+
DumpShaderFile(pOutputFolder, spirvAsm->str, spirvAsm->length, hash, suffix + ".spvasm");
620+
}
621+
spvTextDestroy(spirvAsm);
618622
}
619-
spvTextDestroy(spirvAsm);
623+
620624
#endif // defined(IGC_SPIRV_TOOLS_ENABLED)
621625
}
622626
}
@@ -1313,12 +1317,15 @@ bool TranslateBuildSPMD(
13131317
{
13141318
DumpShaderFile(pOutputFolder, pInputArgs->pInput, pInputArgs->InputSize, hash, ".spv", &inputf);
13151319
#if defined(IGC_SPIRV_TOOLS_ENABLED)
1316-
spv_text spirvAsm = nullptr;
1317-
if (DisassembleSPIRV(pInputArgs->pInput, pInputArgs->InputSize, &spirvAsm) == SPV_SUCCESS)
1320+
if (IGC_IS_FLAG_ENABLED(SpvAsmDumpEnable))
13181321
{
1319-
DumpShaderFile(pOutputFolder, spirvAsm->str, spirvAsm->length, hash, ".spvasm");
1322+
spv_text spirvAsm = nullptr;
1323+
if (DisassembleSPIRV(pInputArgs->pInput, pInputArgs->InputSize, &spirvAsm) == SPV_SUCCESS)
1324+
{
1325+
DumpShaderFile(pOutputFolder, spirvAsm->str, spirvAsm->length, hash, ".spvasm");
1326+
}
1327+
spvTextDestroy(spirvAsm);
13201328
}
1321-
spvTextDestroy(spirvAsm);
13221329
#endif // defined(IGC_SPIRV_TOOLS_ENABLED)
13231330
}
13241331

IGC/common/igc_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ DECLARE_IGC_REGKEY(bool, DumpZEInfoToConsole, false, "Dump zeinfo to c
417417
DECLARE_IGC_REGKEY(debugString, ProgbinDumpFileName, 0, "Specify filename to use for dumping progbin file to current dir", true)
418418
DECLARE_IGC_REGKEY(bool, ElfDumpEnable, false, "dump ELF file", true)
419419
DECLARE_IGC_REGKEY(bool, ElfTempDumpEnable, false, "dump temporary ELF files", true)
420+
DECLARE_IGC_REGKEY(bool, SpvAsmDumpEnable, false, "Dump spvasm file", true)
420421
DECLARE_IGC_REGKEY(debugString, DebugDumpNamePrefix, 0, "Set a prefix to debug info dump filenames(with path) and drop hash info from them (for testing purposes)", true)
421422
DECLARE_IGC_REGKEY(bool, ShowFullVectorsInShaderDumps, false, "print all elements of vectors in ShaderDumps, can dramatically increase ShaderDumps size", true)
422423
DECLARE_IGC_REGKEY(bool, PrintHexFloatInShaderDumpAsm, true, "print floats in hex in asm dump", true)

documentation/configuration_flags.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ $ export IGC_ShaderDumpEnable=1
375375
| `DumpZEInfoToConsole` | Dump zeinfo to console | Available |
376376
| `ElfDumpEnable` | dump ELF file | Available |
377377
| `ElfTempDumpEnable` | dump temporary ELF files | Available |
378+
| `SpvAsmDumpEnable` | Dump spvasm file | Available |
378379
| `EnableCapsDump` | Enable hardware caps dump | Available |
379380
| `EnableCisDump` | Enable cis dump | Available |
380381
| `EnableCosDump` | Enable cos dump | Available |

0 commit comments

Comments
 (0)