Skip to content

Commit fc186d8

Browse files
matborzyszkowskiigcbot
authored andcommitted
Add flag to control dumping spvasm file
We need spvasm file only for debugging purposes, so we can disable it by default.
1 parent be76904 commit fc186d8

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
@@ -423,6 +423,7 @@ DECLARE_IGC_REGKEY(bool, DumpZEInfoToConsole, false, "Dump zeinfo to c
423423
DECLARE_IGC_REGKEY(debugString, ProgbinDumpFileName, 0, "Specify filename to use for dumping progbin file to current dir", true)
424424
DECLARE_IGC_REGKEY(bool, ElfDumpEnable, false, "dump ELF file", true)
425425
DECLARE_IGC_REGKEY(bool, ElfTempDumpEnable, false, "dump temporary ELF files", true)
426+
DECLARE_IGC_REGKEY(bool, SpvAsmDumpEnable, false, "Dump spvasm file", true)
426427
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)
427428
DECLARE_IGC_REGKEY(bool, ShowFullVectorsInShaderDumps, false, "print all elements of vectors in ShaderDumps, can dramatically increase ShaderDumps size", true)
428429
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
@@ -376,6 +376,7 @@ $ export IGC_ShaderDumpEnable=1
376376
| `DumpZEInfoToConsole` | Dump zeinfo to console | Available |
377377
| `ElfDumpEnable` | dump ELF file | Available |
378378
| `ElfTempDumpEnable` | dump temporary ELF files | Available |
379+
| `SpvAsmDumpEnable` | Dump spvasm file | Available |
379380
| `EnableCapsDump` | Enable hardware caps dump | Available |
380381
| `EnableCisDump` | Enable cis dump | Available |
381382
| `EnableCosDump` | Enable cos dump | Available |

0 commit comments

Comments
 (0)