diff --git a/CMakeLists.txt b/CMakeLists.txt index f1a0f3f35fd..6633c564d82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,8 @@ 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) @@ -58,6 +60,18 @@ detect_package_backend() find_package(ROCmCMakeBuildTools REQUIRED) find_package(Threads REQUIRED) +include(CMakeDependentOption) + +cmake_dependent_option(MIGRAPHX_MSVC_STATIC_RUNTIME "" OFF "WIN32" OFF) + +if(NOT MIGRAPHX_MSVC_STATIC_RUNTIME) + set(MIGRAPHX_MSVC_RUNTIME_SUFFIX "DLL") +endif() + +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) option(MIGRAPHX_USE_SPECTRE_MITIGATED_LIBRARIES "Use Spectre-mitigated libraries" OFF) @@ -94,7 +108,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/requirements.txt b/requirements.txt index ff2131be194..6578350e680 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 -DABSL_MSVC_STATIC_RUNTIME=Off -google/protobuf@v30.0 -DCMAKE_POSITION_INDEPENDENT_CODE=On -Dprotobuf_BUILD_TESTS=Off -Dprotobuf_MSVC_STATIC_RUNTIME=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 42b8e13828b..2ca9d5e4e50 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -156,9 +156,6 @@ 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() configure_file(version.h.in include/migraphx/version.h) @@ -349,7 +346,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) @@ -383,7 +380,7 @@ 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) -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..545a1636f0b 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 @@ -26,15 +26,14 @@ find_package(protobuf QUIET CONFIG) if(protobuf_FOUND) 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) diff --git a/src/targets/fpga/CMakeLists.txt b/src/targets/fpga/CMakeLists.txt index 11b47b9b20d..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 @@ -35,6 +35,8 @@ 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) + rocm_install_targets( PRIVATE TARGETS migraphx_fpga diff --git a/src/targets/gpu/CMakeLists.txt b/src/targets/gpu/CMakeLists.txt index 6d66ccdc573..86f70df32d1 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,15 @@ add_library(migraphx_gpu topk.cpp write_literals.cpp ${JIT_GPU_SRCS} - ${MIOPEN_SRCS} ) +if(MIGRAPHX_USE_MIOPEN) + target_sources(migraphx_gpu + PRIVATE + 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..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 @@ -27,7 +27,7 @@ if(protobuf_FOUND) add_library(tf-proto STATIC ${PROTO_SRCS}) protobuf_generate( TARGET tf-proto - PROTOS + PROTOS graph.proto node_def.proto attr_value.proto @@ -39,9 +39,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( @@ -86,4 +85,3 @@ rocm_install_targets( PRIVATE TARGETS migraphx_tf ) -