@@ -8583,6 +8583,22 @@ static void setUniformSampler(G4_InstSend* sendInst, bool uniformSampler)
85838583Need to split sample_d and sample_dc in to two simd8 sends since HW doesn't support it.
85848584Also need to split any sample instruciton that has more then 5 parameters. Since there is a limit on msg length.
85858585*/
8586+ static unsigned TmpSmplDstID = 0 ;
8587+ const char * getNameString (Mem_Manager& mem, size_t size, const char * format, ...)
8588+ {
8589+ #ifdef _DEBUG
8590+ char * name = (char *) mem.alloc (size);
8591+ va_list args;
8592+ va_start (args, format);
8593+ std::vsnprintf (name, size, format, args);
8594+ va_end (args);
8595+ return name;
8596+ #else
8597+ const char * name = " " ;
8598+ return const_cast <char *>(name);
8599+ #endif
8600+ }
8601+
85868602static int splitSampleInst (VISASampler3DSubOpCode actualop,
85878603 bool pixelNullMask,
85888604 bool cpsEnable,
@@ -8599,6 +8615,7 @@ static int splitSampleInst(VISASampler3DSubOpCode actualop,
85998615 IR_Builder *builder,
86008616 unsigned int numParms,
86018617 G4_SrcRegRegion ** params,
8618+ Mem_Manager& mem,
86028619 bool uniformSampler = true )
86038620{
86048621 int status = CM_SUCCESS;
@@ -8640,7 +8657,9 @@ static int splitSampleInst(VISASampler3DSubOpCode actualop,
86408657 ++tmpDstRows;
86418658 }
86428659
8643- tempDstDcl = builder->createDeclareNoLookup (" TmpSmplDst" ,
8660+ const char *name = getNameString (mem, 20 , " %s%d" , " TmpSmplDst_" , TmpSmplDstID++);
8661+
8662+ tempDstDcl = builder->createDeclareNoLookup (name,
86448663 originalDstDcl->getRegFile (),
86458664 originalDstDcl->getNumElems (),
86468665 (uint16_t )tmpDstRows,
@@ -8734,7 +8753,9 @@ static int splitSampleInst(VISASampler3DSubOpCode actualop,
87348753 G4_Declare* tempDstDcl2 = nullptr ;
87358754 if (!dst->isNullReg ())
87368755 {
8737- tempDstDcl2 = builder->createDeclareNoLookup (" TmpSmplDst2" ,
8756+ const char *name = getNameString (mem, 20 , " %s%d" , " TmpSmplDst2_" , TmpSmplDstID++);
8757+
8758+ tempDstDcl2 = builder->createDeclareNoLookup (name,
87388759 originalDstDcl->getRegFile (),
87398760 originalDstDcl->getNumElems (),
87408761 (uint16_t )tmpDstRows,
@@ -9097,7 +9118,7 @@ int IR_Builder::translateVISASampler3DInst(
90979118
90989119 return splitSampleInst (actualop, pixelNullMask, cpsEnable, pred, chMask,
90999120 numChannels, aoffimmi, sampler, surface, dst,
9100- emask, useHeader, numRows, this , numParms, params, uniformSampler);
9121+ emask, useHeader, numRows, this , numParms, params, mem, uniformSampler);
91019122 }
91029123
91039124 bool useSplitSend = useSends ();
@@ -9230,7 +9251,7 @@ int IR_Builder::translateVISALoad3DInst(
92309251 return splitSampleInst (actualop, pixelNullMask, /* cpsEnable*/ false ,
92319252 pred_opnd, channelMask, numChannels, aoffimmi,
92329253 NULL , surface, dst, em, useHeader, numRows,
9233- this , numParms, opndArray);
9254+ this , numParms, opndArray, mem );
92349255 }
92359256
92369257 bool useSplitSend = useSends ();
@@ -9348,7 +9369,7 @@ int IR_Builder::translateVISAGather3dInst(
93489369 return splitSampleInst (actualop, pixelNullMask, /* cpsEnable*/ false ,
93499370 pred, channelMask, 4 , aoffimmi, sampler,
93509371 surface, dst, em, useHeader, numRows, this ,
9351- numOpnds, opndArray);
9372+ numOpnds, opndArray, mem );
93529373 }
93539374
93549375 bool useSplitSend = useSends ();
0 commit comments