You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: visa/FlowGraph.cpp
+363-1Lines changed: 363 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4280,6 +4280,361 @@ static int getConflictTimesForTGLLP(std::ostream& output, int *firstRegCandidate
4280
4280
return conflictTimes;
4281
4281
}
4282
4282
4283
+
staticintgetConflictTimesForTGL(std::ostream& output, int *firstRegCandidate, int &sameBankConflicts, bool zeroOne, bool isTGLLP)
4284
+
{
4285
+
int conflictTimes = 0;
4286
+
int bundles[2][16];
4287
+
int bankSrcs[2];
4288
+
4289
+
for (int i = 0; i < 2; i++)
4290
+
{
4291
+
for (int j = 0; j < 16; j++)
4292
+
{
4293
+
bundles[i][j] = -1;
4294
+
}
4295
+
bankSrcs[i] = 0;
4296
+
}
4297
+
4298
+
output << "{";
4299
+
for (int i = 0; i < G4_MAX_SRCS; i++)
4300
+
{
4301
+
bool same_register = false;
4302
+
4303
+
if (isValidReg(firstRegCandidate[i]))
4304
+
{
4305
+
for (int j = 0; j < i; j++)
4306
+
{
4307
+
if (isValidReg(firstRegCandidate[j]) && j != i)
4308
+
{
4309
+
if (firstRegCandidate[j] == firstRegCandidate[i])
4310
+
{
4311
+
same_register = true;
4312
+
break;
4313
+
}
4314
+
}
4315
+
}
4316
+
4317
+
if (same_register)
4318
+
{
4319
+
continue;
4320
+
}
4321
+
4322
+
int bundleID = (firstRegCandidate[i] % 64) / 4;
4323
+
if (isTGLLP)
4324
+
{
4325
+
bundleID = (firstRegCandidate[i] % 16) / 2;
4326
+
}
4327
+
4328
+
int bankID = (firstRegCandidate[i] % 4) / 2;
4329
+
if (zeroOne)
4330
+
{
4331
+
bankID = (firstRegCandidate[i]) % 2;
4332
+
}
4333
+
4334
+
//Same bank and same bundle
4335
+
if (bundles[bankID][bundleID] != -1) //Same bank and same bundle
4336
+
{
4337
+
conflictTimes++;
4338
+
}
4339
+
4340
+
bundles[bankID][bundleID] = i;
4341
+
bankSrcs[bankID]++;
4342
+
if (bankID == 0)
4343
+
{
4344
+
output << "E:";
4345
+
}
4346
+
else
4347
+
{
4348
+
output << "O:";
4349
+
}
4350
+
output << bundleID << ",";
4351
+
}
4352
+
}
4353
+
4354
+
//Same bank but different bundles
4355
+
if (conflictTimes == 0 &&
4356
+
(bankSrcs[0] > 2 ||
4357
+
bankSrcs[1] > 2))
4358
+
{
4359
+
conflictTimes++;
4360
+
sameBankConflicts++;
4361
+
}
4362
+
elseif (bankSrcs[0] > 2 ||
4363
+
bankSrcs[1] > 2)
4364
+
{
4365
+
sameBankConflicts++;
4366
+
}
4367
+
4368
+
output << "}, ";
4369
+
4370
+
return conflictTimes;
4371
+
}
4372
+
4373
+
/*
4374
+
* Gen12 BC evaluation
4375
+
* In Gen12, there are 8 bundles and 2 banks per HW thread.
4376
+
* Banks are divided according to EVEN/ODD of register index: 0101010101010101
4377
+
* There are 8 bundles per 16 registers: 0011223344556677
4378
+
* For two adjacent instructions: inst1 and inst2, inst1_src1(, inst1_src2) and inst2_src0 will be read in same cycle
4379
+
* Considered HW swap and read suppresion mechanisms
4380
+
* HW swap:
4381
+
* The origional GRF register reading sequence for a three source instruction is: src0 in cycle0 and src1 and src2 in cycle2.
4382
+
* HW swap mechanism detects the conflict between src1 and src2, if there is a conflict, HW will read src1 in cycle0 and src0 and src2 in cycle1.
4383
+
* Note that:
4384
+
* 1. for SIMD16, HW swap only happens when detecting conflicts in first simd8's registers. conflict in second simd8 will not trigger swap.
4385
+
* 2. for SIMD16, when swapping happens, the src1 and src0 of both simd8 instructions will be swapped.
4386
+
* Read suppression between instructions:
4387
+
* The read suppression mechanism is used to save the GRF register reading operations with a register cache in HW. The suppression we talked here
4388
+
* is the suppression between instructions. For each source operand slot, HW provide a GRF cache. With the cache, if the same GRF will be read in
4389
+
* the instruction, the read will not happen, the cached value will be used directly.
4390
+
* Note that:
4391
+
* 1. The cache will only buffer the latest GRF which was read
4392
+
* 2. The cache will be flushed if the buffered register is used as destination operand.
4393
+
* 3. For SIMD16, if one source is scalar, the read suppression doen't happen, no matter within the SIMD16 instruction or with the following instruction.
4394
+
* 4. The read suppression between instructions only happens in src1 and src2
4395
+
* 5. 2 GRFs read suppression for src1 and 1 GRF read suppression for src0 and src2.
4396
+
* Read suppression within a instruction:
4397
+
* 1. Works for all source operands.
4398
+
*
4399
+
* suppressRegs is used as the read suppression buffer
4400
+
* lastDst is used to keep dst register of last instruction. It's used to clear read suppression buffer. Once a register is defined, it's not buffered anymore
4401
+
* lastRegs is used to keep the src1 and src2 of last instruction, in case there is conflict with current instruction GRF read
4402
+
*/
4403
+
uint32_tG4_BB::emitBankConflictGen12(std::ostream& os_output, G4_INST *inst, int *suppressRegs, int &sameConflictTimes, int &twoSrcConflicts, int &simd16RS, bool zeroOne, bool isTGLLP)
uint32_tG4_BB::emitBankConflictGen12lp(std::ostream& os_output, G4_INST *inst, int *suppressRegs, int *lastRegs, int &sameConflictTimes, int &twoSrcConflicts, int &simd16RS)
Copy file name to clipboardExpand all lines: visa/FlowGraph.h
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -438,6 +438,7 @@ class G4_BB
438
438
439
439
uint32_temitBankConflictGen12lp(std::ostream & os_output, G4_INST * inst, int * suppressRegs, int * lastRegs, int & sameConflictTimes, int & twoSrcConflicts, int & simd16RS);
0 commit comments