From 00d3066b97a37008574c10d2faacab4cb7e99374 Mon Sep 17 00:00:00 2001 From: renjithravindrankannath <94420380+renjithravindrankannath@users.noreply.github.com> Date: Tue, 5 Mar 2024 15:16:31 -0800 Subject: [PATCH] migraphx: add v6.0.0 & v6.0.2 (#42918) * Updates for migraphx 6.0.0 & 6.0.2 * Style check error and audit check error fix * Adding patch for half-include-directory * The parameter GPU_TARGETS is used from 5.7 in migraphx * Adding rocmlir dependency in migraphx and 6.0 updates in rocmlir * Applying upcoming changes to make CK JIT optional and enable compilation on Windows in order to build without ck dependency --- .../packages/composable-kernel/package.py | 2 ++ ...-half-include-directory-migraphx-6.0.patch | 23 +++++++++++++++++++ .../builtin/packages/migraphx/package.py | 23 +++++++++++++++---- .../repos/builtin/packages/rocmlir/package.py | 6 +++-- 4 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 var/spack/repos/builtin/packages/migraphx/0003-add-half-include-directory-migraphx-6.0.patch diff --git a/var/spack/repos/builtin/packages/composable-kernel/package.py b/var/spack/repos/builtin/packages/composable-kernel/package.py index 5ffb8d7733..1ac7f930ec 100644 --- a/var/spack/repos/builtin/packages/composable-kernel/package.py +++ b/var/spack/repos/builtin/packages/composable-kernel/package.py @@ -81,6 +81,8 @@ def cmake_args(self): args.append(self.define_from_variant("GPU_TARGETS", "amdgpu_target")) if self.spec.satisfies("@5.6.0:"): args.append(self.define("INSTANCES_ONLY", "ON")) + args.append(self.define("CK_BUILD_JIT_LIB", "ON")) + args.append(self.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON")) if self.spec.satisfies("@:5.7"): args.append(self.define("CMAKE_CXX_FLAGS", "-O3")) return args diff --git a/var/spack/repos/builtin/packages/migraphx/0003-add-half-include-directory-migraphx-6.0.patch b/var/spack/repos/builtin/packages/migraphx/0003-add-half-include-directory-migraphx-6.0.patch new file mode 100644 index 0000000000..6133a2f767 --- /dev/null +++ b/var/spack/repos/builtin/packages/migraphx/0003-add-half-include-directory-migraphx-6.0.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a76fb11..0f589d0 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -57,7 +57,8 @@ else() + option(MIGRAPHX_ENABLE_PYTHON "Enable python bindings" ON) + endif() + +-find_path(HALF_INCLUDE_DIR half.hpp PATH_SUFFIXES half) ++find_path(HALF_INCLUDE_DIR half.hpp) ++ + if (NOT HALF_INCLUDE_DIR) + message(FATAL_ERROR "Could not find half.hpp - Please check that the install path of half.hpp has been added to CMAKE_PREFIX_PATH") + else() +@@ -278,7 +279,7 @@ if(BUILD_TESTING) + add_subdirectory(test) + endif() + add_subdirectory(tools) +- ++target_include_directories(migraphx PUBLIC "${NLOHMANN_JSON_INCLUDE} ${HALF_INCLUDE_DIR}") + set(DEST_DIR ${CMAKE_BINARY_DIR}) + file(GLOB backend_files ${CMAKE_SOURCE_DIR}/src/py/backend/*.py) + file(MAKE_DIRECTORY ${DEST_DIR}/lib/onnx_migraphx) diff --git a/var/spack/repos/builtin/packages/migraphx/package.py b/var/spack/repos/builtin/packages/migraphx/package.py index a15916eb57..c3a1ecf260 100644 --- a/var/spack/repos/builtin/packages/migraphx/package.py +++ b/var/spack/repos/builtin/packages/migraphx/package.py @@ -45,8 +45,20 @@ class Migraphx(CMakePackage): patch("0002-restrict-python-2.7-usage.patch", when="@:5.1") patch("0003-restrict-python-2.7-usage.patch", when="@5.2.0:5.4") patch("0004-restrict-python2.7-usage-for-5.5.0.patch", when="@5.5.0") - patch("0005-Adding-half-include-directory-path-migraphx.patch", when="@5.6.0:") + patch("0005-Adding-half-include-directory-path-migraphx.patch", when="@5.6.0:5.7") patch("0006-add-option-to-turn-off-ck.patch", when="@5.7") + patch( + "https://github.com/ROCm/AMDMIGraphX/commit/728bea3489c97c9e1ddda0a0ae527ffd2d70cb97.patch?full_index=1", + sha256="3a8afd32208aa4f59fb31f898d243287771ebd409c7af7a4a785c586081e3711", + when="@6.0:", + ) + + patch( + "https://github.com/ROCm/AMDMIGraphX/commit/624f8ef549522f64fdddad7f49a2afe1890b0b79.patch?full_index=1", + sha256="410d0fd49f5f65089cd4f540c530c85896708b4fd94c67d15c2c279158aea85d", + when="@6.0:", + ) + patch("0003-add-half-include-directory-migraphx-6.0.patch", when="@6.0:") depends_on("cmake@3.5:", type="build") depends_on("protobuf", type="link") @@ -85,8 +97,8 @@ class Migraphx(CMakePackage): depends_on(f"rocblas@{ver}", when=f"@{ver}") depends_on(f"miopen-hip@{ver}", when=f"@{ver}") - for ver in ["5.7.0", "5.7.1", "6.0.0", "6.0.2"]: - depends_on(f"composable-kernel@{ver}", when=f"@{ver}") + for ver in ["6.0.0", "6.0.2"]: + depends_on(f"rocmlir@{ver}", when=f"@{ver}") @property def cmake_python_hints(self): @@ -119,8 +131,11 @@ def cmake_args(self): if "@5.5.0:" in self.spec: args.append(self.define("CMAKE_CXX_FLAGS", "-I{0}".format(abspath))) args.append(self.define("MIGRAPHX_ENABLE_PYTHON", "OFF")) - if "@5.7" in self.spec: + if "@5.7:" in self.spec: args.append(self.define("MIGRAPHX_USE_COMPOSABLEKERNEL", "OFF")) + args.append( + self.define("GPU_TARGETS", "gfx906;gfx908;gfx90a;gfx1030;gfx1100;gfx1101;gfx1102") + ) return args def test(self): diff --git a/var/spack/repos/builtin/packages/rocmlir/package.py b/var/spack/repos/builtin/packages/rocmlir/package.py index f56a3650ce..ad16506d4f 100644 --- a/var/spack/repos/builtin/packages/rocmlir/package.py +++ b/var/spack/repos/builtin/packages/rocmlir/package.py @@ -14,9 +14,11 @@ class Rocmlir(CMakePackage): homepage = "https://github.com/ROCm/rocMLIR" git = "https://github.com/ROCm/rocMLIR.git" - url = "https://github.com/ROCm/rocMLIR/archive/refs/tags/rocm-6.0.0.tar.gz" + url = "https://github.com/ROCm/rocMLIR/archive/refs/tags/rocm-6.0.2.tar.gz" maintainers("srekolam") + version("6.0.2", sha256="6ed039e8045169bb64c10fb063c2e1753b8d52d6d56c60e001c929082be1f20b") + version("6.0.0", sha256="128915abdceaf5cef26a717d154f2b2f9466f6904f4490f158038878cedbf618") version("5.5.1", commit="8c29325e7e68e3248e863172bf0e7f97055d45ee") version("5.5.0", sha256="a5f62769d28a73e60bc8d61022820f050e97c977c8f6f6275488db31512e1f42") version("5.4.3", sha256="c0ba0f565e1c6614c9e6091a24cbef67b734a29e4a4ed7a8a57dc43f58ed8d53") @@ -48,7 +50,7 @@ def patch(self): depends_on("half") depends_on("pkgconfig", type="build") - for ver in ["5.3.0", "5.4.0", "5.4.3", "5.5.0", "5.5.1"]: + for ver in ["5.3.0", "5.4.0", "5.4.3", "5.5.0", "5.5.1", "6.0.0", "6.0.2"]: depends_on(f"hip@{ver}", when=f"@{ver}") depends_on(f"llvm-amdgpu@{ver}", when=f"@{ver}") depends_on(f"hsa-rocr-dev@{ver}", when=f"@{ver}")