-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[HIPIFY][Feature] Ninja support #1864
Comments
This is the patch I've created in TheRock to workaround this for now: https://github.com/nod-ai/TheRock/blob/main/patches/amd-mainline/HIPIFY/0003-Don-t-override-CMAKE_C-XX-_COMPILER-on-MSVC.patch diff --git a/CMakeLists.txt b/CMakeLists.txt
index dad79610..f3616fbc 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,6 +115,10 @@ if (NOT HIPIFY_CLANG_TESTS_ONLY)
${LLVM_BINARY_DIR}/tools/lld/include
${LLVM_EXTERNAL_LLD_SOURCE_DIR}/include)
endif()
+ elseif(MSVC)
+ # Keep the existing compiler since MSVC-specific flags will be set later.
+ # Overriding CMAKE_CXX_COMPILER/CMAKE_C_COMPILER below is sketchy - could
+ # that be removed or reworked instead?
else()
set(CMAKE_CXX_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang++)
set(CMAKE_C_COMPILER ${LLVM_TOOLS_BINARY_DIR}/clang)
--
2.47.1.windows.2 |
Hello, @ScottTodd. I think we need Ninja support not only for MSVS but Linux/GNU, too. |
Looking at how some other ROCm projects are set up, overriding
It seems like HIPIFY builds just fine on my systems using MSVC though, so requiring a toolchain might be unneeded complexity. That being said, HIPIFY already requires clang anyways. |
Hi @ScottTodd,
It is not quite so. Anyway, what about |
Problem Description
Using the Ninja CMake generator (https://ninja-build.org/), HIPIFY fails to build with MSVC.
I'm following the instructions at https://github.com/ROCm/HIPIFY/blob/amd-staging/docs/building/building-hipify.rst, swapping
-G "Visual Studio 17 2022"
for-G Ninja
. I regularly use Ninja for other projects with MSVC on Windows, including LLVM, without issues (it's a much nicer experience than the Visual Studio generator IME).The build fails due to compilation commands passing MSVC flags to the
clang++
compiler after this code changes the value ofCMAKE_CXX_COMPILER
from (for example)C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.42.34433/bin/Hostx64/x64/cl.exe
toclang++
:HIPIFY/CMakeLists.txt
Lines 90 to 93 in f601f96
Sample error logs:
Full error logs: https://gist.github.com/ScottTodd/10cca27eba121216129b2111f2e316b1
Operating System
Windows 11 (10.0.22631)
CPU
AMD Ryzen Threadripper PRO 7975WX 32-Cores
ROCm Version
ROCm 6.3.1
ROCm Component
HIPIFY
Steps to Reproduce
Build clang from LLVM source:
Build HIPIFY:
See errors: https://gist.github.com/ScottTodd/10cca27eba121216129b2111f2e316b1
(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support
No response
Additional Information
Building using the Visual Studio generator does work successfully. Swap step 2 in my reproducer with
https://gist.github.com/ScottTodd/a29c712370fa7b83fd64931675be8965
Changing this code to keep the existing
CMAKE_CXX_COMPILER
fixes the build for me:HIPIFY/CMakeLists.txt
Lines 90 to 93 in f601f96
I'm not sure if there is something mandatory about using the compiler from
LLVM_TOOLS_BINARY_DIR
though. I would suspect that any build toolchain could be used, so long as the linking step against clang/LLVM libraries succeeds.We're starting to build many ROCm projects as part of https://github.com/nod-ai/TheRock. Other projects so far have been compatible with Ninja.
I see these solutions for TheRock:
The text was updated successfully, but these errors were encountered: