Skip to content

Commit 7d5a1e8

Browse files
Konstantin Vladimirovigcbot
authored andcommitted
Support for critical shader dump while translating from SPIRV
1 parent 657547c commit 7d5a1e8

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

IGC/VectorCompiler/igcdeps/src/TranslationInterface.cpp

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ static void adjustPlatform(const IGC::CPlatform &IGCPlatform,
148148
auto &PlatformInfo = IGCPlatform.getPlatformInfo();
149149
unsigned RevId = PlatformInfo.usRevId;
150150
Opts.CPUStr = cmc::getPlatformStr(PlatformInfo, /* inout */ RevId);
151+
Opts.RevId = RevId;
151152
Opts.WATable = std::make_unique<WA_TABLE>(IGCPlatform.getWATable());
152153
}
153154

@@ -381,6 +382,26 @@ static llvm::Optional<vc::ExternalData> fillExternalData() {
381382
return std::move(ExtData);
382383
}
383384

385+
static void dumpPlatform(const vc::CompileOptions &Opts, PLATFORM Platform,
386+
vc::ShaderDumper &Dumper) {
387+
#if defined(_DEBUG) || defined(_INTERNAL)
388+
if (!IGC_IS_FLAG_ENABLED(ShaderDumpEnable))
389+
return;
390+
391+
std::ostringstream Os;
392+
auto Core = Platform.eDisplayCoreFamily;
393+
auto RenderCore = Platform.eRenderCoreFamily;
394+
auto Product = Platform.eProductFamily;
395+
auto RevId = Platform.usRevId;
396+
397+
Os << "NEO passed: DisplayCore = " << Core << ", RenderCore = " << RenderCore
398+
<< ", Product = " << Product << ", Revision = " << RevId << "\n";
399+
Os << "IGC translated into: " << Opts.CPUStr << ", " << Opts.RevId << "\n";
400+
401+
Dumper.dumpText(Os.str(), "platform.be.txt");
402+
#endif
403+
}
404+
384405
std::error_code vc::translateBuild(const TC::STB_TranslateInputArgs *InputArgs,
385406
TC::STB_TranslateOutputArgs *OutputArgs,
386407
TC::TB_DATA_FORMAT InputDataFormatTemp,
@@ -418,7 +439,11 @@ std::error_code vc::translateBuild(const TC::STB_TranslateInputArgs *InputArgs,
418439
BuildDiag Diag;
419440
vc::CompileOptions &Opts = ExpOptions.get();
420441
adjustOptions(IGCPlatform, InputDataFormatTemp, Opts, Diag);
421-
442+
443+
// here we have Opts set and can dump what we got from runtime and how
444+
// we understood it
445+
dumpPlatform(Opts, IGCPlatform.getPlatformInfo(), *Dumper);
446+
422447
if (IGC_IS_FLAG_ENABLED(ShaderOverride))
423448
Opts.ShaderOverrider =
424449
vc::createVC_IGCShaderOverrider(Hash, IGCPlatform.getPlatformInfo());

IGC/VectorCompiler/include/vc/GenXCodeGen/GenXWrapper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ enum class BinaryKind { CM, OpenCL, ZE };
6767
struct CompileOptions {
6868
FileType FType = FileType::SPIRV;
6969
std::string CPUStr;
70+
int RevId;
7071
std::unique_ptr<WA_TABLE> WATable = nullptr;
7172
// Optional shader dumper.
7273
std::unique_ptr<ShaderDumper> Dumper = nullptr;

0 commit comments

Comments
 (0)