Skip to content

Commit 4db165d

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: Add new implicit arg for OpenCL inline sampler in bindless mode
To support OpenCL inline sampler in bindless mode, a new implicit arg `inlineSampler` is added for each unique inline sampler. The arg passes bindless offset of its sampler state into the kernel. Therefore, a new zeinfo payload argument `inline_sampler` is added for the implicit arg. The payload argument has an entry `sampler_index` that is used for looking up inline sampler entry in `inline_samplers` section of zeinfo. For example, payload_arguments: - arg_type: inline_sampler offset: 60 size: 4 addrmode: bindless addrspace: sampler sampler_index: 1 inline_samplers: - sampler_index: 1 addrmode: none filtermode: nearest
1 parent 2ae4dd8 commit 4db165d

File tree

31 files changed

+120
-470
lines changed

31 files changed

+120
-470
lines changed

IGC/AdaptorCommon/AddImplicitArgs.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace IGC
5353
/// @brief Provides name of pass
5454
virtual llvm::StringRef getPassName() const override
5555
{
56-
return "AddImplicitArgs";
56+
return "AddImplictArgs";
5757
}
5858

5959
virtual void getAnalysisUsage(llvm::AnalysisUsage &AU) const override

IGC/AdaptorCommon/ImplicitArgs.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ static const std::vector<ImplicitArg> IMPLICIT_ARGS = {
6262
ImplicitArg(ImplicitArg::SAMPLER_ADDRESS, "smpAddress", ImplicitArg::INT, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_DWORD, true),
6363
ImplicitArg(ImplicitArg::SAMPLER_NORMALIZED, "smpNormalized", ImplicitArg::INT, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_DWORD, true),
6464
ImplicitArg(ImplicitArg::SAMPLER_SNAP_WA, "smpSnapWA", ImplicitArg::INT, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_DWORD, true),
65-
ImplicitArg(ImplicitArg::INLINE_SAMPLER, "inlineSampler", ImplicitArg::INT, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_DWORD, true),
6665
ImplicitArg(ImplicitArg::FLAT_IMAGE_BASEOFFSET, "flatImageBaseoffset", ImplicitArg::LONG, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_QWORD, true),
6766
ImplicitArg(ImplicitArg::FLAT_IMAGE_HEIGHT, "flatImageHeight", ImplicitArg::INT, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_DWORD, true),
6867
ImplicitArg(ImplicitArg::FLAT_IMAGE_WIDTH, "flatImageWidth", ImplicitArg::INT, WIAnalysis::UNIFORM_GLOBAL, 1, ImplicitArg::ALIGN_DWORD, true),
@@ -649,27 +648,6 @@ bool ImplicitArgs::isImplicitStruct(ImplicitArg::ArgType argType)
649648
return (argType >= ImplicitArg::STRUCT_START) && (argType <= ImplicitArg::STRUCT_END);
650649
}
651650

652-
bool ImplicitArgs::isImplicitArg(Argument *arg) const
653-
{
654-
unsigned argSize = arg->getParent()->arg_size();
655-
unsigned numImplicitArgs = size();
656-
IGC_ASSERT_MESSAGE(argSize >= numImplicitArgs, "Function arg size does not match meta data args.");
657-
unsigned argNo = arg->getArgNo();
658-
return argNo >= (argSize - numImplicitArgs);
659-
}
660-
661-
int ImplicitArgs::getExplicitArgNumForArg(Argument *implicitArg) const
662-
{
663-
unsigned argSize = implicitArg->getParent()->arg_size();
664-
unsigned numImplicitArgs = size();
665-
IGC_ASSERT_MESSAGE(argSize >= numImplicitArgs, "Function arg size does not match meta data args.");
666-
unsigned argNo = implicitArg->getArgNo();
667-
IGC_ASSERT_MESSAGE(argNo >= (argSize - numImplicitArgs), "The arg should be implicit arg");
668-
unsigned implicitArgIndex = argNo - (argSize - numImplicitArgs);
669-
ArgInfoMetaDataHandle argInfo = m_funcInfoMD->getImplicitArgInfoListItem(implicitArgIndex);
670-
return argInfo->getExplicitArgNum();
671-
}
672-
673651
ImplicitArg::ArgType ImplicitArgs::getArgType(unsigned int index) const {
674652
IGC_ASSERT_MESSAGE((index < size()), "Index out of range");
675653
ArgInfoMetaDataHandle argInfo = m_funcInfoMD->getImplicitArgInfoListItem(index);

IGC/AdaptorCommon/ImplicitArgs.hpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ namespace IGC
8181
SAMPLER_ADDRESS,
8282
SAMPLER_NORMALIZED,
8383
SAMPLER_SNAP_WA,
84-
INLINE_SAMPLER,
8584
FLAT_IMAGE_BASEOFFSET,
8685
FLAT_IMAGE_HEIGHT,
8786
FLAT_IMAGE_WIDTH,
@@ -363,14 +362,6 @@ namespace IGC
363362
/// @param argType The argument type to check.
364363
static bool isImplicitStruct(ImplicitArg::ArgType argType);
365364

366-
/// @brief Returns true if the given argument is an implicit argument.
367-
/// @param arg The argument to check.
368-
bool isImplicitArg(llvm::Argument *arg) const;
369-
370-
/// @brief Returns explicit argument number associated with the given implicit argument.
371-
/// @param implicitArg The associated implicit argument.
372-
int getExplicitArgNumForArg(llvm::Argument *implicitArg) const;
373-
374365
llvm::Value* getImplicitArgValue(llvm::Function& F, ImplicitArg::ArgType argType, const IGCMD::MetaDataUtils* pMdUtils);
375366

376367
private:

IGC/Compiler/CISACodeGen/OpenCLKernelCodeGen.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,19 +1307,6 @@ namespace IGC
13071307
break;
13081308
}
13091309

1310-
case KernelArg::ArgType::IMPLICIT_INLINE_SAMPLER: {
1311-
uint32_t arg_idx = kernelArg->getAssociatedArgNo();
1312-
ResourceAllocMD& resAllocMD = GetContext()->getModuleMetaData()->FuncMD[entry].resAllocMD;
1313-
auto it = llvm::find_if(resAllocMD.inlineSamplersMD, [&](auto &inlineSamplerMD) {
1314-
return inlineSamplerMD.m_Value == arg_idx;
1315-
});
1316-
IGC_ASSERT_MESSAGE(it != resAllocMD.inlineSamplersMD.end(), "Inline sampler isn't found in metadata.");
1317-
zebin::ZEInfoBuilder::addPayloadArgumentImplicitInlineSampler(
1318-
m_kernelInfo.m_zePayloadArgs, zebin::PreDefinedAttrGetter::ArgType::inline_sampler, payloadPosition,
1319-
kernelArg->getAllocateSize(), it->index);
1320-
break;
1321-
}
1322-
13231310
case KernelArg::ArgType::IMPLICIT_BUFFER_OFFSET: {
13241311
zebin::zeInfoPayloadArgument& arg = zebin::ZEInfoBuilder::addPayloadArgumentImplicit(m_kernelInfo.m_zePayloadArgs,
13251312
zebin::PreDefinedAttrGetter::ArgType::buffer_offset,

IGC/Compiler/Optimizer/OCLBIUtils.cpp

Lines changed: 40 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@ SPDX-License-Identifier: MIT
1515
#include "llvmWrapper/IR/IRBuilder.h"
1616
#include "llvmWrapper/IR/Instructions.h"
1717
#include "common/LLVMWarningsPop.hpp"
18-
#include "AdaptorCommon/ImplicitArgs.hpp"
1918
#include "LLVM3DBuilder/BuiltinsFrontend.hpp"
2019
#include "Probe/Assertion.h"
2120
#include "IGC/common/StringMacros.hpp"
22-
#include <llvm/Support/Casting.h>
2321

2422
using namespace llvm;
2523
using namespace IGC;
@@ -251,7 +249,7 @@ Argument* CImagesBI::CImagesUtils::findImageFromBufferPtr(const MetaDataUtils& M
251249
return nullptr;
252250
}
253251

254-
static bool isSYCLBindlessImageLoad(Value *v)
252+
static bool isBindlessImageLoad(Value *v)
255253
{
256254
auto *load = dyn_cast<LoadInst>(v);
257255
if (!load)
@@ -272,7 +270,7 @@ ConstantInt* CImagesBI::CImagesUtils::getImageIndex(
272270
{
273271
ConstantInt* imageIndex = nullptr;
274272

275-
imageParam = ValueTracker::track(pCallInst, paramIndex, nullptr, nullptr, isSYCLBindlessImageLoad);
273+
imageParam = ValueTracker::track(pCallInst, paramIndex, nullptr, nullptr, isBindlessImageLoad);
276274
IGC_ASSERT(imageParam);
277275
IGC_ASSERT(isa<Argument>(imageParam) || isa<LoadInst>(imageParam));
278276
int i = (*pParamMap)[imageParam].index;
@@ -282,7 +280,7 @@ ConstantInt* CImagesBI::CImagesUtils::getImageIndex(
282280

283281
BufferType CImagesBI::CImagesUtils::getImageType(ParamMap* pParamMap, CallInst* pCallInst, unsigned int paramIndex)
284282
{
285-
Value *imageParam = ValueTracker::track(pCallInst, paramIndex, nullptr, nullptr, isSYCLBindlessImageLoad);
283+
Value *imageParam = ValueTracker::track(pCallInst, paramIndex, nullptr, nullptr, isBindlessImageLoad);
286284
IGC_ASSERT(imageParam);
287285
IGC_ASSERT(isa<Argument>(imageParam) || isa<LoadInst>(imageParam));
288286
return isa<LoadInst>(imageParam) ? BufferType::BINDLESS : (*pParamMap)[imageParam].type;
@@ -441,104 +439,62 @@ class COCL_sample : public CImagesBI
441439
}
442440
return false;
443441
};
444-
Value* samplerValue = ValueTracker::track(m_pCallInst, 1, m_pMdUtils, m_modMD, isBindlessSampler);
445-
if (!samplerValue) {
442+
Value* samplerParam = ValueTracker::track(m_pCallInst, 1, m_pMdUtils, m_modMD, isBindlessSampler);
443+
if (!samplerParam) {
446444
emitError("There are instructions that use a sampler, but no sampler found in the kernel!", m_pCallInst);
447445
return nullptr;
448446
}
449447

450448
auto modMD = m_pCodeGenContext->getModuleMetaData();
451449

452-
auto addToInlineSamplersMD = [&](int samplerConstantVal)
453-
{
454-
// Is this sampler already allocated?
455-
auto iter = m_pInlineMap->find(samplerConstantVal);
456-
if (iter != m_pInlineMap->end())
457-
{
458-
return ConstantInt::get(m_pIntType, iter->second);
459-
}
460-
461-
// No, allocate it.
462-
int currSamplerIdx = (*m_pNextSampler)++;
463-
(*m_pInlineMap)[samplerConstantVal] = currSamplerIdx;
464-
samplerIndex = ConstantInt::get(m_pIntType, currSamplerIdx);
465-
466-
// Push this information into the metadata, for the state processor's benefit
467-
FunctionMetaData& funcMD = m_modMD->FuncMD[m_pFunc];
468-
ResourceAllocMD& resAllocMD = funcMD.resAllocMD;
469-
InlineSamplersMD inlineSamplerMD;
470-
CreateInlineSamplerAnnotations(inlineSamplerMD, samplerConstantVal);
471-
inlineSamplerMD.index = currSamplerIdx;
472-
resAllocMD.inlineSamplersMD.push_back(inlineSamplerMD);
473-
m_pMdUtils->save(*m_pCtx);
474-
return samplerIndex;
475-
};
476-
450+
// If bindless image is preferred, map the bindless pointer
477451
if (modMD->UseBindlessImage)
478452
{
479-
// In bindless mode, samplerValue is BinaryOperator::Or computed in ResolveSampledImageBuiltins pass.
480-
// Continue to track back the sampler's origin value, which could be one of following values:
481-
// * a constant, e.g. inline sampler.
482-
// * kernel argument, e.g. sampler that is kernel argument.
483-
// * load inst, e.g. sampler in SYCL bindless sampled image.
484-
Value *samplerValueOrigin = ValueTracker::track(samplerValue, m_pFunc, m_pMdUtils, m_modMD, isSYCLBindlessImageLoad);
485-
if (!samplerValueOrigin) {
486-
emitError("There are instructions that use a sampler, but no sampler found in the kernel!", m_pCallInst);
487-
return nullptr;
488-
}
489-
// Map the bindless pointer.
490-
Value *bindlessSampler = nullptr;
491-
if (auto *samplerConstant = dyn_cast<ConstantInt>(samplerValueOrigin))
492-
{
493-
// Sampler is constant, e.g. inline sampler.
494-
int samplerConstantVal = int_cast<int>(samplerConstant->getZExtValue());
495-
samplerIndex = addToInlineSamplersMD(samplerConstantVal);
496-
497-
// Bindless inline sampler is passed via implicit kernel argument.
498-
ImplicitArgs implicitArgs(*m_pFunc, m_pMdUtils);
499-
500-
Argument *arg = implicitArgs.getNumberedImplicitArg(*m_pFunc, ImplicitArg::INLINE_SAMPLER, samplerConstantVal);
501-
if (!arg) {
502-
emitError("Implicit arg isn't found for inline sampler!", m_pCallInst);
503-
return nullptr;
504-
}
505-
auto *binOp = cast<BinaryOperator>(samplerValue);
506-
auto *argExt = new ZExtInst(arg, Type::getInt64Ty(*m_pCtx), "", binOp);
507-
binOp->setOperand(0, argExt);
508-
509-
unsigned addressSpace = IGC::EncodeAS4GFXResource(*samplerIndex, BufferType::BINDLESS_SAMPLER);
510-
Type *ptrTy = PointerType::get(m_pFloatType, addressSpace);
511-
bindlessSampler = BitCastInst::CreateBitOrPointerCast(m_pCallInst->getOperand(1), ptrTy, "bindless_sampler", m_pCallInst);
512-
}
513-
else
514-
{
515-
// Sampler is either sampler that is kernel argument, or sampler in SYCL bindless sampled image.
516-
// If sampler is argument, look up index in the parameter map.
517-
int i = isa<Argument>(samplerValueOrigin) ? (*m_pParamMap)[samplerValueOrigin].index : 0;
518-
samplerIndex = ConstantInt::get(m_pIntType, i);
519-
unsigned int addressSpace = IGC::EncodeAS4GFXResource(*samplerIndex, BufferType::BINDLESS_SAMPLER);
520-
Type* ptrTy = llvm::PointerType::get(m_pFloatType, addressSpace);
521-
bindlessSampler = isa<IntegerType>(samplerValue->getType()) ?
522-
BitCastInst::CreateBitOrPointerCast(samplerValue, ptrTy, "bindless_sampler", m_pCallInst) :
523-
BitCastInst::CreatePointerCast(samplerValue, ptrTy, "bindless_sampler", m_pCallInst);
524-
}
453+
// If sampler is argument, look up index in the parameter map.
454+
int i = isa<Argument>(samplerParam) ? (*m_pParamMap)[samplerParam].index : 0;
455+
samplerIndex = ConstantInt::get(m_pIntType, i);
456+
unsigned int addressSpace = IGC::EncodeAS4GFXResource(*samplerIndex, BufferType::BINDLESS_SAMPLER);
457+
Type* ptrTy = llvm::PointerType::get(m_pFloatType, addressSpace);
458+
Value* bindlessSampler = isa<IntegerType>(samplerParam->getType()) ?
459+
BitCastInst::CreateBitOrPointerCast(samplerParam, ptrTy, "bindless_sampler", m_pCallInst) :
460+
BitCastInst::CreatePointerCast(samplerParam, ptrTy, "bindless_sampler", m_pCallInst);
525461
return bindlessSampler;
526462
}
527463

528464
// Argument samplers are looked up in the parameter map
529-
if (isa<Argument>(samplerValue))
465+
if (isa<Argument>(samplerParam))
530466
{
531-
int i = (*m_pParamMap)[samplerValue].index;
467+
int i = (*m_pParamMap)[samplerParam].index;
532468
samplerIndex = ConstantInt::get(m_pIntType, i);
533469
return samplerIndex;
534470
}
535471

536472
// The sampler is not an argument, make sure it's a constant
537-
IGC_ASSERT_MESSAGE(isa<ConstantInt>(samplerValue), "Sampler must be a global variable or a constant");
538-
auto *samplerConstant = cast<ConstantInt>(samplerValue);
539-
int samplerConstantVal = int_cast<int>(samplerConstant->getZExtValue());
473+
IGC_ASSERT_MESSAGE(isa<ConstantInt>(samplerParam), "Sampler must be a global variable or a constant");
474+
ConstantInt* constSampler = cast<ConstantInt>(samplerParam);
475+
int samplerValue = int_cast<int>(constSampler->getZExtValue());
476+
477+
// Is this sampler already allocated?
478+
auto iter = m_pInlineMap->find(samplerValue);
479+
if (iter != m_pInlineMap->end())
480+
{
481+
return ConstantInt::get(m_pIntType, iter->second);
482+
}
540483

541-
return addToInlineSamplersMD(samplerConstantVal);
484+
// No, allocate it.
485+
int currSamplerIdx = (*m_pNextSampler)++;
486+
(*m_pInlineMap)[samplerValue] = currSamplerIdx;
487+
samplerIndex = ConstantInt::get(m_pIntType, currSamplerIdx);
488+
489+
// Push this information into the metadata, for the state processor's benefit
490+
FunctionMetaData& funcMD = m_modMD->FuncMD[m_pFunc];
491+
ResourceAllocMD& resAllocMD = funcMD.resAllocMD;
492+
InlineSamplersMD inlineSamplerMD;
493+
CreateInlineSamplerAnnotations(inlineSamplerMD, samplerValue);
494+
inlineSamplerMD.index = currSamplerIdx;
495+
resAllocMD.inlineSamplersMD.push_back(inlineSamplerMD);
496+
m_pMdUtils->save(*m_pCtx);
497+
return samplerIndex;
542498
}
543499

544500
void CreateInlineSamplerAnnotations(InlineSamplersMD& inlineSamplerMD, int samplerValue)

IGC/Compiler/Optimizer/OpenCLPasses/ImageFuncs/ImageFuncResolution.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,7 @@ Value* ImageFuncResolution::getSamplerProperty(CallInst& CI)
212212
ModuleMetaData* modMD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
213213
if (Value* sampler = ValueTracker::track(&CI, 0, pMdUtils, modMD))
214214
{
215-
auto *arg = dyn_cast<Argument>(sampler);
216-
bool isImplicitInlineSamplerArg = arg ? m_implicitArgs.isImplicitArg(arg) : false;
217-
if (arg && !isImplicitInlineSamplerArg)
215+
if (isa<Argument>(sampler))
218216
{
219217
if (m_implicitArgs.isImplicitArgExist(ArgTy))
220218
{
@@ -226,22 +224,13 @@ Value* ImageFuncResolution::getSamplerProperty(CallInst& CI)
226224
{
227225
llvm::Function* pFunc = CI.getFunction();
228226

227+
IGC_ASSERT_MESSAGE(isa<ConstantInt>(sampler), "Sampler must be a constant integer");
229228
uint64_t samplerVal = 0;
230229
if (modMD->FuncMD.find(pFunc) != modMD->FuncMD.end())
231230
{
232231
FunctionMetaData funcMD = modMD->FuncMD[pFunc];
233232
ResourceAllocMD resAllocMD = funcMD.resAllocMD;
234-
unsigned samplerValue;
235-
if (isImplicitInlineSamplerArg)
236-
{
237-
// Inline sampler value is stored as explicit argument number in ImageFuncsAnalysis pass.
238-
samplerValue = m_implicitArgs.getExplicitArgNumForArg(arg);
239-
}
240-
else
241-
{
242-
IGC_ASSERT_MESSAGE(isa<ConstantInt>(sampler), "Sampler must be a constant integer");
243-
samplerValue = int_cast<unsigned int>(cast<ConstantInt>(sampler)->getZExtValue());
244-
}
233+
uint samplerValue = int_cast<unsigned int>(cast<ConstantInt>(sampler)->getZExtValue());
245234
for (auto i = resAllocMD.inlineSamplersMD.begin(), e = resAllocMD.inlineSamplersMD.end(); i != e; i++)
246235
{
247236
IGC::InlineSamplersMD inlineSamplerMD = *i;

IGC/Compiler/Optimizer/OpenCLPasses/ImageFuncs/ImageFuncsAnalysis.cpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ bool ImageFuncsAnalysis::runOnModule(Module& M) {
5656
m_pMDUtils = getAnalysis<MetaDataUtilsWrapper>().getMetaDataUtils();
5757
CodeGenContext* ctx = getAnalysis<CodeGenContextWrapper>().getCodeGenContext();
5858

59-
m_useAdvancedBindlessMode = ctx->getModuleMetaData()->compOpt.UseBindlessMode &&
60-
!ctx->getModuleMetaData()->compOpt.UseLegacyBindlessMode;
59+
m_addImplicitImageArgs = !ctx->getModuleMetaData()->compOpt.UseBindlessMode ||
60+
ctx->getModuleMetaData()->compOpt.UseLegacyBindlessMode;
6161

6262
// Run on all functions defined in this module
6363
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) {
@@ -81,7 +81,7 @@ bool ImageFuncsAnalysis::runOnFunction(Function& F) {
8181
// Visit the function
8282
visit(F);
8383

84-
ImplicitArgs::addImageArgs(F, m_argMap, m_pMDUtils);
84+
ImplicitArgs::addImageArgs(F, m_argMap, getAnalysis<MetaDataUtilsWrapper>().getMetaDataUtils());
8585

8686
m_argMap.clear();
8787

@@ -100,15 +100,15 @@ void ImageFuncsAnalysis::visitCallInst(CallInst& CI)
100100
// Check for OpenCL image dimension function calls
101101
std::set<int>* imageFunc = nullptr;
102102

103-
if (funcName == GET_IMAGE_HEIGHT && !m_useAdvancedBindlessMode)
103+
if (funcName == GET_IMAGE_HEIGHT && m_addImplicitImageArgs)
104104
{
105105
imageFunc = &m_argMap[ImplicitArg::IMAGE_HEIGHT];
106106
}
107-
else if (funcName == GET_IMAGE_WIDTH && !m_useAdvancedBindlessMode)
107+
else if (funcName == GET_IMAGE_WIDTH && m_addImplicitImageArgs)
108108
{
109109
imageFunc = &m_argMap[ImplicitArg::IMAGE_WIDTH];
110110
}
111-
else if (funcName == GET_IMAGE_DEPTH && !m_useAdvancedBindlessMode)
111+
else if (funcName == GET_IMAGE_DEPTH && m_addImplicitImageArgs)
112112
{
113113
imageFunc = &m_argMap[ImplicitArg::IMAGE_DEPTH];
114114
}
@@ -128,7 +128,7 @@ void ImageFuncsAnalysis::visitCallInst(CallInst& CI)
128128
{
129129
imageFunc = &m_argMap[ImplicitArg::IMAGE_SRGB_CHANNEL_ORDER];
130130
}
131-
else if ((funcName == GET_IMAGE1D_ARRAY_SIZE || funcName == GET_IMAGE2D_ARRAY_SIZE) && !m_useAdvancedBindlessMode)
131+
else if ((funcName == GET_IMAGE1D_ARRAY_SIZE || funcName == GET_IMAGE2D_ARRAY_SIZE) && m_addImplicitImageArgs)
132132
{
133133
imageFunc = &m_argMap[ImplicitArg::IMAGE_ARRAY_SIZE];
134134
}
@@ -197,21 +197,9 @@ void ImageFuncsAnalysis::visitCallInst(CallInst& CI)
197197
// These WAs need to be reworked to support indirect case in the future.
198198
if (callArg)
199199
{
200-
if (Argument * arg = dyn_cast<Argument>(callArg))
200+
if (Argument * arg = dyn_cast<Argument>(callArg); arg && isSamplerArgument(arg))
201201
{
202-
if (isSamplerArgument(arg))
203-
{
204-
imageFunc->insert(arg->getArgNo());
205-
return;
206-
}
207-
}
208-
else if (m_useAdvancedBindlessMode)
209-
{
210-
IGC_ASSERT_MESSAGE(isa<ConstantInt>(callArg), "Expect inline sampler");
211-
auto *inlineSampler = cast<ConstantInt>(callArg);
212-
// Inline sampler doesn't associate with an explicit argument.
213-
// To avoid adding a new metadata entry, inline sampler value is stored as explicit argument number.
214-
m_argMap[ImplicitArg::INLINE_SAMPLER].insert(int_cast<int>(inlineSampler->getZExtValue()));
202+
imageFunc->insert(arg->getArgNo());
215203
return;
216204
}
217205
}

IGC/Compiler/Optimizer/OpenCLPasses/ImageFuncs/ImageFuncsAnalysis.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ namespace IGC
103103
/// @brief MetaData utils used to generate LLVM metadata
104104
IGCMD::MetaDataUtils* m_pMDUtils = nullptr;
105105

106-
/// @brief Indicate whether advanced bindless mode is used.
107-
/// If false, implicit image args for information like width, height, etc.
106+
/// @brief If true, implicit image args for information like width, height, etc.
108107
/// will be added to m_argMap
109-
bool m_useAdvancedBindlessMode{};
108+
bool m_addImplicitImageArgs{};
110109
};
111110

112111
} // namespace IGC

0 commit comments

Comments
 (0)