Skip to content

Commit 3912307

Browse files
zuban32sys_zuul
authored andcommitted
Fix kernel attributes processing
Change-Id: If9cf1d2ab92c875e2b6f51d75751d09722b41ae8
1 parent 2f0ed94 commit 3912307

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed

visa/BuildCISAIRImpl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ int CISA_IR_Builder::Compile(const char* nameInput, std::ostream* os, bool emit_
886886
for( iter = m_kernels.begin(), i = 0; iter != end; iter++, i++ )
887887
{
888888
VISAKernelImpl* kernel = (*iter);
889+
kernel->processAttributes();
889890
kernel->getIRBuilder()->setIsKernel(kernel->getIsKernel());
890891
kernel->getIRBuilder()->setCUnitId(i);
891892
if( kernel->getIsKernel() == false )

visa/BuildIR.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,13 +875,13 @@ class IR_Builder {
875875
void initBuiltinSLMSpillAddr(int perThreadSLMSize);
876876

877877
IR_Builder(INST_LIST_NODE_ALLOCATOR &alloc, PhyRegPool &pregs, G4_Kernel &k,
878-
Mem_Manager &m, Options *options, bool isFESP64Bits,
878+
Mem_Manager &m, Options *options,
879879
FINALIZER_INFO *jitInfo = NULL, PVISA_WA_TABLE pWaTable = NULL)
880880
: curFile(NULL), curLine(0), curCISAOffset(-1), immPool(*this), func_id(-1), metaData(jitInfo),
881881
isKernel(false), cunit(0),
882882
builtinSamplerHeaderInitialized(false), m_pWaTable(pWaTable), m_options(options), CanonicalRegionStride0(0, 1, 0),
883883
CanonicalRegionStride1(1, 1, 0), CanonicalRegionStride2(2, 1, 0), CanonicalRegionStride4(4, 1, 0),
884-
use64BitFEStackVars(isFESP64Bits), mem(m), phyregpool(pregs), hashtable(m), rgnpool(m), dclpool(m),
884+
use64BitFEStackVars(false), mem(m), phyregpool(pregs), hashtable(m), rgnpool(m), dclpool(m),
885885
instList(alloc), kernel(k)
886886
{
887887
num_general_dcl = 0;

visa/VISAKernel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ class VISAKernelImpl : public VISAFunction
230230

231231
int getVISAOffset() const;
232232

233+
void processAttributes();
234+
233235
/***************** START EXPOSED APIS *************************/
234236
VISA_BUILDER_API int CreateVISAGenVar(VISA_GenVar *& decl, const char *varName, int numberElements, VISA_Type dataType,
235237
VISA_Align varAlign, VISA_GenVar *parentDecl = NULL, int aliasOffset = 0);

visa/VISAKernelImpl.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -456,27 +456,12 @@ int VISAKernelImpl::InitializeFastPath()
456456
}
457457
m_jitInfo = (FINALIZER_INFO*)m_mem.alloc(sizeof(FINALIZER_INFO));
458458

459-
int feSPSize = 32;
460-
if (!getIntKernelAttributeValue("FESPSize", feSPSize))
461-
{
462-
feSPSize = 32;
463-
}
464-
int spillMemOffset = 0;
465-
if (getIntKernelAttributeValue("SpillMemOffset", spillMemOffset))
466-
{
467-
if (spillMemOffset > 0)
468-
{
469-
getOptions()->setOption(vISA_SpillMemOffset, (uint32_t)spillMemOffset);
470-
}
471-
}
472-
473459
void* addr = m_kernelMem->alloc(sizeof(class IR_Builder));
474460
m_builder = new(addr)IR_Builder(m_instListNodeAllocator,
475461
*m_phyRegPool,
476462
*m_kernel,
477463
*m_kernelMem,
478464
m_options,
479-
(feSPSize == 64),
480465
m_jitInfo,
481466
m_pWaTable
482467
);
@@ -8148,6 +8133,23 @@ int VISAKernelImpl::getVISAOffset() const
81488133
return -1;
81498134
}
81508135

8136+
void VISAKernelImpl::processAttributes()
8137+
{
8138+
int feSPSize = 32;
8139+
if (getIntKernelAttributeValue("FESPSize", feSPSize) && feSPSize == 64)
8140+
{
8141+
m_builder->set64BitFEStackVars();
8142+
}
8143+
int spillMemOffset = 0;
8144+
if (getIntKernelAttributeValue("SpillMemOffset", spillMemOffset))
8145+
{
8146+
if (spillMemOffset > 0)
8147+
{
8148+
getOptions()->setOption(vISA_SpillMemOffset, (uint32_t)spillMemOffset);
8149+
}
8150+
}
8151+
}
8152+
81518153
void VISAKernelImpl::computeFCInfo(BinaryEncodingBase* binEncodingInstance)
81528154
{
81538155
// This function iterates over all instructions in kernel and sets up data

0 commit comments

Comments
 (0)