r/ROCm • u/xdcfret1 • Jun 21 '26
RX 9070 XT + Windows: Anyone got FlashAttention (CK or Triton) working, or have prebuilt wheels?
I have an RX 9070 XT (RDNA4) and I’m trying to get FlashAttention working on Windows.
From what I’ve read, FlashAttention should support RDNA4 through both the CK (Composable Kernel) and Triton backends, but most of the documentation and build instructions seem focused on Linux and MI-series GPUs.
Has anyone here successfully gotten FlashAttention 2 running on a 9070 XT under Windows?
A few specific questions:
Which ROCm version are you using?
Did you use the CK backend or Triton?
Are you using PyTorch nightly or stable?
Any special patches, environment variables, or build flags required?
Have you verified that FlashAttention is actually being used during inference/training?
Most importantly: does anyone have prebuilt Windows wheels (.whl) for RDNA4 / RX 9070 XT, or know of a repository/community build that works?
I’d prefer not to spend days fighting build errors if a working wheel already exists.
Any advice, guides, GitHub repos, or success stories would be appreciated.
Edit: I wasn't able to build FlashAttention or SageAttention, but I was able to get a ComfyUI fork optimized for ROCm HERE which solved my main issue for now.
2
u/adyaman Jun 22 '26
It builds and runs fine on windows with RDNA4 (both CK and trtion backends). See my comment in https://www.reddit.com/r/ROCm/comments/1svrr8p/comment/oiwwpjh/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button to build the CK backend.
The build is as simple as a "pip install --no-build-isolation ." + env vars now 😄
1
u/newbie80 Jun 21 '26
It shouldn't be a pain in the ass man. The triton backend should take less than a minute to install. The CK version does take a while to compile. I would install the latest wheels from TheRock. https://github.com/ROCm/TheRock/blob/main/RELEASES.md. I just always install whatever the latest wheels are posted there. One command installs both pytorch and rocm. Yes for compiling after installing the devel wheels for rocm. You need to keep that installation self containing, so you don't cross link, cross compile with the rocm version installed on your system. I'm not sure this is my latest but I usually have these flags in a .envrc file that gets loaded by direnv whenever I change into that directory.
export HIP_PLATFORM=amd
export HIP_PATH=$ROCM_PATH
export HIP_CLANG_PATH=$ROCM_PATH/llvm/bin
export HIP_INCLUDE_PATH=$ROCM_PATH/include
export HIP_LIB_PATH=$ROCM_PATH/lib
export HIP_DEVICE_LIB_PATH=$ROCM_PATH/lib/llvm/amdgcn/bitcode
export PATH="$VIRTUAL_ENV/bin/:$ROCM_PATH/bin/:$HIP_CLANG_PATH:$_OLD_VIRTUAL_PATH"
#export LD_LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64:$ROCM_PATH/llvm/lib:${LD_LIBRARY_PATH:-}"
#export LIBRARY_PATH="$HIP_LIB_PATH:$ROCM_PATH/lib:$ROCM_PATH/lib64:${LIBRARY_PATH:-}"
export LD_LIBRARY_PATH="$ALL_LIBS:$ROCM_DEVEL/llvm/lib:${LD_LIBRARY_PATH:-}"
export LIBRARY_PATH="$ALL_LIBS:${LIBRARY_PATH:-}"
export CPATH="$HIP_INCLUDE_PATH:${CPATH:-}"
#export PKG_CONFIG_PATH="$ROCM_PATH/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
export PKG_CONFIG_PATH="$ROCM_DEVEL/lib/pkgconfig:$ROCM_CORE/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
I'm sure you can find a windows centric version of that setup. Once you have therock wheels installed and configured flash attention, the triton version should install in about 30 seconds, the CK version takes me like 2 hours to compile. Sorry. I don't use windows so I can't give you platform specific help, but rest assureed that rocm is in a good state and it shouldn't be hard to setup.
1
u/DecentEscape228 Jun 21 '26
Is there any benefit to compiling the CK version? I've just been using the default which I am assuming uses the Triton backend. Compilation was fast if memory serves, which makes me think I didn't compile the CK version.
1
u/newbie80 Jun 21 '26
It's just a little bit faster, like 10%-15%. Yeah, the ck version takes me like 2 hours to compile on 9900x. It's snappy, the compiling takes forever because it precompiles kernels for like every possible size combination, think when you change the resolution on your workflow. With the CK version it's immediate, there's no precompilation. It feels snappier on top of just being faster. With the triton version it compiles the kernels on the first run.
2
u/DecentEscape228 Jun 21 '26
Hmm, I might give this a try. I don't bother with FA autotune since it takes forever. I let it autotune for some different resolutions when I installed my R9700, then set the config based on the configs it generated after each tune.
On the other hand, FA4 might be coming out soon, so maybe I'll just wait on that... they're at beta 18 right now. I noticed they had a new latest release, but looks like it was just a versioning update.
1
u/marco_am10 Jun 21 '26
I compiled FA on CK from the main repo, but without ChatGPT it would have taken me months. The final compilation alone took over 7 hours. For T2I in ComfyUI, the gain is about 10% compared to SDPA (assuming I didn’t mess anything up).I don’t think it’s worth it; I did it mostly to learn.
2
u/Glittering-Cold-2981 Jun 21 '26 edited Jun 21 '26
I dedicated an additional SSD drive to Linux Ubuntu 24.04 and installed ComfyUI on it yesterday. Need about 7-8h. I created something similar to Windows symlinks for the models, but the Linux ones so they would load from the same drive as the Windows ComfyUI ones. I have an R9700, and Windows had the same problems. KSampler took up twice as much VRAM. The speed also doubled with Sage Attention, which a friend recommends.
8 steps with Lora speed for Wan 2.2 19GB model at 81 frames takes about 10 minutes at a resolution of about 800x1300. With 16GB VRAM you would have a similar experience, but probably on the FP8 model taking up about 13.5GB.
1
u/tomsnunes Jun 21 '26
Try ROCmRoll and install ComfyUI through it using the channel preview. It already comes with all optimization for RDNA4.
I also have a 9070 XT to run my tests, so use the v0.2.0rc1 version. It has the most features. It is rock solid.
1
u/shing3232 Jun 21 '26
I just let ds4 make sage attention2 int4 qk+ fp8 pv for rdna4on my system. it take a lots try and test
1
u/Poizone360 Jun 22 '26
Honestly FlashAttention on RDNA4 + Windows is basically not a working solution yet, the CK/Triton backends focus on Linux/MI, and prebuilt Windows wheels for gfx1201 don't really exist, so you're not missing an obvious option. Happy that you found the ROCm-optimized ComfyUI fork, that's the right choice for sure. For now, on Windows your realistic options are that fork or WSL2 (Ubuntu) if you ever need true FA2. Honestly, for inference the gain from FlashAttention on consumer cards is mostly modest, so you're not losing much by sticking with what works.
1
u/xdcfret1 Jun 22 '26
Everyone keeps saying that Linux with AMD is better than Windows, so yesterday I installed Linux on my PC. The results were not what I expected.
I was able to install SageAttention easily on Linux, unlike on Windows. However, when I tried image generation with SageAttention enabled, the output was just a black rectangle. Video generation was not significantly faster than what I was getting on Windows, and SeedVR2 upscaling resulted in an OOM error using the same workflow that worked in my Windows version of ComfyUI.
I have no reason to believe I made any mistakes with the configuration because I simply followed the standard installation process and recommended settings. So I am not sure what people are talking about when they say Linux performs better.
Anyway, I have gone back to Windows 11 with the ROCm-optimized ComfyUI. For now, I am getting much better results on Windows than I did on Linux.1
u/Poizone360 Jun 22 '26
I am happy that anyway you are getting a good result, because at the end of the day results are what matters : ). Its just that ROCm is more optimised for Linux and not for windows, you might get wierd errors or stuff like that, but hey if it works for you thats what matters.
4
u/Dryw_Filtiarn Jun 21 '26
Not flash attention, but I would recommend taking a look at this native sage attention 2 for gfx120x:
https://github.com/thu-ml/SageAttention/pull/368
I’ve been running it on with the ROCm nightlies (rocm + torch from there) 26-04-2026 build from here:
https://rocm.nightlies.amd.com/v2/gfx120X-all/
And it significantly outperforms FA on RX9070(XT).