Skip to content

add few ops of bufferization dialect and arith dialect.#127

Merged
jamesthejellyfish merged 1 commit intoHuawei-CPLLab:mainfrom
Narutoworld:support-bufferization-dialect
Mar 4, 2026
Merged

add few ops of bufferization dialect and arith dialect.#127
jamesthejellyfish merged 1 commit intoHuawei-CPLLab:mainfrom
Narutoworld:support-bufferization-dialect

Conversation

@Narutoworld
Copy link
Contributor

add support for bufferization dialect's to_tensor and materialize_in_destination.

add support for arith dialect's vadd and vmul.

Copy link

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 new operations in the bufferization and arith dialects. The bufferization dialect gains to_tensor and materialize_in_destination operations for converting between tensor and memref representations. The arith dialect adds trunc for type truncation, and vadd/vmul for vector addition and multiplication operations.

Changes:

  • Added new bufferization.py file with to_tensor and materialize_in_destination operations
  • Extended arith.py with trunc, vadd, and vmul operations for vector operations and type truncation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 11 comments.

File Description
src/pydsl/bufferization.py New file implementing bufferization dialect operations for tensor/memref conversion with helper validation functions
src/pydsl/arith.py Added vector import and implemented trunc, vadd, and vmul operations for arithmetic on vectors and type truncation

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

Copy link
Collaborator

@jamesthejellyfish jamesthejellyfish left a comment

Choose a reason for hiding this comment

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

Looks mostly pretty good, but there's a few things that should be cleaned up:

  • pass the formatting check: This should be as simple as running hatch fmt -f on your repo (assuming you have the latest hatch installed) and then rebasing
  • fix or resolve the small issues that copilot mentioned - if you think the suggestion is wrong, just add a reply and then resolve without changing anything
  • can you add some test cases to arith.py and bufferization.py that utilize the new ops? For some of the more obscure ops you could just check that the op is created (there are examples of how to do this in test_transform.py), but if you could write a simple program that utilizes each op and then verify the results that would be ideal

@Narutoworld Narutoworld force-pushed the support-bufferization-dialect branch 6 times, most recently from 603b110 to 3eb8a68 Compare February 26, 2026 20:20
@Narutoworld Narutoworld force-pushed the support-bufferization-dialect branch 2 times, most recently from 418d450 to 9edce0b Compare February 27, 2026 17:39
…_destination.

add support for arith dialect's vadd and mul.

Update memref.py and frontend.py.
@Narutoworld Narutoworld force-pushed the support-bufferization-dialect branch from 9edce0b to 1940abb Compare March 4, 2026 14:22
Copy link
Collaborator

@jamesthejellyfish jamesthejellyfish left a comment

Choose a reason for hiding this comment

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

LGTM!

@jamesthejellyfish jamesthejellyfish merged commit 7cdfe7e into Huawei-CPLLab:main Mar 4, 2026
2 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.

3 participants