Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmake/PostBuildSteps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ if(WIN32 AND BUILD_PYTHON)
endif()
endif()

# MSVC OpenMP (libomp140) - TheRock copies this into torch/lib/ before the
# wheel build when using MSVC OpenMP instead of MKL libiomp.
set(_libomp140 "${TORCH_SRC_DIR}/lib/libomp140.x86_64.dll")
if(EXISTS "${_libomp140}")
install(FILES "${_libomp140}" DESTINATION "${TORCH_INSTALL_LIB_DIR}")
endif()
Comment on lines +70 to +75

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to #191625, we could consider a USE_ROCM help here to limit when others building pytorch would trigger this code path. Looking at how libiomp5md.dll is used above though, I think not adding a USE_ROCM check is probably fine?

Note that I'm not thrilled about using OpenMP from MSVC in our downstream build scripts, see the comments at https://github.com/ROCm/TheRock/blob/6b2138632e722857796e4b662c64eec7ae21a3ce/external-builds/pytorch/build_prod_wheels.py#L905-L940

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed — I left it without a USE_ROCM guard to match the libiomp5md.dll block above. The EXISTS "${TORCH_SRC_DIR}/lib/libomp140.x86_64.dll" check already scopes this to builds that actually staged that DLL (i.e. TheRock's MSVC-OpenMP path), so non-ROCm builds won't be affected. Point taken on the broader MSVC-OpenMP concern in the TheRock build scripts; I'll follow up on that separately on the TheRock side rather than in this wheel-packaging fix.


# libuv (uv.dll) - required by torch distributed (gloo transport).
# libuv_DLL_PATH is an optional CI hint (forwarded via EnvVarForwarding.cmake);
# fall back to libuv_ROOT/bin/uv.dll which Windows CI sets.
Expand Down