MIOpen icon indicating copy to clipboard operation
MIOpen copied to clipboard

Instructions: How to build in windows?

Open johnnynunez opened this issue 1 year ago • 9 comments

johnnynunez avatar Dec 13 '24 13:12 johnnynunez

Hi @johnnynunez , we have instructions to build MIOpen in Ubuntu as

  • Build from souce: https://rocm.docs.amd.com/projects/MIOpen/en/latest/install/install.html
  • Build using docker: https://rocm.docs.amd.com/projects/MIOpen/en/latest/install/docker-build.html. For windows build, you can refer to https://github.com/ROCm/MIOpen/discussions/2703 . Notice that you were in that discussion.

huanrwan-amd avatar Dec 13 '24 20:12 huanrwan-amd

Probably @apwojcik can provide some insights. At least he participated in windows CI stage setup.

CAHEK7 avatar Dec 17 '24 05:12 CAHEK7

New HIP SDK 6.2.0 is on windows: https://www.amd.com/en/developer/resources/rocm-hub/eula/licenses.html?filename=AMD-Software-PRO-Edition-24.Q4-Win10-Win11-For-HIP.exe

johnnynunez avatar Dec 17 '24 10:12 johnnynunez

Probably @apwojcik can provide some insights. At least he participated in windows CI stage setup.

Why is not include in hip sdk if it is compiling on github runners? I mean like amd comgr

As of ROCm version 6.1.2, the HIP SDK for Windows includes updated versions of the runtime components amdhip64 and amd_comgr. To use the latest capabilities of the HIP SDK, reference the new versions of these DLL binaries.

amdhip64_6.dll (formerly amdhip64.dll)

amd_comgr_2.dll (formerly amd_comgr.dll)
```

johnnynunez avatar Dec 17 '24 14:12 johnnynunez

PS C:\Users\Johnny\Documents\GitHub\MIOpen\build> cmake .. `
>>     -DMIOPEN_BACKEND=HIP `
>>     -DCMAKE_PREFIX_PATH="C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows" `
>>     -DCMAKE_CXX_FLAGS="--rocm-path='C:/Program Files/AMD/ROCm/6.2'" `
>>     -DROCM_PATH="C:\Program Files\AMD\ROCm\6.2" `
>>     -DCMAKE_LIBRARY_PATH="C:\Program Files\AMD\ROCm\6.2\lib" `
>>     -DCMAKE_PREFIX_PATH="C:\Program Files\AMD\ROCm\6.2" `
>>     -Dnlohmann_json_DIR="C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/share/nlohmann_json" `
>>     -G "Ninja" `
>>     -DMIOPEN_USE_MLIR=Off `
>>     -DMIOPEN_ENABLE_AI_KERNEL_TUNING=Off `
>>     -DMIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK=Off `
>>     -DHALF_INCLUDE_DIR="C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/include" `
>>     -DMIOPEN_USE_COMPOSABLEKERNEL=Off `
>>     -DCMAKE_MAKE_PROGRAM="C:/tools/ninja/ninja.exe" `
>>     -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang.exe" `
>>     -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" `
>>     -DBZIP2_INCLUDE_DIR="C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/include" `
>>     -DBZIP2_LIBRARIES="C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/lib/bz2.lib" `
>>     -DROCM_DIR="C:/Program Files/AMD/ROCm/6.2/cmake" `
>>     -DBUILD_TESTING=Off
CMake Deprecation Warning at /opt/rocm/share/rocm/cmake/ROCMConfig.cmake:12 (message):
  Use of find_package(ROCM) is deprecated as of ROCm 6.4.  Please use
  find_package(ROCmCMakeBuildTools)
Call Stack (most recent call first):
  CMakeLists.txt:83 (find_package)


-- MIOPEN_WORKAROUND_USE_BOOST_FILESYSTEM OFF
-- MIOPEN_OFFLINE_COMPILER_PATHS_V2: OFF
-- MIOPEN_BUILD_DRIVER: ON
-- Build with HIP 6.2.41512 C:/Program Files/AMD/ROCm/6.2/lib/cmake/hip
-- Enable Composable Kernels: Off
-- Hip compiler flags:  -x hip   -D__HIP_PLATFORM_AMD__=1  -DUSE_PROF_API=1 C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib --hip-link  C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib
-- OpenCL compiler: C:/Program Files/LLVM/bin/clang.exe
-- Build with rocblas 4.2.4 C:/Program Files/AMD/ROCm/6.2/lib/cmake/rocblas
-- Build without hipbBLASLt
-- HIP backend selected.
-- clang-offload-bundler found: C:/Program Files/LLVM/bin/clang-offload-bundler.exe
-- AMDGCN assembler: C:/Program Files/LLVM/bin/clang.exe
-- Build with amd_comgr
CMake Deprecation Warning at C:/Program Files/AMD/ROCm/6.2/lib/cmake/hiprtc/hiprtc-config.cmake:21 (cmake_minimum_required):
  Compatibility with CMake < 3.10 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
  to tell CMake that the project requires at least <min> but has been updated
  to work with policies introduced by <max> or earlier.
Call Stack (most recent call first):
  CMakeLists.txt:488 (find_package)


-- Build with hiprtc 6.2.41512 C:/Program Files/AMD/ROCm/6.2/lib/cmake/hiprtc
-- HALF_INCLUDE_DIR: C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/include
-- Build without rocTracer
-- Build with rocrand 3.1.1 C:/Program Files/AMD/ROCm/6.2/lib/cmake/rocrand
-- rocm-cmake: Set license file to C:/Users/Johnny/Documents/GitHub/MIOpen/LICENSE.txt.
-- Clang tidy found: 18.1.8
-- MIOpen_VERSION= 3.3.0
-- CMAKE_BUILD_TYPE= Release
-- Configuring done (3.8s)
-- Generating done (1.7s)
-- Build files have been written to: C:/Users/Johnny/Documents/GitHub/MIOpen/build
PS C:\Users\Johnny\Documents\GitHub\MIOpen\build> ninja
[0/2] Re-checking globbed directories...
[1/577] Building CXX object addkernels/CMakeFiles/addkernels.dir/addkernels.cpp.obj
FAILED: addkernels/CMakeFiles/addkernels.dir/addkernels.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DBOOST_ALL_NO_LIB=1 -DHIP_COMPILER_FLAGS=" -x hip   -D__HIP_PLATFORM_AMD__=1  -DUSE_PROF_API=1 C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib --hip-link  C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib " -DMIOPEN_BETA_API=1 -DMIOPEN_HACK_DO_NOT_INCLUDE_CONFIG_H=1 -DMIOPEN_WORKAROUND_USE_BOOST_FILESYSTEM=0 -IC:/Users/Johnny/Documents/GitHub/MIOpen/src/include --rocm-path='C:/Program Files/AMD/ROCm/6.2' -O3 -DNDEBUG -std=c++17 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt   -U__HCC__ -Wall -Wextra -Wcomment -Wendif-labels -Wformat -Winit-self -Wreturn-type -Wsequence-point -Wswitch -Wtrigraphs -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wno-ignored-qualifiers -Wno-sign-compare -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-conversion -Wno-double-promotion -Wno-exit-time-destructors -Wno-extra-semi -Wno-extra-semi-stmt -Wno-float-conversion -Wno-gnu-anonymous-struct -Wno-gnu-zero-variadic-macro-arguments -Wno-missing-prototypes -Wno-nested-anon-types -Wno-option-ignored -Wno-padded -Wno-return-std-move-in-c++11 -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-weak-vtables -Wno-covered-switch-default -Wno-unused-result -Wno-unsafe-buffer-usage -Wno-deprecated-declarations -Wno-shadow-uncaptured-local -Wno-global-constructors -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-ignored-attributes -Wno-deprecated -Wno-incompatible-pointer-types -Wno-old-style-cast -Wno-unknown-attributes -Wno-microsoft-cpp-macro -Wno-microsoft-enum-value -Wno-language-extension-token -Wno-c++11-narrowing -Wno-float-equal -Wno-redundant-parens -Wno-format-nonliteral -Wno-unused-template -Wno-comma -Wno-suggest-destructor-override -Wno-switch-enum -Wno-shift-sign-overflow -Wno-suggest-override -Wno-inconsistent-missing-destructor-override -Wno-cast-function-type -Wno-nonportable-system-include-path -Wno-documentation -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Wno-unused-value -Wno-unused-parameter -Wno-missing-noreturn -Wno-tautological-constant-out-of-range-compare -Wno-c++20-extensions -fdelayed-template-parsing -fms-extensions -fms-compatibility -MD -MT addkernels/CMakeFiles/addkernels.dir/addkernels.cpp.obj -MF addkernels\CMakeFiles\addkernels.dir\addkernels.cpp.obj.d -o addkernels/CMakeFiles/addkernels.dir/addkernels.cpp.obj -c C:/Users/Johnny/Documents/GitHub/MIOpen/addkernels/addkernels.cpp
clang++: error: no such file or directory: 'Files/AMD/ROCm/6.2''
[2/577] Building CXX object addkernels/CMakeFiles/addkernels.dir/include_inliner.cpp.obj
FAILED: addkernels/CMakeFiles/addkernels.dir/include_inliner.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DBOOST_ALL_NO_LIB=1 -DHIP_COMPILER_FLAGS=" -x hip   -D__HIP_PLATFORM_AMD__=1  -DUSE_PROF_API=1 C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib --hip-link  C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib " -DMIOPEN_BETA_API=1 -DMIOPEN_HACK_DO_NOT_INCLUDE_CONFIG_H=1 -DMIOPEN_WORKAROUND_USE_BOOST_FILESYSTEM=0 -IC:/Users/Johnny/Documents/GitHub/MIOpen/src/include --rocm-path='C:/Program Files/AMD/ROCm/6.2' -O3 -DNDEBUG -std=c++17 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt   -U__HCC__ -Wall -Wextra -Wcomment -Wendif-labels -Wformat -Winit-self -Wreturn-type -Wsequence-point -Wswitch -Wtrigraphs -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wno-ignored-qualifiers -Wno-sign-compare -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-conversion -Wno-double-promotion -Wno-exit-time-destructors -Wno-extra-semi -Wno-extra-semi-stmt -Wno-float-conversion -Wno-gnu-anonymous-struct -Wno-gnu-zero-variadic-macro-arguments -Wno-missing-prototypes -Wno-nested-anon-types -Wno-option-ignored -Wno-padded -Wno-return-std-move-in-c++11 -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-weak-vtables -Wno-covered-switch-default -Wno-unused-result -Wno-unsafe-buffer-usage -Wno-deprecated-declarations -Wno-shadow-uncaptured-local -Wno-global-constructors -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-ignored-attributes -Wno-deprecated -Wno-incompatible-pointer-types -Wno-old-style-cast -Wno-unknown-attributes -Wno-microsoft-cpp-macro -Wno-microsoft-enum-value -Wno-language-extension-token -Wno-c++11-narrowing -Wno-float-equal -Wno-redundant-parens -Wno-format-nonliteral -Wno-unused-template -Wno-comma -Wno-suggest-destructor-override -Wno-switch-enum -Wno-shift-sign-overflow -Wno-suggest-override -Wno-inconsistent-missing-destructor-override -Wno-cast-function-type -Wno-nonportable-system-include-path -Wno-documentation -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Wno-unused-value -Wno-unused-parameter -Wno-missing-noreturn -Wno-tautological-constant-out-of-range-compare -Wno-c++20-extensions -fdelayed-template-parsing -fms-extensions -fms-compatibility -MD -MT addkernels/CMakeFiles/addkernels.dir/include_inliner.cpp.obj -MF addkernels\CMakeFiles\addkernels.dir\include_inliner.cpp.obj.d -o addkernels/CMakeFiles/addkernels.dir/include_inliner.cpp.obj -c C:/Users/Johnny/Documents/GitHub/MIOpen/addkernels/include_inliner.cpp
clang++: error: no such file or directory: 'Files/AMD/ROCm/6.2''
[3/577] Building CXX object tools/sqlite2txt/CMakeFiles/sqlite2txt.dir/main.cpp.obj
FAILED: tools/sqlite2txt/CMakeFiles/sqlite2txt.dir/main.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DBOOST_ALL_NO_LIB=1 -DHIP_COMPILER_FLAGS=" -x hip   -D__HIP_PLATFORM_AMD__=1  -DUSE_PROF_API=1 C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib --hip-link  C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib " -DMIOPEN_BETA_API=1 -isystem C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/include --rocm-path='C:/Program Files/AMD/ROCm/6.2' -O3 -DNDEBUG -std=c++17 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt   -U__HCC__ -Wall -Wextra -Wcomment -Wendif-labels -Wformat -Winit-self -Wreturn-type -Wsequence-point -Wswitch -Wtrigraphs -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wno-ignored-qualifiers -Wno-sign-compare -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-conversion -Wno-double-promotion -Wno-exit-time-destructors -Wno-extra-semi -Wno-extra-semi-stmt -Wno-float-conversion -Wno-gnu-anonymous-struct -Wno-gnu-zero-variadic-macro-arguments -Wno-missing-prototypes -Wno-nested-anon-types -Wno-option-ignored -Wno-padded -Wno-return-std-move-in-c++11 -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-weak-vtables -Wno-covered-switch-default -Wno-unused-result -Wno-unsafe-buffer-usage -Wno-deprecated-declarations -Wno-shadow-uncaptured-local -Wno-global-constructors -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-ignored-attributes -Wno-deprecated -Wno-incompatible-pointer-types -Wno-old-style-cast -Wno-unknown-attributes -Wno-microsoft-cpp-macro -Wno-microsoft-enum-value -Wno-language-extension-token -Wno-c++11-narrowing -Wno-float-equal -Wno-redundant-parens -Wno-format-nonliteral -Wno-unused-template -Wno-comma -Wno-suggest-destructor-override -Wno-switch-enum -Wno-shift-sign-overflow -Wno-suggest-override -Wno-inconsistent-missing-destructor-override -Wno-cast-function-type -Wno-nonportable-system-include-path -Wno-documentation -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Wno-unused-value -Wno-unused-parameter -Wno-missing-noreturn -Wno-tautological-constant-out-of-range-compare -Wno-c++20-extensions -fdelayed-template-parsing -fms-extensions -fms-compatibility -MD -MT tools/sqlite2txt/CMakeFiles/sqlite2txt.dir/main.cpp.obj -MF tools\sqlite2txt\CMakeFiles\sqlite2txt.dir\main.cpp.obj.d -o tools/sqlite2txt/CMakeFiles/sqlite2txt.dir/main.cpp.obj -c C:/Users/Johnny/Documents/GitHub/MIOpen/tools/sqlite2txt/main.cpp
clang++: error: no such file or directory: 'Files/AMD/ROCm/6.2''
[4/577] Building CXX object src/sqlite/CMakeFiles/sqlite_memvfs.dir/memvfs.cpp.obj
FAILED: src/sqlite/CMakeFiles/sqlite_memvfs.dir/memvfs.cpp.obj
C:\PROGRA~1\LLVM\bin\CLANG_~1.EXE -DBOOST_ALL_NO_LIB=1 -DHIP_COMPILER_FLAGS=" -x hip   -D__HIP_PLATFORM_AMD__=1  -DUSE_PROF_API=1 C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib --hip-link  C:/Program Files/LLVM/lib/clang/18/lib/windows/clang_rt.builtins-x86_64.lib " -DMIOPEN_BETA_API=1 -isystem C:/Users/Johnny/Documents/GitHub/vcpkg/installed/x64-windows/include --rocm-path='C:/Program Files/AMD/ROCm/6.2' -O3 -DNDEBUG -std=c++17 -D_DLL -D_MT -Xclang --dependent-lib=msvcrt   -U__HCC__ -Wall -Wextra -Wcomment -Wendif-labels -Wformat -Winit-self -Wreturn-type -Wsequence-point -Wswitch -Wtrigraphs -Wundef -Wuninitialized -Wunreachable-code -Wunused -Wno-ignored-qualifiers -Wno-sign-compare -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-conversion -Wno-double-promotion -Wno-exit-time-destructors -Wno-extra-semi -Wno-extra-semi-stmt -Wno-float-conversion -Wno-gnu-anonymous-struct -Wno-gnu-zero-variadic-macro-arguments -Wno-missing-prototypes -Wno-nested-anon-types -Wno-option-ignored -Wno-padded -Wno-return-std-move-in-c++11 -Wno-shorten-64-to-32 -Wno-sign-conversion -Wno-unknown-warning-option -Wno-unused-command-line-argument -Wno-weak-vtables -Wno-covered-switch-default -Wno-unused-result -Wno-unsafe-buffer-usage -Wno-deprecated-declarations -Wno-shadow-uncaptured-local -Wno-global-constructors -Wno-reserved-identifier -Wno-zero-as-null-pointer-constant -Wno-ignored-attributes -Wno-deprecated -Wno-incompatible-pointer-types -Wno-old-style-cast -Wno-unknown-attributes -Wno-microsoft-cpp-macro -Wno-microsoft-enum-value -Wno-language-extension-token -Wno-c++11-narrowing -Wno-float-equal -Wno-redundant-parens -Wno-format-nonliteral -Wno-unused-template -Wno-comma -Wno-suggest-destructor-override -Wno-switch-enum -Wno-shift-sign-overflow -Wno-suggest-override -Wno-inconsistent-missing-destructor-override -Wno-cast-function-type -Wno-nonportable-system-include-path -Wno-documentation -Wno-deprecated-builtins -Wno-enum-constexpr-conversion -Wno-unused-value -Wno-unused-parameter -Wno-missing-noreturn -Wno-tautological-constant-out-of-range-compare -Wno-c++20-extensions -fdelayed-template-parsing -fms-extensions -fms-compatibility -Wno-everything -MD -MT src/sqlite/CMakeFiles/sqlite_memvfs.dir/memvfs.cpp.obj -MF src\sqlite\CMakeFiles\sqlite_memvfs.dir\memvfs.cpp.obj.d -o src/sqlite/CMakeFiles/sqlite_memvfs.dir/memvfs.cpp.obj -c C:/Users/Johnny/Documents/GitHub/MIOpen/src/sqlite/memvfs.cpp
clang++: error: no such file or directory: 'Files/AMD/ROCm/6.2''
ninja: build stopped: subcommand failed.
PS C:\Users\Johnny\Documents\GitHub\MIOpen\build>

johnnynunez avatar Dec 17 '24 16:12 johnnynunez

Probably @apwojcik can provide some insights. At least he participated in windows CI stage setup.

Why is not include in hip sdk if it is compiling on github runners? I mean like amd comgr

As of ROCm version 6.1.2, the HIP SDK for Windows includes updated versions of the runtime components amdhip64 and amd_comgr. To use the latest capabilities of the HIP SDK, reference the new versions of these DLL binaries.

amdhip64_6.dll (formerly amdhip64.dll)

amd_comgr_2.dll (formerly amd_comgr.dll)

I guess because it is

  1. not compiled but github runners, at least for windows. But there are internal CI runs for some other non-related-to-miopen projects
  2. not a mandatory part of ROCm framework (while comgr is, it's kind of essential part of one of the runtime compilation schemes)

Also that's funny that some part of the build system can't handle spaces in the paths.

CAHEK7 avatar Dec 24 '24 04:12 CAHEK7

I guess because it is

  1. not compiled but github runners, at least for windows. But there are internal CI runs for some other non-related-to-miopen projects
  2. not a mandatory part of ROCm framework (while comgr is, it's kind of essential part of one of the runtime compilation schemes)

Also that's funny that some part of the build system can't handle spaces in the paths.

Well, we have to wait for rocm 7.0 that is unified stack

johnnynunez avatar Dec 24 '24 18:12 johnnynunez

it is possible, but the procedure is quite involved. I'll try to get some kind of clean script for this set up. you are going to need access to some cmake files and header files from a linux install of rocm, as well as a grab bag of fixes and dev packages for all kinds of libraries

edit: had fun this weekend setting this up, stay tuned, I'll probably provide the Dockerfile and build script later today. You can prepare by setting up a Docker Windows containers environment, which I decided to use since it is the cleanest way to build this without cluttering your host system with stuff you're never using otherwise.

justinkb avatar Jan 10 '25 08:01 justinkb

Please see my instructions here https://github.com/justinkb/MIOpen-Build-Win

justinkb avatar Jan 13 '25 16:01 justinkb

@johnnynunez. Hope you were able to successfully build MIOpen for Windows. Closing ticket.

ppanchad-amd avatar Apr 29 '25 17:04 ppanchad-amd