Skip to content

Commit d0eb845

Browse files
bcheng0127igcbot
authored andcommitted
Change schedule priority according to dep type
For barrier dep, shouldn't use latency cycle to calcuate priority, because barrier is order issue, not the latecy issue. Use occupancy steady.
1 parent a17ec75 commit d0eb845

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

IGC/ocloc_tests/optimizations/PromoteToPredicatedMemoryAccess/LoadSubDW.cl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ SPDX-License-Identifier: MIT
1313
// RUN: ocloc compile -file %s -device pvc -options "-igc_opts 'EnablePromoteToPredicatedMemoryAccess=1 VISAOptions=-asmToConsole'" 2>&1 | FileCheck %s --check-prefixes=CHECK-ASM
1414

1515
// CHECK-ASM: kernel test_i8_0
16-
// CHECK-ASM: cmp (32|M0) (lt)[[F1:f[0-9\.]+]]
17-
// CHECK-ASM: ([[F1]]) goto (32|M0)
1816
// CHECK-ASM: {{[_a-z0-9A-Z]+}}:
1917
// CHECK-ASM-DAG: cmp (32|M0) (le)[[F2:f[0-9\.]+]] null<1>:d r{{[0-9\.]+}}
2018
// CHECK-ASM-DAG: cmp (32|M0) (ge)[[F3:f[0-9\.]+]] null<1>:d r{{[0-9\.]+}}

visa/LocalScheduler/Dependencies_G4IR.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,15 @@ DepType vISA::getDepScratchSend(G4_INST *curInst, G4_INST *liveInst) {
189189
return NODEP;
190190
}
191191

192+
bool vISA::isNotLatencyBarrier (DepType type) {
193+
if (type == CONTROL_FLOW_BARRIER ||
194+
type == OPT_BARRIER ||
195+
type == SEND_BARRIER ||
196+
type == MSG_BARRIER)
197+
return true;
198+
return false;
199+
}
200+
192201
DepType vISA::CheckBarrier(G4_INST *inst) {
193202
if (inst->isOptBarrier() || inst->isAtomicInst() || inst->opcode() == G4_madm) {
194203
return OPT_BARRIER;

visa/LocalScheduler/Dependencies_G4IR.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ DepType getDepSend(G4_INST *curInst, G4_INST *liveInst, bool BTIIsRestrict);
3838

3939
DepType getDepScratchSend(G4_INST *curInst, G4_INST *liveInst);
4040

41+
bool isNotLatencyBarrier(DepType type);
42+
4143
DepType CheckBarrier(G4_INST *inst);
4244

4345
DepType getDepForOpnd(Gen4_Operand_Number cur, Gen4_Operand_Number liv);

visa/LocalScheduler/LocalScheduler_G4IR.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1887,9 +1887,16 @@ void DDD::collectRoots() {
18871887
void DDD::setPriority(Node *pred, const Edge &edge) {
18881888
// Calculate PRED's priority (pred->priority), based on SUCC's priority
18891889
Node *succ = edge.getNode();
1890+
DepType type = edge.getType();
18901891
vISA_ASSERT(succ->priority != Node::PRIORITY_UNINIT,
18911892
"succ node has no priority?");
1892-
int newPriority = succ->priority + edge.getLatency();
1893+
int newPriority = succ->priority;
1894+
// Note that, node->isBarrier cannot be used here. Because there may be
1895+
// non-barrier dep.
1896+
if (isNotLatencyBarrier(type))
1897+
newPriority += pred->getOccupancy();
1898+
else
1899+
newPriority += edge.getLatency();
18931900
pred->priority =
18941901
(newPriority > pred->priority) ? newPriority : pred->priority;
18951902
}

0 commit comments

Comments
 (0)