Skip to content

[HAL] Refactor memory property attributes - #21005

Merged
benvanik merged 15 commits into
iree-org:mainfrom
ziereis:refactor_allocator_attributes
Jun 16, 2025
Merged

benvanik merged 15 commits into
iree-org:mainfrom
ziereis:refactor_allocator_attributes

Conversation

@ziereis

@ziereis ziereis commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Refactors memory_types and buffer_usage to values from attributes. Progress towards #20856.

This will make it easier to introduce the hal.resolve_memory_properties in a follow up PR.

@ziereis
ziereis requested a review from benvanik as a code owner June 4, 2025 13:00
@ziereis
ziereis force-pushed the refactor_allocator_attributes branch from 8c3eb08 to f26f742 Compare June 4, 2025 13:06
@ziereis ziereis changed the title [HAL] Refactor allocator attributes [HAL] Refactor memory property attributes Jun 4, 2025

@benvanik benvanik left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good! few minor things

@ziereis
ziereis requested a review from benvanik June 5, 2025 15:52
IREE::HAL::BufferUsageBitfield bufferUsage, OpBuilder &builder) {
// Emit a select op to let the runtime decide which device/queue affinity to
// use if required.
static std::tuple<SmallVector<Value>, SmallVector<Value>>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I can't follow this and the change doesn't seem relevant to this PR. It should just need to take the Values and create AllocatorSelectOp as it did before.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Before it did create a AllocatorSelectAttrOp using the DeviceOptimalAttr. I thought now i would need to create a ContextResolveOp for every affinity in the DeviceOptimalAttr to get the actual device Value and then emit the AllocatorSelectOp using these Values? Maybe you can give me some suggestion how this should be done instead?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not confident that resolving the devices this early is going to fully work with subsequent analysis, but we can give it a try!

@ziereis
ziereis requested a review from benvanik June 6, 2025 07:46
@ziereis
ziereis force-pushed the refactor_allocator_attributes branch from 0d97e0d to 8f3c06b Compare June 10, 2025 12:23
OpBuilder &builder) {
auto [devices, queueAffinities] =
lookupDevicesAndQueueAffintiesFor(op, builder);
// return the device and queue affinity for the first device if there is only

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please review the comments in your PR to ensure they are properly punctuated complete sentences (here and in several other files).

https://google.github.io/styleguide/cppguide.html#Punctuation_Spelling_and_Grammar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did give it another pass, i hope i corrected everything.

IREE::HAL::BufferUsageBitfield bufferUsage, OpBuilder &builder) {
// Emit a select op to let the runtime decide which device/queue affinity to
// use if required.
static std::tuple<SmallVector<Value>, SmallVector<Value>>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not confident that resolving the devices this early is going to fully work with subsequent analysis, but we can give it a try!

@ziereis
ziereis requested a review from benvanik June 13, 2025 12:15
@benvanik

Copy link
Copy Markdown
Collaborator

Looks great!

@benvanik
benvanik enabled auto-merge (squash) June 16, 2025 16:02
@benvanik
benvanik merged commit 1b0acbf into iree-org:main Jun 16, 2025
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
Refactors memory_types and buffer_usage to values from attributes.
Progress towards #20856.

This will make it easier to introduce the
`hal.resolve_memory_properties` in a follow up PR.

---------

Signed-off-by: default <[email protected]>
Signed-off-by: Thomas Ziereis <[email protected]>
Co-authored-by: Ben Vanik <[email protected]>
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