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

Add support for bfloat in VInsert PreLegalizerCombiner #243

Open
wants to merge 4 commits into
base: aie-public
Choose a base branch
from

Conversation

abhinay-anubola
Copy link
Collaborator

@abhinay-anubola abhinay-anubola commented Nov 21, 2024

Add support for bfloat in SetExtract PreLegalizerCombiner
Add support for bfloat in VInsert PreLegalizerCombiner

@abhinay-anubola abhinay-anubola force-pushed the sanubola.support.bf512.VInsertCombiner branch from d6afe1c to 85d6911 Compare November 21, 2024 13:48
Copy link
Collaborator

@gbossu gbossu left a comment

Choose a reason for hiding this comment

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

I think this looks good, but I'm wondering if getting rid of aie2_set_bf512_bf256 in the frontend and using aie2_set_I512_I256 wouldn't be better

@abhinay-anubola abhinay-anubola force-pushed the sanubola.support.bf512.VInsertCombiner branch 3 times, most recently from f10042d to 39c7708 Compare November 27, 2024 06:43
@@ -527,9 +527,9 @@ INTRINSIC(v32bfloat16) insert(v32bfloat16 a, int idx, v16bfloat16 b) {
// Set 256-bit portion of 512-bit register
INTRINSIC(v32bfloat16) set_v32bfloat16(int idx, v16bfloat16 b) {
if (idx == 0)
return __builtin_aiev2_set_bf512_bf256(b, 0);
return __builtin_aiev2_set_I512_I256(b, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks curious, all values different from 0 can be used as index 1. I was wondering why not simply:

return __builtin_aiev2_set_I512_I256(b, idx == 0 ? 0 : 1);

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think those headers were partly auto-generated, and for some intrinsics we have more than two different values. So I'd assume it's easier to write a generic generator if sticking to if/else.

@abhinay-anubola abhinay-anubola force-pushed the sanubola.support.bf512.VInsertCombiner branch from 39c7708 to d234b71 Compare December 23, 2024 08:55
MachineInstr *
llvm::getDefIgnoringCopiesAndBitcasts(Register Reg,
llvm::getDefIgnoringCopiesAndBitcasts(Register Reg, bool AllowMultiUse,
const MachineRegisterInfo &MRI) {

Copy link
Collaborator

Choose a reason for hiding this comment

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

You seem to never use AllowMultiUse=true. Do you have future plans outside of this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh okay there is one use in matchExtractConcat. I would be curious to see if allowing multiple uses in other combiners would help as well?

@@ -191,6 +191,7 @@ unsigned getVInsertScalarSize(unsigned IntrinsicID) {
case Intrinsic::aie2_vinsert8_I512:
return 8;
case Intrinsic::aie2_vinsert16_I512:
case Intrinsic::aie2_vinsert16_bf512:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should also get rid of that intrinsic at some point

@abhinay-anubola abhinay-anubola force-pushed the sanubola.support.bf512.VInsertCombiner branch 2 times, most recently from 534837e to 9d57d0f Compare January 7, 2025 14:24
@abhinay-anubola abhinay-anubola force-pushed the sanubola.support.bf512.VInsertCombiner branch from 9d57d0f to 2c573c6 Compare January 8, 2025 10:43
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.

5 participants