Skip to content

Commit 23f4cb1

Browse files
weiyu-chengfxbot
authored andcommitted
remove software fence intrinsic before binary encoding
Change-Id: I3109e3f2282c5115e518b1f2c6ae6788c04659df
1 parent ee8d050 commit 23f4cb1

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

visa/FlowGraph.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,11 @@ class G4_BB
496496

497497
// reset this BB's instruction's local id so they are [0,..#BBInst-1]
498498
void resetLocalId();
499+
500+
void removeIntrinsics(Intrinsic intrinId)
501+
{
502+
instList.remove_if([=](G4_INST* inst) { return inst->isIntrinsic() && inst->asIntrinsicInst()->getIntrinsicId() == intrinId;});
503+
}
499504
};
500505
}
501506

visa/IsaVerification.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,10 @@ static void verifyVariableDecl(const common_isa_header& isaHeader, const kernel_
276276
break; // Prevent gcc warning
277277
}
278278

279-
int varSize = var->num_elements * CISATypeTable[var->getType()].typeSize;
280-
281279
REPORT_HEADER(options, var->num_elements != 0 && var->num_elements <= 4096,
282280
"V%d's number of elements(%d) is out of range: %s",
283281
declID + numPreDefinedVars, var->num_elements,
284282
declError.c_str());
285-
REPORT_HEADER(options, varSize < COMMON_ISA_MAX_VARIABLE_SIZE,
286-
"V%d's size(%d) exceeds the maximum allowed limit (4K): %s",
287-
declID + numPreDefinedVars, varSize, declError.c_str());
288283
REPORT_HEADER(options, !(var->alias_index == 0 && var->alias_offset != 0),
289284
"V%d's alias offset must be zero when it is not aliased: %s",
290285
declID + numPreDefinedVars, declError.c_str());

visa/VISAKernelImpl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,13 @@ void* VISAKernelImpl::compilePostOptimize(unsigned int& binarySize)
305305
expandIndirectCallWithRegTarget();
306306
}
307307

308+
// remove SW fences at this point
309+
// ToDo: remove all intrinsics?
310+
for (auto bb : m_kernel->fg.BBs)
311+
{
312+
bb->removeIntrinsics(Intrinsic::MemFence);
313+
}
314+
308315

309316
m_kernel->evalAddrExp();
310317

0 commit comments

Comments
 (0)