Skip to content

Commit 173ad8a

Browse files
ppogotovigcbot
authored andcommitted
Enabling the TimeStatsPerPass option
Enabling the TimeStatsPerPass option
1 parent bbbac69 commit 173ad8a

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

IGC/AdaptorOCL/dllInterfaceCompute.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,7 @@ bool TranslateBuildSPMD(
17041704

17051705
COMPILER_TIME_END(&oclContext, TIME_TOTAL);
17061706

1707+
COMPILER_TIME_PER_PASS_PRINT(&oclContext, ShaderType::OPENCL_SHADER, oclContext.hash);
17071708
COMPILER_TIME_PRINT(&oclContext, ShaderType::OPENCL_SHADER, oclContext.hash);
17081709

17091710
COMPILER_TIME_DEL(&oclContext, m_compilerTimeStats);

IGC/Compiler/CISACodeGen/MemOpt2.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ char MemOpt2::ID = 0;
434434
FunctionPass *createMemOpt2Pass(int MLT) { return new MemOpt2(MLT); }
435435

436436
#define PASS_FLAG "igc-memopt2"
437-
#define PASS_DESC "IGC Memory Optimization, the 2nd"
437+
#define PASS_DESC "IGC Memory Optimization the 2nd"
438438
#define PASS_CFG_ONLY false
439439
#define PASS_ANALYSIS false
440440
IGC_INITIALIZE_PASS_BEGIN(MemOpt2, PASS_FLAG, PASS_DESC, PASS_CFG_ONLY,

IGC/common/Stats.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,6 @@ void TimeStats::printTime(ShaderType type, ShaderHash hash, void* context, UINT6
531531

532532
pp.printTimeCSV( shaderName, psoDDIHash);
533533

534-
// Skip printing PerPass info to CSV for now
535-
//pp.printPerPassTimeCSV( shaderName );
536534
// Avoid printing the timestats for each shader to screen
537535
// pp.printSumTimeTable(llvm::dbgs());
538536
}
@@ -572,6 +570,19 @@ void TimeStats::printSumTime() const
572570
pp.printSumTimeTable(llvm::dbgs());
573571
}
574572

573+
void TimeStats::printTimePerPass(ShaderType type, ShaderHash hash) const
574+
{
575+
TimeStats pp = postProcess();
576+
577+
std::string shaderName = IGC::Debug::DumpName(IGC::Debug::GetShaderOutputName()).Type(type).Hash(hash).StagedInfo(nullptr).str().c_str();
578+
if (shaderName.find_last_of("\\") != std::string::npos)
579+
{
580+
shaderName = shaderName.substr(shaderName.find_last_of("\\") + 1, shaderName.size());
581+
}
582+
583+
pp.printPerPassTimeCSV(shaderName);
584+
}
585+
575586
bool TimeStats::skipTimer( int i ) const
576587
{
577588
const COMPILE_TIME_INTERVALS interval = static_cast<COMPILE_TIME_INTERVALS>(i);

IGC/common/Stats.hpp

+15
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ class TimeStats
218218
void printTime( ShaderType type, ShaderHash hash, UINT64 psoDDIHash) const;
219219
void printTime( ShaderType type, ShaderHash hash, void* context, UINT64 psoDDIHash) const;
220220

221+
void printTimePerPass( ShaderType type, ShaderHash hash ) const;
222+
221223
/// Print the aggregated times for multiple shaders
222224
void printSumTime() const;
223225
/// Print the times for all passes
@@ -426,6 +428,19 @@ class TimeStats
426428
} \
427429
} while (0)
428430

431+
#define COMPILER_TIME_PER_PASS_PRINT( pointer, ...) \
432+
do \
433+
{ \
434+
if( (pointer) && (pointer)->m_compilerTimeStats ) \
435+
{ \
436+
if ( IGC_REGKEY_OR_FLAG_ENABLED(DumpTimeStatsPerPass, TIME_STATS_PER_PASS ) ) \
437+
{ \
438+
(pointer)->m_compilerTimeStats->printTimePerPass( \
439+
__VA_ARGS__ ); \
440+
} \
441+
} \
442+
} while (0)
443+
429444
#else // GET_TIME_STATS
430445

431446
# define COMPILER_TIME_START( pointer, value ) do { } while (0)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*========================== begin_copyright_notice ============================
2+
3+
Copyright (C) 2024 Intel Corporation
4+
5+
SPDX-License-Identifier: MIT
6+
7+
============================= end_copyright_notice ===========================*/
8+
9+
// REQUIRES: regkeys, pvc-supported
10+
11+
// RUN: ocloc compile -file %s -options "-igc_opts 'DumpToCurrentDir=1 DumpTimeStatsPerPass=1'" -device pvc
12+
// RUN: FileCheck %s --input-file=TimeStatPerPass_Shaders.csv --check-prefixes=CHECK
13+
// CHECK: Frequency
14+
15+
// This test checks that DumpTimeStatsPerPass option works correctly.
16+
__kernel void foo(int a, int b, __global int *res) { *res = a + b; }

0 commit comments

Comments
 (0)