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

[AIE2P] End-to-End support of fifo store intrinsics #308

Merged
merged 3 commits into from
Jan 29, 2025

Conversation

khallouh
Copy link
Collaborator

No description provided.

case Intrinsic::aie2p_fifo_st_push_512_bfp16:
case Intrinsic::aie2p_fifo_st_flush:
case Intrinsic::aie2p_fifo_st_flush_conv:
case Intrinsic::aie2p_fifo_st_flush_1d:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would that be equivalent to what you call a normal aie2p_fifo_st_flush followed by a ptr increment? Same for 2d/3d?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would hope so. And the architecture file calls it normal ;-)

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was just wondering because we would then only need the aie2p_fifo_st_flush instrinsic/builtin. And we could get the 1d/2d/3d versions using instruction selection combiners like we do for "normal" load/stores. But then we would probably need new G_AIE_FIFO_xxxx opcodes, so it's probably not worth to do this now.

@khallouh khallouh force-pushed the hamza.bfp16.ldst.store branch from 5de2dfb to 25d6fdd Compare January 24, 2025 08:49
void test_fifo_st_flush_2d_byte(v16uint32 *&p, fifo_state_t &s, int off,
int size1, addr_t &count1, int inc1) {
return fifo_st_flush_2d_byte(p, s, off, size1, count1, inc1);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: This really is a huge file and it is pretty much impossible to review. It seems that in many cases, only the vector type changes. Do you think it would be possible to templatise all those test_xxxx functions and run the same file multiple times with e.g. -DTYPE=v16uint32, -DTYPE=v16int32, etc.

At least I think that would work for the "flush" tests, because the vector type does not seem to appear in the check lines. For "push", we might have so write a test for each type, but there aren't that many push variants, so I think that's fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried it but there is still the function label line which depends on the type.

@khallouh khallouh force-pushed the hamza.bfp16.ldst.store branch 3 times, most recently from 07dda5e to eec639b Compare January 24, 2025 14:14
FIFO_ST_NORMAL(v32int16)
FIFO_ST_NORMAL(v32uint16)
FIFO_ST_NORMAL(v16int32)
FIFO_ST_NORMAL(v16uint32)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should #undef these macros after their usage

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

@@ -81,4 +81,118 @@ INTRINSIC(v64uint16) unpack(v64uint8 v) { return unpack(v, __SIGN_UNSIGNED); }
INTRINSIC(v128int8) unpack(v128int4 v) { return unpack(v, __SIGN_SIGNED); }
INTRINSIC(v128uint8) unpack(v128uint4 v) { return unpack(v, __SIGN_UNSIGNED); }

#define FIFO_ST_PUSH_NORMAL(T) \
INTRINSIC(void) fifo_st_reset(T *&p, T v, fifo_state_t &s) { \
Copy link
Collaborator

Choose a reason for hiding this comment

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

The API also supports volatile qualified pointers. Could you add those variants as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Correction: I meant restrict, not volatile

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added the versions with memory bank annotations and the restrict qualifier. See the last fixup commit.

@abhinay-anubola
Copy link
Collaborator

It would be good if you could squash the fixup commit with the original commit. This will help keep the commit history clean.

@khallouh
Copy link
Collaborator Author

It would be good if you could squash the fixup commit with the original commit. This will help keep the commit history clean.

I will do that later. Just wanted to show what the fixup commit fixed and when.

@khallouh khallouh force-pushed the hamza.bfp16.ldst.store branch from be6981a to 305332a Compare January 29, 2025 09:32
@khallouh khallouh force-pushed the hamza.bfp16.ldst.store branch 2 times, most recently from f85aa4e to 74da324 Compare January 29, 2025 13:16
// RUN: %clang -O1 --target=aie2 -nostdlibinc -S -emit-llvm %s -o - | FileCheck %s
// RUN: %clang -O1 --target=aie2p -nostdlibinc -S -emit-llvm %s -o - | FileCheck %s
Copy link
Collaborator

Choose a reason for hiding this comment

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

Noice

gbossu
gbossu previously approved these changes Jan 29, 2025
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.

LGTM. I cannot verify every line, but what I've seen is correct and our regression suite seems to confirm that. Nice work!

@khallouh khallouh force-pushed the hamza.bfp16.ldst.store branch from 434e55e to 6840966 Compare January 29, 2025 13:50
@khallouh khallouh enabled auto-merge (rebase) January 29, 2025 13:55
@khallouh khallouh force-pushed the hamza.bfp16.ldst.store branch from 6840966 to a33eb0a Compare January 29, 2025 14:34
@khallouh khallouh merged commit 87f2b03 into aie-public Jan 29, 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.

5 participants