Skip to content

Commit 9cf5a0b

Browse files
jmechalasigcbot
authored andcommitted
Tooling changes in vISA Backend
Tooling changes in vISA Backend to streamline debugging and testing.
1 parent ae382b7 commit 9cf5a0b

File tree

6 files changed

+30
-13
lines changed

6 files changed

+30
-13
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4618,7 +4618,7 @@ void CEncoder::InitEncoder(bool canAbortOnSpill, bool hasStackCall, bool hasInli
46184618

46194619
std::string kernelName = std::string(m_program->entry->getName());
46204620
std::string asmName;
4621-
if (m_enableVISAdump || context->m_instrTypes.hasDebugInfo) {
4621+
if (m_enableVISAdump || vbuilder->GetOption(vISA_ShaderStatsDumpless) || context->m_instrTypes.hasDebugInfo) {
46224622
asmName = GetDumpFileName("asm");
46234623
} else {
46244624
asmName = "kernel.asm";

visa/BinaryEncodingIGA.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,16 +1619,11 @@ SendDesc BinaryEncodingIGA::encodeExDescImm(G4_INST *sendInst,
16191619
const G4_Operand *exDescG4 = sendInst->getSrc(3);
16201620
const G4_SendDescRaw *descG4 = (G4_SendDescRaw *)sendInst->getMsgDesc();
16211621
vISA_ASSERT(descG4 != nullptr, "expected raw descriptor");
1622-
if (sendInst->getBuilder().getOption(vISA_ShaderDataBaseStats)) {
1622+
if (sendInst->getBuilder().getOption(vISA_ShaderStatsDumpless)) {
16231623
auto JitInfo = kernel.fg.builder->getJitInfo();
16241624
JitInfo->sendInfo.src0Vec.push_back(descG4->getSrc0LenRegs());
16251625
JitInfo->sendInfo.src1Vec.push_back(descG4->getSrc1LenRegs());
16261626
JitInfo->sendInfo.destVec.push_back(descG4->getDstLenRegs());
1627-
printSendDataToFile(descG4->getSrc0LenRegs(),
1628-
descG4->getSrc1LenRegs(),
1629-
descG4->getDstLenRegs(),
1630-
sendInst->getBuilder().getOptions()->getOptionCstr(
1631-
vISA_ShaderDataBaseStatsFilePath));
16321627
}
16331628

16341629
sdos.xlen = (int)descG4->extMessageLength();
@@ -1684,16 +1679,11 @@ SendDesc BinaryEncodingIGA::encodeExDescRegA0(G4_INST *sendInst,
16841679
G4_Operand *exDescG4 = sendInst->getSrc(3);
16851680
const G4_SendDescRaw *descG4 = sendInst->getMsgDescRaw();
16861681
vISA_ASSERT(descG4 != nullptr, "expected raw descriptor");
1687-
if (sendInst->getBuilder().getOption(vISA_ShaderDataBaseStats)) {
1682+
if (sendInst->getBuilder().getOption(vISA_ShaderStatsDumpless)) {
16881683
auto JitInfo = kernel.fg.builder->getJitInfo();
16891684
JitInfo->sendInfo.src0Vec.push_back(descG4->getSrc0LenRegs());
16901685
JitInfo->sendInfo.src1Vec.push_back(descG4->getSrc1LenRegs());
16911686
JitInfo->sendInfo.destVec.push_back(descG4->getDstLenRegs());
1692-
printSendDataToFile(descG4->getSrc0LenRegs(),
1693-
descG4->getSrc1LenRegs(),
1694-
descG4->getDstLenRegs(),
1695-
sendInst->getBuilder().getOptions()->getOptionCstr(
1696-
vISA_ShaderDataBaseStatsFilePath));
16971687
}
16981688
SendDesc exDescIga;
16991689
exDescIga.type = SendDesc::Kind::REG32A;

visa/BuildCISAIR.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ class CISA_IR_Builder : public VISABuilder {
7878
VISA_BUILDER_API int GetuInt32Option(vISAOptions option) override {
7979
return m_options.getuInt32Option(option);
8080
}
81+
VISA_BUILDER_API bool GetOption(vISAOptions option) override {
82+
return m_options.getOption(option);
83+
}
8184
VISA_BUILDER_API void SetOption(vISAOptions option, bool val) override {
8285
m_options.setOption(option, val);
8386
}

visa/VISAKernelImpl.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ SPDX-License-Identifier: MIT
3434
#include "KernelCost.hpp"
3535
#include "include/RelocationInfo.h"
3636
#include "visa_igc_common_header.h"
37+
#ifdef _WIN32
38+
#include "inc/common/DriverStore.h"
39+
#endif
3740

3841
#include <cctype>
3942
#include "common/LLVMWarningsPush.hpp"
@@ -468,6 +471,24 @@ void *VISAKernelImpl::encodeAndEmit(unsigned int &binarySize) {
468471
dumpPerfStatsInJson(m_asmName);
469472
}
470473

474+
#ifdef _WIN32
475+
if (m_options->getOption(vISA_ShaderStatsDumpless)) {
476+
typedef void(__stdcall* PFNOPENWRAPPERDLL)(
477+
void* buf, size_t buf_size, char* dump_stem, char* platform,
478+
void* sendinfo, size_t sendinfo_size);
479+
HMODULE handle = LoadDependency("WrapperLib.dll");
480+
if (handle) {
481+
auto OpenWrapper =
482+
(PFNOPENWRAPPERDLL)GetProcAddress(handle, "process_buffer");
483+
if (OpenWrapper) {
484+
OpenWrapper(binary, binarySize, (char*)m_asmName.c_str(),
485+
(char*)m_kernel->getGenxPlatformString(),
486+
&m_jitInfo->sendInfo, sizeof(m_jitInfo->sendInfo));
487+
}
488+
}
489+
}
490+
#endif
491+
471492
return binary;
472493
}
473494

visa/include/VISABuilderAPIDefinition.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,7 @@ class VISABuilder {
13151315
bool emit_visa_only = false) = 0;
13161316

13171317
VISA_BUILDER_API virtual int GetuInt32Option(vISAOptions option) = 0;
1318+
VISA_BUILDER_API virtual bool GetOption(vISAOptions option) = 0;
13181319
VISA_BUILDER_API virtual void SetOption(vISAOptions option, bool val) = 0;
13191320
VISA_BUILDER_API virtual void SetOption(vISAOptions option, uint32_t val) = 0;
13201321
VISA_BUILDER_API virtual void SetOption(vISAOptions option,

visa/include/VISAOptionsDefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ DEF_VISA_OPTION(vISA_DumpPerfStatsVerbose, ET_BOOL, "-dumpVISAJsonStatsVerbose",
4343
"dump the verbose stats to default json file name", false)
4444
DEF_VISA_OPTION(vISA_DumpSendInfoStats, ET_BOOL, "-dumpVISASendInfoStats",
4545
"dumps the sendinfo stats with the stats.json file", false)
46+
DEF_VISA_OPTION(vISA_ShaderStatsDumpless, ET_BOOL, "-noDumpShaderStats",
47+
"executes pathway for no dumping and running shader stats", false)
4648
DEF_VISA_OPTION(VISA_FullIRVerify, ET_BOOL, "-fullIRVerify", UNUSED, false)
4749
// dump each option while it is being set by setOption()
4850
DEF_VISA_OPTION(vISA_dumpVISAOptions, ET_BOOL, "-dumpVisaOptions", UNUSED,

0 commit comments

Comments
 (0)