Skip to content

Commit 395bd13

Browse files
committed
[Autobackout][FuncReg]Revert of change: 7d5dfab
Add AnnotateUniformAllocas pass - second attempt. Change-Id: I0d88c7dd5a36c39122c211a5813a58ce0d8ccf81
1 parent 7d5dfab commit 395bd13

File tree

6 files changed

+12
-150
lines changed

6 files changed

+12
-150
lines changed

IGC/Compiler/CISACodeGen/AnnotateUniformAllocas.cpp

Lines changed: 0 additions & 77 deletions
This file was deleted.

IGC/Compiler/CISACodeGen/AnnotateUniformAllocas.h

Lines changed: 0 additions & 63 deletions
This file was deleted.

IGC/Compiler/CISACodeGen/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
44
set(IGC_BUILD__SRC__CISACodeGen_Common
55
"${CMAKE_CURRENT_SOURCE_DIR}/AdvCodeMotion.cpp"
66
"${CMAKE_CURRENT_SOURCE_DIR}/AdvMemOpt.cpp"
7-
"${CMAKE_CURRENT_SOURCE_DIR}/AnnotateUniformAllocas.cpp"
87
"${CMAKE_CURRENT_SOURCE_DIR}/BlockCoalescing.cpp"
98
"${CMAKE_CURRENT_SOURCE_DIR}/CheckInstrTypes.cpp"
109
"${CMAKE_CURRENT_SOURCE_DIR}/CISABuilder.cpp"
@@ -95,7 +94,6 @@ set(IGC_BUILD__SRC__Compiler_CISACodeGen
9594
set(IGC_BUILD__HDR__CISACodeGen_Common
9695
"${CMAKE_CURRENT_SOURCE_DIR}/AdvCodeMotion.h"
9796
"${CMAKE_CURRENT_SOURCE_DIR}/AdvMemOpt.h"
98-
"${CMAKE_CURRENT_SOURCE_DIR}/AnnotateUniformAllocas.h"
9997
"${CMAKE_CURRENT_SOURCE_DIR}/BlockCoalescing.hpp"
10098
"${CMAKE_CURRENT_SOURCE_DIR}/CheckInstrTypes.hpp"
10199
"${CMAKE_CURRENT_SOURCE_DIR}/CISABuilder.hpp"

IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2727
#include "Compiler/CodeGenContextWrapper.hpp"
2828
#include "Compiler/MetaDataUtilsWrapper.h"
2929
#include "Compiler/CISACodeGen/RegisterPressureEstimate.hpp"
30+
#include "Compiler/CISACodeGen/WIAnalysis.hpp"
3031
#include "common/LLVMUtils.h"
3132
#include "Compiler/CISACodeGen/LowerGEPForPrivMem.hpp"
3233
#include "Compiler/CodeGenPublic.h"
@@ -69,6 +70,7 @@ namespace IGC {
6970
AU.addRequired<RegisterPressureEstimate>();
7071
AU.addRequired<MetaDataUtilsWrapper>();
7172
AU.addRequired<CodeGenContextWrapper>();
73+
AU.addRequired<WIAnalysis>();
7274
AU.addRequired<DominatorTreeWrapperPass>();
7375
AU.setPreservesCFG();
7476
}
@@ -250,7 +252,14 @@ bool LowerGEPForPrivMem::IsNativeType(Type* type)
250252

251253
bool LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst* pAlloca)
252254
{
253-
bool isUniformAlloca = pAlloca->getMetadata("uniform") != nullptr;
255+
auto WI = &getAnalysis<WIAnalysis>();
256+
bool isUniformAlloca = WI->whichDepend(pAlloca) == WIAnalysis::UNIFORM;
257+
if (isUniformAlloca)
258+
{
259+
IRBuilder<> builder(pAlloca);
260+
MDNode* node = MDNode::get(pAlloca->getContext(), ConstantAsMetadata::get(builder.getInt1(true)));
261+
pAlloca->setMetadata("uniform", node);
262+
}
254263
unsigned int allocaSize = extractAllocaSize(pAlloca);
255264
unsigned int allowedAllocaSizeInBytes = MAX_ALLOCA_PROMOTE_GRF_NUM * 4;
256265

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
161161
#include "Compiler/Optimizer/IGCInstCombiner/IGCInstructionCombining.hpp"
162162
#include "DebugInfo.hpp"
163163
#include "Compiler/CISACodeGen/HalfPromotion.h"
164-
#include "Compiler/CISACodeGen/AnnotateUniformAllocas.h"
165164
#include "Probe/Assertion.h"
166165

167166
/***********************************************************************************
@@ -461,17 +460,14 @@ namespace IGC
461460
// Resolve the Private memory to register pass
462461
if (!isOptDisabled)
463462
{
464-
mpm.add(createBreakCriticalEdgesPass());
465-
mpm.add(createAnnotateUniformAllocasPass());
466-
467463
if (IGC_IS_FLAG_DISABLED(DisablePromotePrivMem) &&
468464
ctx.m_instrTypes.hasNonPrimitiveAlloca &&
469465
ctx.m_retryManager.AllowPromotePrivateMemory())
470466
{
467+
mpm.add(createBreakCriticalEdgesPass());
471468
mpm.add(createPromotePrivateArrayToReg());
469+
mpm.add(createCFGSimplificationPass());
472470
}
473-
474-
mpm.add(createCFGSimplificationPass());
475471
mpm.add(createPromoteMemoryToRegisterPass());
476472
}
477473
else

IGC/Compiler/InitializePasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ namespace llvm {
3232
// The following declarations are placed according to alphabetic order for simplicity
3333
void initializeAddImplicitArgsPass(llvm::PassRegistry&);
3434
void initializeAddressSpaceAliasAnalysisPass(llvm::PassRegistry&);
35-
void initializeAnnotateUniformAllocasPass(llvm::PassRegistry&);
3635
void initializeAggregateArgumentsAnalysisPass(llvm::PassRegistry&);
3736
void initializeAlignmentAnalysisPass(llvm::PassRegistry&);
3837
void initializePreBIImportAnalysisPass(llvm::PassRegistry&);

0 commit comments

Comments
 (0)