Skip to content

Commit c5c21e1

Browse files
mnaczkigcbot
authored andcommitted
Limit Vec Element in ShaderDump
1 parent bc9a467 commit c5c21e1

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

IGC/common/MDFrameWork.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ IN THE SOFTWARE.
3333
#include "common/LLVMWarningsPop.hpp"
3434

3535
#include "StringMacros.hpp"
36+
#include "common/igc_regkeys.hpp"
3637

3738
#include <iostream>
3839

@@ -187,6 +188,16 @@ MDNode* CreateNode(const std::vector<val> &vec, Module* module, StringRef name)
187188
for (auto it = vec.begin(); it != vec.end(); ++it)
188189
{
189190
nodes.push_back(CreateNode(*(it), module, name.str() + "Vec[" + std::to_string(i++) + "]"));
191+
if (IGC_IS_FLAG_DISABLED(ShowFullVectorsInShaderDumps) && i > MAX_VECTOR_SIZE_TO_PRINT_IN_SHADER_DUMPS)
192+
{
193+
std::string warningMessage = "ShaderDumpEnable Warning! " + name.str() + "Vec[] has " + std::to_string(vec.size())
194+
+ " elements. Including first " + std::to_string(MAX_VECTOR_SIZE_TO_PRINT_IN_SHADER_DUMPS)
195+
+ " items in ShaderDumps. To print all elements set ShowFullVectorsInShaderDumps register flag to True. "
196+
+ "ShaderOverride flag may not work properly without ShowFullVectorsInShaderDumps enabled.";
197+
printf("%s\n\n", warningMessage.c_str());
198+
nodes.push_back(CreateNode(false, module, warningMessage + " ShowFullVectorsInShaderDumps currently equals"));
199+
break;
200+
}
190201
}
191202
MDNode* node = MDNode::get(module->getContext(), nodes);
192203
return node;

IGC/common/MDFrameWork.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const unsigned int INPUT_RESOURCE_SLOT_COUNT = 128;
4646
const unsigned int NUM_SHADER_RESOURCE_VIEW_SIZE = (INPUT_RESOURCE_SLOT_COUNT + 1) / 64;
4747

4848
const unsigned int g_c_maxNumberOfBufferPushed = 4;
49+
static const int MAX_VECTOR_SIZE_TO_PRINT_IN_SHADER_DUMPS = 1000;
4950

5051
namespace IGC
5152
{

IGC/common/igc_flags.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ DECLARE_IGC_REGKEY(bool, QualityMetricsEnable, false, "Enable Quality M
244244
DECLARE_IGC_REGKEY(bool, ShaderDumpEnable, false, "dump LLVM IR, visaasm, and GenISA", true)
245245
DECLARE_IGC_REGKEY(bool, ElfDumpEnable, false, "dump ELF file", true)
246246
DECLARE_IGC_REGKEY(bool, ShaderDumpEnableAll, false, "dump all LLVM IR passes, visaasm, and GenISA", true)
247+
DECLARE_IGC_REGKEY(bool, ShowFullVectorsInShaderDumps, false, "print all elements of vectors in ShaderDumps, can dramatically increase ShaderDumps size", true)
247248
DECLARE_IGC_REGKEY(debugString, PrintAfter, 0, "Take either all or comma/semicolon-separated list of pass names. If set, enable print LLVM IR after the given pass is done (mimic llvm print-after)", true)
248249
DECLARE_IGC_REGKEY(debugString, PrintBefore, 0, "Take either all or comma/semicolon-separated list of pass names. If set, enable print LLVM IR before the given pass is done (mimic llvm print-before)", true)
249250
DECLARE_IGC_REGKEY(bool, InterleaveSourceShader, true, "Interleave the source shader in asm dump", true)

0 commit comments

Comments
 (0)