Skip to content

Comments

CMake: Use HIPIFY_OUTPUT_DIR when installing ROCm headers#491

Open
daissi wants to merge 1 commit intopytorch:mainfrom
daissi:wip/daissi/fix-hip-headers-install
Open

CMake: Use HIPIFY_OUTPUT_DIR when installing ROCm headers#491
daissi wants to merge 1 commit intopytorch:mainfrom
daissi:wip/daissi/fix-hip-headers-install

Conversation

@daissi
Copy link

@daissi daissi commented Feb 16, 2026

When USE_ROCM is enabled, the install path for HIP headers was derived by replacing CMAKE_CURRENT_SOURCE_DIR in the header directory path.

However, HIPified headers are generated into HIPIFY_OUTPUT_DIR, not CMAKE_CURRENT_SOURCE_DIR. As a result, the computed install path is incorrect.

This change replaces CMAKE_CURRENT_SOURCE_DIR with HIPIFY_OUTPUT_DIR when rewriting header paths, ensuring ROCm headers are installed into the correct include/gloo/... location.

This fixes incorrect include directory layout when building with ROCm.

This patch is applied for the Debian packaging otherwise headers are installed in the wrong location.

When USE_ROCM is enabled, the install path for HIP headers was derived
by replacing CMAKE_CURRENT_SOURCE_DIR in the header directory path.

However, HIPified headers are generated into HIPIFY_OUTPUT_DIR, not
CMAKE_CURRENT_SOURCE_DIR. As a result, the computed install path is
incorrect.

This change replaces CMAKE_CURRENT_SOURCE_DIR with
HIPIFY_OUTPUT_DIR when rewriting header paths, ensuring ROCm headers
are installed into the correct include/gloo/... location.

This fixes incorrect include directory layout when building with ROCm.

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
@meta-cla
Copy link

meta-cla bot commented Feb 16, 2026

Hi @daissi!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@daissi
Copy link
Author

daissi commented Feb 16, 2026

cc @GZGavinZhao @d4l3k

@meta-cla meta-cla bot added the CLA Signed label Feb 17, 2026
Copy link
Contributor

@GZGavinZhao GZGavinZhao left a comment

Choose a reason for hiding this comment

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

The change is reasonable to me. I'm curious though how the official ROCm PyTorch distribution was able to build/compile with the previous code. I assume it's because the official ROCm wheels have been built with gloo as a submodule so it doesn't have this problem...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants