Skip to content

Commit 3bbc34c

Browse files
fangliu2020sys_zuul
authored and
sys_zuul
committed
Enable NULL render target feature for RTW messages
Change-Id: I07cb98ebbafcf314750b95ca72be4277501337ed
1 parent 988e2fb commit 3bbc34c

File tree

8 files changed

+30
-8
lines changed

8 files changed

+30
-8
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2471,6 +2471,9 @@ namespace IGC
24712471
//controls last render target select bit
24722472
cntrls.isLastWrite = lastRenderTarget;
24732473

2474+
// controls NULL render target enbale bit
2475+
cntrls.isNullRT = false;
2476+
24742477
//r1Reg should always be populated
24752478
//vISA will decide whether to use it or not.
24762479
VISA_RawOpnd* r1RegOpnd = GetRawSource(r1Reg);

visa/BuildCISAIRImpl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,11 @@ bool CISA_IR_Builder::CISA_create_rtwrite_3d_instruction(
22292229
{
22302230
cntrls.isCoarseMode = true;
22312231
}
2232+
2233+
if (strstr(mode, "NULLRT"))
2234+
{
2235+
cntrls.isNullRT = true;
2236+
}
22322237
}
22332238
else
22342239
{

visa/ByteCodeReaderNG.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,7 @@ static void readInstructionDataportNG(unsigned& bytePos, const char* buf, ISA_Op
948948
cntrls.isCoarseMode = (mode & (0x1 << 10))? true:false;
949949
cntrls.isSampleIndex = (mode & (0x1 << 11)) ? true : false;
950950
cntrls.RTIndexPresent = (mode & (0x1 << 2)) ? true : false;
951+
cntrls.isNullRT = (mode & (0x1 << 12)) ? true : false;
951952
cntrls.isHeaderMaskfromCe0 = 0;
952953

953954
VISA_VectorOpnd *sampleIndex = cntrls.isSampleIndex ? readVectorOperandNG(bytePos, buf, container, false) : NULL;

visa/Gen4_IR.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ class G4_SendMsgDescriptor
345345
return createExtDesc(funcID, isEot, 0, 0);
346346
}
347347

348-
static uint32_t createMRTExtDesc(bool src0Alpha, uint8_t RTIndex, bool isEOT, uint32_t extMsgLen)
348+
static uint32_t createMRTExtDesc(bool src0Alpha, uint8_t RTIndex, bool isEOT, uint32_t extMsgLen, uint16_t extFuncCtrl)
349349
{
350350
ExtDescData data;
351351
data.value = 0;
@@ -354,6 +354,7 @@ class G4_SendMsgDescriptor
354354
data.layout.src0Alpha = src0Alpha;
355355
data.layout.eot = isEOT;
356356
data.layout.extMsgLength = extMsgLen;
357+
data.layout.extFuncCtrl = extFuncCtrl;
357358
return data.value;
358359
}
359360

visa/IsaDisassembly.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,6 +2392,7 @@ static std::string printInstructionDataport(
23922392
if( mode & (0x1 << 0x9)) sstr << "<PS>";
23932393
if( mode & (0x1 << 0x10)) sstr << "<CM>";
23942394
if (mode & (0x1 << 0x11)) sstr << "<SI>";
2395+
if (mode & (0x1 << 0x12)) sstr << "<NULLRT>";
23952396
}
23962397

23972398
sstr << " " << printExecutionSize(inst->opcode, inst->execsize) << " ";

visa/TranslationInterface.cpp

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8294,6 +8294,16 @@ int IR_Builder::translateVISARTWrite3DInst(
82948294
if(cntrls.isCoarseMode)
82958295
fc |= 0x1 << COARSE_PIXEL_OUTPUT_ENABLE;
82968296
#define CPS_COUNTER_EXT_MSG_DESC_OFFSET 16
8297+
8298+
uint16_t extFuncCtrl = 0;
8299+
if (cntrls.isNullRT && getPlatform() >= GENX_ICLLP)
8300+
{
8301+
// extFuncCtrl is the 16:31 bits of extDesc. NullRT is the bit 20 of extDesc.
8302+
// That says NullRT is the bit 4 of extFuncCtrl.
8303+
#define NULL_RENDER_TARGET 4
8304+
extFuncCtrl |= 0x1 << NULL_RENDER_TARGET;
8305+
}
8306+
82978307
if (useSplitSend || cpsCounter)
82988308
{
82998309
G4_SendMsgDescriptor *msgDesc = NULL;
@@ -8303,7 +8313,7 @@ int IR_Builder::translateVISARTWrite3DInst(
83038313
{
83048314
m0 = Create_Src_Opnd_From_Dcl(msg, getRegionStride1());
83058315
msgDesc = createSendMsgDesc(fc, 0, numHeaderGRF, SFID::DP_WRITE, numRows,
8306-
0, SendAccess::WRITE_ONLY, surface);
8316+
extFuncCtrl, SendAccess::WRITE_ONLY, surface);
83078317
msgDesc->setHeaderPresent(useHeader);
83088318
}
83098319
else
@@ -8312,16 +8322,15 @@ int IR_Builder::translateVISARTWrite3DInst(
83128322
{
83138323
// direct imm is a-ok for ext desc
83148324
msgDesc = createSendMsgDesc(fc, 0, numRows, SFID::DP_WRITE, 0,
8315-
0, SendAccess::WRITE_ONLY, surface);
8325+
extFuncCtrl, SendAccess::WRITE_ONLY, surface);
83168326
}
83178327
else
83188328
{
8319-
83208329
assert(rtIndex->isImm() && "RTIndex must be imm at this point");
83218330
uint8_t RTIndex = (uint8_t)rtIndex->asImm()->getImm() & 0x7;
83228331
uint32_t desc = G4_SendMsgDescriptor::createDesc(fc, false, numRows, 0);
83238332
uint32_t extDesc = G4_SendMsgDescriptor::createMRTExtDesc(cntrls.s0aPresent, RTIndex,
8324-
false, 0);
8333+
false, 0, extFuncCtrl);
83258334
msgDesc = createGeneralMsgDesc(desc, extDesc, SendAccess::WRITE_ONLY, surface);
83268335

83278336
if (!canEncodeFullExtDesc())

visa/VISAKernelImpl.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5674,16 +5674,17 @@ int VISAKernelImpl::AppendVISA3dRTWriteCPS(VISA_PredOpnd *pred, VISA_EMask_Ctrl
56745674
int num_operands = 0;
56755675
bool isCPSCounter = (cPSCounter)? true: false;
56765676

5677-
int mode = ((int)cntrls.isSampleIndex << 11) |
5677+
int mode = ((int)cntrls.isNullRT << 12) |
5678+
((int)cntrls.isSampleIndex << 11) |
56785679
((int)cntrls.isCoarseMode << 10) |
56795680
((int)cntrls.isPerSample << 9) |
56805681
((int)(isCPSCounter) << 8) |
5681-
(((int)cntrls.isLastWrite << 7) |
5682+
((int)cntrls.isLastWrite << 7) |
56825683
((int)cntrls.isStencil << 6) |
56835684
((int)cntrls.zPresent << 5) |
56845685
((int)cntrls.oMPresent << 4) |
56855686
((int)cntrls.s0aPresent << 3) |
5686-
((int)cntrls.RTIndexPresent << 2));
5687+
((int)cntrls.RTIndexPresent << 2);
56875688

56885689
//mode
56895690
ADD_OPND(num_operands, opnd, this->CreateOtherOpndHelper(num_pred_desc_operands, num_operands, inst_desc, mode));

visa/include/visa_igc_common_header.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ typedef struct _vISA_RT_CONTROLS
621621
unsigned isCoarseMode:1; //controls coasrse mode bit inmsg descriptor
622622
unsigned isSampleIndex : 1; //controls whether sampleIndex is used.
623623
unsigned isHeaderMaskfromCe0 : 1;
624+
unsigned isNullRT : 1; // null render target
624625
} vISA_RT_CONTROLS;
625626

626627
typedef enum

0 commit comments

Comments
 (0)