From bf3ef25841d19c6984cc7b540fe293cd87c81d33 Mon Sep 17 00:00:00 2001 From: tobitege <10787084+tobitege@users.noreply.github.com> Date: Fri, 30 Oct 2026 09:42:20 +0100 Subject: [PATCH] [Engine] fix Windows HIP long-path loading --- cmake/hip_backend.cmake | 11 +++++++++++ cmake/strata-utf8.manifest | 1 + src/kernels/hc_persist_parity.cpp | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/cmake/hip_backend.cmake b/cmake/hip_backend.cmake index 966fa21d05..cb07a26f19 100644 --- a/cmake/hip_backend.cmake +++ b/cmake/hip_backend.cmake @@ -43,6 +43,17 @@ endif() string(REPLACE ";" "," STRATA_HIP_ARCHS "${STRATA_HIP_ARCH_LIST}") enable_language(HIP) +# The Windows HIP build uses clang's GNU-style driver, so the MSVC-only manifest helper does not run. +# Embed the Windows settings in every HIP executable, including the tests. Tensile opens its kernel files +# with ordinary paths; without longPathAware it fails above MAX_PATH even when Windows long paths are on. +if(WIN32) + add_library(strata_hip_windows_settings INTERFACE) + target_link_options(strata_hip_windows_settings INTERFACE "LINKER:/MANIFEST:EMBED" + "LINKER:/MANIFESTINPUT:${CMAKE_CURRENT_LIST_DIR}/strata-utf8.manifest") + set_property(TARGET strata_hip_windows_settings PROPERTY INTERFACE_LINK_DEPENDS + "${CMAKE_CURRENT_LIST_DIR}/strata-utf8.manifest") + link_libraries(strata_hip_windows_settings) +endif() # CMake caches CMAKE_HIP_FLAGS_ while it enables HIP, before it tests the compiler. A configure that stopped # there because HIP could not compile at all (Visual Studio 2026's with the HIP SDK 7.2, a wrong ROCm path) # cached them empty, and every later configure of that build folder keeps them: setup's Release build then compiled diff --git a/cmake/strata-utf8.manifest b/cmake/strata-utf8.manifest index f2fff698a0..540f6ed815 100644 --- a/cmake/strata-utf8.manifest +++ b/cmake/strata-utf8.manifest @@ -3,6 +3,7 @@ UTF-8 + true diff --git a/src/kernels/hc_persist_parity.cpp b/src/kernels/hc_persist_parity.cpp index 0e63006009..8a9d6e4101 100644 --- a/src/kernels/hc_persist_parity.cpp +++ b/src/kernels/hc_persist_parity.cpp @@ -52,8 +52,12 @@ T* dev(size_t n) { int main(int argc, char** argv) { const bool off = argc > 1 && std::strcmp(argv[1], "--off") == 0; +#if defined(_WIN32) + if (_putenv_s("STRATA_HC_PERSIST", off ? "" : "1") != 0) return 2; +#else if (off) unsetenv("STRATA_HC_PERSIST"); else setenv("STRATA_HC_PERSIST", "1", 1); +#endif k::fused_gr_check(); k::fused_gr_persist_init();