Skip to content

Commit 3305c0c

Browse files
lwesiersigcbot
authored andcommitted
Fix for ManageableBarriers
Fix for ManageableBarriers in SimpleMode. There was broken encoding of the barrier count in zebin.
1 parent 09b42cd commit 3305c0c

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6655,7 +6655,8 @@ namespace IGC
66556655

66566656
// Depend on vISA information about barriers presence to make sure that it's
66576657
// always set properly, even if a barrier is used as a part of Inline vISA code only.
6658-
if (jitInfo->numBarriers != 0)
6658+
if (jitInfo->numBarriers != 0 &&
6659+
!m_program->m_State.GetHasBarrier())
66596660
{
66606661
if (context->getModuleMetaData()->NBarrierCnt > 0 ||
66616662
additionalVISAAsmToLink)

IGC/Compiler/Optimizer/OpenCLPasses/ManageableBarriers/ManageableBarriersResolution.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,8 @@ ManageableBarriersResolution::~ManageableBarriersResolution(void)
509509

510510
bool ManageableBarriersResolution::runOnModule(Module& M)
511511
{
512-
mSimpleBarrierIDCount = 1;
513512
mModule = &M;
513+
bool isManageableBarriersAdded = false;
514514
mCurrentMode = static_cast<MBMode>(IGC_GET_FLAG_VALUE(ManageableBarriersMode));
515515
for (auto& F : M)
516516
{
@@ -520,6 +520,9 @@ bool ManageableBarriersResolution::runOnModule(Module& M)
520520

521521
if (mManageBarrierInstructionsInit.size() > 0)
522522
{
523+
mSimpleBarrierIDCount = 1;
524+
isManageableBarriersAdded = true;
525+
523526
if (mCurrentMode == MBMode::Mix ||
524527
mCurrentMode == MBMode::SimpleOnly)
525528
{
@@ -552,13 +555,12 @@ bool ManageableBarriersResolution::runOnModule(Module& M)
552555
}
553556
}
554557

555-
if (isManageableBarriersAdded())
558+
if (isManageableBarriersAdded)
556559
{
557560
// Add attribute NBarrierCnt to metadata
558561
auto MD = getAnalysis<MetaDataUtilsWrapper>().getModuleMetaData();
559562
// Adding max as it could be dynamic
560563
MD->NBarrierCnt = getMaxNamedBarrierCount();
561-
562564
return true;
563565
}
564566
return false;

IGC/Compiler/Optimizer/OpenCLPasses/ManageableBarriers/ManageableBarriersResolution.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,6 @@ namespace IGC
156156
void visitCallInst(llvm::CallInst& CI);
157157

158158
static bool HasHWSupport(GFXCORE_FAMILY GFX_CORE);
159-
160-
private:
161-
/// @brief Indicates if the pass changed the processed function
162-
inline bool isManageableBarriersAdded()
163-
{
164-
return mGlobalDataPoolPerFunc.size() > 0;
165-
}
166159
};
167160

168161
} // namespace IGC

0 commit comments

Comments
 (0)