Skip to content

Commit 772f1bd

Browse files
srividyakarumurisys_zuul
authored andcommitted
Fixing push analysis where it fails to trace for constant buffer
Change-Id: I018c7cc5eb563710176223bc27b58d3fccf5eebd
1 parent 7870b86 commit 772f1bd

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

IGC/Compiler/CISACodeGen/PushAnalysis.cpp

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,38 @@ namespace IGC
313313
}
314314

315315
llvm::GenIntrinsicInst* pRuntimeVal = llvm::dyn_cast<llvm::GenIntrinsicInst>(pAddress);
316+
uint runtimeval0;
316317

317-
if (pRuntimeVal == nullptr ||
318-
pRuntimeVal->getIntrinsicID() != llvm::GenISAIntrinsic::GenISA_RuntimeValue)
318+
bool isRuntimeValFound = false;
319+
if (pRuntimeVal == nullptr)
320+
{
321+
auto it = std::find(m_argList.begin(), m_argList.end(), pAddress);
322+
if (it != m_argList.end())
323+
{
324+
int argIndex = (int) std::distance(m_argList.begin(), it);
325+
PushInfo& pushInfo = m_context->getModuleMetaData()->pushInfo;
326+
for (auto index_it = pushInfo.constantReg.begin(); index_it != pushInfo.constantReg.end(); ++index_it)
327+
{
328+
if (index_it->second == argIndex)
329+
{
330+
runtimeval0 = index_it->first;
331+
isRuntimeValFound = true;
332+
}
333+
}
334+
}
335+
if (!isRuntimeValFound)
336+
return false;
337+
}
338+
else if(pRuntimeVal->getIntrinsicID() != llvm::GenISAIntrinsic::GenISA_RuntimeValue)
319339
return false;
340+
if (!isRuntimeValFound)
341+
runtimeval0 = (uint)llvm::cast<llvm::ConstantInt>(pRuntimeVal->getOperand(0))->getZExtValue();
320342

321-
IGC_ASSERT(32 == GetSizeInBits(pRuntimeVal->getType()) ||
322-
64 == GetSizeInBits(pRuntimeVal->getType()));
323-
const bool is64Bit = 64 == GetSizeInBits(pRuntimeVal->getType());
343+
uint runtimevalSize = GetSizeInBits(pAddress->getType());
344+
IGC_ASSERT(32 == runtimevalSize ||
345+
64 == runtimevalSize);
346+
const bool is64Bit = 64 == runtimevalSize;
324347

325-
uint runtimeval0 = (uint)llvm::cast<llvm::ConstantInt>(pRuntimeVal->getOperand(0))->getZExtValue();
326348
PushInfo& pushInfo = m_context->getModuleMetaData()->pushInfo;
327349

328350
// then check for static flag so that we can do push safely
@@ -1473,6 +1495,7 @@ namespace IGC
14731495
{
14741496
BlockPushConstants();
14751497
}
1498+
14761499
// WA: Gen11+ HW doesn't work correctly if doubles are on vertex shader input and the input has unused components,
14771500
// so ElementComponentEnableMask is not full => packing occurs
14781501
// Code below fills gaps in inputs, so the ElementComponentEnableMask if full even if we don't use all

0 commit comments

Comments
 (0)