Skip to content

Commit 0798e27

Browse files
pkwasnie-inteligcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 8ae4499
Add GEP Loop Strength Reduction pass Adds new optimization pass reducing strength of GEP instructions in loop. Xe architecture doesn't have native support for access from "base pointer plus offset". Codegen must translate GEP instruction "getelementptr %constantPointer, %variableOffset" to "(long long)pointer + offset*sizeof(*pointer)", generating additional mov/add/shl instructions. If GEP is inside a loop and offset is incremented in constant steps, it is beneficial to change GEP into induction variable "getelementptr %variablePointer, %constantOffset". This change adds new pass translating code: int id = get_global_id(0); for (int i = 32; i < n_iters - 32; i += 32) { output[id + i] = output[id + i + 32] * output[id + i - 32]; } Into: int id = get_global_id(0); global float* outputm32 = output + id; for (int i = 32; i < n_iters - 32; i += 32, outputm32 += 32) { *(outputm32 + 32) = *(outputm32 + 64) * *outputm32; }
1 parent adacd04 commit 0798e27

25 files changed

+6
-2610
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ SPDX-License-Identifier: MIT
8383
#include "Compiler/Optimizer/OpenCLPasses/UnreachableHandling/UnreachableHandling.hpp"
8484
#include "Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.hpp"
8585
#include "Compiler/Optimizer/OpenCLPasses/ScalarArgAsPointer/ScalarArgAsPointer.hpp"
86-
#include "Compiler/Optimizer/OpenCLPasses/GEPLoopStrengthReduction/GEPLoopStrengthReduction.hpp"
8786
#include "Compiler/Optimizer/MCSOptimization.hpp"
8887
#include "Compiler/Optimizer/GatingSimilarSamples.hpp"
8988
#include "Compiler/Optimizer/IntDivConstantReduction.hpp"
@@ -356,15 +355,6 @@ static void UpdateInstTypeHint(CodeGenContext& ctx)
356355
// forward declaration
357356
llvm::ModulePass* createPruneUnusedArgumentsPass();
358357

359-
static bool useStatelessToStateful(CodeGenContext& ctx)
360-
{
361-
return (ctx.m_instrTypes.hasLoadStore &&
362-
ctx.m_DriverInfo.SupportsStatelessToStatefulBufferTransformation() &&
363-
!ctx.getModuleMetaData()->compOpt.GreaterThan4GBBufferRequired &&
364-
IGC_IS_FLAG_ENABLED(EnableStatelessToStateful) &&
365-
!ctx.m_instrTypes.hasInlineAsmPointerAccess);
366-
}
367-
368358
void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSignature* pSignature)
369359
{
370360
COMPILER_TIME_START(&ctx, TIME_CG_Add_Legalization_Passes);
@@ -715,7 +705,12 @@ void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSignature
715705
mpm.add(new PromoteStatelessToBindless());
716706
}
717707

718-
if (!isOptDisabled && useStatelessToStateful(ctx))
708+
if (!isOptDisabled &&
709+
ctx.m_instrTypes.hasLoadStore &&
710+
ctx.m_DriverInfo.SupportsStatelessToStatefulBufferTransformation() &&
711+
!ctx.getModuleMetaData()->compOpt.GreaterThan4GBBufferRequired &&
712+
IGC_IS_FLAG_ENABLED(EnableStatelessToStateful) &&
713+
!ctx.m_instrTypes.hasInlineAsmPointerAccess)
719714
{
720715
mpm.add(new StatelessToStateful());
721716
}
@@ -1490,15 +1485,6 @@ void OptimizeIR(CodeGenContext* const pContext)
14901485
mpm.add(createSROAPass());
14911486
}
14921487
}
1493-
1494-
if (pContext->type == ShaderType::OPENCL_SHADER &&
1495-
pContext->platform.isCoreChildOf(IGFX_XE_HPC_CORE) &&
1496-
!useStatelessToStateful(*pContext) &&
1497-
pContext->m_retryManager.IsFirstTry())
1498-
{
1499-
mpm.add(createGEPLoopStrengthReductionPass(IGC_IS_FLAG_ENABLED(allowLICM) &&
1500-
pContext->m_retryManager.AllowLICM()));
1501-
}
15021488
}
15031489

15041490
// Note:

IGC/Compiler/InitializePasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ void initializeGenericAddressAnalysisPass(llvm::PassRegistry&);
6666
void initializeGenericAddressDynamicResolutionPass(llvm::PassRegistry&);
6767
void initializeGenFDIVEmulationPass(llvm::PassRegistry&);
6868
void initializeGenIRLoweringPass(llvm::PassRegistry&);
69-
void initializeGEPLoopStrengthReductionPass(llvm::PassRegistry&);
7069
void initializeGEPLoweringPass(llvm::PassRegistry&);
7170
void initializeGenSpecificPatternPass(llvm::PassRegistry&);
7271
void initializeGreedyLiveRangeReductionPass(llvm::PassRegistry&);

IGC/Compiler/Optimizer/OpenCLPasses/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ add_subdirectory(DeviceEnqueueFuncs)
2020
add_subdirectory(DisableLoopUnrollOnRetry)
2121
add_subdirectory(ExtensionFuncs)
2222
add_subdirectory(GenericAddressResolution)
23-
add_subdirectory(GEPLoopStrengthReduction)
2423
add_subdirectory(ImageFuncs)
2524
add_subdirectory(LocalBuffers)
2625
add_subdirectory(NamedBarriers)
@@ -71,7 +70,6 @@ set(IGC_BUILD__SRC__Optimizer_OpenCLPasses_All
7170
${IGC_BUILD__SRC__OpenCLPasses_DpasFuncs}
7271
${IGC_BUILD__SRC__OpenCLPasses_ExtensionFuncs}
7372
${IGC_BUILD__SRC__OpenCLPasses_GenericAddressResolution}
74-
${IGC_BUILD__SRC__OpenCLPasses_GEPLoopStrengthReduction}
7573
${IGC_BUILD__SRC__OpenCLPasses_ImageFuncs}
7674
${IGC_BUILD__SRC__OpenCLPasses_LocalBuffers}
7775
${IGC_BUILD__SRC__OpenCLPasses_LowerLocalMemPool}
@@ -127,7 +125,6 @@ set(IGC_BUILD__HDR__Optimizer_OpenCLPasses_All
127125
${IGC_BUILD__HDR__OpenCLPasses_DpasFuncs}
128126
${IGC_BUILD__HDR__OpenCLPasses_ExtensionFuncs}
129127
${IGC_BUILD__HDR__OpenCLPasses_GenericAddressResolution}
130-
${IGC_BUILD__HDR__OpenCLPasses_GEPLoopStrengthReduction}
131128
${IGC_BUILD__HDR__OpenCLPasses_ImageFuncs}
132129
${IGC_BUILD__HDR__OpenCLPasses_LocalBuffers}
133130
${IGC_BUILD__HDR__OpenCLPasses_LowerLocalMemPool}
@@ -176,7 +173,6 @@ set(IGC_BUILD_Compiler_OpenCLPasses_Groups
176173
Compiler__OpenCLPasses_ExtensionFuncs
177174
Compiler__OpenCLPasses_GenericAddressResolution
178175
Compiler__OpenCLPasses_GenericAddressSpaceStaticResolution
179-
Compiler__OpenCLPasses_GEPLoopStrengthReduction
180176
Compiler__OpenCLPasses_ImageFuncs
181177
Compiler__OpenCLPasses_LocalBuffers
182178
Compiler__OpenCLPasses_LowerLocalMemPool

IGC/Compiler/Optimizer/OpenCLPasses/GEPLoopStrengthReduction/CMakeLists.txt

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

0 commit comments

Comments
 (0)