Skip to content

Commit

Permalink
AOCL: add v5.0 (spack#46964)
Browse files Browse the repository at this point in the history
  • Loading branch information
amd-toolchain-support authored Oct 17, 2024
1 parent 420266c commit 2da812c
Show file tree
Hide file tree
Showing 16 changed files with 595 additions and 212 deletions.
16 changes: 14 additions & 2 deletions var/spack/repos/builtin/packages/amd-aocl/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class AmdAocl(BundlePackage):

maintainers("amd-toolchain-support")

version("4.2", preferred=True)
version("5.0", preferred=True)
version("4.2")
version("4.1")
version("4.0")
version("3.2")
Expand All @@ -38,21 +39,32 @@ class AmdAocl(BundlePackage):
depends_on("amdblis threads=openmp")
depends_on("amdfftw +openmp")
depends_on("amdlibflame threads=openmp")
depends_on("aocl-sparse +openmp")
depends_on("aocl-da +openmp")
depends_on("aocl-compression +openmp")

with when("~openmp"):
depends_on("amdblis threads=none")
depends_on("amdfftw ~openmp")
depends_on("amdlibflame threads=none")
depends_on("aocl-sparse ~openmp")
depends_on("aocl-da ~openmp")
depends_on("aocl-compression ~openmp")

for vers in ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2"]:
for vers in ["2.2", "3.0", "3.1", "3.2", "4.0", "4.1", "4.2", "5.0"]:
with when(f"@={vers}"):
depends_on(f"amdblis@={vers}")
depends_on(f"amdfftw@={vers}")
depends_on(f"amdlibflame@={vers}")
depends_on("amdlibflame ^[virtuals=blas] amdblis")
depends_on(f"amdlibm@={vers}")
depends_on(f"amdscalapack@={vers}")
depends_on("amdscalapack ^[virtuals=blas] amdblis")
depends_on("amdscalapack ^[virtuals=lapack] amdlibflame")
depends_on(f"aocl-sparse@={vers}")
if Version(vers) >= Version("4.2"):
depends_on(f"aocl-compression@={vers}")
depends_on(f"aocl-crypto@={vers}")
depends_on(f"aocl-libmem@={vers}")
if Version(vers) >= Version("5.0"):
depends_on(f"aocl-da@={vers}")
28 changes: 12 additions & 16 deletions var/spack/repos/builtin/packages/amdblis/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import os

from llnl.util import tty

from spack.package import *
from spack.pkg.builtin.blis import BlisBase

Expand Down Expand Up @@ -39,10 +37,11 @@ class Amdblis(BlisBase):
license("BSD-3-Clause")

version(
"4.2",
sha256="0e1baf850ba0e6f99e79f64bbb0a59fcb838ddb5028e24527f52b407c3c62963",
"5.0",
sha256="5abb34972b88b2839709d0af8785662bc651c7806ccfa41d386d93c900169bc2",
preferred=True,
)
version("4.2", sha256="0e1baf850ba0e6f99e79f64bbb0a59fcb838ddb5028e24527f52b407c3c62963")
version("4.1", sha256="a05c6c7d359232580d1d599696053ad0beeedf50f3b88d5d22ee7d34375ab577")
version("4.0", sha256="cddd31176834a932753ac0fc4c76332868feab3e9ac607fa197d8b44c1e74a41")
version("3.2", sha256="5a400ee4fc324e224e12f73cc37b915a00f92b400443b15ce3350278ad46fff6")
Expand All @@ -66,18 +65,6 @@ def configure_args(self):
spec = self.spec
args = super().configure_args()

if not (
spec.satisfies(r"%[email protected]:4.2")
or spec.satisfies(r"%[email protected]:13.1")
or spec.satisfies(r"%clang@15:17")
):
tty.warn(
"AOCL has been tested to work with the following compilers "
"versions - [email protected]:13.1, [email protected]:4.2, and clang@15:17 "
"see the following aocl userguide for details: "
"https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf"
)

if spec.satisfies("+ilp64"):
args.append("--blas-int-size=64")

Expand Down Expand Up @@ -125,3 +112,12 @@ def create_symlink(self):
os.symlink("libblis-mt.a", "libblis.a")
if os.path.isfile("libblis-mt.so"):
os.symlink("libblis-mt.so", "libblis.so")

@property
def libs(self):
return find_libraries(
["libblis"] if self.spec.satisfies("threads=none") else ["libblis-mt"],
root=self.prefix,
shared=self.spec.satisfies("libs=shared"),
recursive=True,
)
26 changes: 10 additions & 16 deletions var/spack/repos/builtin/packages/amdfftw/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import os

from llnl.util import tty

from spack.build_environment import optimization_flags
from spack.package import *
from spack.pkg.builtin.fftw import FftwBase
Expand Down Expand Up @@ -43,10 +41,11 @@ class Amdfftw(FftwBase):
license("GPL-2.0-only")

version(
"4.2",
sha256="391ef7d933e696762e3547a35b58ab18d22a6cf3e199c74889bcf25a1d1fc89b",
"5.0",
sha256="bead6c08309a206f8a6258971272affcca07f11eb57b5ecd8496e2e7e3ead877",
preferred=True,
)
version("4.2", sha256="391ef7d933e696762e3547a35b58ab18d22a6cf3e199c74889bcf25a1d1fc89b")
version("4.1", sha256="f1cfecfcc0729f96a5bd61c6b26f3fa43bb0662d3fff370d4f73490c60cf4e59")
version("4.0", sha256="5f02cb05f224bd86bd88ec6272b294c26dba3b1d22c7fb298745fd7b9d2271c0")
version("3.2", sha256="31cab17a93e03b5b606e88dd6116a1055b8f49542d7d0890dbfcca057087b8d0")
Expand Down Expand Up @@ -158,6 +157,13 @@ class Amdfftw(FftwBase):

requires("target=x86_64:", msg="AMD FFTW available only on x86_64")

def flag_handler(self, name, flags):
(flags, _, _) = super().flag_handler(name, flags)
if name == "cflags":
if self.spec.satisfies("%gcc@14:"):
flags.append("-Wno-incompatible-pointer-types")
return (flags, None, None)

def configure(self, spec, prefix):
"""Configure function"""
# Base options
Expand All @@ -175,18 +181,6 @@ def configure(self, spec, prefix):
options.append("FC={0}".format(os.path.basename(spack_fc)))
options.append("F77={0}".format(os.path.basename(spack_fc)))

if not (
spec.satisfies(r"%[email protected]:4.2")
or spec.satisfies(r"%[email protected]:13.1")
or spec.satisfies(r"%clang@15:17")
):
tty.warn(
"AOCL has been tested to work with the following compilers "
"versions - [email protected]:13.1, [email protected]:4.2, and clang@15:17 "
"see the following aocl userguide for details: "
"https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf"
)

if spec.satisfies("+debug"):
options.append("--enable-debug")

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff -Naru a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2024-02-26 18:26:37.000000000 +0000
+++ b/CMakeLists.txt 2024-03-19 20:48:44.099094687 +0000
@@ -1197,3 +1197,12 @@
PROPERTY ADDITIONAL_CLEAN_FILES
${CMAKE_SOURCE_DIR}/build/FLA_config.h ${CMAKE_SOURCE_DIR}/include/
)
+
+# pkgconfig file
+set (prefix ${CMAKE_INSTALL_PREFIX})
+set (VERSION 4.2)
+configure_file (flame.pc.in flame.pc @ONLY)
+install (FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/flame.pc
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig
+ COMPONENT Development)
diff -Naru a/flame.pc.in b/flame.pc.in
--- a/flame.pc.in 1970-01-01 00:00:00.000000000 +0000
+++ b/flame.pc.in 2024-03-19 20:48:51.112058421 +0000
@@ -0,0 +1,9 @@
+prefix=@prefix@
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: libFLAME
+Description: AMD-optimized libFLAME library
+Version: @VERSION@
+Libs: -L${libdir} -lflame
+Cflags: -I${includedir}
47 changes: 20 additions & 27 deletions var/spack/repos/builtin/packages/amdlibflame/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
# ----------------------------------------------------------------------------\

from llnl.util import tty

import spack.build_systems.autotools
import spack.build_systems.cmake
from spack.package import *
Expand Down Expand Up @@ -49,11 +47,13 @@ class Amdlibflame(CMakePackage, LibflameBase):
maintainers("amd-toolchain-support")

license("BSD-3-Clause")

version(
"4.2",
sha256="93a433c169528ffba74a99df0ba3ce3d5b1fab9bf06ce8d2fd72ee84768ed84c",
"5.0",
sha256="3bee3712459a8c5bd728a521d8a4c8f46735730bf35d48c878d2fc45fc000918",
preferred=True,
)
version("4.2", sha256="93a433c169528ffba74a99df0ba3ce3d5b1fab9bf06ce8d2fd72ee84768ed84c")
version("4.1", sha256="8aed69c60d11cc17e058cabcb8a931cee4f343064ade3e73d3392b7214624b61")
version("4.0", sha256="bcb05763aa1df1e88f0da5e43ff86d956826cbea1d9c5ff591d78a3e091c66a4")
version("3.2", sha256="6b5337fb668b82d0ed0a4ab4b5af4e2f72e4cedbeeb4a8b6eb9a3ef057fb749a")
Expand All @@ -67,13 +67,6 @@ class Amdlibflame(CMakePackage, LibflameBase):
depends_on("fortran", type="build") # generated

variant("ilp64", default=False, when="@3.0.1: ", description="Build with ILP64 support")
variant(
"enable-aocl-blas",
default=False,
when="@4.1.0:",
description="Enables tight coupling with AOCL-BLAS library in order to use AOCL-BLAS\
internal routines",
)
variant(
"vectorization",
default="auto",
Expand All @@ -94,7 +87,7 @@ class Amdlibflame(CMakePackage, LibflameBase):
# Required dependencies
with when("build_system=cmake"):
generator("make")
depends_on("cmake@3.15.0:", type="build")
depends_on("cmake@3.22:", type="build")

conflicts("threads=pthreads", msg="pthread is not supported")
conflicts("threads=openmp", when="@:3", msg="openmp is not supported by amdlibflame < 4.0")
Expand All @@ -103,12 +96,14 @@ class Amdlibflame(CMakePackage, LibflameBase):
patch("aocc-2.2.0.patch", when="@:2", level=1)
patch("cray-compiler-wrapper.patch", when="@:3.0.0", level=1)
patch("supermat.patch", when="@4.0:4.1", level=1)
patch("libflame-pkgconfig.patch", when="@4.2")

provides("[email protected]", when="@2:")

depends_on("python+pythoncmd", type="build")
depends_on("gmake@4:", when="@3.0.1,3.1:", type="build")
for vers in ["4.1", "4.2"]:

for vers in ["4.1", "4.2", "5.0"]:
with when(f"@{vers}"):
depends_on(f"aocl-utils@{vers}")

Expand All @@ -128,9 +123,14 @@ def libs(self):

def flag_handler(self, name, flags):
if name == "cflags":
if (
self.spec.satisfies("%clang@16:")
or self.spec.satisfies("%[email protected]:")
or self.spec.satisfies("%gcc@14:")
):
flags.append("-Wno-implicit-function-declaration")
if self.spec.satisfies("%clang@16:") or self.spec.satisfies("%[email protected]:"):
flags.append("-Wno-error=incompatible-function-pointer-types")
flags.append("-Wno-implicit-function-declaration")
flags.append("-Wno-sometimes-uninitialized")
if name == "ldflags":
if self.spec.satisfies("^aocl-utils~shared"):
Expand All @@ -153,10 +153,13 @@ def cmake_args(self):
else:
args.append(self.define("ENABLE_AMD_FLAGS", True))

if spec.satisfies("threads=none"):
args.append(self.define("ENABLE_MULTITHREADING", False))

if spec.satisfies("@3.0.1: +ilp64"):
args.append(self.define("ENABLE_ILP64", True))

if spec.satisfies("@4.1.0: +enable-aocl-blas"):
if spec.satisfies("@4.2: ^[virtuals=blas] amdblis"):
args.append(self.define("ENABLE_AOCL_BLAS", True))
args.append("-DAOCL_ROOT:PATH={0}".format(spec["blas"].prefix))

Expand All @@ -170,6 +173,8 @@ def cmake_args(self):
else:
args.append(self.define("LF_ISA_CONFIG", spec.variants["vectorization"].value))

args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared"))

return args


Expand All @@ -179,18 +184,6 @@ def configure_args(self):
args = self.pkg.configure_args()
spec = self.spec

if not (
spec.satisfies(r"%[email protected]:4.2")
or spec.satisfies(r"%[email protected]:13.1")
or spec.satisfies(r"%clang@15:17")
):
tty.warn(
"AOCL has been tested to work with the following compilers "
"versions - [email protected]:13.1, [email protected]:4.2, and clang@15:17 "
"see the following aocl userguide for details: "
"https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf"
)

# From 3.2 version, amd optimized flags are encapsulated under:
# enable-amd-aocc-flags for AOCC compiler
# enable-amd-flags for all other compilers
Expand Down
31 changes: 11 additions & 20 deletions var/spack/repos/builtin/packages/amdlibm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import os

from llnl.util import tty

from spack.package import *


Expand All @@ -28,16 +26,17 @@ class Amdlibm(SConsPackage):
_name = "amdlibm"
homepage = "https://www.amd.com/en/developer/aocl/libm.html"
git = "https://github.com/amd/aocl-libm-ose.git"
url = "https://github.com/amd/aocl-libm-ose/archive/refs/tags/3.0.tar.gz"
url = "https://github.com/amd/aocl-libm-ose/archive/3.0.tar.gz"
maintainers("amd-toolchain-support")

license("BSD-3-Clause")

version(
"4.2",
sha256="58847b942e998b3f52eb41ae26403c7392d244fcafa707cbf23165aac24edd9e",
"5.0",
sha256="ba1d50c068938c9a927e37e5630f683b6149d7d5a95efffeb76e7c9a8bcb2b5e",
preferred=True,
)
version("4.2", sha256="58847b942e998b3f52eb41ae26403c7392d244fcafa707cbf23165aac24edd9e")
version("4.1", sha256="5bbbbc6bc721d9a775822eab60fbc11eb245e77d9f105b4fcb26a54d01456122")
version("4.0", sha256="038c1eab544be77598eccda791b26553d3b9e2ee4ab3f5ad85fdd2a77d015a7d")
version("3.2", sha256="c75b287c38a3ce997066af1f5c8d2b19fc460d5e56678ea81f3ac33eb79ec890")
Expand All @@ -54,7 +53,7 @@ class Amdlibm(SConsPackage):
depends_on("[email protected]:", type=("build", "run"))
depends_on("[email protected]:", type=("build"))
depends_on("mpfr", type=("link"))
for vers in ["4.1", "4.2"]:
for vers in ["4.1", "4.2", "5.0"]:
with when(f"@{vers}"):
depends_on(f"aocl-utils@{vers}")

Expand All @@ -66,29 +65,21 @@ class Amdlibm(SConsPackage):
patch("libm-ose-SconsSpack.patch", when="@3.1:4.2")

conflicts("%gcc@:9.1.0", msg="Minimum supported GCC version is 9.2.0")
conflicts("%[email protected]:", msg="Maximum supported GCC version is 13.1.0")
conflicts("%[email protected]:16.0", msg="supported Clang version is from 9 to 16")
conflicts("%clang@:9.0", msg="Minimum supported Clang version is 9")
conflicts("%[email protected]:", msg="Maximum supported Clang version is 17.0.0")
conflicts("%[email protected]:", msg="Maximum supported GCC version is 14.2.0")
conflicts("%[email protected]", msg="dependency on [email protected]")

def patch(self):
filter_file("14.1", "14.2", "scripts/site_scons/alm/check.py")

def build_args(self, spec, prefix):
"""Setting build arguments for amdlibm"""
args = [f"-j{determine_number_of_jobs(parallel=True)}", f"--prefix={prefix}"]

if self.spec.satisfies("@4.1: "):
args.append("--aocl_utils_install_path={0}".format(self.spec["aocl-utils"].prefix))

if not (
self.spec.satisfies(r"%[email protected]:4.2")
or self.spec.satisfies(r"%[email protected]:13.1")
or self.spec.satisfies(r"%clang@15:16")
):
tty.warn(
"AOCL has been tested to work with the following compilers\
versions - [email protected]:13.1, [email protected]:4.2, and clang@15:16\
see the following aocl userguide for details: \
https://www.amd.com/content/dam/amd/en/documents/developer/version-4-2-documents/aocl/aocl-4-2-user-guide.pdf"
)

# we are circumventing the use of
# Spacks compiler wrappers because
# SCons wipes out all environment variables.
Expand Down
Loading

0 comments on commit 2da812c

Please sign in to comment.