-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
End to end support for bfp16 scl2vec intrinsics #278
base: aie-public
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,8 @@ typedef int16_t v32int16 __attribute__((__vector_size__(64))) | |
__attribute__((aligned(__MIN_ALIGNMENT))); | ||
typedef int8_t v64int8 __attribute__((__vector_size__(64))) | ||
__attribute__((aligned(__MIN_ALIGNMENT))); | ||
typedef char v64char __attribute__((__vector_size__(64))) | ||
__attribute__((aligned(__MIN_ALIGNMENT))); | ||
typedef uint32_t v8uint64 __attribute__((__vector_size__(64))) | ||
__attribute__((aligned(__MIN_ALIGNMENT))); | ||
typedef uint32_t v16uint32 __attribute__((__vector_size__(64))) | ||
|
@@ -246,6 +248,7 @@ typedef int16_t v4int16 __attribute__((__vector_size__(8))); | |
typedef uint16_t v4uint16 __attribute__((__vector_size__(8))); | ||
typedef uint8_t v8uint8 __attribute__((__vector_size__(8))); | ||
typedef int8_t v8int8 __attribute__((__vector_size__(8))); | ||
typedef char v8char __attribute__((__vector_size__(8))); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need for these two types, just use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are defined in the global header now as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And they are need to be able to cast as the builtins take a v64c (a vector of char) and we define |
||
typedef buint8_t v16uint4 __attribute__((__vector_size__(8))); | ||
typedef bint8_t v16int4 __attribute__((__vector_size__(8))); | ||
/* vector types */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -572,4 +572,10 @@ def int_aie2p_sqrtf : ClangBuiltin<"__builtin_aie2p_sqrtf">, AIE2PNLF; | |
// DIVS | ||
def int_aie2p_divs : AIE2PDIVS; | ||
|
||
// BFP16 MAC MUL | ||
class AIE2PSHUFFLEBFP16 | ||
: Intrinsic<[llvm_v64i8_ty, llvm_v8i8_ty], [llvm_v64i8_ty, llvm_v8i8_ty, llvm_v64i8_ty, llvm_v8i8_ty, llvm_i32_ty], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should use |
||
[IntrNoMem]>; | ||
def int_aie2p_vshuffle_576_bfp16 : AIE2PSHUFFLEBFP16; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This selects to the same instruction whether we come from |
||
|
||
} // TargetPrefix = "aie2p" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,11 +134,15 @@ bool AIEBaseInstructionSelector::selectG_IMPLICIT_DEF( | |
// Make sure no input operands are passed to IMPLICIT_DEF | ||
while (I.getNumOperands() > 1) | ||
I.removeOperand(1); | ||
const MachineOperand &DstOp = I.getOperand(0); | ||
const RegisterBank &RB = *RBI.getRegBank(DstOp.getReg(), MRI, TRI); | ||
const TargetRegisterClass &RC = | ||
TRI.getMinClassForRegBank(RB, MRI.getType(DstOp.getReg())); | ||
return RBI.constrainGenericRegister(DstOp.getReg(), RC, MRI); | ||
const Register DstReg = I.getOperand(0).getReg(); | ||
const RegClassOrRegBank &RegClassOrBank = MRI.getRegClassOrRegBank(DstReg); | ||
const TargetRegisterClass *DstRC = | ||
RegClassOrBank.dyn_cast<const TargetRegisterClass *>(); | ||
if (!DstRC) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, if this is needed, could you put it in its own commit along with the tests that it affects? |
||
const RegisterBank &RB = *RegClassOrBank.get<const RegisterBank *>(); | ||
DstRC = &TRI.getMinClassForRegBank(RB, MRI.getType(DstReg)); | ||
} | ||
return RBI.constrainGenericRegister(DstReg, *DstRC, MRI); | ||
} | ||
|
||
bool AIEBaseInstructionSelector::selectG_PHI(MachineInstr &I, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
|
||
include "AIEBaseRegisterBanks.td" | ||
def AccRegBank : RegisterBank<"AccRegBank", [ACC512, ACC1024, ACC2048]>; | ||
def GPRRegBank : RegisterBank<"GPRRegBank", [eR, eL, eE, EXPVEC64]>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, include a new line in the end. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not be needed after rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as for the llvm intrinsic, we don't need the 576 in the name