From 80da06feba8387e65dfedfe22a788cbfcbcfc78f Mon Sep 17 00:00:00 2001 From: Fergus Byrne Date: Fri, 4 Oct 2024 17:18:21 +0100 Subject: [PATCH 1/2] Add support for GFX1103 --- .../core/grappler/optimizers/auto_mixed_precision.cc | 2 +- tensorflow/tools/ci_build/Dockerfile.rocm | 4 ++-- .../tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux2014 | 2 +- .../Dockerfile.rocm.manylinux_2_28 | 2 +- .../tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub20 | 2 +- .../tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub22 | 2 +- .../tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub24 | 2 +- tensorflow/tools/tf_sig_build_dockerfiles/setup.rocm.sh | 2 +- third_party/xla/xla/stream_executor/device_description.h | 7 +++++-- 9 files changed, 14 insertions(+), 11 deletions(-) diff --git a/tensorflow/core/grappler/optimizers/auto_mixed_precision.cc b/tensorflow/core/grappler/optimizers/auto_mixed_precision.cc index 287bfed6c64120..db7ec8e70aa113 100644 --- a/tensorflow/core/grappler/optimizers/auto_mixed_precision.cc +++ b/tensorflow/core/grappler/optimizers/auto_mixed_precision.cc @@ -116,7 +116,7 @@ bool HasFastFP16Support(const DeviceProperties& props) { #elif TENSORFLOW_USE_ROCM absl::flat_hash_set FP16SupportedDevices = { {"gfx906"}, {"gfx908"}, {"gfx90a"}, {"gfx910"}, {"gfx940"}, {"gfx941"}, - {"gfx942"}, {"gfx1010"}, {"gfx1012"}, {"gfx1030"}, {"gfx1100"} + {"gfx942"}, {"gfx1010"}, {"gfx1012"}, {"gfx1030"}, {"gfx1100"}, {"gfx1103"} }; std::string gcnArchName = props.environment().at("architecture"); std::vector gpu_arch = absl::StrSplit(gcnArchName, ":"); diff --git a/tensorflow/tools/ci_build/Dockerfile.rocm b/tensorflow/tools/ci_build/Dockerfile.rocm index 37e8a43ca4ed09..9cd6a96555dc39 100644 --- a/tensorflow/tools/ci_build/Dockerfile.rocm +++ b/tensorflow/tools/ci_build/Dockerfile.rocm @@ -6,8 +6,8 @@ MAINTAINER Jeff Poznanovic ARG ROCM_DEB_REPO=https://repo.radeon.com/rocm/apt/6.2/ ARG ROCM_BUILD_NAME=ubuntu ARG ROCM_BUILD_NUM=main -ARG ROCM_PATH=/opt/rocm/ -ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100" +ARG ROCM_PATH=/opt/rocm +ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103" ARG DEBIAN_FRONTEND=noninteractive ENV TF_NEED_ROCM 1 diff --git a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux2014 b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux2014 index 428d84e283fdd8..68030cf73e872e 100644 --- a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux2014 +++ b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux2014 @@ -8,7 +8,7 @@ COPY setup.packages.rocm.cs7.sh setup.packages.rocm.cs7.sh COPY builder.packages.rocm.cs7.txt builder.packages.rocm.cs7.txt RUN /setup.packages.rocm.cs7.sh /builder.packages.rocm.cs7.txt -ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100" +ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103" ENV GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS} # Install ROCM diff --git a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux_2_28 b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux_2_28 index 62fa83359940a9..31efa92f0b2774 100644 --- a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux_2_28 +++ b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.manylinux_2_28 @@ -17,7 +17,7 @@ COPY setup.packages.rocm.el8.sh setup.packages.rocm.el8.sh COPY builder.packages.rocm.el8.txt builder.packages.rocm.el8.txt RUN /setup.packages.rocm.el8.sh /builder.packages.rocm.el8.txt -ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100" +ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103" ENV GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS} # Install ROCM diff --git a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub20 b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub20 index b576b9ca7dc85f..841e94010e38b6 100644 --- a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub20 +++ b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub20 @@ -2,7 +2,7 @@ FROM ubuntu:20.04 ################################################################################ -ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100" +ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103" ENV GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS} # Install build dependencies diff --git a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub22 b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub22 index 1c325ec37f4b0c..8b167f594a1e76 100644 --- a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub22 +++ b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub22 @@ -2,7 +2,7 @@ FROM ubuntu:22.04 ################################################################################ -ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100" +ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103" ENV GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS} # Install build dependencies diff --git a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub24 b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub24 index 21875e44ef50e0..77caf99977ed7d 100644 --- a/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub24 +++ b/tensorflow/tools/tf_sig_build_dockerfiles/Dockerfile.rocm.ub24 @@ -2,7 +2,7 @@ FROM ubuntu:24.04 ################################################################################ -ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100" +ARG GPU_DEVICE_TARGETS="gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103" ENV GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS} # Install build dependencies diff --git a/tensorflow/tools/tf_sig_build_dockerfiles/setup.rocm.sh b/tensorflow/tools/tf_sig_build_dockerfiles/setup.rocm.sh index 7d3a78d5c50dad..06545bac680ef8 100755 --- a/tensorflow/tools/tf_sig_build_dockerfiles/setup.rocm.sh +++ b/tensorflow/tools/tf_sig_build_dockerfiles/setup.rocm.sh @@ -145,7 +145,7 @@ then echo "build:rocm_base --copt=-fclang-abi-compat=17" >> /etc/bazel.bazelrc fi -GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS:-"gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100"} +GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS:-"gfx908 gfx90a gfx940 gfx941 gfx942 gfx1030 gfx1100 gfx1103"} echo $ROCM_VERSION echo $ROCM_REPO diff --git a/third_party/xla/xla/stream_executor/device_description.h b/third_party/xla/xla/stream_executor/device_description.h index f6bb2e4a41ad4e..20af227bf7e810 100644 --- a/third_party/xla/xla/stream_executor/device_description.h +++ b/third_party/xla/xla/stream_executor/device_description.h @@ -207,13 +207,15 @@ class RocmComputeCapability { bool gfx11_rx7900() const { return gfx_version() == "gfx1100"; } + bool gfx11_r780m() const { return gfx_version() == "gfx1103"; } + bool has_nhwc_layout_support() const { return gfx9_mi100_or_later(); } bool has_bf16_dtype_support() const { return gfx9_mi100_or_later(); } bool has_fast_fp16_support() const { return gfx9_mi100_or_later() || gfx10_rx68xx() || gfx10_rx69xx() || - gfx11_rx7900(); + gfx11_rx7900() || gfx11_r780m(); } bool has_mfma_instr_support() const { return gfx9_mi100_or_later(); } @@ -256,7 +258,8 @@ class RocmComputeCapability { "gfx90a", // MI200 "gfx940", "gfx941", "gfx942", // MI300 "gfx1030", // RX68xx / RX69xx - "gfx1100" // RX7900 + "gfx1100", // RX7900 + "gfx1103" // Radeon 780M }; }; From a3c0d086f3af71c40fa955c48468ca04d6269861 Mon Sep 17 00:00:00 2001 From: fbyrne Date: Fri, 17 Jan 2025 22:16:07 +0000 Subject: [PATCH 2/2] Add support for GFX1103 --- third_party/xla/xla/stream_executor/rocm/rocm_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/xla/xla/stream_executor/rocm/rocm_context.cc b/third_party/xla/xla/stream_executor/rocm/rocm_context.cc index 9addbb1a29af4b..d3c52a47dc5bbc 100644 --- a/third_party/xla/xla/stream_executor/rocm/rocm_context.cc +++ b/third_party/xla/xla/stream_executor/rocm/rocm_context.cc @@ -92,7 +92,7 @@ bool GetReservedMemory(uint64_t* reserve) { } else if (compute_capability.gfx10_rx68xx() || compute_capability.gfx10_rx69xx()) { *reserve = RESERVED_GFX10_X; - } else if (compute_capability.gfx11_rx7900()) { + } else if (compute_capability.gfx11_rx7900() || compute_capability.gfx11_r780m()) { *reserve = RESERVED_GFX11_X; }