Skip to content

[ROCm] Guard distributed usage with hasattr for Windows compatibility#2208

Closed
0xDELUXA wants to merge 0 commit intoDao-AILab:mainfrom
0xDELUXA:fix/distributed/rocm
Closed

[ROCm] Guard distributed usage with hasattr for Windows compatibility#2208
0xDELUXA wants to merge 0 commit intoDao-AILab:mainfrom
0xDELUXA:fix/distributed/rocm

Conversation

@0xDELUXA
Copy link
Copy Markdown
Contributor

@0xDELUXA 0xDELUXA commented Jan 23, 2026

Without these checks, ROCm on Windows raises an AttributeError when importing certain distributed functions.

For example, when adding a custom node to ComfyUI:

  File "E:\ComfyUI\venv\Lib\site-packages\flash_attn\utils\distributed.py", line 12, in <module>
    torch.distributed.all_gather_into_tensor = torch.distributed._all_gather_base
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'torch.distributed' has no attribute '_all_gather_base'

Cannot import E:\ComfyUI\custom_nodes\RES4LYF module for custom nodes: module 'torch.distributed' has no attribute '_all_gather_base'

This PR adds hasattr checks to prevent this error. It is not expected to cause any issues on Nvidia or Linux.

Environment details

GPU: AMD Radeon RX 9060 XT
Python: 3.12.10
PyTorch: 2.11.0a0+rocm7.11.0a20260121 (TheRock)
Triton: 3.6.0a0.post25 (triton-windows)
OS: Windows 11

Edit:
Migrated to ROCm#172.

@0xDELUXA 0xDELUXA changed the title Add hasattr checks for distributed base functions to improve compatibility with ROCm [on Windows] Add hasattr checks for distributed to improve compatibility with ROCm on Windows Jan 23, 2026
@0xDELUXA 0xDELUXA changed the title Add hasattr checks for distributed to improve compatibility with ROCm on Windows Add hasattr checks for distributed to improve compatibility with ROCm on Windows Jan 23, 2026
@0xDELUXA 0xDELUXA changed the title Add hasattr checks for distributed to improve compatibility with ROCm on Windows [ROCm] Guard distributed usage with hasattr for Windows compatibility Jan 23, 2026
@0xDELUXA 0xDELUXA force-pushed the fix/distributed/rocm branch from 02452eb to 863aee0 Compare January 24, 2026 13:27
@0xDELUXA 0xDELUXA closed this Jan 24, 2026
@0xDELUXA 0xDELUXA force-pushed the fix/distributed/rocm branch from 863aee0 to 57cef6c Compare January 24, 2026 13:28
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.

1 participant