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

Delinearize indexing #318

Merged
merged 7 commits into from
Feb 12, 2025
Merged

Delinearize indexing #318

merged 7 commits into from
Feb 12, 2025

Conversation

ivanradanov
Copy link
Collaborator

No description provided.

// CHECK-SAME: %[[VAL_0:[^:]*]]: memref<?x5x3xi64, 1>) {
// CHECK: %[[VAL_1:.*]] = arith.constant 1 : i64
// CHECK: affine.parallel (%[[VAL_2:.*]], %[[VAL_3:.*]], %[[VAL_4:.*]]) = (0, 0, 0) to (7, 5, 3) {
// CHECK: affine.store %[[VAL_1]], %[[VAL_0]]{{\[}}%[[VAL_2]] + (%[[VAL_3]] + %[[VAL_4]] floordiv 3) floordiv 5, (%[[VAL_3]] + %[[VAL_4]] floordiv 3) mod 5, %[[VAL_4]] mod 3] : memref<?x5x3xi64, 1>
Copy link
Member

Choose a reason for hiding this comment

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

the outer one should get simplified to floordiv 15, right?

Copy link
Member

Choose a reason for hiding this comment

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

we also ideally want to be able to remove val4 floordiv3 -> 0 [since its always less than 3]

// CHECK-SAME: %[[VAL_0:[^:]*]]: memref<?x5x3xi64, 1>) {
// CHECK: %[[VAL_1:.*]] = arith.constant 1 : i64
// CHECK: affine.parallel (%[[VAL_2:.*]], %[[VAL_3:.*]], %[[VAL_4:.*]]) = (0, 0, 0) to (7, 5, 3) {
// CHECK: affine.store %[[VAL_1]], %[[VAL_0]]{{\[}}%[[VAL_2]], %[[VAL_3]], %[[VAL_4]]] : memref<?x5x3xi64, 1>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wsmoses Now we manage to eliminate all floordiv and mod.

@ivanradanov
Copy link
Collaborator Author

I think I fixed the crash and it should be good now

@wsmoses wsmoses merged commit 4de99ba into main Feb 12, 2025
6 of 11 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.

2 participants