Overview
We're aiming to support as much of the toolkit as possible on Windows.
- Our build target is "native" Windows (not WSL 1 or WSL 2), compiling using standard build tools (e.g. MSVC).
- We should support local builds, have regular CI builds (GitHub Actions), and eventually be able to distribute artifacts.
- We should also have any appropriate documentation, developer guides, etc. needed.
Current status
Initial experiments 2025-01-30
Expand to see details
Setup notes
- I'm on Windows 11 version 23H2, OS build 22631.4751
- I enabled Windows developer mode and granted my user account the ability to create symlinks
- I created a Dev Drive by following https://learn.microsoft.com/en-us/windows/dev-drive/ (500GB, shared with other projects)
- I installed standard software development tools and configured developer options:
Fetching sources
After cloning TheRock, I tried to checkout sources using python ./build_tools/fetch_sources.py. That needed the repo tool (https://gerrit.googlesource.com/git-repo/+/HEAD/README.md, docs at https://source.android.com/docs/setup/reference/repo), which is not distributed on Windows, so I downloaded the script manually. I did then have to edit build_tools/fetch_sources.py to exec python D:/path/to/repo instead of just repo. We can teach that script how to download the file on its own and run it in a portable way.
Configure and build
After fetching sources, I tried configuring and building with CMake (under VSCode):
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DTHEROCK_ENABLE_RCCL=OFF -DTHEROCK_ENABLE_MATH_LIBS=OFF -DTHEROCK_ENABLE_ML_FRAMEWORKS=OFF -DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu -UTHEROCK_AMDGPU_TARGETS -UTHEROCK_AMDGPU_DIST_BUNDLE_NAME -DLLVM_BUILD_LLVM_DYLIB=OFF --no-warn-unused-cli -SD:/projects/TheRock -Bd:/projects/TheRock/build -G Ninja
I found a few Windows issues specific to TheRock:
Next, I'm finding issues in the subprojects that TheRock includes. Sample logs: https://gist.github.com/ScottTodd/0a6625c4502169c5d54535bf122fc7fd. I'm not sure how deep these issues go, and if some of them are fixed on development branches. Here are a few I've found so far:
Overview
We're aiming to support as much of the toolkit as possible on Windows.
Current status
build_windows_packages.ymlworkflow runs as part ofci.ymlon every commit. The workflow builds some supported subprojects and publishes all built artifacts to S3.release_windows_packages.ymlworkflow runs nightly and publishes tarballs, rocm python packages, and torch packages to nightly releases.Initial experiments 2025-01-30
Expand to see details
Setup notes
git from https://git-scm.com/downloads (latest version
2.45.1) then enabled symlinks withBuild Tools for Visual Studio 2022 from https://visualstudio.microsoft.com/downloads/ (latest version
17.12.4)CMake from https://cmake.org/download/ (latest, version
3.31.5)Ninja as a CMake generator from https://ninja-build.org/ (latest, version
1.12.1)ccache from https://ccache.dev/ (latest, version
4.10.2)Fetching sources
After cloning TheRock, I tried to checkout sources using
python ./build_tools/fetch_sources.py. That needed the repo tool (https://gerrit.googlesource.com/git-repo/+/HEAD/README.md, docs at https://source.android.com/docs/setup/reference/repo), which is not distributed on Windows, so I downloaded the script manually. I did then have to editbuild_tools/fetch_sources.pyto execpython D:/path/to/repoinstead of justrepo. We can teach that script how to download the file on its own and run it in a portable way.Configure and build
After fetching sources, I tried configuring and building with CMake (under VSCode):
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DTHEROCK_ENABLE_RCCL=OFF -DTHEROCK_ENABLE_MATH_LIBS=OFF -DTHEROCK_ENABLE_ML_FRAMEWORKS=OFF -DTHEROCK_AMDGPU_FAMILIES=gfx110X-dgpu -UTHEROCK_AMDGPU_TARGETS -UTHEROCK_AMDGPU_DIST_BUNDLE_NAME -DLLVM_BUILD_LLVM_DYLIB=OFF --no-warn-unused-cli -SD:/projects/TheRock -Bd:/projects/TheRock/build -G NinjaI found a few Windows issues specific to TheRock:
Next, I'm finding issues in the subprojects that TheRock includes. Sample logs: https://gist.github.com/ScottTodd/0a6625c4502169c5d54535bf122fc7fd. I'm not sure how deep these issues go, and if some of them are fixed on development branches. Here are a few I've found so far:
rocm-core
__attribute__is not portable to all compilers (specifically MSVC) in https://github.com/ROCm/rocm-core/blob/master/rocm_version.h.in, do something likeNeed a similar fix for
__attribute__((nonnull)), maybe_Ret_nonnull(https://stackoverflow.com/a/78737973)rocm-core
link.handdlfcn.hheaders are Unix-only in https://github.com/ROCm/rocm-core/blob/master/rocm_getpath.cpp (use something likeLoadLibraryA()on a.dllinstead ofdlopen()on a.so). The headers should also only be included ifBUILD_SHARED_LIBSis defined (see next bullet)-DBUILD_SHARED_LIBS=OFFhere helps a bit: https://github.com/nod-ai/TheRock/blob/96ebf46b5ca62add1307d9f03db6d04f31207ff0/base/CMakeLists.txt#L22rocm-core in the same file uses
PATH_MAXwhich is nonstandard. There is aFILENAME_MAXthat is standard but https://stackoverflow.com/a/65174437 says it is not to be trusted for memory allocation. Could do something likemin(FILENAME_MAX, 4096)(choosing some sensible value that is notINT_MAX)llvm warns about
Generating libLLVM is not supported on MSVCin https://github.com/ROCm/llvm-project/blob/amd-staging/llvm/tools/llvm-shlib/CMakeLists.txt so I set-DLLVM_BUILD_LLVM_DYLIB=OFFin my CMake configure command. Not sure if that was load bearing for anything else yet. Could auto-detect and flip that off by default in TheRock or one of the subprojects that includes it.rocm_smi_lib sets
CMAKE_CXX_FLAGSthat assume gcc/clang: https://github.com/ROCm/rocm_smi_lib/blob/e5c5a1d5b7cba41ab801a987fb6c466503411804/CMakeLists.txt#L79-L85. It seems like https://github.com/ROCm/amdsmi is the successor to rocm_smi, but it has the same issue: https://github.com/ROCm/amdsmi/blob/9872083b491c9b136496fd493414aca5c6c144cb/CMakeLists.txt#L99-L104. Both projects also only claim to support Linux.