Skip to content

Commit 5b35a87

Browse files
committed
[AIE2P] Create dummy 256-bit accumulator and compose it with 512-bit to mimic vector register hierarchy
Subregister indices corresponds to vector and accumulator does not cover the co- rresponding sized registers and leads to undefined uses if we use same subregis- ter indices for both. Having separate subregister indices solves this problem. However, with this approach, we cannot allocate vector register for accumulator (or vice versa). The idea is to mimic the register composition hierarchy of vector for accumulator (only for smaller types, because 2048 does not matter) creating dummy 256-bit accumulators and reverting the separate subregister indices. Now, vector and accumulator register has same lane masks.
1 parent 7741c0d commit 5b35a87

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

llvm/lib/Target/AIE/aie2p/AIE2PRegisterInfo.td

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -398,23 +398,43 @@ class AIE2PDim3DRegisterClass <dag reglist, RegAltNameIndex idx = NoRegAltName>
398398
srFifo_of, srFifo_uf,
399399
srSparse_of, srFPFlags, srF2IFlags, srF2FFlags,
400400
srF2BFlags, srFPNlf, srFPCnvFx2Fl, srFPCnvFl2Fx)>;
401+
402+
let isArtificial = 1 in {
403+
foreach i = 0 - 4 in {
404+
def dummy_acc256ll_l #i : AIE2P3BitReg<i, "dummy_acc256ll_l" #i>;
405+
def dummy_acc256ll_h #i : AIE2P3BitReg<i, "dummy_acc256ll_h" #i>;
406+
}
407+
foreach i = 0 - 4 in {
408+
def dummy_acc256lh_l #i : AIE2P3BitReg<i, "dummy_acc256lh_l" #i>;
409+
def dummy_acc256lh_h #i : AIE2P3BitReg<i, "dummy_acc256lh_h" #i>;
410+
}
411+
foreach i = 0 - 4 in {
412+
def dummy_acc256hl_l #i : AIE2P3BitReg<i, "dummy_acc256hl_l" #i>;
413+
def dummy_acc256hl_h #i : AIE2P3BitReg<i, "dummy_acc256hl_h" #i>;
414+
}
415+
foreach i = 0 - 4 in {
416+
def dummy_acc256hh_l #i : AIE2P3BitReg<i, "dummy_acc256hh_l" #i>;
417+
def dummy_acc256hh_h #i : AIE2P3BitReg<i, "dummy_acc256hh_h" #i>;
418+
}
419+
}
401420

402-
421+
let SubRegIndices = [sub_256_lo, sub_256_hi], CoveredBySubRegs = 1 in {
403422
foreach i = 0 - 4 in {
404-
def bmll #i : AIE2P3BitReg<i, "bmll" #i>;
423+
def bmll #i : AIE2P3BitReg<i, "bmll" #i, [!cast<Register>("dummy_acc256ll_l" #i), !cast<Register>("dummy_acc256ll_h" #i)]>;
405424
}
406425

407426
foreach i = 0 - 4 in {
408-
def bmlh #i : AIE2P3BitReg<i, "bmlh" #i>;
427+
def bmlh #i : AIE2P3BitReg<i, "bmlh" #i, [!cast<Register>("dummy_acc256lh_l" #i), !cast<Register>("dummy_acc256lh_h" #i)]>;
409428
}
410429

411430
foreach i = 0 - 4 in {
412-
def bmhl #i : AIE2P3BitReg<i, "bmhl" #i>;
431+
def bmhl #i : AIE2P3BitReg<i, "bmhl" #i, [!cast<Register>("dummy_acc256hl_l" #i), !cast<Register>("dummy_acc256hl_h" #i)]>;
413432
}
414433

415434
foreach i = 0 - 4 in {
416-
def bmhh #i : AIE2P3BitReg<i, "bmhh" #i>;
435+
def bmhh #i : AIE2P3BitReg<i, "bmhh" #i, [!cast<Register>("dummy_acc256hh_l" #i), !cast<Register>("dummy_acc256hh_h" #i)]>;
417436
}
437+
} // let SubRegIndices = [sub_256_lo, sub_256_hi], CoveredBySubRegs = 1
418438

419439
def eBMLL : AIE2PVector512RegisterClass<(add bmll0, bmll1, bmll2, bmll3, bmll4)>;
420440
def eBMLH : AIE2PVector512RegisterClass<(add bmlh0, bmlh1, bmlh2, bmlh3, bmlh4)>;

0 commit comments

Comments
 (0)