From 7edb16208f7ba43a93c9a2e62f0312669960aff7 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 4 May 2026 15:52:24 +0200 Subject: [PATCH 01/20] upgrade for protobuf v30 on Windows --- CMakeLists.txt | 1 - cmake/LinkedLibraries.cmake | 160 +++++++++++++++++++++++++ requirements.txt | 2 +- src/CMakeLists.txt | 18 ++- src/onnx/CMakeLists.txt | 13 +- src/protobuf_memswap_instantiation.cpp | 43 +++++++ src/targets/gpu/CMakeLists.txt | 12 +- src/tf/CMakeLists.txt | 15 ++- 8 files changed, 241 insertions(+), 23 deletions(-) create mode 100644 cmake/LinkedLibraries.cmake create mode 100644 src/protobuf_memswap_instantiation.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 66a2913ec9e..a2cb6c17294 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,6 @@ endif() # By default build shared libraries option(BUILD_SHARED_LIBS "Create shared libraries" ON) - option(MIGRAPHX_STRIP_SYMBOLS "Strip symbols in release mode" OFF) # Strip symbols for release diff --git a/cmake/LinkedLibraries.cmake b/cmake/LinkedLibraries.cmake new file mode 100644 index 00000000000..35b2793d7b1 --- /dev/null +++ b/cmake/LinkedLibraries.cmake @@ -0,0 +1,160 @@ +##################################################################################### +# The MIT License (MIT) +# +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +##################################################################################### + +include_guard() + +function(__get_target_link_libraries target output) + if(TARGET ${target}) + set(__options "") + set(__one_value_args FILTER) + set(__multi_value_args "") + cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) + get_target_property(__imported ${target} IMPORTED) + set(__property LINKED_LIBRARIES) + if(__imported) + set(__property INTERFACE_LINK_LIBRARIES) + endif() + get_target_property(__raw_libraries ${target} ${__property}) + if(arg_FILTER) + list(FILTER __raw_libraries INCLUDE REGEX ${arg_FILTER}) + endif() + set(${output} "${__raw_libraries}" PARENT_SCOPE) + endif() +endfunction() + +function(__set_target_link_libraries target libraries) + if(TARGET ${target}) + get_target_property(__imported ${target} IMPORTED) + set(__property LINKED_LIBRARIES) + if(__imported) + set(__property INTERFACE_LINK_LIBRARIES) + endif() + set_target_properties(${target} PROPERTIES ${__property} "${libraries}") + endif() +endfunction() + +function(__impl_get_target_linked_libraries target output visited) + list(FIND ${visited} ${target} __visited) + if(__visited EQUAL -1) + list(APPEND ${visited} ${target}) + set(__options FLATTEN) + set(__one_value_args FILTER) + set(__multi_value_args "") + cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) + if(arg_FILTER) + set(__filter FILTER ${arg_FILTER}) + endif() + __get_target_link_libraries(${target} __libraries ${__filter}) + if(arg_FLATTEN) + foreach(__target ${__libraries}) + __impl_get_target_linked_libraries(${__target} __target_libraries "${visited}" FLATTEN "${__filter}") + list(APPEND __flatten_libraries ${__target_libraries}) + endforeach() + list(APPEND __libraries ${__flatten_libraries}) + endif() + list(REMOVE_DUPLICATES __libraries) + endif() + set(${output} "${__libraries}" PARENT_SCOPE) + set(${visited} "${${visited}}" PARENT_SCOPE) +endfunction() + +function(get_target_linked_libraries target output) + if(NOT TARGET ${target}) + message(FATAL_ERROR "${target}: required a CMake target") + endif() + set(__options FLATTEN) + set(__one_value_args FILTER) + set(__multi_value_args "") + cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) + if (arg_FLATTEN) + set(__flatten FLATTEN) + endif() + if (arg_FILTER) + set(__filter FILTER ${arg_FILTER}) + endif() + __impl_get_target_linked_libraries(${target} __libraries __targets_visited ${__flatten} ${__filter}) + list(REMOVE_DUPLICATES __libraries) + set(${output} ${__libraries} PARENT_SCOPE) +endfunction() + +function(remove_target_linked_libraries target) + if(NOT TARGET ${target}) + message(FATAL_ERROR "${target}: required a CMake target or imported target") + endif() + set(__options FLATTEN) + set(__one_value_args FILTER LIBRARIES) + set(__multi_value_args "") + cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) + if(NOT arg_LIBRARIES OR arg_LIBRARIES STREQUAL "") + return() + endif() + if(arg_FILTER) + set(__filter FILTER ${arg_FILTER}) + endif() + if(arg_FLATTEN) + set(__flatten FLATTEN) + endif() + __impl_get_target_linked_libraries(${target} __libraries __targets_visited ${__flatten} ${__filter}) + list(REMOVE_DUPLICATES __libraries) + foreach(__library ${target} ${__libraries}) + if(TARGET ${__library}) + __get_target_link_libraries(${__library} __target_libraries) + list(REMOVE_ITEM __target_libraries ${arg_LIBRARIES}) + __set_target_link_libraries(${__library} "${__target_libraries}") + endif() + endforeach() +endfunction() + +function(filter_target_linked_libraries target) + if(NOT TARGET ${target}) + message(FATAL_ERROR "${target}: required a CMake target or imported target") + endif() + set(__options FLATTEN INCLUDE EXCLUDE) + set(__one_value_args FILTER REGEX) + set(__multi_value_args "") + cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) + if(NOT arg_REGEX OR arg_REGEX STREQUAL "") + return() + endif() + set(__operation EXCLUDE) + if(arg_INCLUDE AND arg_EXCLUDE) + message(WARNING "INCLUDE and EXCLUDE are mutually exclusive, defaulting to EXCLUDE") + elseif(arg_INCLUDE) + set(__operation INCLUDE) + endif() + if(arg_FILTER) + set(__filter FILTER ${arg_FILTER}) + endif() + if(arg_FLATTEN) + set(__flatten FLATTEN) + endif() + __impl_get_target_linked_libraries(${target} __libraries __targets_visited ${__flatten} ${__filter}) + list(REMOVE_DUPLICATES __libraries) + foreach(__library ${__libraries}) + __get_target_link_libraries(${__library} __target_libraries) + list(FILTER __target_libraries ${__operation} REGEX "${arg_REGEX}") + __set_target_link_libraries(${__library} "${__target_libraries}") + endforeach() +endfunction() diff --git a/requirements.txt b/requirements.txt index 553e1c72018..18a8147df0c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ # THE SOFTWARE. ##################################################################################### abseil/abseil-cpp@20250512.0 -DABSL_ENABLE_INSTALL=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -google/protobuf@v30.0 -DCMAKE_POSITION_INDEPENDENT_CODE=On -Dprotobuf_BUILD_TESTS=Off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 +google/protobuf@v30.0 -DCMAKE_POSITION_INDEPENDENT_CODE=On -Dprotobuf_BUILD_TESTS=Off -Dprotobuf_BUILD_SHARED_LIBS=Off -Dprotobuf_MSVC_STATIC_RUNTIME=Off -Dprotobuf_BUILD_LIBPROTOC=On -Dprotobuf_BUILD_PROTOC_BINARIES=On -Dprotobuf_BUILD_PROTOBUF_BINARIES=On -DCMAKE_POLICY_VERSION_MINIMUM=3.5 nlohmann/json@v3.8.0 -DCMAKE_POLICY_VERSION_MINIMUM=3.5 pybind/pybind11@3e9dfa2866941655c56877882565e7577de6fc7b --build msgpack/msgpack-c@cpp-3.3.0 -DMSGPACK_BUILD_TESTS=Off -DMSGPACK_BUILD_EXAMPLES=Off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7a1d00a4faa..b55ab1036d9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,6 +31,8 @@ include(RegisterOp) include(CheckCXXLinkerFlag) include(CheckCXXSourceCompiles) +include(LinkedLibraries) + set(CMAKE_REQUIRED_FLAGS "-Werror=deprecated-declarations") check_cxx_source_compiles(" #include @@ -126,7 +128,6 @@ add_library(migraphx rewrite_dot.cpp simplify_qdq.cpp split_reduce.cpp - sqlite.cpp rewrite_gelu.cpp rewrite_low_precision.cpp rewrite_pooling.cpp @@ -149,6 +150,11 @@ add_library(migraphx verify_args.cpp ) +if(MIGRAPHX_USE_MIOPEN) + target_sources(migraphx + sqlite.cpp) +endif() + file(GLOB BUILDER_SRCS CONFIGURE_DEPENDS op/builder/*.cpp) target_sources(migraphx PRIVATE ${BUILDER_SRCS}) @@ -348,7 +354,7 @@ endif() target_link_libraries(migraphx PUBLIC Threads::Threads) if(MIGRAPHX_USE_EIGEN) - find_package(Eigen3) + find_package(Eigen3 QUIET) if(Eigen3_FOUND) target_compile_definitions(migraphx PUBLIC MIGRAPHX_USE_EIGEN=1) target_compile_definitions(migraphx PRIVATE EIGEN_MPL2_ONLY) @@ -377,12 +383,14 @@ endif() find_package(nlohmann_json 3.8.0 REQUIRED) target_link_libraries(migraphx PRIVATE nlohmann_json::nlohmann_json) -find_package(SQLite3 REQUIRED) -target_link_libraries(migraphx PRIVATE SQLite::SQLite3) +if(MIGRAPHX_USE_MIOPEN) + find_package(SQLite3 REQUIRED) + target_link_libraries(migraphx PRIVATE SQLite::SQLite3) +endif() # See: https://github.com/msgpack/msgpack-c/wiki/Q%26A#how-to-support-both-msgpack-c-c-version-5x-and-6x- # Prefer 6.x (msgpack-cxx) -find_package(msgpack-cxx) +find_package(msgpack-cxx QUIET) if(msgpack-cxx_FOUND) message(STATUS "Found msgpack-cxx (>=6.x)") else() diff --git a/src/onnx/CMakeLists.txt b/src/onnx/CMakeLists.txt index f0074c1c9b9..d123ad7d258 100644 --- a/src/onnx/CMakeLists.txt +++ b/src/onnx/CMakeLists.txt @@ -24,17 +24,20 @@ find_package(protobuf QUIET CONFIG) if(protobuf_FOUND) + # On Windows, dependency projects need to be compiled with MSVC, + # because a few of them are failing to compile with the Clang compiler. + filter_target_linked_libraries(protobuf::libprotobuf + FLATTEN FILTER "absl::" EXCLUDE REGEX "-ignore:4221") add_library(onnx-proto STATIC) protobuf_generate(TARGET onnx-proto PROTOS onnx.proto) - target_include_directories(onnx-proto SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROTOBUF_INCLUDE_DIR}) - target_link_libraries(onnx-proto PRIVATE ${PROTOBUF_LIBRARY}) - target_link_libraries(onnx-proto PRIVATE protobuf::libprotobuf) + target_include_directories(onnx-proto SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(onnx-proto PUBLIC protobuf::libprotobuf) else() find_package(Protobuf REQUIRED) protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS onnx.proto) add_library(onnx-proto STATIC ${PROTO_SRCS}) target_include_directories(onnx-proto SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROTOBUF_INCLUDE_DIR}) - target_link_libraries(onnx-proto PRIVATE ${PROTOBUF_LIBRARY}) + target_link_libraries(onnx-proto PUBLIC ${PROTOBUF_LIBRARY}) endif() if(MSVC) @@ -45,7 +48,7 @@ endif() set_target_properties(onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On) file(GLOB ONNX_SRCS CONFIGURE_DEPENDS *.cpp) -add_library(migraphx_onnx ${ONNX_SRCS}) +add_library(migraphx_onnx ${ONNX_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) target_include_directories(migraphx_onnx PRIVATE include) set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx) migraphx_generate_export_header(migraphx_onnx) diff --git a/src/protobuf_memswap_instantiation.cpp b/src/protobuf_memswap_instantiation.cpp new file mode 100644 index 00000000000..d7a6089aabf --- /dev/null +++ b/src/protobuf_memswap_instantiation.cpp @@ -0,0 +1,43 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#if defined(_WIN32) && defined(_DEBUG) + +#include + +// Workaround for Windows Debug build +// Explicitly instantiate protobuf memswap template to resolve linking errors + +namespace google { +namespace protobuf { +namespace internal { + +// Explicit template instantiation for memswap<16> +template void memswap<16>(char* a, char* b); + +} // namespace internal +} // namespace protobuf +} // namespace google + +#endif // defined(_WIN32) && defined(_DEBUG) diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index 6d66ccdc573..acb0e64f137 100644 --- a/src/targets/gpu/CMakeLists.txt +++ b/src/targets/gpu/CMakeLists.txt @@ -147,10 +147,6 @@ if(NOT MIGRAPHX_USE_COMPOSABLEKERNEL) ${CMAKE_CURRENT_SOURCE_DIR}/jit/ck_gemm_softmax_gemm.cpp) endif() -if(MIGRAPHX_USE_MIOPEN) - set(MIOPEN_SRCS abs.cpp) -endif() - add_library(migraphx_gpu analyze_streams.cpp allocation_model.cpp @@ -184,7 +180,6 @@ add_library(migraphx_gpu prefuse_ops.cpp prepare_mlir.cpp prepare_reduce.cpp - perfdb.cpp pooling.cpp problem_cache.cpp rocblas.cpp @@ -195,9 +190,14 @@ add_library(migraphx_gpu topk.cpp write_literals.cpp ${JIT_GPU_SRCS} - ${MIOPEN_SRCS} ) +if(MIGRAPHX_USE_MIOPEN) + target_sources(migraphx_gpu + abs.cpp + perfdb.cpp) +endif() + set_target_properties(migraphx_gpu PROPERTIES EXPORT_NAME gpu) migraphx_generate_export_header(migraphx_gpu) diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 7b02373162e..1c3976958d1 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -24,10 +24,16 @@ find_package(protobuf QUIET CONFIG) if(protobuf_FOUND) + # On Windows, dependency projects need to be compiled with MSVC, + # because a few of them are failing to compile with the Clang compiler. + filter_target_linked_libraries( + protobuf::libprotobuf + FLATTEN FILTER "absl::" EXCLUDE REGEX "-ignore:4221") + add_library(tf-proto STATIC ${PROTO_SRCS}) protobuf_generate( TARGET tf-proto - PROTOS + PROTOS graph.proto node_def.proto attr_value.proto @@ -39,9 +45,8 @@ if(protobuf_FOUND) op_def.proto versions.proto ) - target_include_directories(tf-proto SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${PROTOBUF_INCLUDE_DIR}) - target_link_libraries(tf-proto PRIVATE ${PROTOBUF_LIBRARY}) - target_link_libraries(tf-proto PRIVATE protobuf::libprotobuf) + target_include_directories(tf-proto SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + target_link_libraries(tf-proto PUBLIC protobuf::libprotobuf) else() find_package(Protobuf REQUIRED) protobuf_generate_cpp( @@ -70,7 +75,7 @@ endif() set_target_properties(tf-proto PROPERTIES POSITION_INDEPENDENT_CODE On) file(GLOB TF_SRCS CONFIGURE_DEPENDS *.cpp) -add_library(migraphx_tf ${TF_SRCS}) +add_library(migraphx_tf ${TF_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) migraphx_generate_export_header(migraphx_tf) target_include_directories(migraphx_tf PRIVATE include) set_target_properties(migraphx_tf PROPERTIES EXPORT_NAME tf) From 3cba518c1d39cde4e9835c6ebaa8f96405f8bc57 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 4 May 2026 16:38:35 +0200 Subject: [PATCH 02/20] update licenses --- src/onnx/CMakeLists.txt | 2 +- src/tf/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/onnx/CMakeLists.txt b/src/onnx/CMakeLists.txt index d123ad7d258..df1fed7c487 100644 --- a/src/onnx/CMakeLists.txt +++ b/src/onnx/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 1c3976958d1..0bacecf359f 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From c063a85bf7fdc8ed96252c6294cb5c91777acde4 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Thu, 7 May 2026 23:46:26 +0200 Subject: [PATCH 03/20] upgrade to use clang-cl --- CMakeLists.txt | 3 + cmake/Embed.cmake | 1 + cmake/LinkedLibraries.cmake | 160 -------------------------- cmake/PythonModules.cmake | 1 + cmake/RuntimeLibrary.cmake | 43 +++++++ src/CMakeLists.txt | 7 +- src/driver/CMakeLists.txt | 3 +- src/onnx/CMakeLists.txt | 7 +- src/py/CMakeLists.txt | 4 +- src/targets/cpu/CMakeLists.txt | 1 + src/targets/fpga/CMakeLists.txt | 3 + src/targets/gpu/CMakeLists.txt | 3 + src/targets/gpu/driver/CMakeLists.txt | 5 +- src/targets/gpu/hiprtc/CMakeLists.txt | 7 +- src/targets/ref/CMakeLists.txt | 1 + src/tf/CMakeLists.txt | 14 +-- test/CMakeLists.txt | 11 +- test/api/CMakeLists.txt | 2 + test/gpu/kernels/CMakeLists.txt | 1 + test/onnx/CMakeLists.txt | 1 + test/op/CMakeLists.txt | 1 + test/ref/CMakeLists.txt | 1 + test/tf/CMakeLists.txt | 1 + test/verify/CMakeLists.txt | 1 + 24 files changed, 94 insertions(+), 188 deletions(-) delete mode 100644 cmake/LinkedLibraries.cmake create mode 100644 cmake/RuntimeLibrary.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a2cb6c17294..2149c610f88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,11 @@ endif() list(APPEND CMAKE_PREFIX_PATH /opt/rocm /opt/rocm/llvm $ENV{ROCM_PATH} $ENV{HIP_PATH}) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +cmake_policy(SET CMP0091 NEW) + project(migraphx LANGUAGES C CXX) include(CTest) +include(RuntimeLibrary) include(DetectPackageBackend) detect_package_backend() diff --git a/cmake/Embed.cmake b/cmake/Embed.cmake index b42d7390a28..47f0bac95e4 100644 --- a/cmake/Embed.cmake +++ b/cmake/Embed.cmake @@ -257,6 +257,7 @@ function(add_embed_library EMBED_NAME) if(EMBED_USE STREQUAL "CArrays") target_sources(${INTERNAL_EMBED_LIB} PRIVATE ${OUTPUT_FILES}) endif() + migraphx_setup_msvc_runtime_library(${INTERNAL_EMBED_LIB}) target_include_directories(${INTERNAL_EMBED_LIB} PRIVATE "${EMBED_DIR}/include") target_compile_options(${INTERNAL_EMBED_LIB} PRIVATE -Wno-reserved-identifier -Wno-extern-initializer -Wno-missing-variable-declarations) set_target_properties(${INTERNAL_EMBED_LIB} PROPERTIES POSITION_INDEPENDENT_CODE On) diff --git a/cmake/LinkedLibraries.cmake b/cmake/LinkedLibraries.cmake deleted file mode 100644 index 35b2793d7b1..00000000000 --- a/cmake/LinkedLibraries.cmake +++ /dev/null @@ -1,160 +0,0 @@ -##################################################################################### -# The MIT License (MIT) -# -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -##################################################################################### - -include_guard() - -function(__get_target_link_libraries target output) - if(TARGET ${target}) - set(__options "") - set(__one_value_args FILTER) - set(__multi_value_args "") - cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) - get_target_property(__imported ${target} IMPORTED) - set(__property LINKED_LIBRARIES) - if(__imported) - set(__property INTERFACE_LINK_LIBRARIES) - endif() - get_target_property(__raw_libraries ${target} ${__property}) - if(arg_FILTER) - list(FILTER __raw_libraries INCLUDE REGEX ${arg_FILTER}) - endif() - set(${output} "${__raw_libraries}" PARENT_SCOPE) - endif() -endfunction() - -function(__set_target_link_libraries target libraries) - if(TARGET ${target}) - get_target_property(__imported ${target} IMPORTED) - set(__property LINKED_LIBRARIES) - if(__imported) - set(__property INTERFACE_LINK_LIBRARIES) - endif() - set_target_properties(${target} PROPERTIES ${__property} "${libraries}") - endif() -endfunction() - -function(__impl_get_target_linked_libraries target output visited) - list(FIND ${visited} ${target} __visited) - if(__visited EQUAL -1) - list(APPEND ${visited} ${target}) - set(__options FLATTEN) - set(__one_value_args FILTER) - set(__multi_value_args "") - cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) - if(arg_FILTER) - set(__filter FILTER ${arg_FILTER}) - endif() - __get_target_link_libraries(${target} __libraries ${__filter}) - if(arg_FLATTEN) - foreach(__target ${__libraries}) - __impl_get_target_linked_libraries(${__target} __target_libraries "${visited}" FLATTEN "${__filter}") - list(APPEND __flatten_libraries ${__target_libraries}) - endforeach() - list(APPEND __libraries ${__flatten_libraries}) - endif() - list(REMOVE_DUPLICATES __libraries) - endif() - set(${output} "${__libraries}" PARENT_SCOPE) - set(${visited} "${${visited}}" PARENT_SCOPE) -endfunction() - -function(get_target_linked_libraries target output) - if(NOT TARGET ${target}) - message(FATAL_ERROR "${target}: required a CMake target") - endif() - set(__options FLATTEN) - set(__one_value_args FILTER) - set(__multi_value_args "") - cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) - if (arg_FLATTEN) - set(__flatten FLATTEN) - endif() - if (arg_FILTER) - set(__filter FILTER ${arg_FILTER}) - endif() - __impl_get_target_linked_libraries(${target} __libraries __targets_visited ${__flatten} ${__filter}) - list(REMOVE_DUPLICATES __libraries) - set(${output} ${__libraries} PARENT_SCOPE) -endfunction() - -function(remove_target_linked_libraries target) - if(NOT TARGET ${target}) - message(FATAL_ERROR "${target}: required a CMake target or imported target") - endif() - set(__options FLATTEN) - set(__one_value_args FILTER LIBRARIES) - set(__multi_value_args "") - cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) - if(NOT arg_LIBRARIES OR arg_LIBRARIES STREQUAL "") - return() - endif() - if(arg_FILTER) - set(__filter FILTER ${arg_FILTER}) - endif() - if(arg_FLATTEN) - set(__flatten FLATTEN) - endif() - __impl_get_target_linked_libraries(${target} __libraries __targets_visited ${__flatten} ${__filter}) - list(REMOVE_DUPLICATES __libraries) - foreach(__library ${target} ${__libraries}) - if(TARGET ${__library}) - __get_target_link_libraries(${__library} __target_libraries) - list(REMOVE_ITEM __target_libraries ${arg_LIBRARIES}) - __set_target_link_libraries(${__library} "${__target_libraries}") - endif() - endforeach() -endfunction() - -function(filter_target_linked_libraries target) - if(NOT TARGET ${target}) - message(FATAL_ERROR "${target}: required a CMake target or imported target") - endif() - set(__options FLATTEN INCLUDE EXCLUDE) - set(__one_value_args FILTER REGEX) - set(__multi_value_args "") - cmake_parse_arguments(arg "${__options}" "${__one_value_args}" "${__multi_value_args}" ${ARGN}) - if(NOT arg_REGEX OR arg_REGEX STREQUAL "") - return() - endif() - set(__operation EXCLUDE) - if(arg_INCLUDE AND arg_EXCLUDE) - message(WARNING "INCLUDE and EXCLUDE are mutually exclusive, defaulting to EXCLUDE") - elseif(arg_INCLUDE) - set(__operation INCLUDE) - endif() - if(arg_FILTER) - set(__filter FILTER ${arg_FILTER}) - endif() - if(arg_FLATTEN) - set(__flatten FLATTEN) - endif() - __impl_get_target_linked_libraries(${target} __libraries __targets_visited ${__flatten} ${__filter}) - list(REMOVE_DUPLICATES __libraries) - foreach(__library ${__libraries}) - __get_target_link_libraries(${__library} __target_libraries) - list(FILTER __target_libraries ${__operation} REGEX "${arg_REGEX}") - __set_target_link_libraries(${__library} "${__target_libraries}") - endforeach() -endfunction() diff --git a/cmake/PythonModules.cmake b/cmake/PythonModules.cmake index c79c71ab26b..248cf426af8 100644 --- a/cmake/PythonModules.cmake +++ b/cmake/PythonModules.cmake @@ -99,6 +99,7 @@ function(py_add_module NAME) else() add_library(${NAME} MODULE ${PARSE_UNPARSED_ARGUMENTS}) endif() + migraphx_setup_msvc_runtime_library(${NAME}) pybind11_strip(${NAME}) if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") py_extension(${NAME} ${PYTHON_VERSION}) diff --git a/cmake/RuntimeLibrary.cmake b/cmake/RuntimeLibrary.cmake new file mode 100644 index 00000000000..de02280451c --- /dev/null +++ b/cmake/RuntimeLibrary.cmake @@ -0,0 +1,43 @@ +##################################################################################### +# The MIT License (MIT) +# +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +##################################################################################### + +include_guard() + +include(CMakeDependentOption) + +cmake_dependent_option(MIGRAPHX_USE_MSVC_STATIC_RUNTIME + "" OFF "WIN32" OFF) + +function(migraphx_setup_msvc_runtime_library target) + if(MSVC AND (CMAKE_CXX_COMPILER STREQUAL Clang OR CMAKE_C_COMPILER STREQUAL Clang)) + target_compile_definitions(${target} PRIVATE + "$<$:_DEBUG;_ITERATOR_DEBUG_LEVEL=2>") + endif() + if(NOT MIGRAPHX_USE_MSVC_STATIC_RUNTIME) + set(__suffix "DLL") + endif() + set_target_properties(${target} PROPERTIES + MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>${__suffix}") + unset(__suffix) +endfunction() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b55ab1036d9..3504ea86afd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,8 +31,6 @@ include(RegisterOp) include(CheckCXXLinkerFlag) include(CheckCXXSourceCompiles) -include(LinkedLibraries) - set(CMAKE_REQUIRED_FLAGS "-Werror=deprecated-declarations") check_cxx_source_compiles(" #include @@ -161,11 +159,10 @@ target_sources(migraphx PRIVATE ${BUILDER_SRCS}) if(WIN32) # Due to compilation crashing, we need to use type-erased matchers on Windows. target_compile_definitions(migraphx PUBLIC MIGRAPHX_USE_TYPE_ERASED_MATCHERS=1) - target_compile_options(migraphx PUBLIC "-mno-ms-bitfields") - # Due to BinSkim errors EnableControlFlowGuard - target_compile_options(migraphx PUBLIC "SHELL:-Xclang -cfguard") endif() +migraphx_setup_msvc_runtime_library(migraphx) + configure_file(version.h.in include/migraphx/version.h) add_library(migraphx_version INTERFACE) rocm_install_targets( diff --git a/src/driver/CMakeLists.txt b/src/driver/CMakeLists.txt index b48205d46fe..2a62364bd13 100644 --- a/src/driver/CMakeLists.txt +++ b/src/driver/CMakeLists.txt @@ -22,7 +22,7 @@ # THE SOFTWARE. ##################################################################################### -add_executable(driver +add_executable(driver main.cpp verify.cpp passes.cpp @@ -51,6 +51,7 @@ file(STRINGS "${CMAKE_SOURCE_DIR}/test/onnx/.onnxrt-commit" String_output) target_compile_definitions(driver PUBLIC MIGRAPHX_ORT_SHA1="${String_output}") target_link_libraries(driver migraphx_all_targets migraphx_onnx migraphx_tf) +migraphx_setup_msvc_runtime_library(driver) if(MIGRAPHX_ENABLE_PYTHON) target_link_libraries(driver migraphx_py) diff --git a/src/onnx/CMakeLists.txt b/src/onnx/CMakeLists.txt index df1fed7c487..d70bb3b71f3 100644 --- a/src/onnx/CMakeLists.txt +++ b/src/onnx/CMakeLists.txt @@ -24,10 +24,6 @@ find_package(protobuf QUIET CONFIG) if(protobuf_FOUND) - # On Windows, dependency projects need to be compiled with MSVC, - # because a few of them are failing to compile with the Clang compiler. - filter_target_linked_libraries(protobuf::libprotobuf - FLATTEN FILTER "absl::" EXCLUDE REGEX "-ignore:4221") add_library(onnx-proto STATIC) protobuf_generate(TARGET onnx-proto PROTOS onnx.proto) target_include_directories(onnx-proto SYSTEM PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) @@ -45,10 +41,13 @@ if(MSVC) else() target_compile_options(onnx-proto PRIVATE -w) endif() + set_target_properties(onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On) +migraphx_setup_msvc_runtime_library(onnx-proto) file(GLOB ONNX_SRCS CONFIGURE_DEPENDS *.cpp) add_library(migraphx_onnx ${ONNX_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) +migraphx_setup_msvc_runtime_library(migraphx_onnx) target_include_directories(migraphx_onnx PRIVATE include) set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx) migraphx_generate_export_header(migraphx_onnx) diff --git a/src/py/CMakeLists.txt b/src/py/CMakeLists.txt index 32da2c08bea..43471fec0a9 100644 --- a/src/py/CMakeLists.txt +++ b/src/py/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -23,6 +23,7 @@ ##################################################################################### add_library(migraphx_py py_loader.cpp) +migraphx_setup_msvc_runtime_library(migraphx_py) migraphx_generate_export_header(migraphx_py) target_include_directories(migraphx_py PRIVATE include) target_link_libraries(migraphx_py PUBLIC migraphx) @@ -37,6 +38,7 @@ foreach(PYTHON_VERSION ${PYTHON_VERSIONS}) add_dependencies(migraphx_py migraphx_pybind_${PYTHON_VERSION}) add_library(migraphx_py_${PYTHON_VERSION} py.cpp) + migraphx_setup_msvc_runtime_library(migraphx_py_${PYTHON_VERSION}) target_include_directories(migraphx_py_${PYTHON_VERSION} PRIVATE include) target_link_libraries(migraphx_py_${PYTHON_VERSION} PUBLIC migraphx) target_link_libraries(migraphx_py_${PYTHON_VERSION} PRIVATE pybind11::pybind11 python${PYTHON_VERSION}::runtime) diff --git a/src/targets/cpu/CMakeLists.txt b/src/targets/cpu/CMakeLists.txt index 558e3538765..78a398b839b 100644 --- a/src/targets/cpu/CMakeLists.txt +++ b/src/targets/cpu/CMakeLists.txt @@ -79,6 +79,7 @@ endif() target_link_libraries(migraphx_cpu PRIVATE migraphx) migraphx_generate_export_header(migraphx_cpu) +migraphx_setup_msvc_runtime_library(migraphx_cpu) find_package(OpenMP) if(WIN32) diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index 11b47b9b20d..3d33df8c32f 100644 --- a/src/targets/fpga/CMakeLists.txt +++ b/src/targets/fpga/CMakeLists.txt @@ -35,6 +35,9 @@ rocm_set_soversion(migraphx_fpga ${MIGRAPHX_SO_VERSION}) rocm_clang_tidy_check(migraphx_fpga) target_link_libraries(migraphx_fpga migraphx) +migraphx_generate_export_header(migraphx_fpga) +migraphx_setup_msvc_runtime_library(migraphx_fpga) + rocm_install_targets( PRIVATE TARGETS migraphx_fpga diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index acb0e64f137..a5a0da93624 100644 --- a/src/targets/gpu/CMakeLists.txt +++ b/src/targets/gpu/CMakeLists.txt @@ -86,6 +86,7 @@ add_embed_library(migraphx_kernels ${KERNEL_FILES} RELATIVE ${CMAKE_CURRENT_SOUR configure_file(device/targets.hpp.in include/migraphx/gpu/device/targets.hpp) file(GLOB DEVICE_GPU_SRCS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/device/*.cpp) add_library(migraphx_device ${DEVICE_GPU_SRCS}) +migraphx_setup_msvc_runtime_library(migraphx_device) add_library(compile_for_gpu INTERFACE) target_compile_features(compile_for_gpu INTERFACE cxx_std_17) @@ -123,6 +124,7 @@ if(MIGRAPHX_USE_COMPOSABLEKERNEL) endif() add_library(migraphx_gpu_kernel_file_check EXCLUDE_FROM_ALL) +migraphx_setup_msvc_runtime_library(migraphx_gpu_kernel_file_check) set(CK_TIDY_SKIP_KERNEL_FILES "ck" "ck_gemm" "ck_gemm_softmax_gemm") foreach(KERNEL_FILE ${KERNEL_FILES}) @@ -200,6 +202,7 @@ endif() set_target_properties(migraphx_gpu PROPERTIES EXPORT_NAME gpu) migraphx_generate_export_header(migraphx_gpu) +migraphx_setup_msvc_runtime_library(migraphx_gpu) function(register_migraphx_gpu_ops PREFIX) foreach(OP ${ARGN}) diff --git a/src/targets/gpu/driver/CMakeLists.txt b/src/targets/gpu/driver/CMakeLists.txt index ae9b9a68513..ae244ebc3db 100644 --- a/src/targets/gpu/driver/CMakeLists.txt +++ b/src/targets/gpu/driver/CMakeLists.txt @@ -23,9 +23,8 @@ ##################################################################################### file(GLOB GPU_DRIVER_SRCS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -add_executable(gpu-driver - ${GPU_DRIVER_SRCS} -) +add_executable(gpu-driver ${GPU_DRIVER_SRCS}) +migraphx_setup_msvc_runtime_library(gpu-driver) rocm_clang_tidy_check(gpu-driver) target_include_directories(gpu-driver PRIVATE include) target_link_libraries(gpu-driver PRIVATE migraphx_gpu) diff --git a/src/targets/gpu/hiprtc/CMakeLists.txt b/src/targets/gpu/hiprtc/CMakeLists.txt index a8cb3cec099..1338932f5a8 100644 --- a/src/targets/gpu/hiprtc/CMakeLists.txt +++ b/src/targets/gpu/hiprtc/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -22,9 +22,8 @@ # THE SOFTWARE. ##################################################################################### -add_executable(migraphx-hiprtc-driver - main.cpp -) +add_executable(migraphx-hiprtc-driver main.cpp) +migraphx_setup_msvc_runtime_library(migraphx-hiprtc-driver) rocm_clang_tidy_check(migraphx-hiprtc-driver) # On Windows, the driver's default 1MB stack size is not enough - increasing to 4MB. set(STACK_SIZE 4194304) diff --git a/src/targets/ref/CMakeLists.txt b/src/targets/ref/CMakeLists.txt index d4b3e63c7a1..e702df701ef 100644 --- a/src/targets/ref/CMakeLists.txt +++ b/src/targets/ref/CMakeLists.txt @@ -34,6 +34,7 @@ target_link_libraries(migraphx_ref PRIVATE Threads::Threads) target_link_libraries(migraphx_ref PUBLIC migraphx) migraphx_generate_export_header(migraphx_ref) +migraphx_setup_msvc_runtime_library(migraphx_ref) rocm_install_targets( PRIVATE diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 0bacecf359f..e6cdc40848f 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -24,12 +24,6 @@ find_package(protobuf QUIET CONFIG) if(protobuf_FOUND) - # On Windows, dependency projects need to be compiled with MSVC, - # because a few of them are failing to compile with the Clang compiler. - filter_target_linked_libraries( - protobuf::libprotobuf - FLATTEN FILTER "absl::" EXCLUDE REGEX "-ignore:4221") - add_library(tf-proto STATIC ${PROTO_SRCS}) protobuf_generate( TARGET tf-proto @@ -72,13 +66,16 @@ if(MSVC) else() target_compile_options(tf-proto PRIVATE -w) endif() + set_target_properties(tf-proto PROPERTIES POSITION_INDEPENDENT_CODE On) +migraphx_setup_msvc_runtime_library(tf-proto) file(GLOB TF_SRCS CONFIGURE_DEPENDS *.cpp) add_library(migraphx_tf ${TF_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) -migraphx_generate_export_header(migraphx_tf) +migraphx_setup_msvc_runtime_library(migraphx_tf) target_include_directories(migraphx_tf PRIVATE include) set_target_properties(migraphx_tf PROPERTIES EXPORT_NAME tf) +migraphx_generate_export_header(migraphx_tf) rocm_set_soversion(migraphx_tf ${MIGRAPHX_SO_VERSION}) rocm_clang_tidy_check(migraphx_tf) target_link_libraries(migraphx_tf PRIVATE tf-proto) @@ -91,4 +88,3 @@ rocm_install_targets( PRIVATE TARGETS migraphx_tf ) - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1db4fb29d4f..40bc9c81c80 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ # #################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -34,14 +34,19 @@ if(MIGRAPHX_DISABLE_LARGE_BUFFER_TESTS) endif() add_library(register_targets STATIC register_target.cpp) +migraphx_setup_msvc_runtime_library(register_targets) target_link_libraries(register_targets PRIVATE migraphx migraphx_all_targets) file(GLOB TESTS CONFIGURE_DEPENDS *.cpp) list(REMOVE_ITEM TESTS ${CMAKE_CURRENT_SOURCE_DIR}/register_target.cpp) +if(NOT MIGRAPHX_USE_MIOPEN) + list(REMOVE_ITEM TESTS ${CMAKE_CURRENT_SOURCE_DIR}/sqlite.cpp) +endif() foreach(TEST ${TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_${BASE_NAME} ${TEST}) + migraphx_setup_msvc_runtime_library(test_${BASE_NAME}) rocm_clang_tidy_check(test_${BASE_NAME}) endforeach() @@ -52,6 +57,7 @@ if(MIGRAPHX_ENABLE_GPU) foreach(TEST ${GPU_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_gpu_${BASE_NAME} ${TEST}) + migraphx_setup_msvc_runtime_library(test_gpu_${BASE_NAME}) rocm_clang_tidy_check(test_gpu_${BASE_NAME}) set_tests_properties(test_gpu_${BASE_NAME} PROPERTIES COST 10 @@ -72,6 +78,7 @@ if(MIGRAPHX_ENABLE_FPGA) foreach(TEST ${FPGA_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_fpga_${BASE_NAME} ${TEST}) + migraphx_setup_msvc_runtime_library(test_fpga_${BASE_NAME}) rocm_clang_tidy_check(test_fpga_${BASE_NAME}) set_tests_properties(test_fpga_${BASE_NAME} PROPERTIES COST 10 @@ -110,6 +117,7 @@ if(MIGRAPHX_ENABLE_GPU AND MIGRAPHX_ENABLE_CPU AND MIGRAPHX_ENABLE_FPGA) get_filename_component(BASE_NAME ${MULTI_TARGET_TEST} NAME_WE) set(TEST_NAME test_${BASE_NAME}) add_executable(${TEST_NAME} ${MULTI_TARGET_TEST}) + migraphx_setup_msvc_runtime_library(${TEST_NAME}) rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx migraphx_onnx migraphx_tf migraphx_all_targets register_targets) target_include_directories(${TEST_NAME} PUBLIC include) @@ -135,6 +143,7 @@ int main() {}\n" ${CMAKE_CURRENT_BINARY_DIR}/header-main-include-${NAME}.cpp ${CMAKE_CURRENT_BINARY_DIR}/header-static-include-${NAME}.cpp ) + migraphx_setup_msvc_runtime_library(${NAME}) endfunction() function(test_headers PREFIX) diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index 61d4211b576..84de68b6b4b 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -24,6 +24,7 @@ function(add_api_test TEST_NAME TEST_SRC TEST_DIR) set(NAME test_api_${TEST_NAME}) add_executable(${NAME} EXCLUDE_FROM_ALL ${TEST_SRC}) + migraphx_setup_msvc_runtime_library(${NAME}) rocm_clang_tidy_check(${NAME}) target_link_libraries(${NAME} migraphx_c migraphx migraphx_all_targets onnx_files pb_files) target_include_directories(${NAME} PUBLIC ../include include) @@ -42,6 +43,7 @@ function(add_c_api_test TEST_NAME TEST_SRC TEST_DIR) if(MIGRAPHX_ENABLE_C_API_TEST) set(NAME test_api_${TEST_NAME}) add_executable(${NAME} EXCLUDE_FROM_ALL ${TEST_SRC}) + migraphx_setup_msvc_runtime_library(${NAME}) target_link_libraries(${NAME} migraphx_c) target_include_directories(${NAME} PUBLIC ../include) add_test(NAME ${NAME} COMMAND $ WORKING_DIRECTORY ${TEST_DIR}) diff --git a/test/gpu/kernels/CMakeLists.txt b/test/gpu/kernels/CMakeLists.txt index 98b9e8ff87f..2ede96bedff 100644 --- a/test/gpu/kernels/CMakeLists.txt +++ b/test/gpu/kernels/CMakeLists.txt @@ -29,6 +29,7 @@ message("KERNELS_TESTS: ${KERNELS_TESTS}") add_embed_library(kernel_tests ${KERNELS_TESTS} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}) rocm_add_test_executable(test_gpu_kernels main.cpp) +migraphx_setup_msvc_runtime_library(test_gpu_kernels) target_link_libraries(test_gpu_kernels migraphx migraphx_gpu kernel_tests) diff --git a/test/onnx/CMakeLists.txt b/test/onnx/CMakeLists.txt index e1f5ab04a68..75059a1269c 100644 --- a/test/onnx/CMakeLists.txt +++ b/test/onnx/CMakeLists.txt @@ -24,6 +24,7 @@ function(add_onnx_test TEST_NAME) rocm_add_test_executable(${TEST_NAME} ${ARGN}) + migraphx_setup_msvc_runtime_library(${TEST_NAME}) rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_onnx migraphx_ref onnx_files) target_include_directories(${TEST_NAME} PUBLIC ../include include) diff --git a/test/op/CMakeLists.txt b/test/op/CMakeLists.txt index e850f58b94f..4fc116d2309 100644 --- a/test/op/CMakeLists.txt +++ b/test/op/CMakeLists.txt @@ -25,6 +25,7 @@ file(GLOB OP_BUILDER_TESTS CONFIGURE_DEPENDS builder/*.cpp) rocm_add_test_executable(test_op_builder_test ${OP_BUILDER_TESTS}) +migraphx_setup_msvc_runtime_library(test_op_builder_test) target_include_directories(test_op_builder_test PUBLIC ../include include) target_link_libraries(test_op_builder_test migraphx migraphx_ref) rocm_clang_tidy_check(test_op_builder_test) diff --git a/test/ref/CMakeLists.txt b/test/ref/CMakeLists.txt index a49fd36b2b8..a3196ad1171 100644 --- a/test/ref/CMakeLists.txt +++ b/test/ref/CMakeLists.txt @@ -25,6 +25,7 @@ file(GLOB REF CONFIGURE_DEPENDS *.cpp) rocm_add_test_executable(test_ref ${REF}) +migraphx_setup_msvc_runtime_library(test_ref) target_include_directories(test_ref PUBLIC ../include) target_link_libraries(test_ref migraphx migraphx_ref) rocm_clang_tidy_check(test_ref) diff --git a/test/tf/CMakeLists.txt b/test/tf/CMakeLists.txt index 3987ec1441f..b2c3e466f88 100644 --- a/test/tf/CMakeLists.txt +++ b/test/tf/CMakeLists.txt @@ -24,6 +24,7 @@ function(add_tf_test TEST_NAME) rocm_add_test_executable(${TEST_NAME} ${ARGN}) + migraphx_setup_msvc_runtime_library(${TEST_NAME}) rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_tf pb_files) target_include_directories(${TEST_NAME} PUBLIC ../include include) diff --git a/test/verify/CMakeLists.txt b/test/verify/CMakeLists.txt index daa5a22138e..3ac2fdc7f92 100644 --- a/test/verify/CMakeLists.txt +++ b/test/verify/CMakeLists.txt @@ -25,6 +25,7 @@ file(GLOB VERIFY_TESTS CONFIGURE_DEPENDS *.cpp) add_executable(test_verify ${VERIFY_TESTS}) +migraphx_setup_msvc_runtime_library(test_verify) rocm_mark_as_test(test_verify) rocm_install_test(TARGETS test_verify) target_link_libraries(test_verify migraphx migraphx_all_targets) From 374d2f27ca596c0b7699459139c59c54d64a2e9e Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Fri, 8 May 2026 00:00:08 +0200 Subject: [PATCH 04/20] update licenses --- src/targets/cpu/CMakeLists.txt | 2 +- src/targets/fpga/CMakeLists.txt | 2 +- src/targets/gpu/driver/CMakeLists.txt | 2 +- src/targets/ref/CMakeLists.txt | 2 +- src/tf/CMakeLists.txt | 2 +- test/gpu/kernels/CMakeLists.txt | 2 +- test/onnx/CMakeLists.txt | 2 +- test/op/CMakeLists.txt | 2 +- test/ref/CMakeLists.txt | 2 +- test/tf/CMakeLists.txt | 2 +- test/verify/CMakeLists.txt | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/targets/cpu/CMakeLists.txt b/src/targets/cpu/CMakeLists.txt index 78a398b839b..1d956f4ddae 100644 --- a/src/targets/cpu/CMakeLists.txt +++ b/src/targets/cpu/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index 3d33df8c32f..d0b4c819f4d 100644 --- a/src/targets/fpga/CMakeLists.txt +++ b/src/targets/fpga/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/gpu/driver/CMakeLists.txt b/src/targets/gpu/driver/CMakeLists.txt index ae244ebc3db..9c70a2dbf6b 100644 --- a/src/targets/gpu/driver/CMakeLists.txt +++ b/src/targets/gpu/driver/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/ref/CMakeLists.txt b/src/targets/ref/CMakeLists.txt index e702df701ef..c334a731d2b 100644 --- a/src/targets/ref/CMakeLists.txt +++ b/src/targets/ref/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index e6cdc40848f..643deae8be0 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/gpu/kernels/CMakeLists.txt b/test/gpu/kernels/CMakeLists.txt index 2ede96bedff..02eb0f647b4 100644 --- a/test/gpu/kernels/CMakeLists.txt +++ b/test/gpu/kernels/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/onnx/CMakeLists.txt b/test/onnx/CMakeLists.txt index 75059a1269c..ab339e28c63 100644 --- a/test/onnx/CMakeLists.txt +++ b/test/onnx/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/op/CMakeLists.txt b/test/op/CMakeLists.txt index 4fc116d2309..6def6f0948c 100644 --- a/test/op/CMakeLists.txt +++ b/test/op/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/ref/CMakeLists.txt b/test/ref/CMakeLists.txt index a3196ad1171..0dc9540ccfd 100644 --- a/test/ref/CMakeLists.txt +++ b/test/ref/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/tf/CMakeLists.txt b/test/tf/CMakeLists.txt index b2c3e466f88..f6212788334 100644 --- a/test/tf/CMakeLists.txt +++ b/test/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/verify/CMakeLists.txt b/test/verify/CMakeLists.txt index 3ac2fdc7f92..622efa2ce7c 100644 --- a/test/verify/CMakeLists.txt +++ b/test/verify/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 9d035ca5e238923e0282342ac6843e5be986cb7d Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Fri, 8 May 2026 00:30:13 +0200 Subject: [PATCH 05/20] add missing PRIVATE --- src/CMakeLists.txt | 3 +-- src/targets/gpu/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3504ea86afd..7c27c266cd9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -149,8 +149,7 @@ add_library(migraphx ) if(MIGRAPHX_USE_MIOPEN) - target_sources(migraphx - sqlite.cpp) + target_sources(migraphx PRIVATE sqlite.cpp) endif() file(GLOB BUILDER_SRCS CONFIGURE_DEPENDS op/builder/*.cpp) diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index a5a0da93624..c110d5cfe56 100644 --- a/src/targets/gpu/CMakeLists.txt +++ b/src/targets/gpu/CMakeLists.txt @@ -196,6 +196,7 @@ add_library(migraphx_gpu if(MIGRAPHX_USE_MIOPEN) target_sources(migraphx_gpu + PRIVATE abs.cpp perfdb.cpp) endif() From 872bc706eef8660139e10426f1311c2c9f7ee7c1 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Fri, 8 May 2026 00:42:47 +0200 Subject: [PATCH 06/20] add missing setup functions --- src/api/CMakeLists.txt | 3 ++- test/gpu/kernels/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 9e83fc6b240..be48c4f5df0 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -27,6 +27,7 @@ add_library(migraphx_c ) set_target_properties(migraphx_c PROPERTIES EXPORT_NAME c) migraphx_generate_export_header(migraphx_c DIRECTORY migraphx/api) +migraphx_setup_msvc_runtime_library(migraphx_c) # migraphx_c is stable API interface library. SO version of this should be # bumped when binary compatibility is broken. diff --git a/test/gpu/kernels/CMakeLists.txt b/test/gpu/kernels/CMakeLists.txt index 02eb0f647b4..637ea6732ab 100644 --- a/test/gpu/kernels/CMakeLists.txt +++ b/test/gpu/kernels/CMakeLists.txt @@ -34,6 +34,7 @@ migraphx_setup_msvc_runtime_library(test_gpu_kernels) target_link_libraries(test_gpu_kernels migraphx migraphx_gpu kernel_tests) add_library(migraphx_gpu_test_kernel_file_check EXCLUDE_FROM_ALL ${KERNELS_TESTS}) +migraphx_setup_msvc_runtime_library(migraphx_gpu_test_kernel_file_check) target_link_libraries(migraphx_gpu_test_kernel_file_check compile_migraphx_gpu_kernels) rocm_clang_tidy_check(migraphx_gpu_test_kernel_file_check) From 1fb8cea85987d44b2786ce8e56df6ab6c8702999 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 14:42:38 +0200 Subject: [PATCH 07/20] incorporate review feedback --- CMakeLists.txt | 11 ++++++- cmake/Embed.cmake | 1 - cmake/PythonModules.cmake | 1 - cmake/RuntimeLibrary.cmake | 43 --------------------------- src/CMakeLists.txt | 2 -- src/api/CMakeLists.txt | 1 - src/driver/CMakeLists.txt | 1 - src/onnx/CMakeLists.txt | 2 -- src/py/CMakeLists.txt | 2 -- src/targets/cpu/CMakeLists.txt | 1 - src/targets/fpga/CMakeLists.txt | 1 - src/targets/gpu/CMakeLists.txt | 3 -- src/targets/gpu/driver/CMakeLists.txt | 1 - src/targets/gpu/hiprtc/CMakeLists.txt | 1 - src/targets/ref/CMakeLists.txt | 1 - src/tf/CMakeLists.txt | 2 -- test/CMakeLists.txt | 16 ++++------ test/api/CMakeLists.txt | 2 -- test/gpu/kernels/CMakeLists.txt | 2 -- test/onnx/CMakeLists.txt | 3 +- test/op/CMakeLists.txt | 1 - test/ref/CMakeLists.txt | 1 - test/tf/CMakeLists.txt | 3 +- test/verify/CMakeLists.txt | 1 - 24 files changed, 17 insertions(+), 86 deletions(-) delete mode 100644 cmake/RuntimeLibrary.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 2149c610f88..8c0e809a985 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ cmake_policy(SET CMP0091 NEW) project(migraphx LANGUAGES C CXX) include(CTest) -include(RuntimeLibrary) include(DetectPackageBackend) detect_package_backend() @@ -61,6 +60,16 @@ detect_package_backend() find_package(ROCmCMakeBuildTools REQUIRED) find_package(Threads REQUIRED) +include(CMakeDependentOption) + +cmake_dependent_option(MIGRAPHX_USE_MSVC_STATIC_RUNTIME "" OFF "WIN32" OFF) + +if(NOT MIGRAPHX_USE_MSVC_STATIC_RUNTIME) + set(MIGRAPHX_MSVC_RUNTIME_SUFFIX "DLL") +endif() + +set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>${MIGRAPHX_MSVC_RUNTIME_SUFFIX}") + option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" ON) if(WIN32) diff --git a/cmake/Embed.cmake b/cmake/Embed.cmake index 47f0bac95e4..b42d7390a28 100644 --- a/cmake/Embed.cmake +++ b/cmake/Embed.cmake @@ -257,7 +257,6 @@ function(add_embed_library EMBED_NAME) if(EMBED_USE STREQUAL "CArrays") target_sources(${INTERNAL_EMBED_LIB} PRIVATE ${OUTPUT_FILES}) endif() - migraphx_setup_msvc_runtime_library(${INTERNAL_EMBED_LIB}) target_include_directories(${INTERNAL_EMBED_LIB} PRIVATE "${EMBED_DIR}/include") target_compile_options(${INTERNAL_EMBED_LIB} PRIVATE -Wno-reserved-identifier -Wno-extern-initializer -Wno-missing-variable-declarations) set_target_properties(${INTERNAL_EMBED_LIB} PROPERTIES POSITION_INDEPENDENT_CODE On) diff --git a/cmake/PythonModules.cmake b/cmake/PythonModules.cmake index 248cf426af8..c79c71ab26b 100644 --- a/cmake/PythonModules.cmake +++ b/cmake/PythonModules.cmake @@ -99,7 +99,6 @@ function(py_add_module NAME) else() add_library(${NAME} MODULE ${PARSE_UNPARSED_ARGUMENTS}) endif() - migraphx_setup_msvc_runtime_library(${NAME}) pybind11_strip(${NAME}) if(NOT CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") py_extension(${NAME} ${PYTHON_VERSION}) diff --git a/cmake/RuntimeLibrary.cmake b/cmake/RuntimeLibrary.cmake deleted file mode 100644 index de02280451c..00000000000 --- a/cmake/RuntimeLibrary.cmake +++ /dev/null @@ -1,43 +0,0 @@ -##################################################################################### -# The MIT License (MIT) -# -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -##################################################################################### - -include_guard() - -include(CMakeDependentOption) - -cmake_dependent_option(MIGRAPHX_USE_MSVC_STATIC_RUNTIME - "" OFF "WIN32" OFF) - -function(migraphx_setup_msvc_runtime_library target) - if(MSVC AND (CMAKE_CXX_COMPILER STREQUAL Clang OR CMAKE_C_COMPILER STREQUAL Clang)) - target_compile_definitions(${target} PRIVATE - "$<$:_DEBUG;_ITERATOR_DEBUG_LEVEL=2>") - endif() - if(NOT MIGRAPHX_USE_MSVC_STATIC_RUNTIME) - set(__suffix "DLL") - endif() - set_target_properties(${target} PROPERTIES - MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>${__suffix}") - unset(__suffix) -endfunction() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c27c266cd9..b33fefa8c24 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -160,8 +160,6 @@ if(WIN32) target_compile_definitions(migraphx PUBLIC MIGRAPHX_USE_TYPE_ERASED_MATCHERS=1) endif() -migraphx_setup_msvc_runtime_library(migraphx) - configure_file(version.h.in include/migraphx/version.h) add_library(migraphx_version INTERFACE) rocm_install_targets( diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index be48c4f5df0..ee2fd69a092 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -27,7 +27,6 @@ add_library(migraphx_c ) set_target_properties(migraphx_c PROPERTIES EXPORT_NAME c) migraphx_generate_export_header(migraphx_c DIRECTORY migraphx/api) -migraphx_setup_msvc_runtime_library(migraphx_c) # migraphx_c is stable API interface library. SO version of this should be # bumped when binary compatibility is broken. diff --git a/src/driver/CMakeLists.txt b/src/driver/CMakeLists.txt index 2a62364bd13..431da1a8762 100644 --- a/src/driver/CMakeLists.txt +++ b/src/driver/CMakeLists.txt @@ -51,7 +51,6 @@ file(STRINGS "${CMAKE_SOURCE_DIR}/test/onnx/.onnxrt-commit" String_output) target_compile_definitions(driver PUBLIC MIGRAPHX_ORT_SHA1="${String_output}") target_link_libraries(driver migraphx_all_targets migraphx_onnx migraphx_tf) -migraphx_setup_msvc_runtime_library(driver) if(MIGRAPHX_ENABLE_PYTHON) target_link_libraries(driver migraphx_py) diff --git a/src/onnx/CMakeLists.txt b/src/onnx/CMakeLists.txt index d70bb3b71f3..cac6b17a955 100644 --- a/src/onnx/CMakeLists.txt +++ b/src/onnx/CMakeLists.txt @@ -43,11 +43,9 @@ else() endif() set_target_properties(onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On) -migraphx_setup_msvc_runtime_library(onnx-proto) file(GLOB ONNX_SRCS CONFIGURE_DEPENDS *.cpp) add_library(migraphx_onnx ${ONNX_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) -migraphx_setup_msvc_runtime_library(migraphx_onnx) target_include_directories(migraphx_onnx PRIVATE include) set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx) migraphx_generate_export_header(migraphx_onnx) diff --git a/src/py/CMakeLists.txt b/src/py/CMakeLists.txt index 43471fec0a9..6709d3570a0 100644 --- a/src/py/CMakeLists.txt +++ b/src/py/CMakeLists.txt @@ -23,7 +23,6 @@ ##################################################################################### add_library(migraphx_py py_loader.cpp) -migraphx_setup_msvc_runtime_library(migraphx_py) migraphx_generate_export_header(migraphx_py) target_include_directories(migraphx_py PRIVATE include) target_link_libraries(migraphx_py PUBLIC migraphx) @@ -38,7 +37,6 @@ foreach(PYTHON_VERSION ${PYTHON_VERSIONS}) add_dependencies(migraphx_py migraphx_pybind_${PYTHON_VERSION}) add_library(migraphx_py_${PYTHON_VERSION} py.cpp) - migraphx_setup_msvc_runtime_library(migraphx_py_${PYTHON_VERSION}) target_include_directories(migraphx_py_${PYTHON_VERSION} PRIVATE include) target_link_libraries(migraphx_py_${PYTHON_VERSION} PUBLIC migraphx) target_link_libraries(migraphx_py_${PYTHON_VERSION} PRIVATE pybind11::pybind11 python${PYTHON_VERSION}::runtime) diff --git a/src/targets/cpu/CMakeLists.txt b/src/targets/cpu/CMakeLists.txt index 1d956f4ddae..317106c8bf3 100644 --- a/src/targets/cpu/CMakeLists.txt +++ b/src/targets/cpu/CMakeLists.txt @@ -79,7 +79,6 @@ endif() target_link_libraries(migraphx_cpu PRIVATE migraphx) migraphx_generate_export_header(migraphx_cpu) -migraphx_setup_msvc_runtime_library(migraphx_cpu) find_package(OpenMP) if(WIN32) diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index d0b4c819f4d..c3afd6ee7dd 100644 --- a/src/targets/fpga/CMakeLists.txt +++ b/src/targets/fpga/CMakeLists.txt @@ -36,7 +36,6 @@ rocm_clang_tidy_check(migraphx_fpga) target_link_libraries(migraphx_fpga migraphx) migraphx_generate_export_header(migraphx_fpga) -migraphx_setup_msvc_runtime_library(migraphx_fpga) rocm_install_targets( PRIVATE diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index c110d5cfe56..86f70df32d1 100644 --- a/src/targets/gpu/CMakeLists.txt +++ b/src/targets/gpu/CMakeLists.txt @@ -86,7 +86,6 @@ add_embed_library(migraphx_kernels ${KERNEL_FILES} RELATIVE ${CMAKE_CURRENT_SOUR configure_file(device/targets.hpp.in include/migraphx/gpu/device/targets.hpp) file(GLOB DEVICE_GPU_SRCS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/device/*.cpp) add_library(migraphx_device ${DEVICE_GPU_SRCS}) -migraphx_setup_msvc_runtime_library(migraphx_device) add_library(compile_for_gpu INTERFACE) target_compile_features(compile_for_gpu INTERFACE cxx_std_17) @@ -124,7 +123,6 @@ if(MIGRAPHX_USE_COMPOSABLEKERNEL) endif() add_library(migraphx_gpu_kernel_file_check EXCLUDE_FROM_ALL) -migraphx_setup_msvc_runtime_library(migraphx_gpu_kernel_file_check) set(CK_TIDY_SKIP_KERNEL_FILES "ck" "ck_gemm" "ck_gemm_softmax_gemm") foreach(KERNEL_FILE ${KERNEL_FILES}) @@ -203,7 +201,6 @@ endif() set_target_properties(migraphx_gpu PROPERTIES EXPORT_NAME gpu) migraphx_generate_export_header(migraphx_gpu) -migraphx_setup_msvc_runtime_library(migraphx_gpu) function(register_migraphx_gpu_ops PREFIX) foreach(OP ${ARGN}) diff --git a/src/targets/gpu/driver/CMakeLists.txt b/src/targets/gpu/driver/CMakeLists.txt index 9c70a2dbf6b..9b5cbc03dd5 100644 --- a/src/targets/gpu/driver/CMakeLists.txt +++ b/src/targets/gpu/driver/CMakeLists.txt @@ -24,7 +24,6 @@ file(GLOB GPU_DRIVER_SRCS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) add_executable(gpu-driver ${GPU_DRIVER_SRCS}) -migraphx_setup_msvc_runtime_library(gpu-driver) rocm_clang_tidy_check(gpu-driver) target_include_directories(gpu-driver PRIVATE include) target_link_libraries(gpu-driver PRIVATE migraphx_gpu) diff --git a/src/targets/gpu/hiprtc/CMakeLists.txt b/src/targets/gpu/hiprtc/CMakeLists.txt index 1338932f5a8..b3cdde66411 100644 --- a/src/targets/gpu/hiprtc/CMakeLists.txt +++ b/src/targets/gpu/hiprtc/CMakeLists.txt @@ -23,7 +23,6 @@ ##################################################################################### add_executable(migraphx-hiprtc-driver main.cpp) -migraphx_setup_msvc_runtime_library(migraphx-hiprtc-driver) rocm_clang_tidy_check(migraphx-hiprtc-driver) # On Windows, the driver's default 1MB stack size is not enough - increasing to 4MB. set(STACK_SIZE 4194304) diff --git a/src/targets/ref/CMakeLists.txt b/src/targets/ref/CMakeLists.txt index c334a731d2b..d54108a06c2 100644 --- a/src/targets/ref/CMakeLists.txt +++ b/src/targets/ref/CMakeLists.txt @@ -34,7 +34,6 @@ target_link_libraries(migraphx_ref PRIVATE Threads::Threads) target_link_libraries(migraphx_ref PUBLIC migraphx) migraphx_generate_export_header(migraphx_ref) -migraphx_setup_msvc_runtime_library(migraphx_ref) rocm_install_targets( PRIVATE diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 643deae8be0..74862734b1b 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -68,11 +68,9 @@ else() endif() set_target_properties(tf-proto PROPERTIES POSITION_INDEPENDENT_CODE On) -migraphx_setup_msvc_runtime_library(tf-proto) file(GLOB TF_SRCS CONFIGURE_DEPENDS *.cpp) add_library(migraphx_tf ${TF_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) -migraphx_setup_msvc_runtime_library(migraphx_tf) target_include_directories(migraphx_tf PRIVATE include) set_target_properties(migraphx_tf PROPERTIES EXPORT_NAME tf) migraphx_generate_export_header(migraphx_tf) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 40bc9c81c80..c92166bd7e8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -34,7 +34,6 @@ if(MIGRAPHX_DISABLE_LARGE_BUFFER_TESTS) endif() add_library(register_targets STATIC register_target.cpp) -migraphx_setup_msvc_runtime_library(register_targets) target_link_libraries(register_targets PRIVATE migraphx migraphx_all_targets) file(GLOB TESTS CONFIGURE_DEPENDS *.cpp) @@ -46,8 +45,7 @@ endif() foreach(TEST ${TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_${BASE_NAME} ${TEST}) - migraphx_setup_msvc_runtime_library(test_${BASE_NAME}) - rocm_clang_tidy_check(test_${BASE_NAME}) + rocm_clang_tidy_check(test_${BASE_NAME}) endforeach() if(MIGRAPHX_ENABLE_GPU) @@ -57,8 +55,7 @@ if(MIGRAPHX_ENABLE_GPU) foreach(TEST ${GPU_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_gpu_${BASE_NAME} ${TEST}) - migraphx_setup_msvc_runtime_library(test_gpu_${BASE_NAME}) - rocm_clang_tidy_check(test_gpu_${BASE_NAME}) + rocm_clang_tidy_check(test_gpu_${BASE_NAME}) set_tests_properties(test_gpu_${BASE_NAME} PROPERTIES COST 10 RESOURCE_LOCK gpu @@ -78,8 +75,7 @@ if(MIGRAPHX_ENABLE_FPGA) foreach(TEST ${FPGA_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_fpga_${BASE_NAME} ${TEST}) - migraphx_setup_msvc_runtime_library(test_fpga_${BASE_NAME}) - rocm_clang_tidy_check(test_fpga_${BASE_NAME}) + rocm_clang_tidy_check(test_fpga_${BASE_NAME}) set_tests_properties(test_fpga_${BASE_NAME} PROPERTIES COST 10 RESOURCE_LOCK fpga @@ -117,8 +113,7 @@ if(MIGRAPHX_ENABLE_GPU AND MIGRAPHX_ENABLE_CPU AND MIGRAPHX_ENABLE_FPGA) get_filename_component(BASE_NAME ${MULTI_TARGET_TEST} NAME_WE) set(TEST_NAME test_${BASE_NAME}) add_executable(${TEST_NAME} ${MULTI_TARGET_TEST}) - migraphx_setup_msvc_runtime_library(${TEST_NAME}) - rocm_clang_tidy_check(${TEST_NAME}) + rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx migraphx_onnx migraphx_tf migraphx_all_targets register_targets) target_include_directories(${TEST_NAME} PUBLIC include) add_test(NAME ${TEST_NAME} COMMAND $ WORKING_DIRECTORY ${TEST_MULTI_TARGET_DIR}) @@ -143,8 +138,7 @@ int main() {}\n" ${CMAKE_CURRENT_BINARY_DIR}/header-main-include-${NAME}.cpp ${CMAKE_CURRENT_BINARY_DIR}/header-static-include-${NAME}.cpp ) - migraphx_setup_msvc_runtime_library(${NAME}) -endfunction() + endfunction() function(test_headers PREFIX) file(GLOB HEADERS CONFIGURE_DEPENDS ${ARGN}) diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt index 84de68b6b4b..61d4211b576 100644 --- a/test/api/CMakeLists.txt +++ b/test/api/CMakeLists.txt @@ -24,7 +24,6 @@ function(add_api_test TEST_NAME TEST_SRC TEST_DIR) set(NAME test_api_${TEST_NAME}) add_executable(${NAME} EXCLUDE_FROM_ALL ${TEST_SRC}) - migraphx_setup_msvc_runtime_library(${NAME}) rocm_clang_tidy_check(${NAME}) target_link_libraries(${NAME} migraphx_c migraphx migraphx_all_targets onnx_files pb_files) target_include_directories(${NAME} PUBLIC ../include include) @@ -43,7 +42,6 @@ function(add_c_api_test TEST_NAME TEST_SRC TEST_DIR) if(MIGRAPHX_ENABLE_C_API_TEST) set(NAME test_api_${TEST_NAME}) add_executable(${NAME} EXCLUDE_FROM_ALL ${TEST_SRC}) - migraphx_setup_msvc_runtime_library(${NAME}) target_link_libraries(${NAME} migraphx_c) target_include_directories(${NAME} PUBLIC ../include) add_test(NAME ${NAME} COMMAND $ WORKING_DIRECTORY ${TEST_DIR}) diff --git a/test/gpu/kernels/CMakeLists.txt b/test/gpu/kernels/CMakeLists.txt index 637ea6732ab..da16c21aa36 100644 --- a/test/gpu/kernels/CMakeLists.txt +++ b/test/gpu/kernels/CMakeLists.txt @@ -29,12 +29,10 @@ message("KERNELS_TESTS: ${KERNELS_TESTS}") add_embed_library(kernel_tests ${KERNELS_TESTS} RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}) rocm_add_test_executable(test_gpu_kernels main.cpp) -migraphx_setup_msvc_runtime_library(test_gpu_kernels) target_link_libraries(test_gpu_kernels migraphx migraphx_gpu kernel_tests) add_library(migraphx_gpu_test_kernel_file_check EXCLUDE_FROM_ALL ${KERNELS_TESTS}) -migraphx_setup_msvc_runtime_library(migraphx_gpu_test_kernel_file_check) target_link_libraries(migraphx_gpu_test_kernel_file_check compile_migraphx_gpu_kernels) rocm_clang_tidy_check(migraphx_gpu_test_kernel_file_check) diff --git a/test/onnx/CMakeLists.txt b/test/onnx/CMakeLists.txt index ab339e28c63..5be7bf83ee9 100644 --- a/test/onnx/CMakeLists.txt +++ b/test/onnx/CMakeLists.txt @@ -24,8 +24,7 @@ function(add_onnx_test TEST_NAME) rocm_add_test_executable(${TEST_NAME} ${ARGN}) - migraphx_setup_msvc_runtime_library(${TEST_NAME}) - rocm_clang_tidy_check(${TEST_NAME}) + rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_onnx migraphx_ref onnx_files) target_include_directories(${TEST_NAME} PUBLIC ../include include) endfunction() diff --git a/test/op/CMakeLists.txt b/test/op/CMakeLists.txt index 6def6f0948c..1c75f4bd8cd 100644 --- a/test/op/CMakeLists.txt +++ b/test/op/CMakeLists.txt @@ -25,7 +25,6 @@ file(GLOB OP_BUILDER_TESTS CONFIGURE_DEPENDS builder/*.cpp) rocm_add_test_executable(test_op_builder_test ${OP_BUILDER_TESTS}) -migraphx_setup_msvc_runtime_library(test_op_builder_test) target_include_directories(test_op_builder_test PUBLIC ../include include) target_link_libraries(test_op_builder_test migraphx migraphx_ref) rocm_clang_tidy_check(test_op_builder_test) diff --git a/test/ref/CMakeLists.txt b/test/ref/CMakeLists.txt index 0dc9540ccfd..b1c7f6d21b2 100644 --- a/test/ref/CMakeLists.txt +++ b/test/ref/CMakeLists.txt @@ -25,7 +25,6 @@ file(GLOB REF CONFIGURE_DEPENDS *.cpp) rocm_add_test_executable(test_ref ${REF}) -migraphx_setup_msvc_runtime_library(test_ref) target_include_directories(test_ref PUBLIC ../include) target_link_libraries(test_ref migraphx migraphx_ref) rocm_clang_tidy_check(test_ref) diff --git a/test/tf/CMakeLists.txt b/test/tf/CMakeLists.txt index f6212788334..358727a2a7a 100644 --- a/test/tf/CMakeLists.txt +++ b/test/tf/CMakeLists.txt @@ -24,8 +24,7 @@ function(add_tf_test TEST_NAME) rocm_add_test_executable(${TEST_NAME} ${ARGN}) - migraphx_setup_msvc_runtime_library(${TEST_NAME}) - rocm_clang_tidy_check(${TEST_NAME}) + rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_tf pb_files) target_include_directories(${TEST_NAME} PUBLIC ../include include) endfunction() diff --git a/test/verify/CMakeLists.txt b/test/verify/CMakeLists.txt index 622efa2ce7c..129b37477fa 100644 --- a/test/verify/CMakeLists.txt +++ b/test/verify/CMakeLists.txt @@ -25,7 +25,6 @@ file(GLOB VERIFY_TESTS CONFIGURE_DEPENDS *.cpp) add_executable(test_verify ${VERIFY_TESTS}) -migraphx_setup_msvc_runtime_library(test_verify) rocm_mark_as_test(test_verify) rocm_install_test(TARGETS test_verify) target_link_libraries(test_verify migraphx migraphx_all_targets) From 7bb41fe25a1eff5376913657909ba884e4aa7b8c Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 14:48:39 +0200 Subject: [PATCH 08/20] Revert "update licenses" This reverts commit 374d2f27ca596c0b7699459139c59c54d64a2e9e. --- src/targets/cpu/CMakeLists.txt | 2 +- src/targets/fpga/CMakeLists.txt | 2 +- src/targets/gpu/driver/CMakeLists.txt | 2 +- src/targets/ref/CMakeLists.txt | 2 +- src/tf/CMakeLists.txt | 2 +- test/gpu/kernels/CMakeLists.txt | 2 +- test/onnx/CMakeLists.txt | 2 +- test/op/CMakeLists.txt | 2 +- test/ref/CMakeLists.txt | 2 +- test/tf/CMakeLists.txt | 2 +- test/verify/CMakeLists.txt | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/targets/cpu/CMakeLists.txt b/src/targets/cpu/CMakeLists.txt index 317106c8bf3..558e3538765 100644 --- a/src/targets/cpu/CMakeLists.txt +++ b/src/targets/cpu/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index c3afd6ee7dd..cc32a87f866 100644 --- a/src/targets/fpga/CMakeLists.txt +++ b/src/targets/fpga/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/gpu/driver/CMakeLists.txt b/src/targets/gpu/driver/CMakeLists.txt index 9b5cbc03dd5..b230a93c96c 100644 --- a/src/targets/gpu/driver/CMakeLists.txt +++ b/src/targets/gpu/driver/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/ref/CMakeLists.txt b/src/targets/ref/CMakeLists.txt index d54108a06c2..d4b3e63c7a1 100644 --- a/src/targets/ref/CMakeLists.txt +++ b/src/targets/ref/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 74862734b1b..c7bee3c90e8 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/gpu/kernels/CMakeLists.txt b/test/gpu/kernels/CMakeLists.txt index da16c21aa36..98b9e8ff87f 100644 --- a/test/gpu/kernels/CMakeLists.txt +++ b/test/gpu/kernels/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/onnx/CMakeLists.txt b/test/onnx/CMakeLists.txt index 5be7bf83ee9..ccb75576a65 100644 --- a/test/onnx/CMakeLists.txt +++ b/test/onnx/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/op/CMakeLists.txt b/test/op/CMakeLists.txt index 1c75f4bd8cd..e850f58b94f 100644 --- a/test/op/CMakeLists.txt +++ b/test/op/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/ref/CMakeLists.txt b/test/ref/CMakeLists.txt index b1c7f6d21b2..a49fd36b2b8 100644 --- a/test/ref/CMakeLists.txt +++ b/test/ref/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/tf/CMakeLists.txt b/test/tf/CMakeLists.txt index 358727a2a7a..cce32e611d8 100644 --- a/test/tf/CMakeLists.txt +++ b/test/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/verify/CMakeLists.txt b/test/verify/CMakeLists.txt index 129b37477fa..daa5a22138e 100644 --- a/test/verify/CMakeLists.txt +++ b/test/verify/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From b913f897acedbb06ab050627370fa8e3e4b7bc4f Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 14:49:18 +0200 Subject: [PATCH 09/20] Revert "add missing setup functions" This reverts commit 872bc706eef8660139e10426f1311c2c9f7ee7c1. --- src/api/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index ee2fd69a092..9e83fc6b240 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 4915986a673bd0487cec5bdf753468e43d80e504 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 14:50:27 +0200 Subject: [PATCH 10/20] revert changes --- src/driver/CMakeLists.txt | 2 +- src/py/CMakeLists.txt | 2 +- src/targets/fpga/CMakeLists.txt | 2 +- src/targets/gpu/driver/CMakeLists.txt | 4 +++- src/targets/gpu/hiprtc/CMakeLists.txt | 6 ++++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/driver/CMakeLists.txt b/src/driver/CMakeLists.txt index 431da1a8762..b48205d46fe 100644 --- a/src/driver/CMakeLists.txt +++ b/src/driver/CMakeLists.txt @@ -22,7 +22,7 @@ # THE SOFTWARE. ##################################################################################### -add_executable(driver +add_executable(driver main.cpp verify.cpp passes.cpp diff --git a/src/py/CMakeLists.txt b/src/py/CMakeLists.txt index 6709d3570a0..32da2c08bea 100644 --- a/src/py/CMakeLists.txt +++ b/src/py/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index cc32a87f866..c3afd6ee7dd 100644 --- a/src/targets/fpga/CMakeLists.txt +++ b/src/targets/fpga/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/src/targets/gpu/driver/CMakeLists.txt b/src/targets/gpu/driver/CMakeLists.txt index b230a93c96c..ae9b9a68513 100644 --- a/src/targets/gpu/driver/CMakeLists.txt +++ b/src/targets/gpu/driver/CMakeLists.txt @@ -23,7 +23,9 @@ ##################################################################################### file(GLOB GPU_DRIVER_SRCS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -add_executable(gpu-driver ${GPU_DRIVER_SRCS}) +add_executable(gpu-driver + ${GPU_DRIVER_SRCS} +) rocm_clang_tidy_check(gpu-driver) target_include_directories(gpu-driver PRIVATE include) target_link_libraries(gpu-driver PRIVATE migraphx_gpu) diff --git a/src/targets/gpu/hiprtc/CMakeLists.txt b/src/targets/gpu/hiprtc/CMakeLists.txt index b3cdde66411..a8cb3cec099 100644 --- a/src/targets/gpu/hiprtc/CMakeLists.txt +++ b/src/targets/gpu/hiprtc/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -22,7 +22,9 @@ # THE SOFTWARE. ##################################################################################### -add_executable(migraphx-hiprtc-driver main.cpp) +add_executable(migraphx-hiprtc-driver + main.cpp +) rocm_clang_tidy_check(migraphx-hiprtc-driver) # On Windows, the driver's default 1MB stack size is not enough - increasing to 4MB. set(STACK_SIZE 4194304) From 57e39ccdc7620c2bbf1e94f5b76693633b06c657 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 14:55:15 +0200 Subject: [PATCH 11/20] revert more changes --- test/CMakeLists.txt | 12 ++++++------ test/onnx/CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index c92166bd7e8..1c1370ad42f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ # #################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -45,7 +45,7 @@ endif() foreach(TEST ${TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_${BASE_NAME} ${TEST}) - rocm_clang_tidy_check(test_${BASE_NAME}) + rocm_clang_tidy_check(test_${BASE_NAME}) endforeach() if(MIGRAPHX_ENABLE_GPU) @@ -55,7 +55,7 @@ if(MIGRAPHX_ENABLE_GPU) foreach(TEST ${GPU_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_gpu_${BASE_NAME} ${TEST}) - rocm_clang_tidy_check(test_gpu_${BASE_NAME}) + rocm_clang_tidy_check(test_gpu_${BASE_NAME}) set_tests_properties(test_gpu_${BASE_NAME} PROPERTIES COST 10 RESOURCE_LOCK gpu @@ -75,7 +75,7 @@ if(MIGRAPHX_ENABLE_FPGA) foreach(TEST ${FPGA_TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) rocm_add_test_executable(test_fpga_${BASE_NAME} ${TEST}) - rocm_clang_tidy_check(test_fpga_${BASE_NAME}) + rocm_clang_tidy_check(test_fpga_${BASE_NAME}) set_tests_properties(test_fpga_${BASE_NAME} PROPERTIES COST 10 RESOURCE_LOCK fpga @@ -113,7 +113,7 @@ if(MIGRAPHX_ENABLE_GPU AND MIGRAPHX_ENABLE_CPU AND MIGRAPHX_ENABLE_FPGA) get_filename_component(BASE_NAME ${MULTI_TARGET_TEST} NAME_WE) set(TEST_NAME test_${BASE_NAME}) add_executable(${TEST_NAME} ${MULTI_TARGET_TEST}) - rocm_clang_tidy_check(${TEST_NAME}) + rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx migraphx_onnx migraphx_tf migraphx_all_targets register_targets) target_include_directories(${TEST_NAME} PUBLIC include) add_test(NAME ${TEST_NAME} COMMAND $ WORKING_DIRECTORY ${TEST_MULTI_TARGET_DIR}) @@ -138,7 +138,7 @@ int main() {}\n" ${CMAKE_CURRENT_BINARY_DIR}/header-main-include-${NAME}.cpp ${CMAKE_CURRENT_BINARY_DIR}/header-static-include-${NAME}.cpp ) - endfunction() +endfunction() function(test_headers PREFIX) file(GLOB HEADERS CONFIGURE_DEPENDS ${ARGN}) diff --git a/test/onnx/CMakeLists.txt b/test/onnx/CMakeLists.txt index ccb75576a65..e1f5ab04a68 100644 --- a/test/onnx/CMakeLists.txt +++ b/test/onnx/CMakeLists.txt @@ -24,7 +24,7 @@ function(add_onnx_test TEST_NAME) rocm_add_test_executable(${TEST_NAME} ${ARGN}) - rocm_clang_tidy_check(${TEST_NAME}) + rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_onnx migraphx_ref onnx_files) target_include_directories(${TEST_NAME} PUBLIC ../include include) endfunction() From 27b93353e5f641512bd8fa6d45e6d1f15e321cd2 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 15:06:18 +0200 Subject: [PATCH 12/20] revert even more changes --- src/onnx/CMakeLists.txt | 3 +- src/protobuf_memswap_instantiation.cpp | 43 -------------------------- src/tf/CMakeLists.txt | 5 ++- 3 files changed, 3 insertions(+), 48 deletions(-) delete mode 100644 src/protobuf_memswap_instantiation.cpp diff --git a/src/onnx/CMakeLists.txt b/src/onnx/CMakeLists.txt index cac6b17a955..545a1636f0b 100644 --- a/src/onnx/CMakeLists.txt +++ b/src/onnx/CMakeLists.txt @@ -41,11 +41,10 @@ if(MSVC) else() target_compile_options(onnx-proto PRIVATE -w) endif() - set_target_properties(onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On) file(GLOB ONNX_SRCS CONFIGURE_DEPENDS *.cpp) -add_library(migraphx_onnx ${ONNX_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) +add_library(migraphx_onnx ${ONNX_SRCS}) target_include_directories(migraphx_onnx PRIVATE include) set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx) migraphx_generate_export_header(migraphx_onnx) diff --git a/src/protobuf_memswap_instantiation.cpp b/src/protobuf_memswap_instantiation.cpp deleted file mode 100644 index d7a6089aabf..00000000000 --- a/src/protobuf_memswap_instantiation.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#if defined(_WIN32) && defined(_DEBUG) - -#include - -// Workaround for Windows Debug build -// Explicitly instantiate protobuf memswap template to resolve linking errors - -namespace google { -namespace protobuf { -namespace internal { - -// Explicit template instantiation for memswap<16> -template void memswap<16>(char* a, char* b); - -} // namespace internal -} // namespace protobuf -} // namespace google - -#endif // defined(_WIN32) && defined(_DEBUG) diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index c7bee3c90e8..2777edc6ca3 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -66,14 +66,13 @@ if(MSVC) else() target_compile_options(tf-proto PRIVATE -w) endif() - set_target_properties(tf-proto PROPERTIES POSITION_INDEPENDENT_CODE On) file(GLOB TF_SRCS CONFIGURE_DEPENDS *.cpp) -add_library(migraphx_tf ${TF_SRCS} ${PROJECT_SOURCE_DIR}/src/protobuf_memswap_instantiation.cpp) +add_library(migraphx_tf ${TF_SRCS}) +migraphx_generate_export_header(migraphx_tf) target_include_directories(migraphx_tf PRIVATE include) set_target_properties(migraphx_tf PROPERTIES EXPORT_NAME tf) -migraphx_generate_export_header(migraphx_tf) rocm_set_soversion(migraphx_tf ${MIGRAPHX_SO_VERSION}) rocm_clang_tidy_check(migraphx_tf) target_link_libraries(migraphx_tf PRIVATE tf-proto) From c6760177637bde26ef8825ad40f7d1d855d37e36 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 15:08:13 +0200 Subject: [PATCH 13/20] the last revert of changes --- test/tf/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/tf/CMakeLists.txt b/test/tf/CMakeLists.txt index cce32e611d8..3987ec1441f 100644 --- a/test/tf/CMakeLists.txt +++ b/test/tf/CMakeLists.txt @@ -24,7 +24,7 @@ function(add_tf_test TEST_NAME) rocm_add_test_executable(${TEST_NAME} ${ARGN}) - rocm_clang_tidy_check(${TEST_NAME}) + rocm_clang_tidy_check(${TEST_NAME}) target_link_libraries(${TEST_NAME} migraphx_tf pb_files) target_include_directories(${TEST_NAME} PUBLIC ../include include) endfunction() From bd5129cc4ce8f9afd10a6e7d8631d85cd2bda33d Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 15:17:52 +0200 Subject: [PATCH 14/20] update licenses --- src/tf/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tf/CMakeLists.txt b/src/tf/CMakeLists.txt index 2777edc6ca3..76b0b0ac746 100644 --- a/src/tf/CMakeLists.txt +++ b/src/tf/CMakeLists.txt @@ -1,7 +1,7 @@ ##################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1c1370ad42f..99f93ba447b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ # #################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 80a8abcc393a230f7679ca2cc9c1264b305148c1 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 17:56:35 +0200 Subject: [PATCH 15/20] incorporate review feedback --- test/CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 99f93ba447b..490d165b89c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,9 +38,6 @@ target_link_libraries(register_targets PRIVATE migraphx migraphx_all_targets) file(GLOB TESTS CONFIGURE_DEPENDS *.cpp) list(REMOVE_ITEM TESTS ${CMAKE_CURRENT_SOURCE_DIR}/register_target.cpp) -if(NOT MIGRAPHX_USE_MIOPEN) - list(REMOVE_ITEM TESTS ${CMAKE_CURRENT_SOURCE_DIR}/sqlite.cpp) -endif() foreach(TEST ${TESTS}) get_filename_component(BASE_NAME ${TEST} NAME_WE) From d58875f9292923d7c97a0f0a92df8eedf1424d63 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Mon, 11 May 2026 17:57:16 +0200 Subject: [PATCH 16/20] revert update licenses --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 490d165b89c..1db4fb29d4f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,7 +1,7 @@ # #################################################################################### # The MIT License (MIT) # -# Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved. +# Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal From 63f726701d22448f9d98b66e2cdf6e7be3d4c4d5 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Tue, 12 May 2026 15:44:28 +0200 Subject: [PATCH 17/20] change to MIGRAPHX_MSVC_STATIC_RUNTIME --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4acd8c40d0e..1d829cba3ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,9 +62,9 @@ find_package(Threads REQUIRED) include(CMakeDependentOption) -cmake_dependent_option(MIGRAPHX_USE_MSVC_STATIC_RUNTIME "" OFF "WIN32" OFF) +cmake_dependent_option(MIGRAPHX_MSVC_STATIC_RUNTIME "" OFF "WIN32" OFF) -if(NOT MIGRAPHX_USE_MSVC_STATIC_RUNTIME) +if(NOT MIGRAPHX_MSVC_STATIC_RUNTIME) set(MIGRAPHX_MSVC_RUNTIME_SUFFIX "DLL") endif() From 20e5a2bb98fd601f3c72680021dff069f729f79a Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Wed, 13 May 2026 13:22:48 +0200 Subject: [PATCH 18/20] Update CMakeLists.txt Co-authored-by: Paul Fultz II --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d829cba3ae..6633c564d82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,9 @@ if(NOT MIGRAPHX_MSVC_STATIC_RUNTIME) set(MIGRAPHX_MSVC_RUNTIME_SUFFIX "DLL") endif() -set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>${MIGRAPHX_MSVC_RUNTIME_SUFFIX}") +if(NOT CMAKE_MSVC_RUNTIME_LIBRARY) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>${MIGRAPHX_MSVC_RUNTIME_SUFFIX}") +endif() if(CMAKE_SYSTEM_NAME STREQUAL "Windows") option(MIGRAPHX_USE_BINSKIM_COMPLIANT_COMPILE_FLAGS "Prepare MIGraphX for BinSkim Binary Analyzer" OFF) From 2fc9406b22e4743faac6f022e55ea3eee441da72 Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Thu, 14 May 2026 16:58:53 +0200 Subject: [PATCH 19/20] incorporate review feedback --- src/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 109fbb0d14c..dcc4ae1f612 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -378,10 +378,8 @@ endif() find_package(nlohmann_json 3.8.0 REQUIRED) target_link_libraries(migraphx PRIVATE nlohmann_json::nlohmann_json) -if(MIGRAPHX_USE_MIOPEN) - find_package(SQLite3 REQUIRED) - target_link_libraries(migraphx PRIVATE SQLite::SQLite3) -endif() +find_package(SQLite3 REQUIRED) +target_link_libraries(migraphx PRIVATE SQLite::SQLite3) # See: https://github.com/msgpack/msgpack-c/wiki/Q%26A#how-to-support-both-msgpack-c-c-version-5x-and-6x- # Prefer 6.x (msgpack-cxx) From 67a5fbcbca928c3f9faf188744494a21d8c302cc Mon Sep 17 00:00:00 2001 From: Artur Wojcik Date: Thu, 14 May 2026 19:55:16 +0200 Subject: [PATCH 20/20] incorporate review feedback --- src/CMakeLists.txt | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dcc4ae1f612..2ca9d5e4e50 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -126,6 +126,7 @@ add_library(migraphx rewrite_dot.cpp simplify_qdq.cpp split_reduce.cpp + sqlite.cpp rewrite_gelu.cpp rewrite_low_precision.cpp rewrite_pooling.cpp @@ -149,10 +150,6 @@ add_library(migraphx verify_args.cpp ) -if(MIGRAPHX_USE_MIOPEN) - target_sources(migraphx PRIVATE sqlite.cpp) -endif() - file(GLOB BUILDER_SRCS CONFIGURE_DEPENDS op/builder/*.cpp) target_sources(migraphx PRIVATE ${BUILDER_SRCS})