From 4f9fe6f9bf07333e7eaa282153068c24497fcdaa Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Fri, 29 Mar 2024 06:58:31 +0000 Subject: Adding 'logging' and 'tracing' variants to enable AOCL DTL trace and logging capabilities (#43414) --- var/spack/repos/builtin/packages/amdblis/package.py | 17 +++++++++++++++++ var/spack/repos/builtin/packages/amdlibflame/package.py | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/var/spack/repos/builtin/packages/amdblis/package.py b/var/spack/repos/builtin/packages/amdblis/package.py index bf78a22b44..33fd95aee4 100644 --- a/var/spack/repos/builtin/packages/amdblis/package.py +++ b/var/spack/repos/builtin/packages/amdblis/package.py @@ -55,6 +55,9 @@ class Amdblis(BlisBase): variant("aocl_gemm", default=False, when="@4.1:", description="aocl_gemm support") variant("suphandling", default=True, description="Small Unpacked Kernel handling") + variant("logging", default=False, description="Enable AOCL DTL Logging") + variant("tracing", default=False, description="Enable AOCL DTL Tracing") + def configure_args(self): spec = self.spec args = super().configure_args() @@ -95,6 +98,20 @@ class Amdblis(BlisBase): if spec.satisfies("@3.1:"): args.append("--disable-aocl-dynamic") + if spec.satisfies("+logging"): + filter_file( + "#define AOCL_DTL_LOG_ENABLE 0", + "#define AOCL_DTL_LOG_ENABLE 1", + f"{self.stage.source_path}/aocl_dtl/aocldtlcf.h", + ) + + if spec.satisfies("+tracing"): + filter_file( + "#define AOCL_DTL_TRACE_ENABLE 0", + "#define AOCL_DTL_TRACE_ENABLE 1", + f"{self.stage.source_path}/aocl_dtl/aocldtlcf.h", + ) + return args @run_after("install") diff --git a/var/spack/repos/builtin/packages/amdlibflame/package.py b/var/spack/repos/builtin/packages/amdlibflame/package.py index d63d7c57e8..c8aa228f0d 100644 --- a/var/spack/repos/builtin/packages/amdlibflame/package.py +++ b/var/spack/repos/builtin/packages/amdlibflame/package.py @@ -79,6 +79,9 @@ class Amdlibflame(CMakePackage, LibflameBase): description="Use hardware vectorization support", ) + variant("logging", default="False", description="Enable AOCL DTL Logging") + variant("tracing", default="False", description="Enable AOCL DTL Tracing") + # Build system build_system( conditional("cmake", when="@4.2:"), conditional("autotools", when="@:4.1"), default="cmake" @@ -215,6 +218,20 @@ class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder): aocl_utils_lib_path = spec["aocl-utils"].libs args.append("LIBAOCLUTILS_LIBRARY_PATH={0}".format(aocl_utils_lib_path)) + if spec.satisfies("+tracing"): + filter_file( + "#define AOCL_DTL_TRACE_ENABLE 0", + "#define AOCL_DTL_TRACE_ENABLE 1", + f"{self.stage.source_path}/aocl_dtl/aocldtlcf.h", + ) + + if spec.satisfies("+logging"): + filter_file( + "#define AOCL_DTL_LOG_ENABLE 0", + "#define AOCL_DTL_LOG_ENABLE 1", + f"{self.stage.source_path}/aocl_dtl/aocldtlcf.h", + ) + return args @when("@4.1:") -- cgit v1.2.3-70-g09d2