Updates to the build systems(CMake and Make) for LPGEMM compilation (#303)

- The current build systems have the following behaviour
  with regards to building "aocl_gemm" addon codebase(LPGEMM)
  when giving "amdzen" as the target architecture(fat-binary)
  - Make:  Attempts to compile LPGEMM kernels using the same
                compiler flags that the makefile fragments set for BLIS
                kernels, based on the compiler version.
  - CMake: With presets, it always enables the addon compilation
                 unless explicitly specified with the ENABLE_ADDON variable.

- This poses a bug with older compilers, owing to them not supporting
  BF16 or INT8 intrinsic compilation.

- This patch adds the functionality to check for GCC and Clang compiler versions,
  and disables LPGEMM compilation if GCC < 11.2 or Clang < 12.0.

- Make:  Updated the configure script to check for the compiler version
              if the addon is specified.
  CMake: Updated the main CMakeLists.txt to check for the compiler version
               if the addon is specified, and to also force-update the associated
               cache variable update. Also updated kernels/CMakeLists.txt to
               check if "aocl_gemm" remains in the ENABLE_ADDONS list after
               all the checks in the previous layers.

AMD-Internal: [CPUPL-7850]

Signed-off by : Vignesh Balasubramanian <Vignesh.Balasubramanian@amd.com>
This commit is contained in:
Balasubramanian, Vignesh
2026-01-16 19:39:55 +05:30
committed by GitHub
parent 9f9bfbed7f
commit 73911d5990
5 changed files with 77 additions and 7 deletions

View File

@@ -113,7 +113,9 @@ function(generate_kernel_targets kernel_target)
# Only generate the object library if there is at least one source file.
list(LENGTH LOCAL_LPGEMM_SOURCE_FILES size_lpgemm)
if (size_lpgemm GREATER 0)
# Check if aocl_gemm addon is enabled before building LPGEMM kernels
# ENABLE_ADDON is filtered in the main CMakeLists.txt based on compiler version
if((size_lpgemm GREATER 0) AND ("aocl_gemm" IN_LIST ENABLE_ADDON))
# Create an object library using the source file list above.
add_library(${kernel_target}_LPGEMM_KERNELS
OBJECT