From 75992627eb55df736ed00d550b60c907198da67c Mon Sep 17 00:00:00 2001 From: ethanwee1 Date: Wed, 5 Feb 2025 18:06:34 +0000 Subject: [PATCH 01/12] [release/2.6] Enable wheels Revert "CONSOLIDATED COMMITS: Triton build updates" cc56ce612b3bb8b4bc6c56f196e96de5979f52ff Update triton.txt bc4b4d0cf49f185a8b311bc1d546a08708a87866 Include ROCm patch version unconditionally in triton version 347a719d20a4924d2dcbfd56f31e01eea08ff2b8 reduce min gcc version to 9.2 0223f80e537e2b8ef25626191fd69093ab9c9ff5 Add TRITON_WHEEL_VERSION_SUFFIX fbd335893bdfa53939cd76e05f798a262f1ef348 In https://github.com/ROCm/pytorch-private/commits/rocm6.4_internal_testing_gfx950/ Please enter the commit message for your changes. Lines starting --- .ci/docker/ci_commit_pins/triton.txt | 2 +- .github/scripts/build_triton_wheel.py | 35 ++++++++++++++++++++++++++- CMakeLists.txt | 6 ++--- version.txt | 2 +- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/.ci/docker/ci_commit_pins/triton.txt b/.ci/docker/ci_commit_pins/triton.txt index 79e9f872660c6..396be2dd54aee 100644 --- a/.ci/docker/ci_commit_pins/triton.txt +++ b/.ci/docker/ci_commit_pins/triton.txt @@ -1 +1 @@ -35c6c7c6284582b3f41c71c150e11b517acf074a +6da9e66008b58a7b8553f96c69021cca0d0028f0 diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index 6ae29da339eed..5b8864ac467b4 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import os +import re import shutil import sys from pathlib import Path @@ -47,6 +48,30 @@ def patch_init_py( with open(path, "w") as f: f.write(orig) +def get_rocm_version() -> str: + rocm_path = os.environ.get('ROCM_HOME') or os.environ.get('ROCM_PATH') or "/opt/rocm" + rocm_version = "0.0.0" + rocm_version_h = f"{rocm_path}/include/rocm-core/rocm_version.h" + if not os.path.isfile(rocm_version_h): + rocm_version_h = f"{rocm_path}/include/rocm_version.h" + # The file could be missing due to 1) ROCm version < 5.2, or 2) no ROCm install. + if os.path.isfile(rocm_version_h): + RE_MAJOR = re.compile(r"#define\s+ROCM_VERSION_MAJOR\s+(\d+)") + RE_MINOR = re.compile(r"#define\s+ROCM_VERSION_MINOR\s+(\d+)") + RE_PATCH = re.compile(r"#define\s+ROCM_VERSION_PATCH\s+(\d+)") + major, minor, patch = 0, 0, 0 + for line in open(rocm_version_h): + match = RE_MAJOR.search(line) + if match: + major = int(match.group(1)) + match = RE_MINOR.search(line) + if match: + minor = int(match.group(1)) + match = RE_PATCH.search(line) + if match: + patch = int(match.group(1)) + rocm_version = str(major)+"."+str(minor)+"."+str(patch) + return rocm_version def build_triton( *, @@ -62,7 +87,12 @@ def build_triton( if "MAX_JOBS" not in env: max_jobs = os.cpu_count() or 1 env["MAX_JOBS"] = str(max_jobs) - + if not release: + # Nightly binaries include the triton commit hash, i.e. 2.1.0+e6216047b8 + # while release build should only include the version, i.e. 2.1.0 + rocm_version = get_rocm_version() + version_suffix = f"+rocm{rocm_version}_{commit_hash[:10]}" + version += version_suffix with TemporaryDirectory() as tmpdir: triton_basedir = Path(tmpdir) / "triton" triton_pythondir = triton_basedir / "python" @@ -133,7 +163,10 @@ def build_triton( return Path.cwd() / conda_path.name # change built wheel name and version + rocm_version = get_rocm_version() + version_suffix = f"+rocm{rocm_version}_{commit_hash[:10]}" env["TRITON_WHEEL_NAME"] = triton_pkg_name + env["TRITON_WHEEL_VERSION_SUFFIX"] = version_suffix if with_clang_ldd: env["TRITON_BUILD_WITH_CLANG_LLD"] = "1" diff --git a/CMakeLists.txt b/CMakeLists.txt index c8af5f00b5c17..b944e769cc509 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,11 +54,11 @@ set(CMAKE_C_STANDARD # ---[ Utils include(cmake/public/utils.cmake) -# --- [ Check that minimal gcc version is 9.3+ -if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3) +# --- [ Check that minimal gcc version is 9.2+ +if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.2) message( FATAL_ERROR - "GCC-9.3 or newer is required to compile PyTorch, but found ${CMAKE_CXX_COMPILER_VERSION}" + "GCC-9.d or newer is required to compile PyTorch, but found ${CMAKE_CXX_COMPILER_VERSION}" ) endif() diff --git a/version.txt b/version.txt index 3d87ca93f8a9b..6a6a3d8e35c7a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.6.0a0 +2.6.1 From aafe6d75dcad3689e34b03748a9fd6148b63a286 Mon Sep 17 00:00:00 2001 From: Ethan Wee <158101733+ethanwee1@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:20:29 -0800 Subject: [PATCH 02/12] Lint --- .github/scripts/build_triton_wheel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index 5b8864ac467b4..82c22ab000659 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -87,7 +87,7 @@ def build_triton( if "MAX_JOBS" not in env: max_jobs = os.cpu_count() or 1 env["MAX_JOBS"] = str(max_jobs) - if not release: + if not release: # Nightly binaries include the triton commit hash, i.e. 2.1.0+e6216047b8 # while release build should only include the version, i.e. 2.1.0 rocm_version = get_rocm_version() From 4fb04c9dbfdc77fd299d8e303be79c6e482e5c5d Mon Sep 17 00:00:00 2001 From: Ethan Wee <158101733+ethanwee1@users.noreply.github.com> Date: Wed, 5 Feb 2025 10:32:09 -0800 Subject: [PATCH 03/12] change to rocmtriton --- .github/scripts/build_triton_wheel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index 82c22ab000659..9e1073bff649c 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -99,6 +99,7 @@ def build_triton( triton_repo = "https://github.com/openai/triton" if device == "rocm": triton_pkg_name = "pytorch-triton-rocm" + triton_repo = "https://github.com/ROCm/triton" elif device == "xpu": triton_pkg_name = "pytorch-triton-xpu" triton_repo = "https://github.com/intel/intel-xpu-backend-for-triton" From 9ed51c4dd303478408cb4eb1a284d6b35515446f Mon Sep 17 00:00:00 2001 From: Jithun Nair Date: Mon, 3 Jun 2024 18:40:04 +0000 Subject: [PATCH 04/12] Removing logic added by upstream to set PYTORCH_EXTRA_INSTALL_REQUIREMENTS since we plan to use builder repo to set it for older and newer branches. Otherwise we end up with duplicate triton dependency specification eg. PYTORCH_EXTRA_INSTALL_REQUIREMENTS='pytorch-triton-rocm==2.3.0+rocm6.1.0.4804a0dd4a | pytorch-triton-rocm==2.3.0+rocm6.1.0.4804a0dd4a' (cherry picked from commit 757cb0d45a6b9fd4b8e0183e40b86e77e06a61f2) --- .circleci/scripts/binary_populate_env.sh | 42 ------------------------ 1 file changed, 42 deletions(-) diff --git a/.circleci/scripts/binary_populate_env.sh b/.circleci/scripts/binary_populate_env.sh index 6167d56dcf7fd..d4ee499352e30 100755 --- a/.circleci/scripts/binary_populate_env.sh +++ b/.circleci/scripts/binary_populate_env.sh @@ -71,48 +71,6 @@ fi export PYTORCH_BUILD_NUMBER=1 -# Set triton version as part of PYTORCH_EXTRA_INSTALL_REQUIREMENTS -TRITON_VERSION=$(cat $PYTORCH_ROOT/.ci/docker/triton_version.txt) - -# Here PYTORCH_EXTRA_INSTALL_REQUIREMENTS is already set for the all the wheel builds hence append TRITON_CONSTRAINT -TRITON_CONSTRAINT="platform_system == 'Linux' and platform_machine == 'x86_64'" -if [[ "$PACKAGE_TYPE" =~ .*wheel.* && -n "${PYTORCH_EXTRA_INSTALL_REQUIREMENTS:-}" && ! "$PYTORCH_BUILD_VERSION" =~ .*xpu.* ]]; then - TRITON_REQUIREMENT="triton==${TRITON_VERSION}; ${TRITON_CONSTRAINT}" - if [[ -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*dev.* ]]; then - TRITON_SHORTHASH=$(cut -c1-8 $PYTORCH_ROOT/.ci/docker/ci_commit_pins/triton.txt) - TRITON_REQUIREMENT="pytorch-triton==${TRITON_VERSION}+git${TRITON_SHORTHASH}; ${TRITON_CONSTRAINT}" - fi - export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${PYTORCH_EXTRA_INSTALL_REQUIREMENTS} | ${TRITON_REQUIREMENT}" -fi - -# Set triton via PYTORCH_EXTRA_INSTALL_REQUIREMENTS for triton rocm package -if [[ "$PACKAGE_TYPE" =~ .*wheel.* && -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*rocm.* && $(uname) == "Linux" ]]; then - TRITON_REQUIREMENT="pytorch-triton-rocm==${TRITON_VERSION}; ${TRITON_CONSTRAINT}" - if [[ -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*dev.* ]]; then - TRITON_SHORTHASH=$(cut -c1-8 $PYTORCH_ROOT/.ci/docker/ci_commit_pins/triton.txt) - TRITON_REQUIREMENT="pytorch-triton-rocm==${TRITON_VERSION}+git${TRITON_SHORTHASH}; ${TRITON_CONSTRAINT}" - fi - if [[ -z "${PYTORCH_EXTRA_INSTALL_REQUIREMENTS:-}" ]]; then - export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${TRITON_REQUIREMENT}" - else - export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${PYTORCH_EXTRA_INSTALL_REQUIREMENTS} | ${TRITON_REQUIREMENT}" - fi -fi - -# Set triton via PYTORCH_EXTRA_INSTALL_REQUIREMENTS for triton xpu package -if [[ "$PACKAGE_TYPE" =~ .*wheel.* && -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*xpu.* && $(uname) == "Linux" ]]; then - TRITON_REQUIREMENT="pytorch-triton-xpu==${TRITON_VERSION}; ${TRITON_CONSTRAINT}" - if [[ -n "$PYTORCH_BUILD_VERSION" && "$PYTORCH_BUILD_VERSION" =~ .*dev.* ]]; then - TRITON_SHORTHASH=$(cut -c1-8 $PYTORCH_ROOT/.ci/docker/ci_commit_pins/triton-xpu.txt) - TRITON_REQUIREMENT="pytorch-triton-xpu==${TRITON_VERSION}+git${TRITON_SHORTHASH}; ${TRITON_CONSTRAINT}" - fi - if [[ -z "${PYTORCH_EXTRA_INSTALL_REQUIREMENTS:-}" ]]; then - export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${TRITON_REQUIREMENT}" - else - export PYTORCH_EXTRA_INSTALL_REQUIREMENTS="${PYTORCH_EXTRA_INSTALL_REQUIREMENTS} | ${TRITON_REQUIREMENT}" - fi -fi - USE_GLOO_WITH_OPENSSL="ON" if [[ "$GPU_ARCH_TYPE" =~ .*aarch64.* ]]; then USE_GLOO_WITH_OPENSSL="OFF" From e3e52d925231003c5e0c477ab7160a4d37e80f4c Mon Sep 17 00:00:00 2001 From: ethanwee1 Date: Wed, 12 Feb 2025 20:50:11 +0000 Subject: [PATCH 05/12] Adding in .git to triton wheel name and changing from _ to --- .github/scripts/build_triton_wheel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index 9e1073bff649c..f770181da3a27 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -165,7 +165,7 @@ def build_triton( # change built wheel name and version rocm_version = get_rocm_version() - version_suffix = f"+rocm{rocm_version}_{commit_hash[:10]}" + version_suffix = f"+rocm{rocm_version}.git{commit_hash[:10]}" env["TRITON_WHEEL_NAME"] = triton_pkg_name env["TRITON_WHEEL_VERSION_SUFFIX"] = version_suffix if with_clang_ldd: From 3118f447e44ed20af35d55eb099fe0b73c2ed89e Mon Sep 17 00:00:00 2001 From: Ethan Wee <158101733+ethanwee1@users.noreply.github.com> Date: Wed, 12 Feb 2025 13:46:43 -0800 Subject: [PATCH 06/12] Remove .git and change to git --- .github/scripts/build_triton_wheel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index f770181da3a27..b08f3dc66c4d6 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -165,7 +165,7 @@ def build_triton( # change built wheel name and version rocm_version = get_rocm_version() - version_suffix = f"+rocm{rocm_version}.git{commit_hash[:10]}" + version_suffix = f"+rocm{rocm_version}.{commit_hash[:10]}" env["TRITON_WHEEL_NAME"] = triton_pkg_name env["TRITON_WHEEL_VERSION_SUFFIX"] = version_suffix if with_clang_ldd: From a7be9d916cd40fff303bf8236bbbae73b53973df Mon Sep 17 00:00:00 2001 From: Jithun Nair Date: Wed, 12 Feb 2025 22:51:17 +0000 Subject: [PATCH 07/12] Update third_party/composable_kernel submodule with fix for __hneg --- third_party/composable_kernel | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/composable_kernel b/third_party/composable_kernel index 50ee4267e27b8..60c7f66251e41 160000 --- a/third_party/composable_kernel +++ b/third_party/composable_kernel @@ -1 +1 @@ -Subproject commit 50ee4267e27b875d149e642f4cebd47be1dc3b57 +Subproject commit 60c7f66251e41951ecb12e7c50975217178c64d2 From 49402a0b0a313007627702da372c9e062d787bb3 Mon Sep 17 00:00:00 2001 From: ethanwee1 Date: Thu, 13 Feb 2025 15:33:08 +0000 Subject: [PATCH 08/12] use .git with 8 characters --- .github/scripts/build_triton_wheel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index b08f3dc66c4d6..8b86c60ec7321 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -165,7 +165,7 @@ def build_triton( # change built wheel name and version rocm_version = get_rocm_version() - version_suffix = f"+rocm{rocm_version}.{commit_hash[:10]}" + version_suffix = f"+rocm{rocm_version}.git{commit_hash[:8]}" env["TRITON_WHEEL_NAME"] = triton_pkg_name env["TRITON_WHEEL_VERSION_SUFFIX"] = version_suffix if with_clang_ldd: From 311fe7007dbe0a1aa65fe34e70d73204540f9327 Mon Sep 17 00:00:00 2001 From: Jithun Nair <37884920+jithunnair-amd@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:22:14 +0530 Subject: [PATCH 09/12] Cleanup --- .github/scripts/build_triton_wheel.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/scripts/build_triton_wheel.py b/.github/scripts/build_triton_wheel.py index 8b86c60ec7321..3dab82a5810a4 100644 --- a/.github/scripts/build_triton_wheel.py +++ b/.github/scripts/build_triton_wheel.py @@ -91,7 +91,7 @@ def build_triton( # Nightly binaries include the triton commit hash, i.e. 2.1.0+e6216047b8 # while release build should only include the version, i.e. 2.1.0 rocm_version = get_rocm_version() - version_suffix = f"+rocm{rocm_version}_{commit_hash[:10]}" + version_suffix = f"+rocm{rocm_version}.git{commit_hash[:8]}" version += version_suffix with TemporaryDirectory() as tmpdir: triton_basedir = Path(tmpdir) / "triton" @@ -164,8 +164,6 @@ def build_triton( return Path.cwd() / conda_path.name # change built wheel name and version - rocm_version = get_rocm_version() - version_suffix = f"+rocm{rocm_version}.git{commit_hash[:8]}" env["TRITON_WHEEL_NAME"] = triton_pkg_name env["TRITON_WHEEL_VERSION_SUFFIX"] = version_suffix if with_clang_ldd: From 237023a26a62c4ddf24c15acd0e28954a7ac649b Mon Sep 17 00:00:00 2001 From: Jithun Nair <37884920+jithunnair-amd@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:27:58 +0530 Subject: [PATCH 10/12] Correct version --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 6a6a3d8e35c7a..e70b4523ae7ff 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.6.1 +2.6.0 From 9f692356eedf602411bdc2639b1aa66f894cb723 Mon Sep 17 00:00:00 2001 From: Jithun Nair <37884920+jithunnair-amd@users.noreply.github.com> Date: Thu, 13 Feb 2025 21:28:42 +0530 Subject: [PATCH 11/12] Update CMakeLists.txt --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b944e769cc509..3fc51fa382891 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,7 +58,7 @@ include(cmake/public/utils.cmake) if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.2) message( FATAL_ERROR - "GCC-9.d or newer is required to compile PyTorch, but found ${CMAKE_CXX_COMPILER_VERSION}" + "GCC-9.2 or newer is required to compile PyTorch, but found ${CMAKE_CXX_COMPILER_VERSION}" ) endif() From dc93c097dd628f89ee3912031bc667764a5257e2 Mon Sep 17 00:00:00 2001 From: Jithun Nair Date: Thu, 13 Feb 2025 22:46:11 +0000 Subject: [PATCH 12/12] Add related_commits --- related_commits | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 related_commits diff --git a/related_commits b/related_commits new file mode 100644 index 0000000000000..f7a03a8e8907e --- /dev/null +++ b/related_commits @@ -0,0 +1,10 @@ +ubuntu|pytorch|apex|release/1.6.0|31d60e599c2ecbe31d5bcf7e4b873366b8747aea|https://github.com/ROCm/apex +centos|pytorch|apex|release/1.6.0|31d60e599c2ecbe31d5bcf7e4b873366b8747aea|https://github.com/ROCm/apex +ubuntu|pytorch|torchvision|release/0.21|7af698794eded568735f9519593603c1ec889eba|https://github.com/pytorch/vision +centos|pytorch|torchvision|release/0.21|7af698794eded568735f9519593603c1ec889eba|https://github.com/pytorch/vision +ubuntu|pytorch|torchtext|release/0.18.0|9bed85d7a7ae13cf8c28598a88d8e461fe1afcb4|https://github.com/pytorch/text +centos|pytorch|torchtext|release/0.18.0|9bed85d7a7ae13cf8c28598a88d8e461fe1afcb4|https://github.com/pytorch/text +ubuntu|pytorch|torchdata|release/0.10|a4bed25873e071ecb4d4206a47b5326965283ad4|https://github.com/pytorch/data +centos|pytorch|torchdata|release/0.10|a4bed25873e071ecb4d4206a47b5326965283ad4|https://github.com/pytorch/data +ubuntu|pytorch|torchaudio|release/2.6|d8831425203385077a03c1d92cfbbe3bf2106008|https://github.com/pytorch/audio +centos|pytorch|torchaudio|release/2.6|d8831425203385077a03c1d92cfbbe3bf2106008|https://github.com/pytorch/audio