Skip to content

Commit b799e7c

Browse files
stefan-iligcbot
authored andcommitted
Add GenericCastToPtrOpt pass
In cases where we have no local casts to generics and we allocate private memory in global space, we can replace GenericCastToPtrExplicit with simple address space cast.
1 parent 76b5b50 commit b799e7c

File tree

8 files changed

+244
-17
lines changed

8 files changed

+244
-17
lines changed

IGC/AdaptorOCL/UnifyIROCL.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ SPDX-License-Identifier: MIT
66
77
============================= end_copyright_notice ===========================*/
88

9-
#include <chrono>
10-
119
#include "common/LLVMWarningsPush.hpp"
1210
#include <llvm/Support/ScaledNumber.h>
13-
#include "llvm/ADT/PostOrderIterator.h"
1411
#include <llvm/IR/LLVMContext.h>
1512
#include <llvm/IR/Verifier.h>
1613
#include <llvm/Analysis/CFGPrinter.h>
@@ -41,6 +38,7 @@ SPDX-License-Identifier: MIT
4138
#include "Compiler/CISACodeGen/ShaderCodeGen.hpp"
4239
#include "Compiler/CISACodeGen/EstimateFunctionSize.h"
4340
#include "Compiler/CISACodeGen/FixAddrSpaceCast.h"
41+
#include "Compiler/Optimizer/OpenCLPasses/GenericCastToPtrOpt/GenericCastToPtrOpt.hpp"
4442
#include "Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GASResolving.h"
4543
#include "Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GASRetValuePropagator.h"
4644
#include "Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/StaticGASResolution.h"
@@ -63,35 +61,29 @@ SPDX-License-Identifier: MIT
6361
#include "Compiler/Optimizer/OpenCLPasses/PrepareInlineSamplerForBindless/PrepareInlineSamplerForBindless.hpp"
6462
#include "Compiler/Optimizer/OpenCLPasses/ResolveInlineSamplerForBindless/ResolveInlineSamplerForBindless.hpp"
6563
#include "Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryUsageAnalysis.hpp"
66-
#include "Compiler/Optimizer/OpenCLPasses/PrivateMemory/PrivateMemoryResolution.hpp"
6764
#include "Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantAnalysis.hpp"
6865
#include "Compiler/Optimizer/OpenCLPasses/ProgramScopeConstants/ProgramScopeConstantResolution.hpp"
6966
#include "Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncsAnalysis.hpp"
7067
#include "Compiler/Optimizer/OpenCLPasses/WIFuncs/WIFuncResolution.hpp"
7168
#include "Compiler/Optimizer/OpenCLPasses/ResourceAllocator/ResourceAllocator.hpp"
7269
#include "Compiler/Optimizer/OpenCLPasses/BreakConstantExpr/BreakConstantExpr.hpp"
7370
#include "Compiler/Optimizer/OpenCLPasses/LocalBuffers/InlineLocalsResolution.hpp"
74-
#include "Compiler/Optimizer/OpenCLPasses/ReplaceUnsupportedIntrinsics/ReplaceUnsupportedIntrinsics.hpp"
7571
#include "Compiler/Optimizer/OpenCLPasses/Atomics/ResolveOCLAtomics.hpp"
7672
#include "Compiler/Optimizer/OpenCLPasses/WGFuncs/WGFuncResolution.hpp"
7773
#include "Compiler/Optimizer/OpenCLPasses/AlignmentAnalysis/AlignmentAnalysis.hpp"
78-
#include "Compiler/Optimizer/PreCompiledFuncImport.hpp"
7974
#include "Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/InjectPrintf.hpp"
8075
#include "Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfAnalysis.hpp"
8176
#include "Compiler/Optimizer/OpenCLPasses/OpenCLPrintf/OpenCLPrintfResolution.hpp"
8277
#include "Compiler/Optimizer/OpenCLPasses/AggregateArguments/AggregateArguments.hpp"
8378
#include "Compiler/Optimizer/OCLBIConverter.h"
8479
#include "Compiler/Optimizer/OpenCLPasses/SetFastMathFlags/SetFastMathFlags.hpp"
8580
#include "Compiler/Optimizer/OpenCLPasses/CorrectlyRoundedDivSqrt/CorrectlyRoundedDivSqrt.hpp"
86-
#include "Compiler/Optimizer/OpenCLPasses/GenericAddressResolution/GenericAddressDynamicResolution.hpp"
87-
#include "Compiler/Optimizer/OpenCLPasses/AddressSpaceAliasAnalysis/AddressSpaceAliasAnalysis.h"
8881
#include "Compiler/Optimizer/OpenCLPasses/DeviceEnqueueFuncs/DeviceEnqueue.hpp"
8982
#include "Compiler/Optimizer/OpenCLPasses/UndefinedReferences/UndefinedReferencesPass.hpp"
9083
#include "Compiler/Optimizer/OpenCLPasses/SubGroupFuncs/SubGroupFuncsResolution.hpp"
9184
#include "Compiler/Optimizer/OpenCLPasses/BIFTransforms/BIFTransforms.hpp"
9285
#include "Compiler/Optimizer/OpenCLPasses/BreakdownIntrinsic/BreakdownIntrinsic.h"
9386
#include "Compiler/Optimizer/OpenCLPasses/TransformUnmaskedFunctionsPass/TransformUnmaskedFunctionsPass.h"
94-
#include "Compiler/Optimizer/OpenCLPasses/StatelessToStateful/StatelessToStateful.hpp"
9587
#include "Compiler/Optimizer/OpenCLPasses/KernelFunctionCloning/KernelFunctionCloning.h"
9688
#include "Compiler/Optimizer/OpenCLPasses/NontemporalLoadsAndStoresInAssert/NontemporalLoadsAndStoresInAssert.hpp"
9789
#include "Compiler/Optimizer/OpenCLPasses/HandleDevicelibAssert/HandleDevicelibAssert.hpp"
@@ -114,13 +106,10 @@ SPDX-License-Identifier: MIT
114106
#include "Compiler/Optimizer/OpenCLPasses/AccuracyDecoratedCallsBiFResolution/AccuracyDecoratedCallsBiFResolution.hpp"
115107
#include "Compiler/Optimizer/OpenCLPasses/ScalarArgAsPointer/ScalarArgAsPointer.hpp"
116108
#include "AdaptorCommon/RayTracing/RayTracingPasses.hpp"
117-
#include "Compiler/MetaDataApi/IGCMetaDataHelper.h"
118109
#include "Compiler/CodeGenContextWrapper.hpp"
119110
#include "Compiler/FixResourcePtr.hpp"
120-
#include "Compiler/InitializePasses.h"
121111
#include "Compiler/MetaDataApi/SpirMetaDataApi.h"
122112
#include "Compiler/Optimizer/ReduceOptPass.hpp"
123-
#include "Compiler/CustomUnsafeOptPass.hpp"
124113
#include "MoveStaticAllocas.h"
125114
#include "preprocess_spvir/PreprocessSPVIR.h"
126115
#include "preprocess_spvir/ConvertUserSemanticDecoratorOnFunctions.h"
@@ -137,20 +126,15 @@ SPDX-License-Identifier: MIT
137126

138127
#include "common/debug/Debug.hpp"
139128
#include "common/igc_regkeys.hpp"
140-
#include "common/debug/Dump.hpp"
141-
#include "common/MemStats.h"
142129

143130
#include <iStdLib/utility.h>
144131

145132
#include "Compiler/CISACodeGen/DebugInfo.hpp"
146133
#include "Compiler/CISACodeGen/TimeStatsCounter.h"
147134
#include "Compiler/DebugInfo/ScalarVISAModule.h"
148-
#include "Compiler/DebugInfo/Utils.h"
149135
#include "Compiler/Builtins/BIFFlagCtrl/BIFFlagCtrlResolution.hpp"
150-
#include "DebugInfo/VISADebugEmitter.hpp"
151136

152137
#include <string>
153-
#include <algorithm>
154138

155139
#include <Metrics/IGCMetric.h>
156140

@@ -400,6 +384,10 @@ static void CommonOCLBasedPasses(OpenCLProgramContext *pContext) {
400384
// mark load and stores inside assert calls as nontemporal to avoid caching.
401385
mpm.add(new NontemporalLoadsAndStoresInAssert());
402386

387+
if (IGC_IS_FLAG_ENABLED(EnableGenericCastToPtrOpt)) {
388+
mpm.add(new GenericCastToPtrOpt());
389+
}
390+
403391
// Report undef references after setting func attribs for import linking
404392
mpm.add(new UndefinedReferencesPass());
405393

IGC/Compiler/InitializePasses.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ void initializeErrorCheckPass(llvm::PassRegistry &);
6363
void initializePoisonFP64KernelsPass(llvm::PassRegistry &);
6464
void initializeReduceOptPassPass(llvm::PassRegistry &);
6565
void initializeTypesLegalizationPassPass(llvm::PassRegistry &);
66+
void initializeGenericCastToPtrOptPass(llvm::PassRegistry &);
6667
void initializeGASResolvingPass(llvm::PassRegistry &);
6768
void initializeGASRetValuePropagatorPass(llvm::PassRegistry &);
6869
void initializeStaticGASResolutionPass(llvm::PassRegistry &);

IGC/Compiler/Optimizer/OpenCLPasses/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ add_subdirectory(DpasFuncs)
2323
add_subdirectory(BfloatFuncs)
2424
add_subdirectory(ErrorCheckPass)
2525
add_subdirectory(ExtensionFuncs)
26+
add_subdirectory(GenericCastToPtrOpt)
2627
add_subdirectory(GEPLoopStrengthReduction)
2728
add_subdirectory(GenericAddressResolution)
2829
add_subdirectory(HandleDevicelibAssert)
@@ -82,6 +83,7 @@ set(IGC_BUILD__SRC__Optimizer_OpenCLPasses_All
8283
${IGC_BUILD__SRC__OpenCLPasses_BfloatFuncs}
8384
${IGC_BUILD__SRC__OpenCLPasses_ErrorCheckPass}
8485
${IGC_BUILD__SRC__OpenCLPasses_ExtensionFuncs}
86+
${IGC_BUILD__SRC__OpenCLPasses_GenericCastToPtrOpt}
8587
${IGC_BUILD__SRC__OpenCLPasses_GEPLoopStrengthReduction}
8688
${IGC_BUILD__SRC__OpenCLPasses_GenericAddressResolution}
8789
${IGC_BUILD__SRC__OpenCLPasses_HandleDevicelibAssert}
@@ -145,6 +147,7 @@ set(IGC_BUILD__HDR__Optimizer_OpenCLPasses_All
145147
${IGC_BUILD__HDR__OpenCLPasses_BfloatFuncs}
146148
${IGC_BUILD__HDR__OpenCLPasses_ErrorCheckPass}
147149
${IGC_BUILD__HDR__OpenCLPasses_ExtensionFuncs}
150+
${IGC_BUILD__HDR__OpenCLPasses_GenericCastToPtrOpt}
148151
${IGC_BUILD__HDR__OpenCLPasses_GEPLoopStrengthReduction}
149152
${IGC_BUILD__HDR__OpenCLPasses_GenericAddressResolution}
150153
${IGC_BUILD__HDR__OpenCLPasses_HandleDevicelibAssert}
@@ -209,6 +212,7 @@ set(IGC_BUILD_Compiler_OpenCLPasses_Groups
209212
Compiler__OpenCLPasses_BfloatFuncs
210213
Compiler__OpenCLPasses_ErrorCheckPass
211214
Compiler__OpenCLPasses_ExtensionFuncs
215+
Compiler__OpenCLPasses_GenericCastToPtrOpt
212216
Compiler__OpenCLPasses_GEPLoopStrengthReduction
213217
Compiler__OpenCLPasses_GenericAddressResolution
214218
Compiler__OpenCLPasses_GenericAddressSpaceStaticResolution
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#=========================== begin_copyright_notice ============================
2+
#
3+
# Copyright (C) 2025 Intel Corporation
4+
#
5+
# SPDX-License-Identifier: MIT
6+
#
7+
#============================ end_copyright_notice =============================
8+
9+
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
10+
11+
12+
set(IGC_BUILD__SRC__GenericCastToPtrOpt
13+
"${CMAKE_CURRENT_SOURCE_DIR}/GenericCastToPtrOpt.cpp"
14+
)
15+
set(IGC_BUILD__SRC__OpenCLPasses_GenericCastToPtrOpt ${IGC_BUILD__SRC__GenericCastToPtrOpt} PARENT_SCOPE)
16+
17+
set(IGC_BUILD__HDR__GenericCastToPtrOpt
18+
"${CMAKE_CURRENT_SOURCE_DIR}/GenericCastToPtrOpt.hpp"
19+
)
20+
set(IGC_BUILD__HDR__OpenCLPasses_GenericCastToPtrOpt ${IGC_BUILD__HDR__GenericCastToPtrOpt} PARENT_SCOPE)
21+
22+
23+
igc_sg_register(
24+
Compiler__OpenCLPasses_GenericCastToPtrOpt
25+
"GenericCastToPtrOpt"
26+
FILES
27+
${IGC_BUILD__SRC__GenericCastToPtrOpt}
28+
${IGC_BUILD__HDR__GenericCastToPtrOpt}
29+
)
30+
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/*========================== begin_copyright_notice ============================
2+
3+
Copyright (C) 2025 Intel Corporation
4+
5+
SPDX-License-Identifier: MIT
6+
7+
============================= end_copyright_notice ===========================*/
8+
9+
#include "Compiler/Optimizer/OpenCLPasses/GenericCastToPtrOpt/GenericCastToPtrOpt.hpp"
10+
11+
#include "common/LLVMWarningsPush.hpp"
12+
#include <llvm/ADT/SmallVector.h>
13+
#include <llvm/ADT/StringRef.h>
14+
#include <llvm/Analysis/CallGraph.h>
15+
#include <llvm/IR/Function.h>
16+
#include <llvm/IR/IRBuilder.h>
17+
#include <llvm/Pass.h>
18+
#include "common/LLVMWarningsPop.hpp"
19+
20+
#include "CISACodeGen/CastToGASAnalysis.h"
21+
#include "Probe/Assertion.h"
22+
#include "Compiler/IGCPassSupport.h"
23+
#include "llvmWrapper/ADT/Optional.h"
24+
25+
using namespace llvm;
26+
using namespace IGC;
27+
28+
#define PASS_FLAG "igc-generic-cast-to-ptr-opt"
29+
#define PASS_DESCRIPTION "Optimize GenericCastToPtrExplicit casts"
30+
#define PASS_CFG_ONLY false
31+
#define PASS_ANALYSIS false
32+
IGC_INITIALIZE_PASS_BEGIN(GenericCastToPtrOpt, PASS_FLAG, PASS_DESCRIPTION,
33+
PASS_CFG_ONLY, PASS_ANALYSIS)
34+
IGC_INITIALIZE_PASS_DEPENDENCY(CastToGASAnalysis)
35+
IGC_INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass)
36+
IGC_INITIALIZE_PASS_END(GenericCastToPtrOpt, PASS_FLAG, PASS_DESCRIPTION,
37+
PASS_CFG_ONLY, PASS_ANALYSIS)
38+
39+
char GenericCastToPtrOpt::ID = 0;
40+
41+
constexpr std::string_view GENERIC_CAST_TO_PTR_FN_NAME =
42+
"spirv_GenericCastToPtrExplicit_ToGlobal";
43+
44+
static void replaceGenericCastToPtrCall(CallInst *TargetFnCall) {
45+
IRBuilder<> Builder(TargetFnCall->getParent());
46+
Builder.SetInsertPoint(TargetFnCall);
47+
auto *AddrSpaceCast = Builder.CreateAddrSpaceCast(
48+
TargetFnCall->getArgOperand(0),
49+
TargetFnCall->getCalledFunction()->getReturnType(),
50+
"generic_cast_to_ptr");
51+
IGC_ASSERT(TargetFnCall->getCalledFunction()->getReturnType()->isPointerTy());
52+
IGC_ASSERT(TargetFnCall->getArgOperand(0)->getType()->isPointerTy());
53+
TargetFnCall->replaceAllUsesWith(AddrSpaceCast);
54+
TargetFnCall->eraseFromParent();
55+
56+
// Clean up the users of the address space cast
57+
auto *NewAddrSpaceCast = dyn_cast<AddrSpaceCastInst>(AddrSpaceCast);
58+
SmallVector<AddrSpaceCastInst *, 32> UsersToRemove;
59+
for (auto *User : NewAddrSpaceCast->users()) {
60+
if (auto *AddrSpaceCastUser = dyn_cast<AddrSpaceCastInst>(User)) {
61+
if (NewAddrSpaceCast->getSrcTy() == AddrSpaceCastUser->getDestTy()) {
62+
AddrSpaceCastUser->replaceAllUsesWith(NewAddrSpaceCast->getOperand(0));
63+
UsersToRemove.push_back(AddrSpaceCastUser);
64+
}
65+
}
66+
}
67+
for (auto *User : UsersToRemove) {
68+
User->eraseFromParent();
69+
}
70+
}
71+
72+
GenericCastToPtrOpt::GenericCastToPtrOpt() : ModulePass(ID) {
73+
initializeGenericCastToPtrOptPass(*PassRegistry::getPassRegistry());
74+
}
75+
76+
void GenericCastToPtrOpt::getAnalysisUsage(llvm::AnalysisUsage &AU) const {
77+
AU.addRequired<CastToGASAnalysis>();
78+
AU.addRequired<CallGraphWrapperPass>();
79+
80+
AU.setPreservesCFG();
81+
}
82+
83+
bool GenericCastToPtrOpt::runOnModule(Module &M) {
84+
if (skipModule(M)) {
85+
return false;
86+
}
87+
88+
CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph();
89+
GASInfo &GI = getAnalysis<CastToGASAnalysis>().getGASInfo();
90+
const bool noGenericPtToLocalOrPrivate =
91+
GI.isNoLocalToGenericOptionEnabled() &&
92+
GI.isPrivateAllocatedInGlobalMemory();
93+
94+
bool modified = false;
95+
96+
for (auto &[Fn, FnCallGraph] : CG) {
97+
if (!Fn || Fn->hasOptNone()) {
98+
continue;
99+
}
100+
101+
const bool noGenericPtToLocalOrPrivateFn =
102+
!GI.canGenericPointToLocal(*FnCallGraph->getFunction()) &&
103+
!GI.canGenericPointToPrivate(*FnCallGraph->getFunction());
104+
if (!noGenericPtToLocalOrPrivate && !noGenericPtToLocalOrPrivateFn) {
105+
continue;
106+
}
107+
108+
for (auto &[CallInstVH, CallRecordNode] : *FnCallGraph.get()) {
109+
// We check only direct calls
110+
auto CallInstVHOptional = IGCLLVM::makeOptional(CallInstVH);
111+
if (!CallInstVHOptional.has_value()) {
112+
continue;
113+
}
114+
auto *CallRecordFn = CallRecordNode->getFunction();
115+
if (CallRecordFn && CallRecordFn->getName().contains(llvm::StringRef(
116+
GENERIC_CAST_TO_PTR_FN_NAME.data(),
117+
GENERIC_CAST_TO_PTR_FN_NAME.size()))) {
118+
replaceGenericCastToPtrCall(cast<CallInst>(CallInstVHOptional.value()));
119+
modified = true;
120+
}
121+
}
122+
}
123+
return modified;
124+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*========================== begin_copyright_notice ============================
2+
3+
Copyright (C) 2025 Intel Corporation
4+
5+
SPDX-License-Identifier: MIT
6+
7+
============================= end_copyright_notice ===========================*/
8+
9+
#pragma once
10+
11+
#include "common/LLVMWarningsPush.hpp"
12+
#include <llvm/Pass.h>
13+
#include "common/LLVMWarningsPop.hpp"
14+
15+
using namespace llvm;
16+
17+
namespace IGC {
18+
/// @brief Optimizes GenericCastToPtrExplicit calls by replacing them with
19+
/// addrspace_cast instructions.
20+
class GenericCastToPtrOpt : public llvm::ModulePass {
21+
public:
22+
static char ID;
23+
24+
GenericCastToPtrOpt();
25+
26+
void getAnalysisUsage(llvm::AnalysisUsage &AU) const override;
27+
28+
StringRef getPassName() const override { return "GenericCastToPtrOpt"; }
29+
30+
bool runOnModule(llvm::Module &M) override;
31+
};
32+
33+
} // namespace IGC
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
;=========================== begin_copyright_notice ============================
2+
;
3+
; Copyright (C) 2025 Intel Corporation
4+
;
5+
; SPDX-License-Identifier: MIT
6+
;
7+
;============================ end_copyright_notice =============================
8+
; REQUIRES: regkeys
9+
; RUN: igc_opt --igc-generic-cast-to-ptr-opt --regkey EnableGenericCastToPtrOpt=1 -S %s --platformpvc | FileCheck %s
10+
; ------------------------------------------------
11+
; GenericCastToPtrOpt
12+
; ------------------------------------------------
13+
14+
; Check that calls to GenericCastToPtrExplicit_ToGlobal are correctly transformed to addrsspacecasts
15+
16+
declare spir_func void @testExternFn(i8 addrspace(1)* noundef)
17+
18+
declare spir_func i8 addrspace(3)* @__builtin_IB_to_local(i8 addrspace(4)* noundef)
19+
20+
declare spir_func i8* @__builtin_IB_to_private(i8 addrspace(4)* noundef)
21+
22+
define internal spir_func i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPU3AS4ci(i8 addrspace(4)* noundef %0, i32 noundef %1) {
23+
%3 = tail call spir_func i8 addrspace(3)* @__builtin_IB_to_local(i8 addrspace(4)* noundef %0) #18
24+
%4 = icmp eq i8 addrspace(3)* %3, null
25+
26+
%5 = tail call spir_func i8* @__builtin_IB_to_private(i8 addrspace(4)* noundef %0) #18
27+
%6 = icmp eq i8* %5, null
28+
29+
%7 = and i1 %4, %6
30+
%8 = addrspacecast i8 addrspace(4)* %0 to i8 addrspace(1)*
31+
%9 = select i1 %7, i8 addrspace(1)* %8, i8 addrspace(1)* null
32+
ret i8 addrspace(1)* %9
33+
}
34+
35+
; CHECK-LABEL: testFn
36+
; CHECK-NOT: %result = call spir_func i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPU3AS4ci(i8 addrspace(4)* %ptr, i32 0)
37+
; CHECK: %generic_cast_to_ptr = addrspacecast [[PTR:.*]] addrspace(4){{.*}} %ptr to [[PTR]] addrspace(1){{.*}}
38+
; CHECK: call spir_func void @testExternFn([[PTR]] addrspace(1){{.*}} %generic_cast_to_ptr)
39+
define spir_kernel void @testFn() {
40+
%ptr = inttoptr i64 0 to i8 addrspace(4)*
41+
%result = call spir_func i8 addrspace(1)* @_Z41__spirv_GenericCastToPtrExplicit_ToGlobalPU3AS4ci(i8 addrspace(4)* %ptr, i32 0)
42+
call spir_func void @testExternFn(i8 addrspace(1)* %result)
43+
ret void
44+
}

IGC/common/igc_flags.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,9 @@ DECLARE_IGC_REGKEY(bool, EnablePreRARematFlag, true, "Enable PreRA Rematerializa
989989
DECLARE_IGC_REGKEY(bool, EnableGASResolver, true, "Enable GAS Resolver", false)
990990
DECLARE_IGC_REGKEY(bool, EnableLowerGPCallArg, true, "Enable pass to lower generic pointers in function arguments",
991991
false)
992+
DECLARE_IGC_REGKEY(
993+
bool, EnableGenericCastToPtrOpt, true,
994+
"Enable simplification of GenericCastToPtrExplicit_ToGlobal calls", false)
992995
DECLARE_IGC_REGKEY(bool, DisableRecompilation, false, "Disable recompilation, skip retry stage", true)
993996
DECLARE_IGC_REGKEY(bool, SampleMultiversioning, false,
994997
"Create branches aroung samplers which can be redundant with some values", false)

0 commit comments

Comments
 (0)