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

[AIE] Legalize G_AND for <8 x s64> vector. #262

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

Conversation

SagarMaheshwari99
Copy link
Collaborator

No description provided.

@SagarMaheshwari99 SagarMaheshwari99 changed the title [AIE2] Legalize G_AND for <8 x s64> vector. [AIE] Legalize G_AND for <8 x s64> vector. Jan 19, 2025
@@ -255,6 +255,13 @@ AIE2PLegalizerInfo::AIE2PLegalizerInfo(const AIE2PSubtarget &ST)
getActionDefinitionsBuilder({G_AND, G_OR})
.legalFor({S32})
.legalFor(AIE2PVectorTypes)
.bitcastIf(
[=](const LegalityQuery &Query) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make this more generic and also handle 256/1024 bit vectors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

@@ -305,7 +299,7 @@ AIE2PLegalizerInfo::AIE2PLegalizerInfo(const AIE2PSubtarget &ST)
.legalFor({V16S32, V32S16, V64S8})
.widenScalarToNextPow2(0)
.clampScalar(0, S32, S32)
// AIE ISA supports only 512-bit vector add/sub/xor
// AIE ISA supports only 512-bit vector add/sub/xor/and/or
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why do we need to update the comment with "and/or"?

@@ -1092,6 +1092,15 @@ def : PatInaccessibleMem<(int_aie2_v16bf16_to_v16i32 VEC256:$src, mSs:$shft),
def : PatInaccessibleMem<(int_aie2_clr16f_conf),
(VCLR_vclr_BF)>;

// AIE does not have a native xor instruction for vector operands.
// Res = A xor B --> Res = AB' || A'B
foreach Ty = [v64i8, v32i16, v16i32] in {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can it be shared between aie2 and aie2p? I see we have exactly the same implementation for aie2p.

(v32i16 (REG_SEQUENCE VEC512, VEC256:$src2, sub_256_lo))),
sub_256_lo))>;
}
// VBOR / VBAND / XOR
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we don't have xor here

// like scalarization. We can use G_CONCAT_VECTORS and unmerge to do this
// more optimally.
.customIf(vectorSmallerThan(0, 512))
.bitcastIf(typeInSet(0, {AccV4S64, AccV8S64, AccV16S64}),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is it not for all aie2p accumulator types defined in AIE2PAccumulatorTypes?

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.

3 participants