Skip to content

Commit 937b607

Browse files
michalkr52igcbot
authored andcommitted
Force support and usage for dynamic BTIs allocation
Refactored conditions based on the supportDynamicBTIsAllocation() condition, as if it was always true. It depended on ZEBinary format usage, which is always used.
1 parent d0a9af7 commit 937b607

File tree

4 files changed

+9
-36
lines changed

4 files changed

+9
-36
lines changed

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -554,13 +554,6 @@ class CPlatform {
554554
return m_platformInfo.eRenderCoreFamily == IGFX_XE_HPC_CORE && IGC_IS_FLAG_ENABLED(EnableQWRotateInstructions);
555555
}
556556

557-
// Some workloads use handcrafted ISA kernels and generate patch tokens for them by compiling a
558-
// dummy kernel. They depend on static BTIs allocation in IGC, that's why dynamic allocation
559-
// can't be enabled by default for all platforms. That is not an issue when ZEBin is enabled by
560-
// default since a workload can generate ZEBin sections by itself, without depending on a dummy kernel
561-
// compilation by IGC.
562-
bool supportDynamicBTIsAllocation() const { return supportsZEBin(); }
563-
564557
bool supportsZEBin() const {
565558
switch (m_platformInfo.eProductFamily) {
566559
default:

IGC/Compiler/Optimizer/OpenCLPasses/ResourceAllocator/ResourceAllocator.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,10 @@ bool ResourceAllocator::runOnFunction(llvm::Function &F) {
296296
break;
297297

298298
case AllocationTypeEnum::Other:
299-
if (ctx->platform.supportDynamicBTIsAllocation()) {
300-
// Use default arg allocator for UAV resources
301-
// Intentionally not allocating index here, since it will
302-
// be done in StatelessToSatefull or PromoteStatelessToBindless
303-
argAlloc = defaultArgAlloc;
304-
} else {
305-
argAlloc.type = ResourceTypeEnum::UAVResourceType;
306-
argAlloc.indexType = numUAVs;
307-
numUAVs++;
308-
}
299+
// Use default arg allocator for UAV resources
300+
// Intentionally not allocating index here, since it will
301+
// be done in StatelessToStateful or PromoteStatelessToBindless
302+
argAlloc = defaultArgAlloc;
309303
break;
310304

311305
default:

IGC/Compiler/Optimizer/OpenCLPasses/StatelessToStateful/StatelessToStateful.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ void StatelessToStateful::promote() {
887887
if (m_promotionMap.empty())
888888
return;
889889

890-
CodeGenContext *ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
891890
ModuleMetaData *modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
892891
FunctionMetaData *funcMD = &modMD->FuncMD[m_F];
893892
ResourceAllocMD *resAllocMD = &funcMD->resAllocMD;
@@ -905,15 +904,8 @@ void StatelessToStateful::promote() {
905904
setModuleUsesBindless();
906905
} else {
907906
ArgAllocMD *argAlloc = &resAllocMD->argAllocMDList[baseArgIndex];
908-
909-
// If the support for dynamic BTIs allocation is disabled, then BTIs are pre-assigned
910-
// in ResourceAllocator pass for all resources independently whether they are
911-
// accessed through stateful addressing model or not.
912-
if (ctx->platform.supportDynamicBTIsAllocation()) {
913-
argAlloc->type = ResourceTypeEnum::UAVResourceType;
914-
argAlloc->indexType = resAllocMD->uavsNumType + bufferPos;
915-
}
916-
907+
argAlloc->type = ResourceTypeEnum::UAVResourceType;
908+
argAlloc->indexType = resAllocMD->uavsNumType + bufferPos;
917909
statefullAddrspace = encodeBindfulAddrspace(argAlloc->indexType);
918910
}
919911

IGC/Compiler/PromoteStatelessToBindless.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ void PromoteStatelessToBindless::GetAccessInstToSrcPointerMap(Instruction *inst,
141141
}
142142

143143
void PromoteStatelessToBindless::PromoteStatelessToBindlessBuffers(Function &F) const {
144-
CodeGenContext *ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
145144
ModuleMetaData *modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
146145
MetaDataUtils *pMdUtils = getAnalysis<MetaDataUtilsWrapper>().getMetaDataUtils();
147146
ImplicitArgs implicitArgs(F, pMdUtils);
@@ -152,8 +151,6 @@ void PromoteStatelessToBindless::PromoteStatelessToBindlessBuffers(Function &F)
152151
FunctionMetaData *funcMD = &modMD->FuncMD[&F];
153152
ResourceAllocMD *resourceAlloc = &funcMD->resAllocMD;
154153

155-
bool supportDynamicBTIsAllocation = ctx->platform.supportDynamicBTIsAllocation() && ctx->enableZEBinary();
156-
157154
for (auto &iter : m_SrcPtrToAccessMap) {
158155
Argument *srcPtr = cast<Argument>(iter.first);
159156

@@ -176,10 +173,8 @@ void PromoteStatelessToBindless::PromoteStatelessToBindlessBuffers(Function &F)
176173
continue;
177174
}
178175

179-
if (supportDynamicBTIsAllocation) {
180-
argInfo->indexType = resourceAlloc->uavsNumType +
181-
(unsigned)std::distance(m_SrcPtrToAccessMap.begin(), m_SrcPtrToAccessMap.find(srcPtr));
182-
}
176+
argInfo->indexType = resourceAlloc->uavsNumType +
177+
(unsigned)std::distance(m_SrcPtrToAccessMap.begin(), m_SrcPtrToAccessMap.find(srcPtr));
183178

184179
// Loop through all access instructions for srcPtr
185180
for (auto &insts : iter.second) {
@@ -238,6 +233,5 @@ void PromoteStatelessToBindless::PromoteStatelessToBindlessBuffers(Function &F)
238233
}
239234
}
240235

241-
if (supportDynamicBTIsAllocation)
242-
resourceAlloc->uavsNumType += m_SrcPtrToAccessMap.size();
236+
resourceAlloc->uavsNumType += m_SrcPtrToAccessMap.size();
243237
}

0 commit comments

Comments
 (0)