Skip to content

Commit 90eaf9f

Browse files
jgu222igcbot
authored andcommitted
Minor change on usage message
1 parent 4589f8d commit 90eaf9f

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

IGC/AdaptorOCL/dllInterfaceCompute.cpp

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ void DumpShaderFile(
345345
const char* pBuffer,
346346
const UINT bufferSize,
347347
const QWORD hash,
348-
const std::string& ext)
348+
const std::string& ext,
349+
std::string* fileName = nullptr)
349350
{
350351
if (pBuffer && bufferSize > 0)
351352
{
@@ -366,6 +367,11 @@ void DumpShaderFile(
366367
fwrite(pBuffer, 1, bufferSize, pFile);
367368
fclose(pFile);
368369
}
370+
371+
if (fileName != nullptr)
372+
{
373+
*fileName = fullPath.str();
374+
}
369375
}
370376
}
371377

@@ -879,16 +885,18 @@ bool TranslateBuild(
879885

880886
if (IGC_IS_FLAG_ENABLED(ShaderDumpEnable))
881887
{
888+
std::string iof, of, inputf; // filenames for internal_options.txt, options.txt, and .spv/.bc
889+
882890
const char *pOutputFolder = IGC::Debug::GetShaderOutputFolder();
883891
QWORD hash = inputShHash.getAsmHash();
884892

885893
if (inputDataFormatTemp == TB_DATA_FORMAT_LLVM_BINARY)
886894
{
887-
DumpShaderFile(pOutputFolder, (char *)pInputArgs->pInput, pInputArgs->InputSize, hash, ".bc");
895+
DumpShaderFile(pOutputFolder, (char *)pInputArgs->pInput, pInputArgs->InputSize, hash, ".bc", &inputf);
888896
}
889897
else if (inputDataFormatTemp == TB_DATA_FORMAT_SPIR_V)
890898
{
891-
DumpShaderFile(pOutputFolder, (char *)pInputArgs->pInput, pInputArgs->InputSize, hash, ".spv");
899+
DumpShaderFile(pOutputFolder, (char *)pInputArgs->pInput, pInputArgs->InputSize, hash, ".spv", &inputf);
892900
#if defined(IGC_SPIRV_TOOLS_ENABLED)
893901
spv_text spirvAsm = nullptr;
894902
if (DisassembleSPIRV(pInputArgs->pInput, pInputArgs->InputSize, &spirvAsm) == SPV_SUCCESS)
@@ -899,8 +907,24 @@ bool TranslateBuild(
899907
#endif // defined(IGC_SPIRV_TOOLS_ENABLED)
900908
}
901909

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");
904928
}
905929

906930
if (!ParseInput(pKernelModule, pInputArgs, pOutputArgs, *llvmContext, inputDataFormatTemp))

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ bool supportMSAARateInPayload() const
140140
bool support16BitImmSrcForMad() const {
141141
return (m_platformInfo.eRenderCoreFamily >= IGFX_GEN10_CORE);
142142
}
143+
PRODUCT_FAMILY GetProductFamily() const { return m_platformInfo.eProductFamily; }
144+
unsigned short GetRevId() const { return m_platformInfo.usRevId; }
143145
GFXCORE_FAMILY GetPlatformFamily() const { return m_platformInfo.eRenderCoreFamily; }
144146
const PLATFORM& getPlatformInfo() const { return m_platformInfo; }
145147
void SetCaps(const SCompilerHwCaps& caps) { m_caps = caps; }

0 commit comments

Comments
 (0)