You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Stream] Add a mechanism for denoting device-device link topology for transfer elision when NUMA. #20854
Currently all devices are assumed NUMA and that transfers are required for performance to avoid high latency/low throughput across limited links. In both homogeneous and heterogeneous cases we may want to elide some of those transfers when it's either known not to be profitable (relative to an extra allocation and copy) or when the user wants to explicitly avoid them. There are issues with potentially needing cache management operations that aren't currently lowered but for the initial #20851 work they will be ignored. In order to elide transfers in #20853 there must be a way to know the relationship between any arbitrary sets of devices in the compiler. There's still some potential to support runtime-dynamic optional transfers but it's way outside the scope for now.
To allow the AffinityAttr queries to work with only local information each device target will need a way to denote how it communicates with other devices. Unfortunately today the only place this information is available is the HAL device analysis and that's not readily accessible from stream. A new interface of some kind is likely required to annotate the top-level module with the device topology in a way that stream can query. stream.topology = #hal.device.topology<...> implementing IREE::Stream::AffinityTopologyAttr or something. Queries in stream passes can then always find that attribute and use it when resolving the information.
I think it's a bit underspecified for now to start work on, unfortunately. If you want to share ideas here and discuss the design that'd be great, though!
Im also not exactly sure how this should look like and if the links should be uni- or bidirectional. Maybe you already have something in mind?
and then a have an Interface like you mentioned, so something like IREE::Stream::AffinityTopologyAttr that has a function like requiresTransfer(AffinityAttr src, AffinityAttr dst) that uses the info in the attribute.
This way the follow up pass for eliding the transfers could get the attribute from the module and the src/dst hal.device.affinity attributes that are attached to the stream.async.transfer and use this as eligibility check for removing the transfer.
Activity
ziereis commentedon May 21, 2025
i would start working on this if its fine with you?
benvanik commentedon May 21, 2025
I think it's a bit underspecified for now to start work on, unfortunately. If you want to share ideas here and discuss the design that'd be great, though!
ziereis commentedon May 21, 2025
Sounds good! So what i thought has to be done is to add an attribute that would look something like this:
Im also not exactly sure how this should look like and if the links should be uni- or bidirectional. Maybe you already have something in mind?
and then a have an Interface like you mentioned, so something like
IREE::Stream::AffinityTopologyAttrthat has a function likerequiresTransfer(AffinityAttr src, AffinityAttr dst)that uses the info in the attribute.This way the follow up pass for eliding the transfers could get the attribute from the module and the src/dst
hal.device.affinityattributes that are attached to thestream.async.transferand use this as eligibility check for removing the transfer.benvanik commentedon May 21, 2025
(this looks like what I was imagining! will respond in a bit - thanks for taking the challenge :)
ziereis commentedon May 22, 2025
Thanks, i also opened a draft PR here #20885 if you want to directly take a look :)
Adding support for `#hal.device.optimal<...>` through to runtime. (#2…
[Stream] Adding AffinityTopologyAttrInterface and HAL implementation. (…
Adding support for `#hal.device.optimal<...>` through to runtime. (#2…
[Stream] Adding AffinityTopologyAttrInterface and HAL implementation. (…