Skip to content

Option to link MIGraphX to MSVC Runtime Library statically or dynamically#4839

Merged
causten merged 33 commits into
developfrom
protobuf-v30
May 29, 2026
Merged

Option to link MIGraphX to MSVC Runtime Library statically or dynamically#4839
causten merged 33 commits into
developfrom
protobuf-v30

Conversation

@apwojcik
Copy link
Copy Markdown
Collaborator

@apwojcik apwojcik commented May 4, 2026

The content of the PR changed from the original submission. Now the PR only adds an option to MIGraphX to enable linking to the MSVC Runtime Library either statically or dynamically. I left the original description below.

Original description:

The change has been migrated from the uai-develop branch.

Windows MIGraphX is still using Protobuf v19. With this PR, we want to switch to Protobuf v30, the same version used by
Linux. However, the Windows environment and differences between Clang make it not a straightforward upgrade.

Using clang-cl requires explicit MSVC runtime library setup for protobuf-generated libraries (and for libraries that link with generated binaries). By default, protobuf sets the MSVC runtime to link statically, while the rest of MIGraphX has the MSVC runtime linked dynamically. We added setting up the MSVC runtime everywhere with this PR, because we will need this in the near future when we switch to linking the MSVC runtime statically for the entire MIGraphX.

Additionally, we do not need to link against SQLite3 if MIGraphX does not depend on the MIOpen.

@apwojcik apwojcik requested a review from causten as a code owner May 4, 2026 14:18
@apwojcik apwojcik added the Windows Related changes for Windows Environments label May 4, 2026
@pfultz2
Copy link
Copy Markdown
Collaborator

pfultz2 commented May 4, 2026

I think you are doing something wrong. The dependencies in requirements.txt build with rbuild using clang-cl, and it doesnt need filter_target_linked_libraries when linking with migraphx.

@pfultz2
Copy link
Copy Markdown
Collaborator

pfultz2 commented May 4, 2026

Additionally, we do not need to link against SQLite3 if MIGraphX does not depend on the MIOpen.

I dont think we even use the get_mlir_perf_for_conv anymore, and it probably doesnt even work anymore and should probably be removed. Can you make a seperate PR to remove perfdb.cpp files?

@apwojcik
Copy link
Copy Markdown
Collaborator Author

apwojcik commented May 4, 2026

I think you are doing something wrong. The dependencies in requirements.txt build with rbuild using clang-cl, and it doesnt need filter_target_linked_libraries when linking with migraphx.

We use clang to compile, and the change is for the clang compiler (not clang-cl). With clang-cl, the MIGraphX compiles with no warnings. We will perform additional testing on binaries built with clang-cl and consider switching the compiler.

@pfultz2
Copy link
Copy Markdown
Collaborator

pfultz2 commented May 4, 2026

I think you are doing something wrong. The dependencies in requirements.txt build with rbuild using clang-cl, and it doesnt need filter_target_linked_libraries when linking with migraphx.

We use clang to compile, and the change is for the clang compiler (not clang-cl). With clang-cl, the MIGraphX compiles with no warnings. We will perform additional testing on binaries built with clang-cl and consider switching the compiler.

Either way this change should go into protobuf. MIGraphX shouldn't be monkey patching it.

@apwojcik apwojcik changed the title upgrade for protobuf v30 on Windows Upgrade to clang-cl for building MIGraphX on Windows May 7, 2026
@apwojcik apwojcik changed the title Upgrade to clang-cl for building MIGraphX on Windows Upgrade to clang-cl and Protobuf v30 for building MIGraphX on Windows May 7, 2026
Comment thread cmake/RuntimeLibrary.cmake Outdated
@apwojcik apwojcik added the UAI label May 8, 2026
@apwojcik apwojcik requested a review from pfultz2 May 11, 2026 12:46
@apwojcik apwojcik changed the title Upgrade to clang-cl and Protobuf v30 for building MIGraphX on Windows Option to link MIGraphX to MVSC Runtime Library statically or dynamically May 11, 2026
Comment thread test/CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
@apwojcik
Copy link
Copy Markdown
Collaborator Author

Providing CMAKE_MSVC_RUNTIME_LIBRARY in the command line will not work (in terms of ease of use) for multi-config generators. You do not provide CMAKE_BUILD_TYPE for them when configuring a build because multi-config generators do not use that variable. Instead, you call cmake --build ... --config <build_type>, and then the generator expressions are kicking off to resolve the name of the runtime library. I cannot imagine requiring someone to configure a build to proceed with generator expressions on the command line. Neither library is broken. The authors provided a friendly interface for someone who wishes to configure and build a library easily without deep knowledge of CMake and generator expressions. Please keep in mind that CMAKE_MSVC_RUNTIME_LIBRARY is primarily designed for Visual Studio, which is a multi-config generator.

Comment thread src/CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
@kentqian kentqian changed the title Option to link MIGraphX to MVSC Runtime Library statically or dynamically Option to link MIGraphX to MSVC Runtime Library statically or dynamically May 22, 2026
@causten causten merged commit fe359db into develop May 29, 2026
39 checks passed
@causten causten deleted the protobuf-v30 branch May 29, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

UAI Windows Related changes for Windows Environments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants