Repository navigation
[HAL] Add hal.allocator.resolve_memory_properties - #21115
Conversation
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: Thomas Ziereis <[email protected]>
Signed-off-by: Thomas Ziereis <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
benvanik
left a comment
There was a problem hiding this comment.
Looking good! Major comments are:
- remove the canonicalization patterns (to ensure there's only one point in the transformation pipeline where we resolve consistently)
- decouple stream/hal by cloning the lifetime enum into HAL (for now, it can change in the future)
- change the pass to doing a single pass module walk instead of a fixed-point pattern application (since fixed-point is not required)
| // The bits set here are those that must be set for the buffer to be used as the | ||
| // buffer within the program with its defined resource lifetime. | ||
| LogicalResult | ||
| deriveRequiredResourceBufferBits(Location loc, IREE::Stream::Lifetime lifetime, |
There was a problem hiding this comment.
We try to keep IR dirs small and focused exclusively on the structure and representation of dialects and their canonical form, and utilities used during conversion stay there. We also try to avoid "utils" dumpsters unless very useful to a large portion of code - and even if so scope them as tightly as possible (such as the conversion utils useful to conversion patterns). These are only needed in one single place in the code (where a lifetime is converted into HAL type/usage enums) and should live with that (in your ResolveTopologyQueries pass).
Having the patterns is nice for baking this out earlier but given what this does (interacting with devices/etc) it's best to do it in your pass in a consistent location - before ResolveTopologyQueriesPass runs there are resolve ops, and after it runs there are not. This makes it more difficult for behavior to creep in that assumes things are always resolved early (because a particular test/user always has a single device and never tests with multiple) and more predictable where to debug issues. So drop the canonicalizers here and then this (and the external resources mappable flag) can all move to ResolveTopologyQueries.
There was a problem hiding this comment.
i kept this at its original place (StreamToHAL/Utils.h) as its still used by BufferAsserts in the Stream conversion patterns. However i moved to cl flag and the deriveAllowedResourceBufferBits function to the pass.
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
benvanik
left a comment
There was a problem hiding this comment.
A few small style changes then LGTM! Nice work!
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
Signed-off-by: default <[email protected]>
|
Thank you for the reviews! :) |
Progress towards: iree-org#20856 Adds a new operation `hal.allocator.resolve_memory_properties` and a pass that tries to resolve it using the topology attribute. The same pass should aim to do the same thing for the `hal.allocator.select` op in a follow up. --------- Signed-off-by: default <[email protected]> Signed-off-by: Thomas Ziereis <[email protected]>
Progress towards: #20856 Adds a new operation `hal.allocator.resolve_memory_properties` and a pass that tries to resolve it using the topology attribute. The same pass should aim to do the same thing for the `hal.allocator.select` op in a follow up. --------- Signed-off-by: default <[email protected]> Signed-off-by: Thomas Ziereis <[email protected]>
progress towards: #20856
Adds a new operation
hal.allocator.resolve_memory_propertiesand a pass that tries to resolve it using the topology attribute. The same pass should aim to do the same thing for thehal.allocator.selectop in a follow up.