Skip to content

Support ROCm on Windows with ADLX VRAM readings - #1799

Open
0xDELUXA wants to merge 1 commit into
modelscope:mainfrom
0xDELUXA:windows-rocm-vram
Open

0xDELUXA wants to merge 1 commit into
modelscope:mainfrom
0xDELUXA:windows-rocm-vram

Conversation

@0xDELUXA

Copy link
Copy Markdown

On ROCm for Windows, torch.cuda.mem_get_info only counts the VRAM used by the current process, so the desktop and other programs look like free VRAM to vram_limit. With the desktop idle, torch reports 0.15 GiB used while the GPU has 2.54 GiB in use.

check_free_vram now goes through diffsynth.core.device.mem_get_info, which on Windows ROCm takes the VRAM used by other processes from ADLX (amd-adlx, new [amd] extra), so vram_limit behaves as it does on NVIDIA GPUs. The other-process share is refreshed at most once a second because an ADLX query takes about half a millisecond and check_free_vram runs on every layer forward; the call averages about 18 us. Without amd-adlx it prints a one-time hint and keeps the torch numbers. Other platforms are unchanged.

On ROCm, TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 is now set by default, otherwise PyTorch SDPA has no flash or memory-efficient kernel on GPUs where AOTriton support is still experimental and fails or falls back to the math path. The setup docs (en/zh) also gain Windows install steps for AMD's ROCm 10 torch wheels.

@Artiprocher

Copy link
Copy Markdown
Collaborator

@0xDELUXA Thank you for your contribution! We don't currently have a Windows AMD device available, so we'll test this feature once we get one.

@0xDELUXA

0xDELUXA commented Nov 3, 2026

Copy link
Copy Markdown
Author

@Artiprocher Thanks! ADLX (AMD Device Library eXtra) is AMD's official SDK for reading GPU state on Windows. It ships with the Adrenalin driver (amdadlx64.dll), so there is nothing extra to install on the driver side: https://gpuopen.com/adlx/

The Python binding amd-adlx (https://pypi.org/project/amd-adlx/) is published by AMD itself (author adlx@amd.com). Its homepage is the GPUOpen page above, and its source is in AMD's ADLX repo under https://github.com/GPUOpen-LibrariesAndSDKs/ADLX/tree/main/ADLXPybind. AMD's own ADLX MCP servers in that repo depend on amd-adlx>=1.0.3.

Projects that already read AMD GPU memory and metrics through ADLX:

Nothing changes on other setups. mem_get_info only calls ADLX when sys.platform == "win32" and torch.version.hip is set. Everywhere else it returns torch.cuda.mem_get_info unchanged. On Windows ROCm without amd-adlx, it prints a one-time hint and uses the torch numbers as before.

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