Skip to content

Commit 0ae6dfb

Browse files
mtargowsigcbot
authored andcommitted
SetMaxRegForThreadDispatch was hardcoded for up to 128 GRFs.
SetMaxRegForThreadDispatch was hardcoded for up to 128 GRFs, so errors could occur on future platforms if larger sets of GRFs allowed.
1 parent fbf1aa9 commit 0ae6dfb

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5414,7 +5414,7 @@ namespace IGC
54145414
context->type == ShaderType::GEOMETRY_SHADER || context->type == ShaderType::HULL_SHADER)
54155415
{
54165416
unsigned maxReg = m_program->GetMaxRegForThreadDispatch();
5417-
V(vKernel->AddKernelAttribute("MaxRegThreadDispatch", 1, &maxReg));
5417+
V(vKernel->AddKernelAttribute("MaxRegThreadDispatch", sizeof(maxReg), &maxReg));
54185418
}
54195419
}
54205420

IGC/Compiler/CISACodeGen/CoalescingEngine.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ namespace IGC
251251
SetCurrentPart(tupleGeneratingInstruction, numPart);
252252
const uint numOperands = GetNumPayloadElements(tupleGeneratingInstruction);
253253
bool isAnyNodeAnchored = false, isAnyNodeCoalescable = false;
254-
SmallPtrSet<CCTuple*, 8> touchedTuplesSet;
255-
SmallVector<CCTuple*, 8> touchedTuples;
254+
SmallPtrSet<CCTuple*, MaxTouchedTuples> touchedTuplesSet;
255+
SmallVector<CCTuple*, MaxTouchedTuples> touchedTuples;
256256

257257
//Step: Prepare.
258258
PrepareTuple(
@@ -371,7 +371,7 @@ namespace IGC
371371
//provided that elements in dominatorsForDisplacement are displaced, and other nodes are attached.
372372
//If interferes is true, then no element will be attached to the ccTuple.
373373
if (!interferes) {
374-
SmallPtrSet<Value*, 8> touchedValuesSet;
374+
SmallPtrSet<Value*, MaxTouchedTuples> touchedValuesSet;
375375
for (uint i = 0; i < numOperands; i++) {
376376
Value* val = GetPayloadElementToValueMapping(tupleGeneratingInstruction, i);
377377

@@ -575,8 +575,8 @@ namespace IGC
575575
void CoalescingEngine::PrepareTuple(
576576
const uint numOperands,
577577
Instruction* tupleGeneratingInstruction,
578-
SmallPtrSet<CCTuple*, 8> & touchedTuplesSet,
579-
SmallVector<CCTuple*, 8> & touchedTuples,
578+
SmallPtrSet<CCTuple*, MaxTouchedTuples> & touchedTuplesSet,
579+
SmallVector<CCTuple*, MaxTouchedTuples> & touchedTuples,
580580
bool& isAnyNodeAnchored,
581581
bool& isAnyNodeCoalescable)
582582
{
@@ -843,7 +843,7 @@ namespace IGC
843843
CCTuple* ccTuple,
844844
ElementFunctor* functor)
845845
{
846-
SmallPtrSet<Value*, 8> touchedValuesSet;
846+
SmallPtrSet<Value*, MaxTouchedTuples> touchedValuesSet;
847847

848848
for (uint i = 0; i < numOperands; i++) {
849849
functor->SetIndex(i);
@@ -1001,7 +1001,7 @@ namespace IGC
10011001
CCTuple* ccTuple,
10021002
ProcessInterferencesElementFunctor* interferencesFunctor)
10031003
{
1004-
SmallPtrSet<Value*, 8> touchedValuesSet;
1004+
SmallPtrSet<Value*, MaxTouchedTuples> touchedValuesSet;
10051005
GatherWeightElementFunctor gatherFunctor;
10061006
ProcessElements(numOperands, tupleInst, offsetDiff, ccTuple, &gatherFunctor);
10071007
bool forceEviction =
@@ -1071,7 +1071,7 @@ namespace IGC
10711071

10721072
if (ccTuple)
10731073
{
1074-
SmallPtrSet<Value*, 8> touchedValuesSet;
1074+
SmallPtrSet<Value*, MaxTouchedTuples> touchedValuesSet;
10751075

10761076
//index = 0;
10771077
payloadCovered = true;
@@ -1179,7 +1179,7 @@ namespace IGC
11791179
}
11801180

11811181
if (payloadCovered) {
1182-
SmallPtrSet<Value*, 8> touchedValuesSet;
1182+
SmallPtrSet<Value*, MaxTouchedTuples> touchedValuesSet;
11831183

11841184
for (uint index = 0; index < numOperands; index++)
11851185
{

IGC/Compiler/CISACodeGen/CoalescingEngine.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ namespace IGC {
3434
class CoalescingEngine : public llvm::FunctionPass, public llvm::InstVisitor<CoalescingEngine>
3535
{
3636
//TODO: this is fixed for now, but once we have pressure heuristic, could be relaxed
37-
static const int MaxTupleSize = 12;
37+
static const int MaxTouchedTuples = 8;
38+
static const int MaxTupleSize = MaxTouchedTuples + 4;
3839

3940
public:
4041
static char ID; // Pass identification, replacement for typeid
@@ -327,7 +328,7 @@ namespace IGC {
327328
else {
328329
uint numUsers = 0;
329330
{
330-
llvm::SmallPtrSet<llvm::User*, 8> touchedUsers;
331+
llvm::SmallPtrSet<llvm::User*, MaxTouchedTuples> touchedUsers;
331332
for (llvm::Value::user_iterator i = val->user_begin(), e = val->user_end(); i != e; ++i) {
332333
llvm::User* user = *i;
333334
if (llvm::isa<llvm::Instruction>(user)) {
@@ -388,8 +389,8 @@ namespace IGC {
388389
void PrepareTuple(
389390
const uint numOperands,
390391
llvm::Instruction* tupleGeneratingInstruction,
391-
llvm::SmallPtrSet<CCTuple*, 8> & touchedTuplesSet,
392-
llvm::SmallVector<CCTuple*, 8> & touchedTuples,
392+
llvm::SmallPtrSet<CCTuple*, MaxTouchedTuples> & touchedTuplesSet,
393+
llvm::SmallVector<CCTuple*, MaxTouchedTuples> & touchedTuples,
393394
bool& isAnyNodeAnchored,
394395
bool& isAnyNodeCoalescable);
395396

@@ -712,7 +713,7 @@ namespace IGC {
712713
CCTuple* m_ccTuple;
713714
CoalescingEngine* m_CE;
714715
int m_index;
715-
llvm::SmallPtrSet<llvm::Value*, 8> m_valuesForIsolation;
716+
llvm::SmallPtrSet<llvm::Value*, MaxTouchedTuples> m_valuesForIsolation;
716717

717718
public:
718719
ProcessInterferencesElementFunctor(
@@ -732,7 +733,7 @@ namespace IGC {
732733

733734
}
734735

735-
llvm::SmallPtrSet<llvm::Value*, 8> & GetComputedValuesForIsolation()
736+
llvm::SmallPtrSet<llvm::Value*, MaxTouchedTuples> & GetComputedValuesForIsolation()
736737
{
737738
return m_valuesForIsolation;
738739
}

0 commit comments

Comments
 (0)