From 66412ebb28f84d9db943c0fbc4127e8924377773 Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Wed, 9 Oct 2024 02:11:58 -0500 Subject: [PATCH 01/10] Initial changes --- .ci/docker/build.sh | 2 ++ .ci/docker/common/install_base.sh | 2 +- .ci/docker/common/install_rocm.sh | 5 +++++ .ci/docker/common/install_user.sh | 7 +++++++ .ci/docker/requirements-ci.txt | 3 +++ 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.ci/docker/build.sh b/.ci/docker/build.sh index 6e94dc51d98d2..fddeb0d0f85bf 100755 --- a/.ci/docker/build.sh +++ b/.ci/docker/build.sh @@ -50,6 +50,8 @@ if [[ "$image" == *-focal* ]]; then UBUNTU_VERSION=20.04 elif [[ "$image" == *-jammy* ]]; then UBUNTU_VERSION=22.04 +elif [[ "$image" == *-noble* ]]; then + UBUNTU_VERSION=24.04 elif [[ "$image" == *ubuntu* ]]; then extract_version_from_image_name ubuntu UBUNTU_VERSION elif [[ "$image" == *centos* ]]; then diff --git a/.ci/docker/common/install_base.sh b/.ci/docker/common/install_base.sh index 3da6fa9e53df1..1fd2ff8d35cd4 100755 --- a/.ci/docker/common/install_base.sh +++ b/.ci/docker/common/install_base.sh @@ -12,7 +12,7 @@ install_ubuntu() { if [[ "$UBUNTU_VERSION" == "20.04"* ]]; then cmake3="cmake=3.16*" maybe_libiomp_dev="" - elif [[ "$UBUNTU_VERSION" == "22.04"* ]]; then + elif [[ "$UBUNTU_VERSION" == "22.04"* ]] || [[ "$UBUNTU_VERSION" == "24.04"* ]] ; then cmake3="cmake=3.22*" maybe_libiomp_dev="" else diff --git a/.ci/docker/common/install_rocm.sh b/.ci/docker/common/install_rocm.sh index 0f8d6e0df749d..db19079ad7c12 100644 --- a/.ci/docker/common/install_rocm.sh +++ b/.ci/docker/common/install_rocm.sh @@ -16,6 +16,11 @@ install_ubuntu() { # gpg-agent is not available by default on 20.04 apt-get install -y --no-install-recommends gpg-agent fi + if [[ $UBUNTU_VERSION == 24.04 ]]; then + apt-get install -y --no-install-recommends gpg-agent + echo -e 'Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600' \ + | sudo tee /etc/apt/preferences.d/rocm-pin-600 + fi apt-get install -y kmod apt-get install -y wget diff --git a/.ci/docker/common/install_user.sh b/.ci/docker/common/install_user.sh index 29d69edd3c43a..ab9eece2c63d8 100755 --- a/.ci/docker/common/install_user.sh +++ b/.ci/docker/common/install_user.sh @@ -2,6 +2,13 @@ set -ex +# Since version 24 the system ships with user 'ubuntu' that has id 1000 +# We need a work-around to enable id 1000 usage for this script +if [[ $UBUNTU_VERSION == 24.04 ]]; then + # touch is used to disable harmless error message + touch /var/mail/ubuntu && chown ubuntu /var/mail/ubuntu && userdel -r ubuntu +fi + # Mirror jenkins user in container # jenkins user as ec2-user should have the same user-id echo "jenkins:x:1000:1000::/var/lib/jenkins:" >> /etc/passwd diff --git a/.ci/docker/requirements-ci.txt b/.ci/docker/requirements-ci.txt index f65ab1e605a3a..a3b59fcda3038 100644 --- a/.ci/docker/requirements-ci.txt +++ b/.ci/docker/requirements-ci.txt @@ -22,6 +22,7 @@ sympy==1.12.1 #test that import: coremltools==5.0b5 ; python_version < "3.12" +coremltools==7.2 ; python_version == "3.12" #Description: Apple framework for ML integration #Pinned versions: 5.0b5 #test that import: @@ -64,6 +65,7 @@ lark==0.12.0 #test that import: librosa>=0.6.2 ; python_version < "3.11" +librosa==0.10.2 ; python_version == "3.12" #Description: A python package for music and audio analysis #Pinned versions: >=0.6.2 #test that import: test_spectral_ops.py @@ -112,6 +114,7 @@ networkx==2.8.8 numba==0.49.0 ; python_version < "3.9" numba==0.54.1 ; python_version == "3.9" numba==0.55.2 ; python_version == "3.10" +numba==0.60.0 ; python_version == "3.12" #Description: Just-In-Time Compiler for Numerical Functions #Pinned versions: 0.54.1, 0.49.0, <=0.49.1 #test that import: test_numba_integration.py From ec1b2302addd683c5e74260d212dfd204de27a21 Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Wed, 9 Oct 2024 02:25:31 -0500 Subject: [PATCH 02/10] Bump cmake version 3.28 --- .ci/docker/common/install_base.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/docker/common/install_base.sh b/.ci/docker/common/install_base.sh index 1fd2ff8d35cd4..856fef82987de 100755 --- a/.ci/docker/common/install_base.sh +++ b/.ci/docker/common/install_base.sh @@ -12,9 +12,12 @@ install_ubuntu() { if [[ "$UBUNTU_VERSION" == "20.04"* ]]; then cmake3="cmake=3.16*" maybe_libiomp_dev="" - elif [[ "$UBUNTU_VERSION" == "22.04"* ]] || [[ "$UBUNTU_VERSION" == "24.04"* ]] ; then + elif [[ "$UBUNTU_VERSION" == "22.04"* ]]; then cmake3="cmake=3.22*" maybe_libiomp_dev="" + elif [[ "$UBUNTU_VERSION" == "24.04"* ]]; then + cmake3="cmake=3.28*" + maybe_libiomp_dev="" else cmake3="cmake=3.5*" maybe_libiomp_dev="libiomp-dev" From a0126a233d26a4ed78b30dc206894108a12188ea Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Wed, 9 Oct 2024 21:42:49 -0500 Subject: [PATCH 03/10] Add hsa-runtime64 lib into torch_hip dependencies --- cmake/Dependencies.cmake | 2 +- cmake/public/LoadHIP.cmake | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index 677ab926e6868..d0a6fb81dc756 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -1081,7 +1081,7 @@ if(USE_ROCM) hip_include_directories(${Caffe2_HIP_INCLUDE}) set(Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS - ${PYTORCH_HIP_LIBRARIES} ${PYTORCH_MIOPEN_LIBRARIES} ${hipcub_LIBRARIES} ${ROCM_HIPRTC_LIB} ${ROCM_ROCTX_LIB}) + ${PYTORCH_HIP_LIBRARIES} ${PYTORCH_MIOPEN_LIBRARIES} ${hipcub_LIBRARIES} ${ROCM_HIPRTC_LIB} ${ROCM_ROCTX_LIB} ${ROCM_HSART_LIB}) list(APPEND Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS ${hipblaslt_LIBRARIES}) list(APPEND Caffe2_PUBLIC_HIP_DEPENDENCY_LIBS diff --git a/cmake/public/LoadHIP.cmake b/cmake/public/LoadHIP.cmake index bbe258b60cdfb..9f74f1db7da3b 100644 --- a/cmake/public/LoadHIP.cmake +++ b/cmake/public/LoadHIP.cmake @@ -186,6 +186,8 @@ if(HIP_FOUND) find_library(ROCM_HIPRTC_LIB hiprtc HINTS ${ROCM_PATH}/lib) # roctx is part of roctracer find_library(ROCM_ROCTX_LIB roctx64 HINTS ${ROCM_PATH}/lib) + # HSA runtime lib + find_library(ROCM_HSART_LIB hsa-runtime64 HINTS ${ROCM_PATH}/lib) # check whether HIP declares new types set(file "${PROJECT_BINARY_DIR}/hip_new_types.cc") From e8ec496541a93b9c06f9da61a2a3eadc703b0e81 Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Wed, 9 Oct 2024 23:08:49 -0500 Subject: [PATCH 04/10] Add HSAruntime dependency --- c10/hip/CMakeLists.txt | 2 +- caffe2/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/c10/hip/CMakeLists.txt b/c10/hip/CMakeLists.txt index a6442e01d2e2e..e1a8bbe9d66a8 100644 --- a/c10/hip/CMakeLists.txt +++ b/c10/hip/CMakeLists.txt @@ -50,7 +50,7 @@ if(NOT BUILD_LIBTORCHLESS) # ---[ Dependency of c10_hip target_link_libraries(c10_hip PUBLIC c10) - target_link_libraries(c10_hip PUBLIC ${PYTORCH_HIP_LIBRARIES}) + target_link_libraries(c10_hip PUBLIC ${PYTORCH_HIP_LIBRARIES} ${ROCM_HSART_LIB}) target_include_directories( c10_hip PUBLIC diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index 5115944b3894e..b0c4cb99d84ca 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -606,7 +606,7 @@ if(USE_ROCM) # caffe2_nvrtc's stubs to driver APIs are useful for HIP. # See NOTE [ ATen NVRTC Stub and HIP ] add_library(caffe2_nvrtc SHARED ${ATen_NVRTC_STUB_SRCS}) - target_link_libraries(caffe2_nvrtc ${PYTORCH_HIP_LIBRARIES} ${ROCM_HIPRTC_LIB}) + target_link_libraries(caffe2_nvrtc ${PYTORCH_HIP_LIBRARIES} ${ROCM_HIPRTC_LIB} ${ROCM_HSART_LIB}) target_include_directories(caffe2_nvrtc PRIVATE ${CMAKE_BINARY_DIR}) target_compile_definitions(caffe2_nvrtc PRIVATE USE_ROCM __HIP_PLATFORM_AMD__) install(TARGETS caffe2_nvrtc DESTINATION "${TORCH_INSTALL_LIB_DIR}") From 2b39e582b36a7a6b7dc4316207b6671be2f88934 Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Thu, 10 Oct 2024 14:19:49 -0500 Subject: [PATCH 05/10] Add HSAruntime to test binaries --- caffe2/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index b0c4cb99d84ca..c78e636b99cb2 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -1808,7 +1808,7 @@ if(BUILD_TEST) foreach(test_src ${Caffe2_HIP_TEST_SRCS}) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} "${test_src}") - target_link_libraries(${test_name} torch_library gtest_main) + target_link_libraries(${test_name} torch_library gtest_main ${ROCM_HSART_LIB}) target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE}) target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS}) From 943377a30e16272a6273ca416e565a3b6988d34c Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Sun, 13 Oct 2024 09:38:32 -0500 Subject: [PATCH 06/10] Add HSA dependency to torch_cpu --- caffe2/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/caffe2/CMakeLists.txt b/caffe2/CMakeLists.txt index c78e636b99cb2..f5db067fce2a0 100644 --- a/caffe2/CMakeLists.txt +++ b/caffe2/CMakeLists.txt @@ -1417,6 +1417,7 @@ target_link_libraries(torch_cpu PUBLIC c10) target_link_libraries(torch_cpu PUBLIC ${Caffe2_PUBLIC_DEPENDENCY_LIBS}) target_link_libraries(torch_cpu PRIVATE ${Caffe2_DEPENDENCY_LIBS}) target_link_libraries(torch_cpu PRIVATE ${Caffe2_DEPENDENCY_WHOLE_LINK_LIBS}) +target_link_libraries(torch_cpu PUBLIC ${ROCM_HSART_LIB}) if(USE_MPI) target_link_libraries(torch_cpu PRIVATE MPI::MPI_CXX) endif() @@ -1808,7 +1809,7 @@ if(BUILD_TEST) foreach(test_src ${Caffe2_HIP_TEST_SRCS}) get_filename_component(test_name ${test_src} NAME_WE) add_executable(${test_name} "${test_src}") - target_link_libraries(${test_name} torch_library gtest_main ${ROCM_HSART_LIB}) + target_link_libraries(${test_name} torch_library gtest_main) target_include_directories(${test_name} PRIVATE $) target_include_directories(${test_name} PRIVATE ${Caffe2_CPU_INCLUDE} ${Caffe2_HIP_INCLUDE}) target_compile_options(${test_name} PRIVATE ${HIP_CXX_FLAGS}) From df60210858f6cab50a5ee6491759f9eb202c7a8a Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Sun, 13 Oct 2024 11:03:39 -0500 Subject: [PATCH 07/10] HSA dependency to SHM manager --- torch/lib/libshm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/lib/libshm/CMakeLists.txt b/torch/lib/libshm/CMakeLists.txt index 8a7329ddab77f..83bd975551a23 100644 --- a/torch/lib/libshm/CMakeLists.txt +++ b/torch/lib/libshm/CMakeLists.txt @@ -22,7 +22,7 @@ set_target_properties(shm PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib" CXX_STANDARD 17) -target_link_libraries(shm PRIVATE ${TORCH_CPU_LIB}) +target_link_libraries(shm PRIVATE ${TORCH_CPU_LIB} ${ROCM_HSART_LIB}) if(UNIX AND NOT APPLE) include(CheckLibraryExists) From ebca0497722d8d25f7ef79d490cce5e8b5106254 Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Sun, 13 Oct 2024 13:38:04 -0500 Subject: [PATCH 08/10] install libstdcxx-ng 14 from conda forge --- .ci/docker/common/install_conda.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.ci/docker/common/install_conda.sh b/.ci/docker/common/install_conda.sh index 0d2267c0a9757..d1b50ec34eca6 100755 --- a/.ci/docker/common/install_conda.sh +++ b/.ci/docker/common/install_conda.sh @@ -123,6 +123,10 @@ fi conda_install_through_forge libstdcxx-ng=12 fi + if [ "$ANACONDA_PYTHON_VERSION" = "3.12" ] ; then + conda_install_through_forge libstdcxx-ng=14 + fi + # Install some other packages, including those needed for Python test reporting pip_install -r /opt/conda/requirements-ci.txt From 243f1f9e0b400a38c09d0a59b74adb1b77e99b3f Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Sun, 13 Oct 2024 15:01:27 -0500 Subject: [PATCH 09/10] Correct the shm dependencies --- torch/lib/libshm/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torch/lib/libshm/CMakeLists.txt b/torch/lib/libshm/CMakeLists.txt index 83bd975551a23..ad97b944be33b 100644 --- a/torch/lib/libshm/CMakeLists.txt +++ b/torch/lib/libshm/CMakeLists.txt @@ -22,7 +22,7 @@ set_target_properties(shm PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib" CXX_STANDARD 17) -target_link_libraries(shm PRIVATE ${TORCH_CPU_LIB} ${ROCM_HSART_LIB}) +target_link_libraries(shm PRIVATE ${TORCH_CPU_LIB}) if(UNIX AND NOT APPLE) include(CheckLibraryExists) @@ -64,7 +64,7 @@ if(BUILD_LIBTORCHLESS) target_link_libraries(torch_shm_manager PRIVATE shm ${C10_LIB}) else() # we need to link directly to c10 here otherwise we miss symbols - target_link_libraries(torch_shm_manager PRIVATE shm c10) + target_link_libraries(torch_shm_manager PRIVATE shm c10 ${ROCM_HSART_LIB}) endif() set_target_properties(torch_shm_manager PROPERTIES INSTALL_RPATH "${_rpath_portable_origin}/../lib") From d98825fd14f3521ce41bd25c63e6701d6c9c905e Mon Sep 17 00:00:00 2001 From: Pruthvi Madugundu Date: Tue, 22 Oct 2024 22:50:33 -0500 Subject: [PATCH 10/10] Update the condition to install conda libc++ng 14 package --- .ci/docker/common/install_conda.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/docker/common/install_conda.sh b/.ci/docker/common/install_conda.sh index d1b50ec34eca6..86ccd589bde62 100755 --- a/.ci/docker/common/install_conda.sh +++ b/.ci/docker/common/install_conda.sh @@ -123,7 +123,7 @@ fi conda_install_through_forge libstdcxx-ng=12 fi - if [ "$ANACONDA_PYTHON_VERSION" = "3.12" ] ; then + if [ "$ANACONDA_PYTHON_VERSION" = "3.12" ] || [ "$UBUNTU_VERSION" == "24.04"* ] ; then conda_install_through_forge libstdcxx-ng=14 fi