File tree Expand file tree Collapse file tree 1 file changed +21
-11
lines changed Expand file tree Collapse file tree 1 file changed +21
-11
lines changed Original file line number Diff line number Diff line change @@ -256,34 +256,44 @@ void VISAKernelImpl::adjustIndirectCallOffset()
256
256
{
257
257
// for every indirect call, count # of instructions inserted
258
258
// between call and the first add
259
- uint32_t num_sync = 0 ;
259
+ uint64_t sync_offset = 0 ;
260
260
G4_INST* first_add = nullptr ;
261
261
INST_LIST::reverse_iterator it = bb->rbegin ();
262
262
// skip call itself
263
263
++it;
264
264
for (; it != bb->rend (); ++it)
265
265
{
266
266
G4_INST* inst = *it;
267
- if (inst->opcode () == G4_sync_nop) {
268
- ++num_sync;
267
+ G4_opcode op = inst->opcode ();
268
+ if (op == G4_sync_allrd || op == G4_sync_allwr)
269
+ {
270
+ inst->setNoCompacted ();
271
+ sync_offset += 16 ;
272
+ continue ;
273
+ }
274
+ else if (op == G4_sync_nop) {
275
+ inst->setCompacted ();
276
+ sync_offset += 8 ;
269
277
continue ;
270
- } else if (inst->opcode () == G4_add) {
271
- if (first_add == nullptr ) {
278
+ }
279
+ else if (op == G4_add)
280
+ {
281
+ if (first_add == nullptr )
282
+ {
272
283
first_add = inst;
273
284
continue ;
274
- } else {
285
+ }
286
+ else
287
+ {
275
288
break ;
276
289
}
277
290
}
278
291
// instructions between call and add could only be
279
- // sync.nop
292
+ // sync.nop, sync.allrd or sync.allwr
280
293
assert (0 );
281
294
}
282
- // assume that the sync.nop must be compacted, the instruction
283
- // length is 8
284
295
assert (first_add->getSrc (1 )->isImm ());
285
- int64_t adjust_off = first_add->getSrc (1 )->asImm ()->getInt ()
286
- - num_sync * 8 ;
296
+ int64_t adjust_off = first_add->getSrc (1 )->asImm ()->getInt () - sync_offset;
287
297
first_add->setSrc (m_builder->createImm (adjust_off, Type_D), 1 );
288
298
}
289
299
}
You can’t perform that action at this time.
0 commit comments