diff --git a/third_party/tsl/third_party/gpus/crosstool/BUILD.rocm.tpl b/third_party/tsl/third_party/gpus/crosstool/BUILD.rocm.tpl index a742cfcd208ec1..67fa8f69a008e7 100644 --- a/third_party/tsl/third_party/gpus/crosstool/BUILD.rocm.tpl +++ b/third_party/tsl/third_party/gpus/crosstool/BUILD.rocm.tpl @@ -112,7 +112,7 @@ filegroup( ) filegroup( - name = "crosstool_wrapper_driver_is_not_gcc", - srcs = ["clang/bin/crosstool_wrapper_driver_is_not_gcc"], + name = "crosstool_wrapper_driver_is_not_gcc", + srcs = [":clang/bin/crosstool_wrapper_driver_is_not_gcc"], + data = ["@local_config_rocm//rocm:all_files"], ) - diff --git a/third_party/tsl/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl b/third_party/tsl/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl index d1d44f9fdb2ce4..602b165113ece5 100755 --- a/third_party/tsl/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl +++ b/third_party/tsl/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl @@ -182,6 +182,7 @@ def InvokeHipcc(argv, log=False): hipccopts += defines hipccopts += std_options hipccopts += m_options + hipccopts += ' --rocm-path="%{rocm_path}" ' if depfiles: # Generate the dependency file diff --git a/third_party/tsl/third_party/gpus/rocm/BUILD.tpl b/third_party/tsl/third_party/gpus/rocm/BUILD.tpl index aa3688e335df37..944beca922953f 100644 --- a/third_party/tsl/third_party/gpus/rocm/BUILD.tpl +++ b/third_party/tsl/third_party/gpus/rocm/BUILD.tpl @@ -1,4 +1,5 @@ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") +load("@local_config_rocm//rocm:build_defs.bzl", "rocm_version_number", "select_threshold") licenses(["restricted"]) # MPL2, portions GPL v3, LGPL v3, BSD-like @@ -12,109 +13,181 @@ config_setting( ) cc_library( - name = "rocm_headers", + name = "rocm_config", hdrs = [ - "rocm/rocm_config.h", - %{rocm_headers} + "rocm_config/rocm_config.h", ], + include_prefix = "rocm", + strip_include_prefix = "rocm_config", + visibility = ["//visibility:public"], +) + +cc_library( + name = "rocm_headers", + hdrs = glob([ + "%{rocm_root}/include/**", + "%{rocm_root}/lib/llvm/lib/**/*.h", + ]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include", + "%{rocm_root}/include/rocrand", + "%{rocm_root}/include/roctracer", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], +) + +cc_library( + name = "rocm", + visibility = ["//visibility:public"], + deps = [ + ":hip", + ":hipblas", + ":hipblaslt", + ":hiprand", + ":hipsolver", + ":hipsparse", + ":hsa-rocr", + ":miopen", + ":rocblas", + ":rocm_config", + ":rocsolver", + ":roctracer", + ] + select_threshold( + above_or_eq = [":hipfft"], + below = [":rocfft"], + threshold = 40100, + value = rocm_version_number(), + ), +) + +cc_library( + name = "hsa-rocr", + hdrs = glob(["%{rocm_root}/include/hsa/**"]), + data = glob(["%{rocm_root}/lib/libhsa-runtime*.so*"]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", - "rocm/include/rocrand", - "rocm/include/roctracer", + "%{rocm_root}/include", ], + linkstatic = 1, + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "hip", - srcs = ["rocm/lib/%{hip_lib}"], - data = ["rocm/lib/%{hip_lib}"], + srcs = glob(["%{rocm_root}/lib/libamdhip*.so*"]), + hdrs = glob(["%{rocm_root}/include/hip/**"]), + data = glob(["%{rocm_root}/lib/hip/**"]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", + "%{rocm_root}/include", ], linkstatic = 1, + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "rocblas", - srcs = ["rocm/lib/%{rocblas_lib}"], - data = ["rocm/lib/%{rocblas_lib}"], + hdrs = glob(["%{rocm_root}/include/rocblas/**"]), + # workaround to bring tensile files to the same fs layout as expected in the lib + # rocblas assumes that tensile files are located in ../roblas/libraries directory + copts = ["-rpath local_config_rocm/rocm/rocm_dis/lib"], + data = glob([ + "%{rocm_root}/lib/librocblas*.so*", + "%{rocm_root}/lib/rocblas/**", + ]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", + "%{rocm_root}/include", ], - linkstatic = 1, + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( - name = "%{hipfft_or_rocfft}", - srcs = ["rocm/lib/%{hipfft_or_rocfft_lib}"], - data = ["rocm/lib/%{hipfft_or_rocfft_lib}"], + name = "rocfft", + srcs = glob(["%{rocm_root}/lib/librocfft*.so*"]), + data = glob(["%{rocm_root}/lib/librocfft*.so*"]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", + "%{rocm_root}/include", ], linkstatic = 1, - visibility = ["//visibility:public"], + deps = [":rocm_config"], +) + +cc_library( + name = "hipfft", + srcs = glob(["%{rocm_root}/lib/libhipfft*.so*"]), + data = glob(["%{rocm_root}/lib/libhipfft*.so*"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include", + ], + linkstatic = 1, + deps = [":rocm_config"], ) cc_library( name = "hiprand", - srcs = ["rocm/lib/%{hiprand_lib}"], - data = ["rocm/lib/%{hiprand_lib}"], + srcs = glob(["%{rocm_root}/lib/libhiprand*.so*"]), + hdrs = glob(["%{rocm_root}/include/hiprand/**"]), + data = glob(["%{rocm_root}/lib/libhiprand*.so*"]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", - "rocm/include/rocrand", + "%{rocm_root}/include", + "%{rocm_root}/include/rocrand", ], linkstatic = 1, + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "miopen", - srcs = ["rocm/lib/%{miopen_lib}"], - data = ["rocm/lib/%{miopen_lib}"], + hdrs = glob(["%{rocm_root}/include/rccl/**"]), + # workaround to bring miopen db files to the same fs layout as expected in the lib + # rocblas assumes that miopen db files are located in ../share/miopen/db directory + copts = ["-rpath local_config_rocm/rocm/rocm_dis/lib"], + data = glob([ + "%{rocm_root}/lib/libMIOpen*.so*", + "%{rocm_root}/share/miopen/**", + ]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", + "%{rocm_root}/include", ], - linkstatic = 1, + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "rccl", - srcs = ["rocm/lib/%{rccl_lib}"], - data = ["rocm/lib/%{rccl_lib}"], + srcs = glob(["%{rocm_root}/lib/librccl*.so*"]), + hdrs = glob(["%{rocm_root}/include/rccl/**"]), + data = glob(["%{rocm_root}/lib/librccl*.so*"]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include", + "%{rocm_root}/include", ], linkstatic = 1, + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], + deps = [":rocm_config"], ) -cc_library( - name = "rocm", +filegroup( + name = "rocm_bin", + srcs = glob(["%{rocm_root}/bin/**/*"]), visibility = ["//visibility:public"], - deps = [ - ":rocm_headers", - ":hip", - ":rocblas", - ":hipblas", - ":%{hipfft_or_rocfft}", - ":hiprand", - ":miopen", - ":hipsparse", - ":roctracer", - ":rocsolver", - ":hipsolver", - ], ) bzl_library( @@ -125,58 +198,135 @@ bzl_library( cc_library( name = "rocprim", srcs = [ - "rocm/include/hipcub/hipcub_version.hpp", - "rocm/include/rocprim/rocprim_version.hpp", + "%{rocm_root}/include/hipcub/hipcub_version.hpp", + "%{rocm_root}/include/rocprim/rocprim_version.hpp", ], hdrs = glob([ - "rocm/include/hipcub/**", - "rocm/include/rocprim/**", + "%{rocm_root}/include/hipcub/**", + "%{rocm_root}/include/rocprim/**", ]), + include_prefix = "rocm", includes = [ - ".", - "rocm/include/hipcub", - "rocm/include/rocprim", + "%{rocm_root}/include/hipcub", + "%{rocm_root}/include/rocprim", ], + strip_include_prefix = "%{rocm_root}", visibility = ["//visibility:public"], deps = [ - "@local_config_rocm//rocm:rocm_headers", + ":rocm_config", + ":rocm_headers", ], ) cc_library( name = "hipsparse", - srcs = ["rocm/lib/%{hipsparse_lib}"], - data = ["rocm/lib/%{hipsparse_lib}"], + srcs = glob(["%{rocm_root}/lib/libhipsparse*.so*"]), + hdrs = glob(["%{rocm_root}/include/hipsparse/**"]), + data = glob(["%{rocm_root}/lib/libhipsparse*.so*"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "roctracer", - data = ["rocm/lib/%{roctracer_lib}"], + hdrs = glob(["%{rocm_root}/include/roctracer/**"]), + data = glob(["%{rocm_root}/lib/libroctracer*.so*"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "rocsolver", - srcs = ["rocm/lib/%{rocsolver_lib}"], - data = ["rocm/lib/%{rocsolver_lib}"], + srcs = glob(["%{rocm_root}/lib/librocsolver*.so*"]), + hdrs = glob(["%{rocm_root}/include/rocsolver/**"]), + data = glob(["%{rocm_root}/lib/librocsolver*.so*"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "hipsolver", - srcs = ["rocm/lib/%{hipsolver_lib}"], - data = ["rocm/lib/%{hipsolver_lib}"], + srcs = glob(["%{rocm_root}/lib/libhipsolver*.so*"]), + hdrs = glob(["%{rocm_root}/include/hipsolver/**"]), + data = glob(["%{rocm_root}/lib/libhipsolver*.so*"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], ) cc_library( name = "hipblas", - srcs = ["rocm/lib/%{hipblas_lib}"], - data = ["rocm/lib/%{hipblas_lib}"], + srcs = glob(["%{rocm_root}/lib/libhipblas.so*"]), + hdrs = glob(["%{rocm_root}/include/hipblas/**"]), + data = glob(["%{rocm_root}/lib/libhipblas.so*"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], +) + +cc_library( + name = "hipblaslt", + hdrs = glob(["%{rocm_root}/include/hipblaslt/**"]), + # workaround to bring tensile files to the same fs layout as expected in the lib + # hibplatslt assumes that tensile files are located in ../hipblaslt/libraries directory + copts = ["-rpath local_config_rocm/rocm/rocm_dis/lib"], + data = glob([ + "%{rocm_root}/lib/hipblaslt/**", + "%{rocm_root}/lib/libhipblaslt.so*", + ]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], +) + +cc_library( + name = "rocrand", + srcs = glob(["%{rocm_root}/lib/librocrand*.so*"]), + hdrs = glob(["%{rocm_root}/include/rocrand/**"]), + include_prefix = "rocm", + includes = [ + "%{rocm_root}/include/", + ], + strip_include_prefix = "%{rocm_root}", + visibility = ["//visibility:public"], + deps = [":rocm_config"], ) filegroup( name = "rocm_root", srcs = [ - "rocm/bin/clang-offload-bundler", + "%{rocm_root}/bin/clang-offload-bundler", ], ) -%{copy_rules} +filegroup( + name = "all_files", + srcs = glob(["%{rocm_root}/**"]), +) diff --git a/third_party/tsl/third_party/gpus/rocm/build_defs.bzl.tpl b/third_party/tsl/third_party/gpus/rocm/build_defs.bzl.tpl index 231a8a1913e7a9..dfc5d36de51552 100644 --- a/third_party/tsl/third_party/gpus/rocm/build_defs.bzl.tpl +++ b/third_party/tsl/third_party/gpus/rocm/build_defs.bzl.tpl @@ -11,6 +11,8 @@ def if_rocm(if_true, if_false = []): "//conditions:default": if_false }) +def select_threshold(value, above_or_eq, threshold, below): + return below if value < threshold else above_or_eq def rocm_default_copts(): """Default options for all ROCm compilations.""" diff --git a/third_party/tsl/third_party/gpus/rocm/rocm_redist.bzl b/third_party/tsl/third_party/gpus/rocm/rocm_redist.bzl new file mode 100644 index 00000000000000..c1cc501e1a2ded --- /dev/null +++ b/third_party/tsl/third_party/gpus/rocm/rocm_redist.bzl @@ -0,0 +1,18 @@ +load( + "@tsl//third_party/gpus/rocm:rocm_redist_ubuntu_20_04.bzl", + "rocm_redist_ubuntu_20_04", +) +load( + "@tsl//third_party/gpus/rocm:rocm_redist_ubuntu_22_04.bzl", + "rocm_redist_ubuntu_22_04", +) +load( + "@tsl//third_party/gpus/rocm:rocm_redist_ubuntu_24_04.bzl", + "rocm_redist_ubuntu_24_04", +) + +rocm_redist = { + "ubuntu_20.04": rocm_redist_ubuntu_20_04, + "ubuntu_22.04": rocm_redist_ubuntu_22_04, + "ubuntu_24.04": rocm_redist_ubuntu_24_04, +} diff --git a/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_20_04.bzl b/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_20_04.bzl new file mode 100644 index 00000000000000..9bc47bcbd4ecfe --- /dev/null +++ b/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_20_04.bzl @@ -0,0 +1,155 @@ +rocm_redist_ubuntu_20_04 = { + "6.2.0": { + "archives": [ + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-runtime-amd6.2.0/hip-runtime-amd6.2.0_6.2.41133.60200-66~20.04_amd64.deb", + sha256 = "215fae8759742bc048699feaacd6256a3ac2138771b69731dab7779325bb1b41", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-dev6.2.0/hip-dev6.2.0_6.2.41133.60200-66~20.04_amd64.deb", + sha256 = "e901d66275b3b520ee73250caa4a1836be142823083528b4db6cc31a18bfb94d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblas6.2.0/hipblas6.2.0_2.2.0.60200-66~20.04_amd64.deb", + sha256 = "f8a20128b5c26198bd9ecec894f8a4c74fa28ee668e4ef1bf73d0c3edff8c144", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblas-dev6.2.0/hipblas-dev6.2.0_2.2.0.60200-66~20.04_amd64.deb", + sha256 = "ab3ee54b33eba013fbf3d9aefe64b54e1918b9fb72790ca0b57fb391cb662cf0", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblaslt6.2.0/hipblaslt6.2.0_0.8.0.60200-66~20.04_amd64.deb", + sha256 = "a9fb63b30c3383b37479253c59c85493b75646037e016f68b136d12c5e6a4adb", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblaslt-dev6.2.0/hipblaslt-dev6.2.0_0.8.0.60200-66~20.04_amd64.deb", + sha256 = "5e2ca28ea10ff16eb75bde5c69aef6dbe3566d8fc49c3d2ace0ae7a777c1ffae", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipcc6.2.0/hipcc6.2.0_1.1.1.60200-66~20.04_amd64.deb", + sha256 = "a68123c046b8c913705262014463a8a30768167a1b68a78d8455deaf85a802d7", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipcub-dev6.2.0/hipcub-dev6.2.0_3.2.0.60200-66~20.04_amd64.deb", + sha256 = "c71fab59f62ad9d4b60aa4217f4db42c6996d83d5ad7ba29e127cc13bda59afc", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipfft6.2.0/hipfft6.2.0_1.0.14.60200-66~20.04_amd64.deb", + sha256 = "25887526ea2e955d4c0afa4749f8db55a49e399a349d43ccf66e0ad99ff78b2a", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipfft-dev6.2.0/hipfft-dev6.2.0_1.0.14.60200-66~20.04_amd64.deb", + sha256 = "3cfec840c79c6bce4e83bf6e056e241cc13ff572352b040a952c7642b61d45aa", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsolver6.2.0/hipsolver6.2.0_2.2.0.60200-66~20.04_amd64.deb", + sha256 = "cb56dd79ff52eaddfed379831023484d9ec32b9538bc3d02ee34c328457cd20e", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsolver-dev6.2.0/hipsolver-dev6.2.0_2.2.0.60200-66~20.04_amd64.deb", + sha256 = "1e968f9405c8b90fbb58dff09d8bab08cf31c8386880fff95e1cb8932320bc37", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsparse6.2.0/hipsparse6.2.0_3.1.1.60200-66~20.04_amd64.deb", + sha256 = "f08ba25b6b950754b5a2bb64c125a01b9f44280f227ff19eeb78e188f0b17320", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsparse-dev6.2.0/hipsparse-dev6.2.0_3.1.1.60200-66~20.04_amd64.deb", + sha256 = "e9464369619bbea7299ac83e17b3cbbabdeb16e6d4da116400532e7737332b65", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hiprand6.2.0/hiprand6.2.0_2.11.0.60200-66~20.04_amd64.deb", + sha256 = "2efed49be9413e08e91b3fb67736644bb0e8809fc673d310a0abab65b69eacad", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hiprand-dev6.2.0/hiprand-dev6.2.0_2.11.0.60200-66~20.04_amd64.deb", + sha256 = "19564fb2f9616860234aa8bd69cca324a1a3ec33476581ec57200a1dac1d4dcb", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hsa-rocr6.2.0/hsa-rocr6.2.0_1.14.0.60200-66~20.04_amd64.deb", + sha256 = "e4940a5d47e9e39d603f18936e7921c603fd8dde0e359e0be796f9c1cdacd431", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/m/miopen-hip6.2.0/miopen-hip6.2.0_3.2.0.60200-66~20.04_amd64.deb", + sha256 = "638a28c5407c3af7d16e1b0179b7494b0aeb36c314114af148b1bcd52e883db1", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/m/miopen-hip-dev/miopen-hip-dev_3.2.0.60200-66~20.04_amd64.deb", + sha256 = "77c9d26c4f0053b71fb86f7a6b489655e27053f9605efca3a16344ccf286e313", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rccl6.2.0/rccl6.2.0_2.20.5.60200-66~20.04_amd64.deb", + sha256 = "2b3ce1ca2e58e891963f26d4bd31ae45894480483f691d371f269e698f75f8eb", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rccl-dev6.2.0/rccl-dev6.2.0_2.20.5.60200-66~20.04_amd64.deb", + sha256 = "0dedbffa5bb272d656086a9586e3705551345945f35f4f6be6dc8a27b63127a9", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocblas6.2.0/rocblas6.2.0_4.2.0.60200-66~20.04_amd64.deb", + sha256 = "6e5b3caeadf592367f8638db67a70b8dd9231a8257dc2012a9c46e2c5974fff5", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocblas-dev/rocblas-dev_4.2.0.60200-66~20.04_amd64.deb", + sha256 = "eaefe5a7d75ef61314b83af5bb85d8e652a730deaa58e1d600b1e9c2e673673c", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocfft-dev6.2.0/rocfft-dev6.2.0_1.0.28.60200-66~20.04_amd64.deb", + sha256 = "e94d50fd6f24d70649ce046dbfe4dda2587d1d82892d4c126a4c3e91d1570071", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-core/rocm-core_6.2.0.60200-66~20.04_amd64.deb", + sha256 = "0e16c9fc58fc904542be4dad63bb2ff34268b5c13957c432e91ec0e4fd149c82", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-hip-libraries/rocm-hip-libraries_6.2.0.60200-66~20.04_amd64.deb", + sha256 = "14f47d79b508eb259bfe4e0e5f360edb5721b908caf3bb981a4eee4181783be9", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-dev/hip-dev_6.2.41133.60200-66~20.04_amd64.deb", + sha256 = "97e6e77eaea56de6cc4ea2c525dd8b9a587546eb99c782c7af46cdc5363b99bf", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-device-libs6.2.0/rocm-device-libs6.2.0_1.0.0.60200-66~20.04_amd64.deb", + sha256 = "ae055b579d319e1a779783ba774f119fb0e1a731d058a03b36dc5c15214d210a", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocminfo6.2.0/rocminfo6.2.0_1.0.0.60200-66~20.04_amd64.deb", + sha256 = "3bcf3dc22dbede7da70299cde1484776827808b967d371441f6cf6d3fe8af30d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-llvm6.2.0/rocm-llvm6.2.0_18.0.0.24292.60200-66~20.04_amd64.deb", + sha256 = "ce17d2b85407b9539e0feda513fd360a48ebfd971c19af122dda21d60448c9fc", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-llvm-dev/rocm-llvm-dev_18.0.0.24292.60200-66~20.04_amd64.deb", + sha256 = "322ca8425c3a8f2ec17c551bad606b96d957b0c1eea07196dd66ac9f15460ed5", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocprim-dev6.2.0/rocprim-dev6.2.0_3.2.0.60200-66~20.04_amd64.deb", + sha256 = "e74e1907eb90a692344626e881cb88eeed5565ac3b487eb94ad4ac02ffd838ed", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocrand-dev/rocrand-dev_3.1.0.60200-66~20.04_amd64.deb", + sha256 = "ddd0ac44b08470dfc128d6f6d2598a9728879f5a78bc5290645baebf22433b63", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/roctracer6.2.0/roctracer6.2.0_4.1.60200.60200-66~20.04_amd64.deb", + sha256 = "b94cdf230b372ebcaf97085cf67f01ef7977f814280fdaf1886797f39899ef41", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/roctracer-dev6.2.0/roctracer-dev6.2.0_4.1.60200.60200-66~20.04_amd64.deb", + sha256 = "9a85b57eea3790432eae06421081b3e59d3c9841d59646364ecd174f9ed4821a", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocsolver6.2.0/rocsolver6.2.0_3.26.0.60200-66~20.04_amd64.deb", + sha256 = "87dcd34a9b50f46161ecdb7781ab03c2b311fb7e13aa167c4a9c5e3bcf24b473", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocsolver-dev6.2.0/rocsolver-dev6.2.0_3.26.0.60200-66~20.04_amd64.deb", + sha256 = "21e4aa1957e7bc5d293a418a983d9b3c3917fb78eb79d3d4d55a253b9bae7743", + ), + ], + "rocm_root": "opt/rocm-6.2.0", + }, +} diff --git a/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_22_04.bzl b/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_22_04.bzl new file mode 100644 index 00000000000000..7f91e1d0d53bb3 --- /dev/null +++ b/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_22_04.bzl @@ -0,0 +1,155 @@ +rocm_redist_ubuntu_22_04 = { + "6.2.0": { + "archives": [ + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-runtime-amd6.2.0/hip-runtime-amd6.2.0_6.2.41133.60200-66~22.04_amd64.deb", + sha256 = "38e9670bedc7bbdc0b9f38c7a0fe90f73ef80f161cbf63c98d30e422438ce2c5", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-dev6.2.0/hip-dev6.2.0_6.2.41133.60200-66~22.04_amd64.deb", + sha256 = "c66cc8c19b57cab740710811457f02a16e24cff761e5c99c3640f63ceefe8281", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblas6.2.0/hipblas6.2.0_2.2.0.60200-66~22.04_amd64.deb", + sha256 = "fbd647e1b13e7aa2c14c9581f9102c069ddab9ecb47a4b226d433ec37b19e92d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblas-dev6.2.0/hipblas-dev6.2.0_2.2.0.60200-66~22.04_amd64.deb", + sha256 = "885cf3f3a52ebde9caadf6348a6cda28fd15e3bc52bab0c90b587d72b29ff7ef", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblaslt6.2.0/hipblaslt6.2.0_0.8.0.60200-66~22.04_amd64.deb", + sha256 = "af3bea7cda7c1af147c3baae1cb3a8846ff571fe713c3a83d0924810bee734fe", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblaslt-dev6.2.0/hipblaslt-dev6.2.0_0.8.0.60200-66~22.04_amd64.deb", + sha256 = "d9d2c80228ebfe74ebb98fc74fda57be498ab84ca40358355c616dfd38efded2", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipcc6.2.0/hipcc6.2.0_1.1.1.60200-66~22.04_amd64.deb", + sha256 = "468026fa8eb70121f0c545557a926ddc41228cef9457b4a00d8fc3a36b04310f", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipcub-dev6.2.0/hipcub-dev6.2.0_3.2.0.60200-66~22.04_amd64.deb", + sha256 = "c2c7d2ec5a8a31837c0addfc619ee67a374ea967cc6d43900472005489f62722", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipfft6.2.0/hipfft6.2.0_1.0.14.60200-66~22.04_amd64.deb", + sha256 = "6e649430cc5e247bbd052dff2d681b6bf0ef09d0bc3446a4911f4ab4cd317140", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipfft-dev6.2.0/hipfft-dev6.2.0_1.0.14.60200-66~22.04_amd64.deb", + sha256 = "389b0c83a39adbeeec442adde3fedba2820ed948179a4a0df03d67560501cd97", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsolver6.2.0/hipsolver6.2.0_2.2.0.60200-66~22.04_amd64.deb", + sha256 = "adf9aad1fc062445e34cdddbeca80db9c02f4c5f258e01c45e2a6222d15cb66d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsolver-dev6.2.0/hipsolver-dev6.2.0_2.2.0.60200-66~22.04_amd64.deb", + sha256 = "cb46dfbff3943a3167f6173fc381d744eb966a3451bcff49458c696888ec452c", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsparse6.2.0/hipsparse6.2.0_3.1.1.60200-66~22.04_amd64.deb", + sha256 = "8c7a216aeef6ceeb3881d3e443a89a0f5c15a17deb5926cba4b787554c8fab87", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsparse-dev6.2.0/hipsparse-dev6.2.0_3.1.1.60200-66~22.04_amd64.deb", + sha256 = "501cad72df5f09572f99c11eebbb1eff49afb6ca8c91bcf4966f81068177a95d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hiprand6.2.0/hiprand6.2.0_2.11.0.60200-66~22.04_amd64.deb", + sha256 = "b20c86be57698a944f91048699d0fbde5253bea28ba9d4035ce1de1d3c20f9ac", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hiprand-dev6.2.0/hiprand-dev6.2.0_2.11.0.60200-66~22.04_amd64.deb", + sha256 = "9dab6f44b92b6020e183777f6f07219d68de5d10cad7538c7ddcae0192aa3e33", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hsa-rocr6.2.0/hsa-rocr6.2.0_1.14.0.60200-66~22.04_amd64.deb", + sha256 = "62d280204d8ff642b464dab03fc344442df6dc5f04e152da20604e8050303c41", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/m/miopen-hip6.2.0/miopen-hip6.2.0_3.2.0.60200-66~22.04_amd64.deb", + sha256 = "6c2aa042067e51d5b70a264ca83c92ffaa6e81d00d08b55986917da860e66d85", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/m/miopen-hip-dev/miopen-hip-dev_3.2.0.60200-66~22.04_amd64.deb", + sha256 = "f3452b2bd9c2869c550c7f963cca65fb35a37183ad4a56d96e05c69adb2f1d04", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rccl6.2.0/rccl6.2.0_2.20.5.60200-66~22.04_amd64.deb", + sha256 = "f3205c0a7d736f457ee2262988260e8dc4c495fa74a394ff73a9dfe002aff335", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rccl-dev6.2.0/rccl-dev6.2.0_2.20.5.60200-66~22.04_amd64.deb", + sha256 = "953a248cd44f403e5423185918166bfa29a009519c3d7b5b5a8e067fdf672602", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocblas6.2.0/rocblas6.2.0_4.2.0.60200-66~22.04_amd64.deb", + sha256 = "c306ca3e59b851ebb35872e09e5598adf2e2ebb736c1b200ff4ee204fe262f7e", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocblas-dev/rocblas-dev_4.2.0.60200-66~22.04_amd64.deb", + sha256 = "115d0e9ec1b93bf7cba5fa1e3de1428f0d999d931c2dd495e4cdad22b5078936", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocfft-dev6.2.0/rocfft-dev6.2.0_1.0.28.60200-66~22.04_amd64.deb", + sha256 = "8c1e72cf1c165e20960b0c2f3c499900a809d59340d14a0acff95c543c7087f2", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-core/rocm-core_6.2.0.60200-66~22.04_amd64.deb", + sha256 = "22c80c1a704f4ce7d6a49a8b41acd64f3ed0513cd7f5570a0664a10df5858334", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-hip-libraries/rocm-hip-libraries_6.2.0.60200-66~22.04_amd64.deb", + sha256 = "9c2ff1dc100e342969bd51a7cd4918048c8b25579de709efde56425d969cd50f", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-dev/hip-dev_6.2.41133.60200-66~22.04_amd64.deb", + sha256 = "1101f3edb9dbc9f4914d7f26b5569ec9bde076d52d4125c98d22a99dd730ab51", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-device-libs6.2.0/rocm-device-libs6.2.0_1.0.0.60200-66~22.04_amd64.deb", + sha256 = "d5b660df350130e0ab04ddf3e36dd442bde27ae9cbb8e5f12c047b0d3cb05463", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocminfo6.2.0/rocminfo6.2.0_1.0.0.60200-66~22.04_amd64.deb", + sha256 = "0d06a84ac53d388089b7b8c80133f60c1eea5bfd85155ecc113efb206a747c25", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-llvm6.2.0/rocm-llvm6.2.0_18.0.0.24292.60200-66~22.04_amd64.deb", + sha256 = "4a29539480a7e4b27991ccf533a35526dd3994a457fa84e4c960192c2fa05b46", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-llvm-dev/rocm-llvm-dev_18.0.0.24292.60200-66~22.04_amd64.deb", + sha256 = "febb8614cedd98f13ba0624072ffdd13b9a6dc3431380a17a0eaf87583627890", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocprim-dev6.2.0/rocprim-dev6.2.0_3.2.0.60200-66~22.04_amd64.deb", + sha256 = "3d859bb735ff8bf1962ce680e9257dcc574ab36224f50069f833fa19c6d7e69d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocrand-dev/rocrand-dev_3.1.0.60200-66~22.04_amd64.deb", + sha256 = "317c16a6e0b0b456153437406dd92225e17dbd454fc1304b0c3fef5fbfc69bc2", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/roctracer6.2.0/roctracer6.2.0_4.1.60200.60200-66~22.04_amd64.deb", + sha256 = "9ddf8835f1e94d5004b4c466091c8110cb72e11eda545d0de395395832076c0a", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/roctracer-dev6.2.0/roctracer-dev6.2.0_4.1.60200.60200-66~22.04_amd64.deb", + sha256 = "9a9ed0c66d3a9d9ff50f1fc3a9e9105bb8b1a6d93c1f856682625dfb68ab627f", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocsolver6.2.0/rocsolver6.2.0_3.26.0.60200-66~22.04_amd64.deb", + sha256 = "5b86bf7b33a3ffa7098878f27d1b119aada69ebb02bd121b47209559c32703be", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocsolver-dev6.2.0/rocsolver-dev6.2.0_3.26.0.60200-66~22.04_amd64.deb", + sha256 = "4573f99191fbe3a2afab84fdf5a05e024bd230ca7866d7eba71a5f2560a3a0bf", + ), + ], + "rocm_root": "opt/rocm-6.2.0", + }, +} diff --git a/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_24_04.bzl b/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_24_04.bzl new file mode 100644 index 00000000000000..79bb1d6d391f15 --- /dev/null +++ b/third_party/tsl/third_party/gpus/rocm/rocm_redist_ubuntu_24_04.bzl @@ -0,0 +1,155 @@ +rocm_redist_ubuntu_24_04 = { + "6.2.0": { + "archives": [ + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-runtime-amd6.2.0/hip-runtime-amd6.2.0_6.2.41133.60200-66~24.04_amd64.deb", + sha256 = "4831c09058882d531d10ead6a13ada15e7e9cbb182bd56ab62f2404207488f3e", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-dev6.2.0/hip-dev6.2.0_6.2.41133.60200-66~24.04_amd64.deb", + sha256 = "5e6601ada30432ee0dab0473585bdf1fa7c398f0c655538d48eba9c44e6dc77a", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblas6.2.0/hipblas6.2.0_2.2.0.60200-66~24.04_amd64.deb", + sha256 = "7ff8f6308c744c71008959b17ab6338de1c6fd3e4581dd94271e6eca9fdc4c13", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblas-dev6.2.0/hipblas-dev6.2.0_2.2.0.60200-66~24.04_amd64.deb", + sha256 = "e9f71e71db600d72dcb2b61e64b965b6c60d47bd4bb699e8abec85edb260b819", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblaslt6.2.0/hipblaslt6.2.0_0.8.0.60200-66~24.04_amd64.deb", + sha256 = "e5dfd8ba9e49f919a96c102d3a652e8ef0c4d1a63b3f3909c856d40b1745e2a9", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipblaslt-dev6.2.0/hipblaslt-dev6.2.0_0.8.0.60200-66~24.04_amd64.deb", + sha256 = "639bd47010035ee6719425510be33d2f54483004a909dfa4c64f853d7394a22f", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipcc6.2.0/hipcc6.2.0_1.1.1.60200-66~24.04_amd64.deb", + sha256 = "c2782a98633e4400f46ba732605e56b2821366db60ec06d88db0615e4d1acf3c", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipcub-dev6.2.0/hipcub-dev6.2.0_3.2.0.60200-66~24.04_amd64.deb", + sha256 = "48fec4d06aef3159db4117125b728242a1eeb480ea3d55d3901d945d4b883694", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipfft6.2.0/hipfft6.2.0_1.0.14.60200-66~24.04_amd64.deb", + sha256 = "8dd73cdbd4f0563f4a0481304771e4cbcac5905eea1f2d8ef41f922cdf9aba85", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipfft-dev6.2.0/hipfft-dev6.2.0_1.0.14.60200-66~24.04_amd64.deb", + sha256 = "e3c0a4ebda8d3aacd44b19c6872f23222513be0a5c04f793605088d9183f1be4", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsolver6.2.0/hipsolver6.2.0_2.2.0.60200-66~24.04_amd64.deb", + sha256 = "adbba9ffcf8b5e4202efbe45924d87520bf4100ec5464bd0ba3beb61cb535c6c", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsolver-dev6.2.0/hipsolver-dev6.2.0_2.2.0.60200-66~24.04_amd64.deb", + sha256 = "01d3dd6195111808b40a5837d3e51d8c27c4700b4bd8bb2d901e39d0474fd98a", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsparse6.2.0/hipsparse6.2.0_3.1.1.60200-66~24.04_amd64.deb", + sha256 = "2ba33a96388cd3edd7b5b8b261fe99cbd569894f4d7db291fc0dd0ff5d7c67ce", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hipsparse-dev6.2.0/hipsparse-dev6.2.0_3.1.1.60200-66~24.04_amd64.deb", + sha256 = "6a767f493a722e2d4260a9bc23cf9db66fd275a094b395c768e305f60d6b4fe9", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hiprand6.2.0/hiprand6.2.0_2.11.0.60200-66~24.04_amd64.deb", + sha256 = "82f182134b415080ba4a12fd7993b6099ee9b9e549c72bfebee24c8486704078", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hiprand-dev6.2.0/hiprand-dev6.2.0_2.11.0.60200-66~24.04_amd64.deb", + sha256 = "011d5c28f45cd9d756e0cf6ea6a3d37eabd98a3381ffd961c772ab92a37e4ee8", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hsa-rocr6.2.0/hsa-rocr6.2.0_1.14.0.60200-66~24.04_amd64.deb", + sha256 = "fa04f707debb75087ea2bf5e327602034eaa3a6900421f2cf32ad5f5f1c887b9", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/m/miopen-hip6.2.0/miopen-hip6.2.0_3.2.0.60200-66~24.04_amd64.deb", + sha256 = "2dbf6d126d0de6930e0cd94d0e525e07d3019d90bd7256f3151a7f1fbc2250af", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/m/miopen-hip-dev/miopen-hip-dev_3.2.0.60200-66~24.04_amd64.deb", + sha256 = "df5fdd2218e4d380b133ba402f3734fbe0589d9cdd8618a101b71b968909b4ba", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rccl6.2.0/rccl6.2.0_2.20.5.60200-66~24.04_amd64.deb", + sha256 = "4d7efa4ee6aa2bf69b0aab449cc1d01c25ca65814e1b3cb07f6b59fa8b1608b8", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rccl-dev6.2.0/rccl-dev6.2.0_2.20.5.60200-66~24.04_amd64.deb", + sha256 = "4ab4f880344e04d61b6fa746be5c4bdc2841409fb6987ee61e39c6420b4eca42", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocblas6.2.0/rocblas6.2.0_4.2.0.60200-66~24.04_amd64.deb", + sha256 = "521c87ce396c6ce10076cc641b6035451fd68ddb36a684c5a9c9538dfc831ade", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocblas-dev/rocblas-dev_4.2.0.60200-66~24.04_amd64.deb", + sha256 = "00f135ce2ae47c35085ef06248ff7d5ce8c12fd0d5b82e7bd77b1dbc0ce7058e", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocfft-dev6.2.0/rocfft-dev6.2.0_1.0.28.60200-66~24.04_amd64.deb", + sha256 = "eb3904263b396d46799eeea1081d8e8d1a551a890432a803364db2d013849f92", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-core/rocm-core_6.2.0.60200-66~24.04_amd64.deb", + sha256 = "af5fcbe8dc2b6cbec30e2d39d30736e8a47a0b9d0ca2be7f179f2947f9c98245", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-hip-libraries/rocm-hip-libraries_6.2.0.60200-66~24.04_amd64.deb", + sha256 = "228f07a3caefc41f6efd5345eb9d3630f1db769f9b4abd1313cbcb32d077ce53", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/h/hip-dev/hip-dev_6.2.41133.60200-66~24.04_amd64.deb", + sha256 = "cda72054d2011dbb062e75386766d928fd8905c15c88685c3ef87fc963bd88ad", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-device-libs6.2.0/rocm-device-libs6.2.0_1.0.0.60200-66~24.04_amd64.deb", + sha256 = "298544f717dfb236b9257b19a0ab81abaaa770128976d4abfdea546cd32d8b02", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocminfo6.2.0/rocminfo6.2.0_1.0.0.60200-66~24.04_amd64.deb", + sha256 = "8e78ed8e480b55a496153b150acb22bab39c3bb8cf1e62f9aff7eaf75a3a3a92", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-llvm6.2.0/rocm-llvm6.2.0_18.0.0.24292.60200-66~24.04_amd64.deb", + sha256 = "72c388eae7c0f54151b46fbd8fa6e26f1ca81e2b8b415c43411a156b3f25b6e7", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocm-llvm-dev/rocm-llvm-dev_18.0.0.24292.60200-66~24.04_amd64.deb", + sha256 = "3e85a859c5dafa82a9a57dda096d566b821217bacfac995f7cc45ed460b68999", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocprim-dev6.2.0/rocprim-dev6.2.0_3.2.0.60200-66~24.04_amd64.deb", + sha256 = "6c832e2feb0885fbe481245825c76a466921b294f530eb0d0da70a44cfe6e608", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocrand-dev/rocrand-dev_3.1.0.60200-66~24.04_amd64.deb", + sha256 = "2a2a95185ce0e54df226474b2f5cfcdc9e5ede5a6d88a8a70c2635ea2237abba", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/roctracer6.2.0/roctracer6.2.0_4.1.60200.60200-66~24.04_amd64.deb", + sha256 = "2f2fb6f8d06ace89131934c833b0ea359335a4b45aeec1559b293d7bc14b1d1d", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/roctracer-dev6.2.0/roctracer-dev6.2.0_4.1.60200.60200-66~24.04_amd64.deb", + sha256 = "c6c781ee87c459aed32e943b389137f98ecd402fb83a3d1c98de9a76abadc3a3", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocsolver6.2.0/rocsolver6.2.0_3.26.0.60200-66~24.04_amd64.deb", + sha256 = "5e4b3e38556f0826e5322971635a49a72283d60862ccc4d28efd11c8fb955b47", + ), + struct( + url = "https://repo.radeon.com/rocm/apt/6.2/pool/main/r/rocsolver-dev6.2.0/rocsolver-dev6.2.0_3.26.0.60200-66~24.04_amd64.deb", + sha256 = "5bb6ae92a25f33488f2ee5f123ac4f67ad130e18e4949161715451509be3b89d", + ), + ], + "rocm_root": "opt/rocm-6.2.0", + }, +} diff --git a/third_party/tsl/third_party/gpus/rocm_configure.bzl b/third_party/tsl/third_party/gpus/rocm_configure.bzl index da4b2b976ffde0..2c5395c07fefa9 100644 --- a/third_party/tsl/third_party/gpus/rocm_configure.bzl +++ b/third_party/tsl/third_party/gpus/rocm_configure.bzl @@ -8,6 +8,10 @@ * `TF_ROCM_AMDGPU_TARGETS`: The AMDGPU targets. """ +load( + "@tsl//third_party/gpus/rocm:rocm_redist.bzl", + "rocm_redist", +) load( "//third_party/remote_config:common.bzl", "config_repo_label", @@ -25,8 +29,6 @@ load( load( ":cuda_configure.bzl", "enable_cuda", - "make_copy_dir_rule", - "make_copy_files_rule", "to_list_of_strings", ) load( @@ -39,6 +41,9 @@ _GCC_HOST_COMPILER_PREFIX = "GCC_HOST_COMPILER_PREFIX" _ROCM_TOOLKIT_PATH = "ROCM_PATH" _TF_ROCM_AMDGPU_TARGETS = "TF_ROCM_AMDGPU_TARGETS" _TF_ROCM_CONFIG_REPO = "TF_ROCM_CONFIG_REPO" +_DISTRIBUTION_PATH = "rocm/rocm_dist" +_OS = "OS" +_ROCM_VERSION = "ROCM_VERSION" _DEFAULT_ROCM_TOOLKIT_PATH = "/opt/rocm" @@ -179,20 +184,8 @@ def _rocm_include_path(repository_ctx, rocm_config, bash_bin): """ inc_dirs = [] - # Add HSA headers (needs to match $HSA_PATH) - inc_dirs.append(rocm_config.rocm_toolkit_path + "/hsa/include") - - # Add HIP headers (needs to match $HIP_PATH) - inc_dirs.append(rocm_config.rocm_toolkit_path + "/hip/include") - if int(rocm_config.rocm_version_number) >= 50200: - inc_dirs.append(rocm_config.rocm_toolkit_path + "/include") - inc_dirs.append(rocm_config.rocm_toolkit_path + "/include/hip") - inc_dirs.append(rocm_config.rocm_toolkit_path + "/include/rocprim") - inc_dirs.append(rocm_config.rocm_toolkit_path + "/include/rocsolver") - inc_dirs.append(rocm_config.rocm_toolkit_path + "/include/rocblas") - - # Add HIP-Clang headers (realpath relative to compiler binary) - rocm_toolkit_path = realpath(repository_ctx, rocm_config.rocm_toolkit_path, bash_bin) + # Add full paths + rocm_toolkit_path = str(repository_ctx.path(rocm_config.rocm_toolkit_path)) inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/8.0/include") inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/9.0.0/include") inc_dirs.append(rocm_toolkit_path + "/llvm/lib/clang/10.0.0/include") @@ -340,7 +333,7 @@ def _select_rocm_lib_paths(repository_ctx, libs_paths, bash_bin): return libs -def _find_libs(repository_ctx, rocm_config, hipfft_or_rocfft, miopen_path, rccl_path, bash_bin): +def _find_libs(repository_ctx, rocm_config, miopen_path, rccl_path, bash_bin): """Returns the ROCm libraries on the system. Args: @@ -356,7 +349,6 @@ def _find_libs(repository_ctx, rocm_config, hipfft_or_rocfft, miopen_path, rccl_ for name, path in [ ("amdhip64", rocm_config.rocm_toolkit_path), ("rocblas", rocm_config.rocm_toolkit_path), - (hipfft_or_rocfft, rocm_config.rocm_toolkit_path), ("hiprand", rocm_config.rocm_toolkit_path), ("MIOpen", miopen_path), ("rccl", rccl_path), @@ -374,17 +366,17 @@ def _find_libs(repository_ctx, rocm_config, hipfft_or_rocfft, miopen_path, rccl_ libs_paths.append(("hipblaslt", _rocm_lib_paths(repository_ctx, "hipblaslt", rocm_config.rocm_toolkit_path), True)) return _select_rocm_lib_paths(repository_ctx, libs_paths, bash_bin) -def find_rocm_config(repository_ctx): +def find_rocm_config(repository_ctx, rocm_path): """Returns ROCm config dictionary from running find_rocm_config.py""" python_bin = get_python_bin(repository_ctx) - exec_result = execute(repository_ctx, [python_bin, repository_ctx.attr._find_rocm_config]) + exec_result = execute(repository_ctx, [python_bin, repository_ctx.attr._find_rocm_config], env_vars = {"ROCM_PATH": rocm_path}) if exec_result.return_code: auto_configure_fail("Failed to run find_rocm_config.py: %s" % err_out(exec_result)) # Parse the dict from stdout. return dict([tuple(x.split(": ")) for x in exec_result.stdout.splitlines()]) -def _get_rocm_config(repository_ctx, bash_bin): +def _get_rocm_config(repository_ctx, bash_bin, rocm_path): """Detects and returns information about the ROCm installation on the system. Args: @@ -399,7 +391,7 @@ def _get_rocm_config(repository_ctx, bash_bin): miopen_version_number: The version of MIOpen on the system. hipruntime_version_number: The version of HIP Runtime on the system. """ - config = find_rocm_config(repository_ctx) + config = find_rocm_config(repository_ctx, rocm_path) rocm_toolkit_path = config["rocm_toolkit_path"] rocm_version_number = config["rocm_version_number"] miopen_version_number = config["miopen_version_number"] @@ -473,15 +465,12 @@ def _create_dummy_repository(repository_ctx): "%{hipblas_lib}": _lib_name("hipblas"), "%{miopen_lib}": _lib_name("miopen"), "%{rccl_lib}": _lib_name("rccl"), - "%{hipfft_or_rocfft}": _lib_name("hipfft"), - "%{hipfft_or_rocfft_lib}": _lib_name("hipfft"), "%{hiprand_lib}": _lib_name("hiprand"), "%{hipsparse_lib}": _lib_name("hipsparse"), "%{roctracer_lib}": _lib_name("roctracer64"), "%{rocsolver_lib}": _lib_name("rocsolver"), "%{hipsolver_lib}": _lib_name("hipsolver"), "%{hipblaslt_lib}": _lib_name("hipblaslt"), - "%{copy_rules}": "", "%{rocm_headers}": "", }, ) @@ -499,7 +488,7 @@ def _create_dummy_repository(repository_ctx): "%{rocm_toolkit_path}": _DEFAULT_ROCM_TOOLKIT_PATH, "%{hipblaslt_flag}": "0", }, - "rocm/rocm/rocm_config.h", + "rocm/rocm_config.h", ) # If rocm_configure is not configured to build with GPU support, and the user @@ -541,6 +530,53 @@ def _compute_rocm_extra_copts(repository_ctx, amdgpu_targets): amdgpu_target for amdgpu_target in amdgpu_targets] return str(amdgpu_target_flags) +def _get_file_name(url): + last_slash_index = url.rfind("/") + return url[last_slash_index + 1:] + +def _download_package(repository_ctx, archive): + file_name = _get_file_name(archive.url) + tmp_dir = "tmp" + repository_ctx.file(tmp_dir + "/.idx") # create tmp dir + + repository_ctx.report_progress("Downloading and extracting {}, expected hash is {}".format(archive.url, archive.sha256)) # buildifier: disable=print + repository_ctx.download_and_extract( + url = archive.url, + output = tmp_dir if archive.url.endswith(".deb") else _DISTRIBUTION_PATH, + sha256 = archive.sha256, + ) + + all_files = repository_ctx.path(tmp_dir).readdir() + + matched_files = [f for f in all_files if _get_file_name(str(f)).startswith("data.")] + for f in matched_files: + repository_ctx.extract(f, _DISTRIBUTION_PATH) + + repository_ctx.delete(tmp_dir) + repository_ctx.delete(file_name) + +def _remove_root_dir(path, root_dir): + if path.startswith(root_dir + "/"): + return path[len(root_dir) + 1:] + return path + +def _setup_rocm_distro_dir(repository_ctx): + """Sets up the rocm hermetic installation directory to be used in hermetic build""" + bash_bin = get_bash_bin(repository_ctx) + os = repository_ctx.os.environ.get(_OS) + rocm_version = repository_ctx.os.environ.get(_ROCM_VERSION) + if os and rocm_version: + redist = rocm_redist[os][rocm_version] + repository_ctx.file("rocm/.index") + for archive in redist["archives"]: + _download_package(repository_ctx, archive) + return _get_rocm_config(repository_ctx, bash_bin, _DISTRIBUTION_PATH + "/" + redist["rocm_root"]) + else: + rocm_path = repository_ctx.os.environ.get(_ROCM_TOOLKIT_PATH, _DEFAULT_ROCM_TOOLKIT_PATH) + repository_ctx.report_progress("Using local rocm installation {}".format(rocm_path)) # buildifier: disable=print + repository_ctx.symlink(rocm_path, _DISTRIBUTION_PATH) + return _get_rocm_config(repository_ctx, bash_bin, _DISTRIBUTION_PATH) + def _create_local_rocm_repository(repository_ctx): """Creates the repository containing files set up to build with ROCm.""" @@ -553,12 +589,8 @@ def _create_local_rocm_repository(repository_ctx): "rocm:rocm_config.h", ]} - bash_bin = get_bash_bin(repository_ctx) - rocm_config = _get_rocm_config(repository_ctx, bash_bin) - - # For ROCm 4.1 and above use hipfft, older ROCm versions use rocfft + rocm_config = _setup_rocm_distro_dir(repository_ctx) rocm_version_number = int(rocm_config.rocm_version_number) - hipfft_or_rocfft = "rocfft" if rocm_version_number < 40100 else "hipfft" # For ROCm 5.2 and above, find MIOpen and RCCL in the main rocm lib path miopen_path = rocm_config.rocm_toolkit_path + "/miopen" if rocm_version_number < 50200 else rocm_config.rocm_toolkit_path @@ -566,75 +598,19 @@ def _create_local_rocm_repository(repository_ctx): # Copy header and library files to execroot. # rocm_toolkit_path - rocm_toolkit_path = rocm_config.rocm_toolkit_path - copy_rules = [ - make_copy_dir_rule( - repository_ctx, - name = "rocm-include", - src_dir = rocm_toolkit_path + "/include", - out_dir = "rocm/include", - ), - ] - - # explicitly copy (into the local_config_rocm repo) the $ROCM_PATH/hiprand/include and - # $ROCM_PATH/rocrand/include dirs, only once the softlink to them in $ROCM_PATH/include - # dir has been removed. This removal will happen in a near-future ROCm release. - hiprand_include = "" - hiprand_include_softlink = rocm_config.rocm_toolkit_path + "/include/hiprand" - softlink_exists = files_exist(repository_ctx, [hiprand_include_softlink], bash_bin) - if not softlink_exists[0]: - hiprand_include = '":hiprand-include",\n' - copy_rules.append( - make_copy_dir_rule( - repository_ctx, - name = "hiprand-include", - src_dir = rocm_toolkit_path + "/hiprand/include", - out_dir = "rocm/include/hiprand", - ), - ) - - rocrand_include = "" - rocrand_include_softlink = rocm_config.rocm_toolkit_path + "/include/rocrand" - softlink_exists = files_exist(repository_ctx, [rocrand_include_softlink], bash_bin) - if not softlink_exists[0]: - rocrand_include = '":rocrand-include",\n' - copy_rules.append( - make_copy_dir_rule( - repository_ctx, - name = "rocrand-include", - src_dir = rocm_toolkit_path + "/rocrand/include", - out_dir = "rocm/include/rocrand", - ), - ) + rocm_toolkit_path = _remove_root_dir(rocm_config.rocm_toolkit_path, "rocm") - rocm_libs = _find_libs(repository_ctx, rocm_config, hipfft_or_rocfft, miopen_path, rccl_path, bash_bin) + bash_bin = get_bash_bin(repository_ctx) + rocm_libs = _find_libs(repository_ctx, rocm_config, miopen_path, rccl_path, bash_bin) rocm_lib_srcs = [] rocm_lib_outs = [] for lib in rocm_libs.values(): if lib: rocm_lib_srcs.append(lib.path) rocm_lib_outs.append("rocm/lib/" + lib.file_name) - copy_rules.append(make_copy_files_rule( - repository_ctx, - name = "rocm-lib", - srcs = rocm_lib_srcs, - outs = rocm_lib_outs, - )) clang_offload_bundler_path = rocm_toolkit_path + "/llvm/bin/clang-offload-bundler" - # copy files mentioned in third_party/gpus/rocm/BUILD - copy_rules.append(make_copy_files_rule( - repository_ctx, - name = "rocm-bin", - srcs = [ - clang_offload_bundler_path, - ], - outs = [ - "rocm/bin/" + "clang-offload-bundler", - ], - )) - have_hipblaslt = "1" if rocm_libs["hipblaslt"] != None else "0" # Set up BUILD file for rocm/ @@ -656,20 +632,7 @@ def _create_local_rocm_repository(repository_ctx): ) repository_dict = { - "%{hip_lib}": rocm_libs["amdhip64"].file_name, - "%{rocblas_lib}": rocm_libs["rocblas"].file_name, - "%{hipfft_or_rocfft}": hipfft_or_rocfft, - "%{hipfft_or_rocfft_lib}": rocm_libs[hipfft_or_rocfft].file_name, - "%{hiprand_lib}": rocm_libs["hiprand"].file_name, - "%{miopen_lib}": rocm_libs["MIOpen"].file_name, - "%{rccl_lib}": rocm_libs["rccl"].file_name, - "%{hipsparse_lib}": rocm_libs["hipsparse"].file_name, - "%{roctracer_lib}": rocm_libs["roctracer64"].file_name, - "%{rocsolver_lib}": rocm_libs["rocsolver"].file_name, - "%{copy_rules}": "\n".join(copy_rules), - "%{rocm_headers}": ('":rocm-include",\n' + - hiprand_include + - rocrand_include), + "%{rocm_root}": rocm_toolkit_path, } if rocm_libs["hipblaslt"] != None: repository_dict["%{hipblaslt_lib}"] = rocm_libs["hipblaslt"].file_name @@ -732,6 +695,7 @@ def _create_local_rocm_repository(repository_ctx): repository_ctx.template( "crosstool/cc_toolchain_config.bzl", tpl_paths["crosstool:hipcc_cc_toolchain_config.bzl"], + rocm_defines, ) repository_ctx.template( @@ -739,11 +703,12 @@ def _create_local_rocm_repository(repository_ctx): tpl_paths["crosstool:clang/bin/crosstool_wrapper_driver_rocm"], { "%{cpu_compiler}": str(cc), - "%{hipcc_path}": rocm_config.rocm_toolkit_path + "/bin/hipcc", + "%{hipcc_path}": str(repository_ctx.path(rocm_config.rocm_toolkit_path + "/bin/hipcc")), "%{hipcc_env}": _hipcc_env(repository_ctx), - "%{rocr_runtime_path}": rocm_config.rocm_toolkit_path + "/lib", + "%{rocm_path}": str(repository_ctx.path(rocm_config.rocm_toolkit_path)), + "%{rocr_runtime_path}": str(repository_ctx.path(rocm_config.rocm_toolkit_path + "/lib")), "%{rocr_runtime_library}": "hsa-runtime64", - "%{hip_runtime_path}": rocm_config.rocm_toolkit_path + "/lib", + "%{hip_runtime_path}": str(repository_ctx.path(rocm_config.rocm_toolkit_path + "/lib")), "%{hip_runtime_library}": "amdhip64", "%{crosstool_verbose}": _crosstool_verbose(repository_ctx), "%{gcc_host_compiler_path}": str(cc), @@ -753,13 +718,13 @@ def _create_local_rocm_repository(repository_ctx): # Set up rocm_config.h, which is used by # tensorflow/compiler/xla/stream_executor/dso_loader.cc. repository_ctx.template( - "rocm/rocm/rocm_config.h", + "rocm/rocm_config/rocm_config.h", tpl_paths["rocm:rocm_config.h"], { "%{rocm_amdgpu_targets}": ",".join( ["\"%s\"" % c for c in rocm_config.amdgpu_targets], ), - "%{rocm_toolkit_path}": rocm_config.rocm_toolkit_path, + "%{rocm_toolkit_path}": str(repository_ctx.path(rocm_config.rocm_toolkit_path)), "%{rocm_version_number}": rocm_config.rocm_version_number, "%{miopen_version_number}": rocm_config.miopen_version_number, "%{hipruntime_version_number}": rocm_config.hipruntime_version_number, @@ -834,6 +799,8 @@ _ENVIRONS = [ "TF_NEED_CUDA", # Needed by the `if_gpu_is_configured` macro _ROCM_TOOLKIT_PATH, _TF_ROCM_AMDGPU_TARGETS, + _OS, + _ROCM_VERSION, ] remote_rocm_configure = repository_rule( diff --git a/third_party/tsl/third_party/remote_config/common.bzl b/third_party/tsl/third_party/remote_config/common.bzl index 57fb6fcf7aca9a..6c2ed3aab70c13 100644 --- a/third_party/tsl/third_party/remote_config/common.bzl +++ b/third_party/tsl/third_party/remote_config/common.bzl @@ -212,7 +212,8 @@ def execute( cmdline, error_msg = None, error_details = None, - allow_failure = False): + allow_failure = False, + env_vars = {}): """Executes an arbitrary shell command. Args: @@ -222,10 +223,11 @@ def execute( error_details: string, details about the error or steps to fix it allow_failure: bool, if True, an empty stdout result or output to stderr is fine, otherwise either of these is an error + env_vars: environment variables Returns: The result of repository_ctx.execute(cmdline) """ - result = raw_exec(repository_ctx, cmdline) + result = raw_exec(repository_ctx, cmdline, env_vars) if (result.stderr or not result.stdout) and not allow_failure: fail( "\n".join([ @@ -236,7 +238,7 @@ def execute( ) return result -def raw_exec(repository_ctx, cmdline): +def raw_exec(repository_ctx, cmdline, env_vars = {}): """Executes a command via repository_ctx.execute() and returns the result. This method is useful for debugging purposes. For example, to print all @@ -245,11 +247,12 @@ def raw_exec(repository_ctx, cmdline): Args: repository_ctx: the repository_ctx cmdline: the list of args + env_vars: environment variables Returns: The 'exec_result' of repository_ctx.execute(). """ - return repository_ctx.execute(cmdline) + return repository_ctx.execute(cmdline, environment = env_vars) def files_exist(repository_ctx, paths, bash_bin = None): """Checks which files in paths exists. diff --git a/third_party/tsl/tsl/platform/default/BUILD b/third_party/tsl/tsl/platform/default/BUILD index 01cf593888c077..3290d06be938b8 100644 --- a/third_party/tsl/tsl/platform/default/BUILD +++ b/third_party/tsl/tsl/platform/default/BUILD @@ -97,6 +97,7 @@ cc_library( "@com_google_absl//absl/synchronization", "@local_config_cuda//cuda:cuda_headers", "@local_config_rocm//rocm:rocm_headers", + "@local_config_rocm//rocm:rocm_config", "@local_config_tensorrt//:tensorrt_headers", ] + if_oss(["@local_config_nccl//:nccl_config"]), ) @@ -401,6 +402,7 @@ cc_library( "//tsl/platform:path", "//tsl/platform:types", "@local_config_rocm//rocm:rocm_headers", + "@local_config_rocm//rocm:rocm_config", ], ) diff --git a/xla/service/gpu/BUILD b/xla/service/gpu/BUILD index 7ba66589d9fb89..c940dd4ec1e02e 100644 --- a/xla/service/gpu/BUILD +++ b/xla/service/gpu/BUILD @@ -3925,6 +3925,7 @@ gpu_kernel_library( "@local_config_cuda//cuda:cuda_headers", ]) + if_rocm_is_configured([ "@local_config_rocm//rocm:rocm_headers", + "@local_config_rocm//rocm:rocm_config", ]), )