Skip to content
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

[fbgemm_gpu] Remove errant RPATHs from binaries #3163

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions .github/scripts/fbgemm_gpu_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ __print_library_infos () {

echo "[CHECK] Listing out external shared libraries linked:"
print_exec ldd "${library}"

echo "[CHECK] Displaying ELF information:"
print_exec readelf -d "${library}"
echo "################################################################################"
echo ""
echo ""
Expand Down
23 changes: 23 additions & 0 deletions .github/scripts/fbgemm_gpu_postbuild.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

echo "################################################################################"
echo "[CMAKE] Running post-build script ..."

# Print directory
pwd

# List all generated .SO files
find . -name '*.so'

# Remove errant RPATHs from the .SO
# https://github.com/pytorch/FBGEMM/issues/3098
# https://github.com/NixOS/patchelf/issues/453
find . -name '*.so' -print0 | xargs -0 patchelf --remove-rpath

echo "[CMAKE] Removed errant RPATHs"
echo "################################################################################"
1 change: 1 addition & 0 deletions .github/scripts/utils_build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ install_build_tools () {
ncurses \
ninja \
openblas \
patchelf \
scikit-build \
wheel) || return 1

Expand Down
6 changes: 6 additions & 0 deletions fbgemm_gpu/FbgemmGpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -725,3 +725,9 @@ install(FILES ${gen_python_source_files}

install(FILES ${gen_defused_optim_py_files}
DESTINATION fbgemm_gpu/split_embedding_optimizer_codegen)

add_custom_target(fbgemm_gpu_py_clean_rpath ALL
WORKING_DIRECTORY ${OUTPUT_DIR}
COMMAND bash ${FBGEMM}/.github/scripts/fbgemm_gpu_postbuild.bash)

add_dependencies(fbgemm_gpu_py_clean_rpath fbgemm_gpu_py)
7 changes: 7 additions & 0 deletions fbgemm_gpu/experimental/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,10 @@ install(TARGETS fbgemm_gpu_experimental_example_py

install(FILES ${experimental_example_python_source_files}
DESTINATION fbgemm_gpu/experimental/example)

add_custom_target(fbgemm_gpu_experimental_example_py_clean_rpath ALL
WORKING_DIRECTORY ${OUTPUT_DIR}
COMMAND bash ${FBGEMM}/.github/scripts/fbgemm_gpu_postbuild.bash)

add_dependencies(fbgemm_gpu_experimental_example_py_clean_rpath
fbgemm_gpu_experimental_example_py)
7 changes: 7 additions & 0 deletions fbgemm_gpu/experimental/gen_ai/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,10 @@ install(TARGETS fbgemm_gpu_experimental_gen_ai_py

install(FILES ${experimental_gen_ai_python_source_files}
DESTINATION fbgemm_gpu/experimental/gen_ai)

add_custom_target(fbgemm_gpu_experimental_gen_ai_py_clean_rpath ALL
WORKING_DIRECTORY ${OUTPUT_DIR}
COMMAND bash ${FBGEMM}/.github/scripts/fbgemm_gpu_postbuild.bash)

add_dependencies(fbgemm_gpu_experimental_gen_ai_py_clean_rpath
fbgemm_gpu_experimental_gen_ai_py)
1 change: 1 addition & 0 deletions fbgemm_gpu/fbgemm_gpu/permute_pooled_embedding_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from typing import List, Optional

import torch

from fbgemm_gpu.utils.loader import load_torch_module

try:
Expand Down
Loading