Skip to content

Commit 2dcae9d

Browse files
hyoon1assistant-librarian[bot]
authored andcommitted
[rocm-libraries] ROCm/rocm-libraries#5977 (commit 794bea7)
[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.
1 parent 7968368 commit 2dcae9d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

example/ck_tile/01_fmha/fmha_fwd_head_grouping.hpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
#include <algorithm>
99
#include <cctype>
1010
#include <cstdio>
11-
#include <dirent.h>
1211
#include <fstream>
1312
#include <iostream>
1413
#include <limits>
1514
#include <optional>
1615
#include <string>
1716

17+
#ifdef __linux__
18+
#include <dirent.h>
19+
#endif
20+
1821
#ifndef CK_TILE_FMHA_ENABLE_HEAD_GROUPING
1922
#define CK_TILE_FMHA_ENABLE_HEAD_GROUPING 1
2023
#endif
@@ -70,6 +73,8 @@ inline std::optional<long long> read_property_value(const std::string& filepath,
7073
return std::nullopt;
7174
}
7275

76+
#if defined(__linux__)
77+
7378
struct kfd_device_location
7479
{
7580
int domain = 0;
@@ -176,6 +181,12 @@ inline size_t get_kfd_sysfs_llc_cache_bytes()
176181
return read_kfd_node_l3_bytes(*node);
177182
}
178183

184+
#else
185+
186+
inline size_t get_kfd_sysfs_llc_cache_bytes() { return 0; }
187+
188+
#endif
189+
179190
inline size_t get_default_llc_cache_bytes_for_arch(const std::string& arch);
180191

181192
inline size_t resolve_llc_cache_bytes_uncached(const std::string& arch)

0 commit comments

Comments
 (0)