Add new variants (OPENCL and HIP) for MIVisionX recipe and their dependencies correctly. (#32486)
* add the 2 variants OPENCL and HIP and their dependencies correctly for OPENCL - rocm-opencl, miopengemm and miopen-opencl for HIP - miopen-hip Earlier this was adding both the dependencies -miopen-hip and miopen-opencl for both the backends which did not seem correct. Also corrected the miopen-hip or miopen-opencl config.h in patch() depending on the backend Also added libjpeg-turbo as it is required for building ROCAl . the AMDRpp is still required for ROCAL inclusion but it currently does not build AMDRpp will be added as a new spack recipe and the mivisionx will refer to that as a dependency in future. * fix style errors * bump up the version for 5.2.3 release. tested +opencl, +hip and ~hip~opencl(cpu backend) Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
parent
c6d7557484
commit
457daf4be6
1 changed files with 84 additions and 40 deletions
|
@ -25,6 +25,7 @@ def url_for_version(self, version):
|
||||||
url = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/archive/rocm-{0}.tar.gz"
|
url = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/archive/rocm-{0}.tar.gz"
|
||||||
return url.format(version)
|
return url.format(version)
|
||||||
|
|
||||||
|
version("5.2.3", sha256="bbcdb5808d2bc880486dffa89f4111fb4b1d6dfe9b11fcd46fbd17939d057cf0")
|
||||||
version("5.2.1", sha256="201996b31f59a8d5e4cc3f17d17a5b81158a34d2a1c833b65ccc3dceb21d176f")
|
version("5.2.1", sha256="201996b31f59a8d5e4cc3f17d17a5b81158a34d2a1c833b65ccc3dceb21d176f")
|
||||||
version("5.2.0", sha256="fee620a1edd3bce18b2cec9ef26ec2afe0a85d6da8a37ed713ab0d1342382503")
|
version("5.2.0", sha256="fee620a1edd3bce18b2cec9ef26ec2afe0a85d6da8a37ed713ab0d1342382503")
|
||||||
version("5.1.3", sha256="62591d5caedc13832c3ccef629a88d9c2a43c884daad1124ddcb9c5f7d5470e9")
|
version("5.1.3", sha256="62591d5caedc13832c3ccef629a88d9c2a43c884daad1124ddcb9c5f7d5470e9")
|
||||||
|
@ -90,10 +91,16 @@ def url_for_version(self, version):
|
||||||
values=("Release", "Debug", "RelWithDebInfo"),
|
values=("Release", "Debug", "RelWithDebInfo"),
|
||||||
description="CMake build type",
|
description="CMake build type",
|
||||||
)
|
)
|
||||||
variant("backend", default="OPENCL", values=("HIP", "OPENCL"), description="backend type")
|
# Adding 2 variants OPENCL ,HIP which HIP as default. earlier to 5.0.0,OPENCL
|
||||||
|
# was the default but has change dto HIP from 5.0.0 onwards.
|
||||||
|
# when tested with HIP as true for versions before 5.1.0, build errors were encountered
|
||||||
|
# this was corrected with 5.2.0. Hence it was made as default starting with 5.2.0 onwards
|
||||||
|
|
||||||
|
variant("opencl", default=False, description="Use OPENCL as the backend")
|
||||||
|
variant("hip", default=True, description="Use HIP as backend")
|
||||||
|
|
||||||
def patch(self):
|
def patch(self):
|
||||||
if "@4.2.0" in self.spec:
|
if self.spec.satisfies("@4.2.0"):
|
||||||
filter_file(
|
filter_file(
|
||||||
"${ROCM_PATH}/opencl",
|
"${ROCM_PATH}/opencl",
|
||||||
self.spec["rocm-opencl"].prefix,
|
self.spec["rocm-opencl"].prefix,
|
||||||
|
@ -106,7 +113,7 @@ def patch(self):
|
||||||
"utilities/mv_deploy/CMakeLists.txt",
|
"utilities/mv_deploy/CMakeLists.txt",
|
||||||
string=True,
|
string=True,
|
||||||
)
|
)
|
||||||
if "@4.5.0:5.1" in self.spec:
|
if self.spec.satisfies("@4.5.0:5.1 + hip"):
|
||||||
filter_file(
|
filter_file(
|
||||||
"${ROCM_PATH}/miopen",
|
"${ROCM_PATH}/miopen",
|
||||||
self.spec["miopen-hip"].prefix.miopen,
|
self.spec["miopen-hip"].prefix.miopen,
|
||||||
|
@ -125,13 +132,20 @@ def patch(self):
|
||||||
"amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt",
|
"amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt",
|
||||||
string=True,
|
string=True,
|
||||||
)
|
)
|
||||||
|
if self.spec.satisfies("@5.1.3: + hip"):
|
||||||
def flag_handler(self, name, flags):
|
filter_file(
|
||||||
spec = self.spec
|
"${ROCM_PATH}/include/miopen/config.h",
|
||||||
protobuf = spec["protobuf"].prefix.include
|
"{0}/include/miopen/config.h".format(self.spec["miopen-hip"].prefix),
|
||||||
if name == "cxxflags":
|
"amd_openvx_extensions/CMakeLists.txt",
|
||||||
flags.append("-I{0}".format(protobuf))
|
string=True,
|
||||||
return (flags, None, None)
|
)
|
||||||
|
if self.spec.satisfies("@5.1.3: + opencl"):
|
||||||
|
filter_file(
|
||||||
|
"${ROCM_PATH}/include/miopen/config.h",
|
||||||
|
"{0}/include/miopen/config.h".format(self.spec["miopen-opencl"].prefix),
|
||||||
|
"amd_openvx_extensions/CMakeLists.txt",
|
||||||
|
string=True,
|
||||||
|
)
|
||||||
|
|
||||||
depends_on("cmake@3.5:", type="build")
|
depends_on("cmake@3.5:", type="build")
|
||||||
depends_on("ffmpeg@:4", type="build")
|
depends_on("ffmpeg@:4", type="build")
|
||||||
|
@ -142,14 +156,21 @@ def flag_handler(self, name, flags):
|
||||||
"+video+videoio+flann+photo+objdetect",
|
"+video+videoio+flann+photo+objdetect",
|
||||||
type="build",
|
type="build",
|
||||||
)
|
)
|
||||||
depends_on("rocm-opencl@3.5.0", when="@1.7")
|
depends_on("rocm-opencl@3.5.0", when="@1.7+opencl")
|
||||||
depends_on("rocm-cmake@3.5.0", type="build", when="@1.7")
|
depends_on("rocm-cmake@3.5.0", type="build", when="@1.7")
|
||||||
depends_on("miopen-opencl@3.5.0", when="@1.7")
|
depends_on("miopen-opencl@3.5.0", when="@1.7+opencl")
|
||||||
depends_on("miopengemm@1.1.6", when="@1.7")
|
depends_on("miopengemm@1.1.6", when="@1.7+opencl")
|
||||||
depends_on("openssl", when="@4.0.0:")
|
depends_on("openssl", when="@4.0.0:")
|
||||||
|
depends_on("libjpeg-turbo", type="build")
|
||||||
|
|
||||||
conflicts("^cmake@3.22:", when="@:5.0.0")
|
conflicts("^cmake@3.22:", when="@:5.0.0")
|
||||||
|
# need to choose atleast one backend and both cannot be set
|
||||||
|
# HIP as backend did not build for older releases 5.1.0 where
|
||||||
|
# OPENCL was default backend.
|
||||||
|
conflicts("+opencl+hip")
|
||||||
|
conflicts("+hip", when="@:5.1.0")
|
||||||
|
|
||||||
|
with when("+opencl"):
|
||||||
for ver in [
|
for ver in [
|
||||||
"3.7.0",
|
"3.7.0",
|
||||||
"3.8.0",
|
"3.8.0",
|
||||||
|
@ -168,20 +189,43 @@ def flag_handler(self, name, flags):
|
||||||
"5.1.3",
|
"5.1.3",
|
||||||
"5.2.0",
|
"5.2.0",
|
||||||
"5.2.1",
|
"5.2.1",
|
||||||
|
"5.2.3",
|
||||||
]:
|
]:
|
||||||
depends_on("rocm-opencl@" + ver, when="@" + ver)
|
depends_on("rocm-opencl@" + ver, when="@" + ver)
|
||||||
depends_on("miopengemm@" + ver, when="@" + ver)
|
depends_on("miopengemm@" + ver, when="@" + ver)
|
||||||
depends_on("miopen-opencl@" + ver, when="@" + ver)
|
depends_on("miopen-opencl@" + ver, when="@" + ver)
|
||||||
for ver in ["4.5.0", "4.5.2", "5.0.0", "5.0.2", "5.1.0", "5.1.3", "5.2.0", "5.2.1"]:
|
with when("+hip"):
|
||||||
|
for ver in [
|
||||||
|
"4.5.0",
|
||||||
|
"4.5.2",
|
||||||
|
"5.0.0",
|
||||||
|
"5.0.2",
|
||||||
|
"5.1.0",
|
||||||
|
"5.1.3",
|
||||||
|
"5.2.0",
|
||||||
|
"5.2.1",
|
||||||
|
"5.2.3",
|
||||||
|
]:
|
||||||
depends_on("miopen-hip@" + ver, when="@" + ver)
|
depends_on("miopen-hip@" + ver, when="@" + ver)
|
||||||
|
|
||||||
|
def flag_handler(self, name, flags):
|
||||||
|
spec = self.spec
|
||||||
|
protobuf = spec["protobuf"].prefix.include
|
||||||
|
if name == "cxxflags":
|
||||||
|
flags.append("-I{0}".format(protobuf))
|
||||||
|
return (flags, None, None)
|
||||||
|
|
||||||
def cmake_args(self):
|
def cmake_args(self):
|
||||||
spec = self.spec
|
spec = self.spec
|
||||||
protobuf = spec["protobuf"].prefix.include
|
protobuf = spec["protobuf"].prefix.include
|
||||||
args = [
|
args = [
|
||||||
self.define("CMAKE_CXX_FLAGS", "-I{0}".format(protobuf)),
|
self.define("CMAKE_CXX_FLAGS", "-I{0}".format(protobuf)),
|
||||||
self.define_from_variant("BACKEND", "backend"),
|
|
||||||
self.define("HIP_PATH", spec["hip"].prefix),
|
|
||||||
self.define("HSA_PATH", spec["hsa-rocr-dev"].prefix),
|
|
||||||
]
|
]
|
||||||
|
if self.spec.satisfies("+opencl"):
|
||||||
|
args.append(self.define("BACKEND", "OPENCL"))
|
||||||
|
args.append(self.define("HSA_PATH", spec["hsa-rocr-dev"].prefix))
|
||||||
|
if self.spec.satisfies("+hip"):
|
||||||
|
args.append(self.define("BACKEND", "HIP"))
|
||||||
|
args.append(self.define("HSA_PATH", spec["hsa-rocr-dev"].prefix))
|
||||||
|
args.append(self.define("HIP_PATH", spec["hip"].prefix))
|
||||||
return args
|
return args
|
||||||
|
|
Loading…
Reference in a new issue