From 609a3cd0c47b4c8b95eba21c07d91376712e9fec Mon Sep 17 00:00:00 2001 From: Adam Dickin Date: Mon, 20 Apr 2026 11:33:09 -0600 Subject: [PATCH] [MIOpen] Windows fixes: long-path manifest for addkernels, nlohmann_json natvis workaround - Embed a longPathAware manifest in addkernels.exe so it can traverse the deep build paths used on Windows. - Drop missing .natvis entries from the imported nlohmann_json target when TheRock's prebuilt artifact omits the file. Co-Authored-By: Claude Opus 4.7 (1M context) --- projects/miopen/CMakeLists.txt | 22 ++++++++++++++++++++ projects/miopen/addkernels/CMakeLists.txt | 4 ++++ projects/miopen/addkernels/longpath.manifest | 8 +++++++ 3 files changed, 34 insertions(+) create mode 100644 projects/miopen/addkernels/longpath.manifest diff --git a/projects/miopen/CMakeLists.txt b/projects/miopen/CMakeLists.txt index fc044c13f762..075219ca8d7c 100644 --- a/projects/miopen/CMakeLists.txt +++ b/projects/miopen/CMakeLists.txt @@ -93,6 +93,28 @@ if(MIOPEN_ENABLE_SQLITE) endif() find_package(BZip2 REQUIRED) find_package(nlohmann_json 3.9.1 REQUIRED) + +# Workaround: TheRock's prebuilt nlohmann_json artifact may be missing the +# natvis file (a Visual Studio debug visualizer) referenced by +# INTERFACE_SOURCES. Drop it from the imported target only if the file +# doesn't exist on disk. Once the artifact is fixed upstream, the file +# will be present and the property is left untouched. +if(TARGET nlohmann_json::nlohmann_json) + get_target_property(_njson_srcs nlohmann_json::nlohmann_json INTERFACE_SOURCES) + if(_njson_srcs) + set(_njson_filtered "${_njson_srcs}") + foreach(_src IN LISTS _njson_srcs) + string(GENEX_STRIP "${_src}" _src_plain) + if(_src_plain MATCHES "\\.natvis$" AND NOT EXISTS "${_src_plain}") + message(STATUS "nlohmann_json: dropping missing natvis entry: ${_src_plain}") + list(REMOVE_ITEM _njson_filtered "${_src}") + endif() + endforeach() + set_property(TARGET nlohmann_json::nlohmann_json + PROPERTY INTERFACE_SOURCES "${_njson_filtered}") + endif() +endif() + if(MIOPEN_ENABLE_SQLITE_KERN_CACHE AND NOT MIOPEN_ENABLE_SQLITE) message(FATAL_ERROR "MIOPEN_ENABLE_SQLITE_KERN_CACHE requires MIOPEN_ENABLE_SQLITE") endif() diff --git a/projects/miopen/addkernels/CMakeLists.txt b/projects/miopen/addkernels/CMakeLists.txt index 65ed95a61116..9028dd68d1d9 100644 --- a/projects/miopen/addkernels/CMakeLists.txt +++ b/projects/miopen/addkernels/CMakeLists.txt @@ -3,6 +3,10 @@ set(ADD_KERNELS_SOURCE include_inliner.cpp addkernels.cpp) +if(WIN32) + list(APPEND ADD_KERNELS_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/longpath.manifest) +endif() + add_executable(addkernels EXCLUDE_FROM_ALL ${ADD_KERNELS_SOURCE}) target_include_directories(addkernels PRIVATE ${PROJECT_SOURCE_DIR}/src/include) if(HAS_LIB_STD_FILESYSTEM) diff --git a/projects/miopen/addkernels/longpath.manifest b/projects/miopen/addkernels/longpath.manifest new file mode 100644 index 000000000000..1536e544d906 --- /dev/null +++ b/projects/miopen/addkernels/longpath.manifest @@ -0,0 +1,8 @@ + + + + + true + + +