@@ -345,7 +345,8 @@ void DumpShaderFile(
345
345
const char * pBuffer,
346
346
const UINT bufferSize,
347
347
const QWORD hash,
348
- const std::string& ext)
348
+ const std::string& ext,
349
+ std::string* fileName = nullptr )
349
350
{
350
351
if (pBuffer && bufferSize > 0 )
351
352
{
@@ -366,6 +367,11 @@ void DumpShaderFile(
366
367
fwrite (pBuffer, 1 , bufferSize, pFile);
367
368
fclose (pFile);
368
369
}
370
+
371
+ if (fileName != nullptr )
372
+ {
373
+ *fileName = fullPath.str ();
374
+ }
369
375
}
370
376
}
371
377
@@ -879,16 +885,18 @@ bool TranslateBuild(
879
885
880
886
if (IGC_IS_FLAG_ENABLED (ShaderDumpEnable))
881
887
{
888
+ std::string iof, of, inputf; // filenames for internal_options.txt, options.txt, and .spv/.bc
889
+
882
890
const char *pOutputFolder = IGC::Debug::GetShaderOutputFolder ();
883
891
QWORD hash = inputShHash.getAsmHash ();
884
892
885
893
if (inputDataFormatTemp == TB_DATA_FORMAT_LLVM_BINARY)
886
894
{
887
- DumpShaderFile (pOutputFolder, (char *)pInputArgs->pInput , pInputArgs->InputSize , hash, " .bc" );
895
+ DumpShaderFile (pOutputFolder, (char *)pInputArgs->pInput , pInputArgs->InputSize , hash, " .bc" , &inputf );
888
896
}
889
897
else if (inputDataFormatTemp == TB_DATA_FORMAT_SPIR_V)
890
898
{
891
- DumpShaderFile (pOutputFolder, (char *)pInputArgs->pInput , pInputArgs->InputSize , hash, " .spv" );
899
+ DumpShaderFile (pOutputFolder, (char *)pInputArgs->pInput , pInputArgs->InputSize , hash, " .spv" , &inputf );
892
900
#if defined(IGC_SPIRV_TOOLS_ENABLED)
893
901
spv_text spirvAsm = nullptr ;
894
902
if (DisassembleSPIRV (pInputArgs->pInput , pInputArgs->InputSize , &spirvAsm) == SPV_SUCCESS)
@@ -899,8 +907,24 @@ bool TranslateBuild(
899
907
#endif // defined(IGC_SPIRV_TOOLS_ENABLED)
900
908
}
901
909
902
- DumpShaderFile (pOutputFolder, (char *)pInputArgs->pInternalOptions , pInputArgs->InternalOptionsSize , hash, " _internal_options.txt" );
903
- DumpShaderFile (pOutputFolder, (char *)pInputArgs->pOptions , pInputArgs->OptionsSize , hash, " _options.txt" );
910
+ DumpShaderFile (pOutputFolder, (char *)pInputArgs->pInternalOptions , pInputArgs->InternalOptionsSize , hash, " _internal_options.txt" , &iof);
911
+ DumpShaderFile (pOutputFolder, (char *)pInputArgs->pOptions , pInputArgs->OptionsSize , hash, " _options.txt" , &of);
912
+
913
+ // dump cmd file that has igcstandalone command to compile this kernel.
914
+ std::ostringstream cmdfile;
915
+ cmdfile << " igcstandalone -api ocl"
916
+ << " -prod " << IGCPlatform.GetProductFamily ()
917
+ << " -step " << IGCPlatform.GetRevId ()
918
+ << " -inputcs " << inputf;
919
+ if (of.size () > 0 )
920
+ {
921
+ cmdfile << " -foptions " << of;
922
+ }
923
+ if (iof.size () > 0 )
924
+ {
925
+ cmdfile << " -finternal_options " << iof;
926
+ }
927
+ DumpShaderFile (pOutputFolder, cmdfile.str ().c_str (), cmdfile.str ().size (), hash, " _cmd.txt" );
904
928
}
905
929
906
930
if (!ParseInput (pKernelModule, pInputArgs, pOutputArgs, *llvmContext, inputDataFormatTemp))
0 commit comments