CMake: compiler flags updated for lpgemm kernels under zen folder.

The "-mno-avx512f" compiler flag has been added for zen/lpgemm
source files to address an issue observed with the znver4 compiler
flag when using GCC installed through Spack. The error message
"unsupported instruction `vpcmpeqd'" was encountered, indicating
unsupported AVX-512F instructions. As a workaround, the
"-mno-avx512f" flag was introduced, ensuring that AVX-512F
instructions are disabled during compilation.

AMD-Internal: [CPUPL-6694]

Change-Id: I546475226fbfea4931d568fc1b928cf6c8699b61
This commit is contained in:
Chandrashekara K R
2025-04-28 18:00:40 +05:30
committed by Chandrashekara KR
parent 29f30c7863
commit b06c6f921b
2 changed files with 26 additions and 8 deletions

View File

@@ -640,10 +640,20 @@ endef
define make-kernels-lpgemm-rule
$(BASE_OBJ_KERNELS_PATH)/$(1)/%.o: $(KERNELS_PATH)/$(1)/%.$(3) $(BLIS_H_FLAT) $(MAKE_DEFS_MK_PATHS)
ifeq ($(ENABLE_VERBOSE),yes)
$(CC) $(call get-kernel-lpgemm-cflags-for,$(2)) -c $$< -o $$@
# disable AVX-512F instructions from being generated by the compiler for zen/lpgemm folder.
ifeq ($(findstring zen/lpgemm, $(1)), zen/lpgemm)
$(CC) $(call get-kernel-lpgemm-cflags-for,$(2)) -mno-avx512f -c $$< -o $$@
else
$(CC) $(call get-kernel-lpgemm-cflags-for,$(2)) -c $$< -o $$@
endif
else
@echo "Compiling $$@" $(call get-kernel-lpgemm-text-for,$(2))
@$(CC) $(call get-kernel-lpgemm-cflags-for,$(2)) -c $$< -o $$@
ifeq ($(findstring zen/lpgemm, $(1)), zen/lpgemm)
@echo "Compiling $$@" $(call get-kernel-lpgemm-text-for,$(2)) -mno-avx512f
@$(CC) $(call get-kernel-lpgemm-cflags-for,$(2)) -mno-avx512f -c $$< -o $$@
else
@echo "Compiling $$@" $(call get-kernel-lpgemm-text-for,$(2))
@$(CC) $(call get-kernel-lpgemm-cflags-for,$(2)) -c $$< -o $$@
endif
endif
endef

View File

@@ -4,7 +4,7 @@
An object-based framework for developing high-performance BLAS-like
libraries.
Copyright (C) 2023 - 2024, Advanced Micro Devices, Inc. All rights reserved.
Copyright (C) 2023 - 2025, Advanced Micro Devices, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -42,9 +42,13 @@ function(generate_kernel_targets kernel_target)
get_config_for_kernel_from_kconfig_map(LOCAL_CONFIG ${kernel_target} "${KCONFIG_MAP}")
# filter the lpgemm source files to a different array
set(LOCAL_LPEGMM_SOURCE_FILES ${LOCAL_SOURCE_FILES})
set(LOCAL_LPGEMM_SOURCE_FILES ${LOCAL_SOURCE_FILES})
list(FILTER LOCAL_SOURCE_FILES EXCLUDE REGEX ".*/lpgemm/.*")
list(FILTER LOCAL_LPEGMM_SOURCE_FILES INCLUDE REGEX ".*/lpgemm/.*")
list(FILTER LOCAL_LPGEMM_SOURCE_FILES INCLUDE REGEX ".*/lpgemm/.*")
# filter the zen/lpgemm source files to a different array
set(LOCAL_ZEN_LPGEMM_SOURCE_FILES ${LOCAL_LPGEMM_SOURCE_FILES})
list(FILTER LOCAL_ZEN_LPGEMM_SOURCE_FILES INCLUDE REGEX ".*/zen/lpgemm/.*")
# Only generate the object library if there is at least one source file.
list(LENGTH LOCAL_SOURCE_FILES size)
@@ -108,13 +112,17 @@ function(generate_kernel_targets kernel_target)
endif()
# Only generate the object library if there is at least one source file.
list(LENGTH LOCAL_LPEGMM_SOURCE_FILES size_lpgemm)
list(LENGTH LOCAL_LPGEMM_SOURCE_FILES size_lpgemm)
if (size_lpgemm GREATER 0)
# Create an object library using the source file list above.
add_library(${kernel_target}_LPGEMM_KERNELS
OBJECT
${LOCAL_LPEGMM_SOURCE_FILES}
${LOCAL_LPGEMM_SOURCE_FILES}
)
# disable AVX-512F instructions from being generated by the compiler for zen/lpgemm folder.
set_source_files_properties(${LOCAL_ZEN_LPGEMM_SOURCE_FILES} PROPERTIES COMPILE_OPTIONS "-mno-avx512f")
# Include the corresponding make_defs.cmake that holds the required compiler options.
include(${CMAKE_SOURCE_DIR}/config/${LOCAL_CONFIG}/make_defs.cmake)
# Use PRIVATE keyword for option setting since we do not want the