Skip to content
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

Merged
merged 5 commits into from
Jan 24, 2025

Conversation

niwinanto
Copy link
Collaborator

TODO:
v128bfp16ebs8 shuffle(v128bfp16ebs8 , unsigned int );
This depends on intrinsics from bfp16 upd_ext

@@ -13,3 +13,4 @@

include "AIEBaseRegisterBanks.td"
def AccRegBank : RegisterBank<"AccRegBank", [ACC512, ACC1024, ACC2048]>;
def GPRRegBank : RegisterBank<"GPRRegBank", [eR, eL, eE, EXPVEC64]>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, include a new line in the end.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should not be needed after rebase

Copy link
Collaborator

@konstantinschwarz konstantinschwarz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, few nits

clang/lib/Headers/aiebase_typedefs.h Show resolved Hide resolved
@@ -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],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use DefaultAttrsIntrinsic instead of Intrinsic

Copy link
Collaborator

@khallouh khallouh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add .ll test from IR to assembly?

@niwinanto niwinanto force-pushed the niwin.bfp16.scl2vecIntrinsic branch 4 times, most recently from 0f04536 to 487aede Compare January 20, 2025 08:01
}

INTRINSIC(v64bfp16ebs8) shuffle(v64bfp16ebs8 a, unsigned mode) {
v64bfp16ebs8 unDef;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Undef

}

INTRINSIC(v64bfp16ebs16) shuffle(v64bfp16ebs16 a, unsigned mode) {
v64bfp16ebs16 unDef;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit Undef

%struct.v64bfp16ebs16 = type <{ <64 x i8>, <8 x i8> }>

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none)
define dso_local noundef <16 x i32> @_Z18test_broadcast_s64Dv2_j(<2 x i32> noundef %b) local_unnamed_addr {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unrelated. Didn't we have tests for these broadcasts?

; CHECK-NEXT: mova r1, #1 // Delay Slot 5
; CHECK-NEXT: lshl r29, r0, r1 // Delay Slot 4
; CHECK-NEXT: or r29, r29, r1; vinsert.32 x0, x2, r29, r2 // Delay Slot 3
; CHECK-NEXT: vinsert.32 x0, x0, r29, r3 // Delay Slot 2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add these tests in a separate commit? as they are unrelated

Copy link
Collaborator

@khallouh khallouh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides a few minor comments, it looks good!

@niwinanto niwinanto force-pushed the niwin.bfp16.scl2vecIntrinsic branch from 487aede to 2eec92d Compare January 23, 2025 05:11
@niwinanto niwinanto force-pushed the niwin.bfp16.scl2vecIntrinsic branch from 2eec92d to 8bc61ad Compare January 23, 2025 09:56
khallouh
khallouh previously approved these changes Jan 23, 2025
Copy link
Collaborator

@khallouh khallouh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@niwinanto niwinanto merged commit af6f54b into aie-public Jan 24, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants