Skip to content

[CK_TILE] Fix Windows build in FMHA head grouping#5977

Merged
brockhargreaves-amd merged 2 commits intodevelopfrom
users/hyoon1/ck/fmha-group-head-win
Mar 30, 2026
Merged

[CK_TILE] Fix Windows build in FMHA head grouping#5977
brockhargreaves-amd merged 2 commits intodevelopfrom
users/hyoon1/ck/fmha-group-head-win

Conversation

@hyoon1
Copy link
Copy Markdown
Contributor

@hyoon1 hyoon1 commented Mar 28, 2026

Motivation

This is a follow-up fix for PR #5018.

PR #5018 added LLC-aware FMHA head grouping / head-major scheduling on RDNA, but it also introduced Linux-only code paths, including <dirent.h>, which break Windows builds. This change fixes that by guarding the Linux-specific LLC probing logic so non-Linux platforms can still build correctly.

Technical Details

  • Guard <dirent.h> with #ifdef __linux__
  • Guard KFD sysfs traversal logic with #if defined(__linux__)
  • On non-Linux platforms, return 0 from get_kfd_sysfs_llc_cache_bytes()
  • Preserve existing fallback behavior through:
    • CK_TILE_FMHA_LLC_CACHE_MB
    • arch-based default LLC sizes
    • no head grouping when no LLC size can be resolved

Test Plan

Test Result

Submission Checklist

@hyoon1 hyoon1 requested a review from a team as a code owner March 28, 2026 21:32
@hyoon1
Copy link
Copy Markdown
Contributor Author

hyoon1 commented Mar 28, 2026

@brockhargreaves-amd This PR will fix the Windows build. Could you take a look?

@brockhargreaves-amd
Copy link
Copy Markdown
Contributor

Windows Strix Halo should support this, no?

@0xDELUXA
Copy link
Copy Markdown

0xDELUXA commented Mar 29, 2026

This PR was created after building FlashAttention 2's CK backend on Windows.

@astrelsky, do you think these changes are also necessary, or are the ones in this PR sufficient? We could get this one merged instead since @brockhargreaves-amd is already here.

@hyoon1
Copy link
Copy Markdown
Contributor Author

hyoon1 commented Mar 29, 2026

Windows Strix Halo should support this, no?

Yes it should support Windows Strix Halo. I think the previous CI error is coming from the other component like miopen, not related to this pr.

@brockhargreaves-amd brockhargreaves-amd self-requested a review March 30, 2026 01:14
@0xDELUXA
Copy link
Copy Markdown

0xDELUXA commented Mar 30, 2026

@hyoon1 Thanks for your work on Dao-AILab/flash-attention#2400 and #5018 as well!

Also, thx to the maintainers for the reviews. After this PR is merged, the only remaining blocker for building FlashAttention's CK backend on Windows will be pypa/distutils#406.

@brockhargreaves-amd brockhargreaves-amd merged commit 794bea7 into develop Mar 30, 2026
32 checks passed
@brockhargreaves-amd brockhargreaves-amd deleted the users/hyoon1/ck/fmha-group-head-win branch March 30, 2026 14:18
assistant-librarian bot pushed a commit to ROCm/composable_kernel that referenced this pull request Mar 30, 2026
[CK_TILE] Fix Windows build in FMHA head grouping

## Motivation

This is a follow-up fix for [PR
#5018](ROCm/rocm-libraries#5018).

[PR #5018](ROCm/rocm-libraries#5018) added
LLC-aware FMHA head grouping / head-major scheduling on RDNA, but it
also introduced Linux-only code paths, including `<dirent.h>`, which
break Windows builds. This change fixes that by guarding the
Linux-specific LLC probing logic so non-Linux platforms can still build
correctly.

## Technical Details

- Guard `<dirent.h>` with `#ifdef __linux__`
- Guard KFD sysfs traversal logic with `#if defined(__linux__)`
- On non-Linux platforms, return `0` from
`get_kfd_sysfs_llc_cache_bytes()`
- Preserve existing fallback behavior through:
  - `CK_TILE_FMHA_LLC_CACHE_MB`
  - arch-based default LLC sizes
  - no head grouping when no LLC size can be resolved

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->

## Test Result

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
vidyasagar-amd pushed a commit that referenced this pull request Apr 9, 2026
## Motivation

This is a follow-up fix for [PR
#5018](#5018).

[PR #5018](#5018) added
LLC-aware FMHA head grouping / head-major scheduling on RDNA, but it
also introduced Linux-only code paths, including `<dirent.h>`, which
break Windows builds. This change fixes that by guarding the
Linux-specific LLC probing logic so non-Linux platforms can still build
correctly.

## Technical Details

- Guard `<dirent.h>` with `#ifdef __linux__`
- Guard KFD sysfs traversal logic with `#if defined(__linux__)`
- On non-Linux platforms, return `0` from
`get_kfd_sysfs_llc_cache_bytes()`
- Preserve existing fallback behavior through:
  - `CK_TILE_FMHA_LLC_CACHE_MB`
  - arch-based default LLC sizes
  - no head grouping when no LLC size can be resolved

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->

## Test Result

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants