Skip to content

[hip] Handle when devices cannot access peers, such as on Windows. - #20114

Merged
ScottTodd merged 3 commits into
iree-org:mainfrom
ScottTodd:rocm-windows-fix-peering
Feb 27, 2025
Merged

ScottTodd merged 3 commits into
iree-org:mainfrom
ScottTodd:rocm-windows-fix-peering

Conversation

@ScottTodd

Copy link
Copy Markdown
Member

With this change, I am able to now follow our ROCm instructions at https://iree.dev/guides/deployment-configurations/gpu-rocm/ on Windows, running MobileNet and getting the expected outputs 🎉

This does two things:

  1. Only try to enable peering between devices if more than 1 device is going to be used
  2. Check hipDeviceCanAccessPeer before calling hipDeviceEnablePeerAccess so there is a chance to log a better error message

More information

On Windows 11 with 2x w7900 and the 6.2 HIP SDK, the previous code returned hipErrorInvalidDevice when calling hipDeviceEnablePeerAccess. On the same system under Linux (unknown HIP/ROCm version but pretty similar), the code works without errors. In both cases, I only requested a single device, so this peering code did not need to run at all. See also this discussion on Discord.

See documentation for these APIs at https://rocm.docs.amd.com/projects/HIP/en/latest/doxygen/html/group___peer_to_peer.html.

Testing

Warning

I've only tested on the machines I have easy access to. I think we still need CI coverage for multi-device (e.g. #19995)

@ScottTodd ScottTodd added the hal/amdgpu Runtime AMDGPU HAL backend label Feb 26, 2025
@ScottTodd ScottTodd added the platform/windows 🚪 Windows-specific build, execution, benchmarking, and deployment label Feb 26, 2025
@ScottTodd
ScottTodd merged commit 034bc30 into iree-org:main Feb 27, 2025
@ScottTodd
ScottTodd deleted the rocm-windows-fix-peering branch February 27, 2025 20:24
geomin12 pushed a commit to geomin12/iree that referenced this pull request Mar 5, 2025
…ree-org#20114)

With this change, I am able to now follow our ROCm instructions at
https://iree.dev/guides/deployment-configurations/gpu-rocm/ on Windows,
running MobileNet and getting the expected outputs 🎉

This does two things:

1. Only try to enable peering between devices if more than 1 device is
going to be used
2. Check `hipDeviceCanAccessPeer` before calling
`hipDeviceEnablePeerAccess` so there is a chance to log a better error
message

### More information

On Windows 11 with 2x w7900 and the 6.2 HIP SDK, the previous code
returned `hipErrorInvalidDevice` when calling
`hipDeviceEnablePeerAccess`. On the same system under Linux (unknown
HIP/ROCm version but pretty similar), the code works without errors. In
both cases, I only requested a single device, so this peering code did
not need to run at all. See also [this discussion on
Discord](https://discord.com/channels/689900678990135345/1282818085153407038/1344105197353570377).

See documentation for these APIs at
https://rocm.docs.amd.com/projects/HIP/en/latest/doxygen/html/group___peer_to_peer.html.

### Testing

> [!WARNING]
> I've only tested on the machines I have easy access to. I think we
still need CI coverage for multi-device (e.g.
iree-org#19995)

Signed-off-by: geomin12 <[email protected]>
@ScottTodd ScottTodd mentioned this pull request Mar 14, 2025
5 of 6 tasks
AWoloszyn added a commit to AWoloszyn/iree that referenced this pull request Apr 7, 2025
iree-org#20114 disabled all peering
any time we only have a single physical device backing a logical
device. This broke our current sharded models:
iree-org#20409

Our current sharded models are not set up this way, they
have multiple logical devices backed by multiple physical devices,
so every hip_device has only a single physical device, and peering
is never enabled at all (see
iree-org#19555) for the original change
to allow this.

This change enables peering for all devices with all devices
that are compatible, which should fix our sharded models.
Howewver we should at some point update our sharding method
to correctly use single logical devices backed by multiple
physical devices.

Signed-off-by: Andrew Woloszyn <[email protected]>
AWoloszyn added a commit that referenced this pull request Apr 7, 2025
#20114 disabled all peering any
time we only have a single physical device backing a logical device.
This broke our current sharded models:
#20409

Our current sharded models are not set up this way, they have multiple
logical devices backed by multiple physical devices, so every hip_device
has only a single physical device, and peering is never enabled at all
(see
#19555) for the original change to
allow this.

This change enables peering for all devices with all devices that are
compatible, which should fix our sharded models. Howewver we should at
some point update our sharding method to correctly use single logical
devices backed by multiple physical devices.

Signed-off-by: Andrew Woloszyn <[email protected]>
AWoloszyn pushed a commit that referenced this pull request Dec 1, 2025
…20114)

With this change, I am able to now follow our ROCm instructions at
https://iree.dev/guides/deployment-configurations/gpu-rocm/ on Windows,
running MobileNet and getting the expected outputs 🎉

This does two things:

1. Only try to enable peering between devices if more than 1 device is
going to be used
2. Check `hipDeviceCanAccessPeer` before calling
`hipDeviceEnablePeerAccess` so there is a chance to log a better error
message

### More information

On Windows 11 with 2x w7900 and the 6.2 HIP SDK, the previous code
returned `hipErrorInvalidDevice` when calling
`hipDeviceEnablePeerAccess`. On the same system under Linux (unknown
HIP/ROCm version but pretty similar), the code works without errors. In
both cases, I only requested a single device, so this peering code did
not need to run at all. See also [this discussion on
Discord](https://discord.com/channels/689900678990135345/1282818085153407038/1344105197353570377).

See documentation for these APIs at
https://rocm.docs.amd.com/projects/HIP/en/latest/doxygen/html/group___peer_to_peer.html.

### Testing

> [!WARNING]
> I've only tested on the machines I have easy access to. I think we
still need CI coverage for multi-device (e.g.
#19995)
AWoloszyn added a commit that referenced this pull request Dec 1, 2025
#20114 disabled all peering any
time we only have a single physical device backing a logical device.
This broke our current sharded models:
#20409

Our current sharded models are not set up this way, they have multiple
logical devices backed by multiple physical devices, so every hip_device
has only a single physical device, and peering is never enabled at all
(see
#19555) for the original change to
allow this.

This change enables peering for all devices with all devices that are
compatible, which should fix our sharded models. Howewver we should at
some point update our sharding method to correctly use single logical
devices backed by multiple physical devices.

Signed-off-by: Andrew Woloszyn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hal/amdgpu Runtime AMDGPU HAL backend platform/windows 🚪 Windows-specific build, execution, benchmarking, and deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants