Skip to content

Commit b811ab6

Browse files
jgu222sys_zuul
authored andcommitted
Continue to refactor visa attribtues
Change-Id: Id1f586df081d23efcffb6e2dae2027bd66616b19
1 parent eba621f commit b811ab6

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

visa/Attributes.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,25 @@ bool Attributes::isAttribute(ID aID, const char* AttrName)
116116

117117
void Attributes::setIntKernelAttribute(Attributes::ID kID, int val)
118118
{
119+
// Verify kernel attribute
120+
switch (kID) {
121+
case ATTR_SpillMemOffset :
122+
{
123+
assert((val & (GENX_GRF_REG_SIZ - 1)) == 0 &&
124+
"Kernel attribute: SpillMemOffset is mis-aligned!");
125+
break;
126+
}
127+
case ATTR_SimdSize :
128+
{
129+
// allow 0
130+
assert((val == 0 || val == 8 || val == 16 || val == 32) &&
131+
"Kernel attribute: SimdSize must be 0|8|16|32!");
132+
break;
133+
}
134+
default:
135+
break;
136+
}
137+
119138
m_kernelAttrs[kID].m_val.m_intVal = val;
120139
m_kernelAttrs[kID].m_isSet = true;
121140
}

visa/BuildIR.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ class IR_Builder {
631631
const iga::Model* getIGAModel() const { return igaModel; }
632632
uint32_t getPerThreadInputSize() const
633633
{
634-
return kernel.getKernelAttrs()->getIntKernelAttribute(Attributes::ATTR_PerThreadInputSize);
634+
return kernel.getIntKernelAttribute(Attributes::ATTR_PerThreadInputSize);
635635
}
636636

637637
bool getHasPerThreadProlog() const { return hasPerThreadProlog; }

visa/FlowGraph.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,10 @@ class G4_Kernel
15211521

15221522
Options *getOptions(){ return m_options; }
15231523
const Attributes* getKernelAttrs() const { return m_kernelAttrs; }
1524+
int getIntKernelAttribute(Attributes::ID aID) const
1525+
{
1526+
return getKernelAttrs()->getIntKernelAttribute(aID);
1527+
}
15241528
bool getOption(vISAOptions opt) const { return m_options->getOption(opt); }
15251529
void computeChannelSlicing();
15261530
void calculateSimdSize();

visa/Optimizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6888,7 +6888,7 @@ bool Optimizer::foldPseudoAndOr(G4_BB* bb, INST_LIST_ITER& ii)
68886888
}
68896889

68906890
if (builder.needReplaceIndirectCallWithJmpi() &&
6891-
kernel.getKernelAttrs()->getIntKernelAttribute(Attributes::ATTR_Extern) != 0)
6891+
kernel.getIntKernelAttribute(Attributes::ATTR_Extern) != 0)
68926892
{
68936893
// replace ret in the external functions with jmpi. That we will
68946894
// also return the call with jmpi in VISAKernelImpl::compilePostOptimize

0 commit comments

Comments
 (0)