Skip to content

Conversation

@Hardcode84
Copy link
Contributor

Tensor load op support shared memory padding with some restrictions.

The the padded allocation shape and only drop padding if it's not supported.

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for hardware padding in tensor load operations to shared memory, allowing the compiler to generate padded memory layouts when constraints are met. Previously, all padding was cleared unconditionally.

Key changes:

  • Introduced is_pow2() utility function to check if a value is a power of 2
  • Added validation logic to determine when padding is supported by the tensor operation hardware constraints
  • Modified padding clearing to be conditional based on hardware support rather than unconditional
  • Renamed property get_unpadded_dims to unpadded_dims and added complementary unpadded_shape property

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
wave_lang/kernel/wave/utils/general_utils.py Added is_pow2() utility function for power-of-2 checks
wave_lang/kernel/wave/tensor_load_to_shared.py Added padding validation and conditional clearing logic; imported is_literal and is_pow2
wave_lang/kernel/wave/generate_bounds_exprs.py Updated to use renamed unpadded_dims property
wave_lang/kernel/wave/codegen/read_write.py Added padding configuration to tensor descriptor; imported subs_idxc
wave_lang/kernel/ops/wave_ops.py Renamed get_unpadded_dims property to unpadded_dims and added unpadded_shape property
lit_tests/kernel/wave/mma.py Updated test expectations to verify padded memory allocation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@Megan0704-1 Megan0704-1 left a comment

Choose a reason for hiding this comment

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

Thank you @Hardcode84!

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Copilot AI review requested due to automatic review settings November 3, 2025 14:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Copy link
Contributor

@Megan0704-1 Megan0704-1 left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @Hardcode84

@Hardcode84 Hardcode84 merged commit 39bbdcf into iree-org:main Nov 4, 2025
26 of 28 checks passed
@Hardcode84 Hardcode84 deleted the tdm-padding branch November 4, 2025 11:14
Megan0704-1 pushed a commit to Megan0704-1/wave that referenced this pull request Nov 10, 2025
Tensor load op support shared memory padding with some restrictions.

The the padded allocation shape and only drop padding if it's not
supported.

---------

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
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