Skip to content

Commit 392d9d7

Browse files
bowenxue-inteligcbot
authored andcommitted
Enable WaveAllJointReduction for 32-bit types
Turn on the WaveAllJointReduction optimization for 32-bit types (int and float) Add regkey that disables the optimization for 64-bit types
1 parent ae0b4a8 commit 392d9d7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

IGC/Compiler/Optimizer/WaveAllJointReduction.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ SPDX-License-Identifier: MIT
66
77
============================= end_copyright_notice ===========================*/
88

9+
#include <igc_regkeys.hpp>
10+
911
#include <GenISAIntrinsics/GenIntrinsicInst.h>
1012
#include "WaveAllJointReduction.hpp"
1113
#include "Compiler/IGCPassSupport.h"
14+
1215
#include "common/LLVMWarningsPush.hpp"
1316
#include <llvm/IR/InstVisitor.h>
1417
#include <llvm/ADT/SmallVector.h>
@@ -93,6 +96,12 @@ void WaveAllJointReductionImpl::visitCallInst( CallInst& callInst )
9396
return;
9497
}
9598

99+
// Disable joint reduction optimization for >32-bit WaveAll operations
100+
if (waveAllInst->getType()->getScalarSizeInBits() > 32) {
101+
if (IGC_IS_FLAG_DISABLED(EnableWaveAllJointReduction64Bit))
102+
return;
103+
}
104+
96105
SmallVector<WaveAllIntrinsic*, 16> mergeList{ waveAllInst };
97106

98107
// For locality, only look at consecutive instructions since non-consecutive instructions may require sinking the final vector WaveAll instruction to where the last joined WaveAll is to satisfy proper domination of each WaveAll's Src

IGC/common/igc_flags.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ DECLARE_IGC_REGKEY(bool, DisableLoopSplitWidePHIs, false, "Disable splitting of
344344
DECLARE_IGC_REGKEY(bool, EnableBarrierControlFlowOptimizationPass, false, "Enable barrier control flow optimization pass", false)
345345
DECLARE_IGC_REGKEY(bool, EnableWaveShuffleIndexSinking, true, "Hoist identical instructions operating on WaveShuffleIndex instructions with the same source and a constant lane/channel", false)
346346
DECLARE_IGC_REGKEY(DWORD, WaveShuffleIndexSinkingMaxIterations, 3, "Max number of iterations to run iterative WaveShuffleIndexSinking", false)
347-
DECLARE_IGC_REGKEY(bool, EnableWaveAllJointReduction, false, "Enable Joint Reduction Optimization.", false)
347+
DECLARE_IGC_REGKEY(bool, EnableWaveAllJointReduction, true, "Enable Joint Reduction Optimization.", false)
348+
DECLARE_IGC_REGKEY(bool, EnableWaveAllJointReduction64Bit, false, "Enable Joint Reduction Optimization for 64-bit data types (i64, double).", false)
348349
DECLARE_IGC_REGKEY(bool, EnablePromoteToPredicatedMemoryAccess, false, "Enable predicated load/store if conversion.", true)
349350
DECLARE_IGC_REGKEY(bool, EnableIntDivRemIncrementReduction, true, "Enable consecutive Int DivRem increment by constant optimization", false)
350351
DECLARE_IGC_REGKEY(bool, DivRemIncrementCondBranchSimplify, false, "Create branches when simplifying consecutive udiv/urem groups increment dividend by constant greater than 1", false)

0 commit comments

Comments
 (0)