Skip to content

Commit a7da8ee

Browse files
committed
AOCL 5.2.2 GA Release
2 parents 9734fc1 + ebf8721 commit a7da8ee

454 files changed

Lines changed: 29981 additions & 7450 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 153 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ set(CMAKE_CXX_STANDARD 11)
4848
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
4949
set(CMAKE_CXX_EXTENSIONS OFF)
5050

51+
# Packages to include.
52+
include(GNUInstallDirs)
53+
include(CMakePackageConfigHelpers)
54+
5155
# Enable IDE folders for targets.
5256
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
5357

@@ -747,14 +751,52 @@ else()
747751
# Remove duplicates in the addon list, if they exist.
748752
list(REMOVE_DUPLICATES ENABLE_ADDON)
749753
message(" Configuring with addons:")
754+
# Check compiler version requirements for each addon
755+
set(FILTERED_ADDON_LIST "")
750756
foreach(ADDON ${ENABLE_ADDON})
751757
message(" ${ADDON}")
752758
if(NOT (EXISTS ${PROJECT_SOURCE_DIR}/addon/${ADDON}))
753759
message(FATAL_ERROR "Requested addon sub-directory does not exist! Cannot continue. \
754760
*** Please verify addon existence and name.")
755761
endif()
762+
763+
# Check if this is aocl_gemm addon and verify compiler version
764+
if("${ADDON}" STREQUAL "aocl_gemm")
765+
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
766+
# aocl_gemm addon (LPGEMM) requires GCC 11.2 or newer
767+
# due to AVX-512 intrinsics and optimization requirements.
768+
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 11.2.0)
769+
message(WARNING "aocl_gemm addon requires GCC 11.2 or newer.")
770+
message(WARNING "Current GCC version is ${CMAKE_C_COMPILER_VERSION}.")
771+
message(WARNING "Skipping aocl_gemm addon.")
772+
continue()
773+
endif()
774+
elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
775+
# aocl_gemm addon (LPGEMM) requires Clang 12.0 or newer
776+
# due to AVX-512 intrinsics and C++17 requirements.
777+
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 12.0.0)
778+
message(WARNING "aocl_gemm addon requires Clang 12.0 or newer.")
779+
message(WARNING "Current Clang version is ${CMAKE_C_COMPILER_VERSION}.")
780+
message(WARNING "Skipping aocl_gemm addon.")
781+
continue()
782+
endif()
783+
endif()
784+
endif()
785+
list(APPEND FILTERED_ADDON_LIST ${ADDON})
756786
endforeach()
757-
set(ENABLE_ADDONS_01 1)
787+
788+
# Update ENABLE_ADDON with filtered list
789+
set(ENABLE_ADDON ${FILTERED_ADDON_LIST})
790+
# Also update the cache to reflect the filtered list
791+
set(ENABLE_ADDON ${FILTERED_ADDON_LIST} CACHE STRING "Filtered addon list" FORCE)
792+
793+
list(LENGTH ENABLE_ADDON addon_count)
794+
if(addon_count GREATER 0)
795+
set(ENABLE_ADDONS_01 1)
796+
else()
797+
message(" All addons were filtered out due to compatibility issues.")
798+
set(ENABLE_ADDONS_01 0)
799+
endif()
758800
endif()
759801
cmake_print_variables(ENABLE_SANDBOX)
760802
if(ENABLE_SANDBOX STREQUAL "")
@@ -1332,69 +1374,133 @@ if(NOT WIN32)
13321374
@ONLY
13331375
)
13341376
endif()
1335-
include(GNUInstallDirs)
13361377

13371378
if(BUILD_SHARED_LIBS)
1338-
# Build shared library.
1339-
add_library(libblis-shared SHARED ${OBJECT_LIBRARIES})
1340-
target_link_libraries(libblis-shared PRIVATE ${LDFLAGS})
1341-
set_target_properties(libblis-shared PROPERTIES LINKER_LANGUAGE C VERSION ${VERSION} SOVERSION ${SO_VERSION_MAJOR})
1342-
set_target_properties(libblis-shared PROPERTIES POSITION_INDEPENDENT_CODE ON)
1343-
if(THREADING_MODEL STREQUAL "openmp")
1344-
if((NOT ${OpenMP_libomp_LIBRARY} STREQUAL "") AND (NOT WIN32))
1345-
target_link_libraries(libblis-shared PRIVATE ${OpenMP_libomp_LIBRARY})
1346-
else()
1347-
target_link_libraries(libblis-shared PRIVATE OpenMP::OpenMP_C)
1348-
endif()
1349-
endif()
1350-
add_dependencies(libblis-shared flat-header)
1351-
if(ENABLE_CBLAS)
1352-
add_dependencies(libblis-shared flat-cblas-header)
1353-
endif()
1354-
# Add headers as a property to the library.
1355-
set_target_properties(libblis-shared PROPERTIES PUBLIC_HEADER "${BLIS_PUBLIC_HEADERS}")
1356-
set_target_properties(libblis-shared PROPERTIES OUTPUT_NAME ${LIBBLIS_SHARED})
1357-
# Install targets for shared.
1358-
install(TARGETS libblis-shared LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1359-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1360-
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1361-
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
1362-
set(libblis_depends libblis-shared)
1379+
# Build shared library with proper target name
1380+
add_library(blis_shared SHARED ${OBJECT_LIBRARIES})
1381+
set_target_properties(blis_shared PROPERTIES
1382+
VERSION ${VERSION}
1383+
SOVERSION ${SO_VERSION_MAJOR}
1384+
OUTPUT_NAME ${LIBBLIS_SHARED}
1385+
)
13631386
endif()
13641387
if(BUILD_STATIC_LIBS OR NOT BUILD_SHARED_LIBS)
1365-
# Build static library.
1366-
add_library(libblis-static STATIC ${OBJECT_LIBRARIES})
1367-
set_target_properties(libblis-static PROPERTIES LINKER_LANGUAGE C)
1368-
# Setting this for static to fix issues where test programs built with gcc 9.4.0 fail to link versions of BLIS build with AOCC 4.0.0.
1369-
set_target_properties(libblis-static PROPERTIES POSITION_INDEPENDENT_CODE ON)
1370-
add_dependencies(libblis-static flat-header)
1371-
if(ENABLE_CBLAS)
1372-
add_dependencies(libblis-static flat-cblas-header)
1388+
# Build static library with proper target name.
1389+
add_library(blis_static STATIC ${OBJECT_LIBRARIES})
1390+
set_target_properties(blis_static PROPERTIES
1391+
OUTPUT_NAME ${LIBBLIS_STATIC}
1392+
)
1393+
endif()
1394+
1395+
# Create the main blis target that points to the preferred library type
1396+
# Priority: shared if available, otherwise static
1397+
if(BUILD_SHARED_LIBS AND TARGET blis_shared)
1398+
add_library(blis ALIAS blis_shared)
1399+
# Create the AOCL::BLIS alias pointing directly to the real target
1400+
add_library(AOCL::BLIS ALIAS blis_shared) # Point to real target, not alias
1401+
# Create the AOCL::BLAS alias pointing directly to the real target
1402+
add_library(AOCL::BLAS ALIAS blis_shared) # Point to real target, not alias
1403+
elseif(TARGET blis_static)
1404+
add_library(blis ALIAS blis_static)
1405+
# Create the AOCL::BLIS alias pointing directly to the real target
1406+
add_library(AOCL::BLIS ALIAS blis_static) # Point to real target, not alias
1407+
# Create the AOCL::BLAS alias pointing directly to the real target
1408+
add_library(AOCL::BLAS ALIAS blis_static) # Point to real target, not alias
1409+
endif()
1410+
1411+
# Also create specific aliases for explicit usage
1412+
if(TARGET blis_shared)
1413+
add_library(AOCL::BLIS_shared ALIAS blis_shared)
1414+
# Create the AOCL::BLAS_shared alias as well
1415+
add_library(AOCL::BLAS_shared ALIAS blis_shared)
1416+
endif()
1417+
if(TARGET blis_static)
1418+
add_library(AOCL::BLIS_static ALIAS blis_static)
1419+
# Create the AOCL::BLAS_static alias as well
1420+
add_library(AOCL::BLAS_static ALIAS blis_static)
1421+
endif()
1422+
1423+
foreach(target IN ITEMS blis_shared blis_static)
1424+
if(TARGET ${target})
1425+
target_include_directories(${target}
1426+
PUBLIC
1427+
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include/${BLIS_CONFIG_FAMILY}>
1428+
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
1429+
PRIVATE
1430+
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/frame/include>
1431+
)
1432+
1433+
add_dependencies(${target} flat-header)
1434+
if(ENABLE_CBLAS)
1435+
add_dependencies(${target} flat-cblas-header)
1436+
endif()
1437+
1438+
target_link_libraries(${target} PUBLIC ${LDFLAGS})
1439+
1440+
if(THREADING_MODEL STREQUAL "openmp")
1441+
if((NOT ${OpenMP_libomp_LIBRARY} STREQUAL "") AND (NOT WIN32))
1442+
target_link_libraries(${target} PUBLIC ${OpenMP_libomp_LIBRARY})
1443+
else()
1444+
target_link_libraries(${target} PUBLIC OpenMP::OpenMP_C)
1445+
endif()
1446+
endif()
1447+
1448+
set_target_properties(${target} PROPERTIES
1449+
LINKER_LANGUAGE C
1450+
POSITION_INDEPENDENT_CODE ON
1451+
)
13731452
endif()
1374-
# Add headers as a property to the library.
1375-
set_target_properties(libblis-static PROPERTIES PUBLIC_HEADER "${BLIS_PUBLIC_HEADERS}")
1376-
set_target_properties(libblis-static PROPERTIES OUTPUT_NAME ${LIBBLIS_STATIC})
1377-
# Install targets.
1378-
install(TARGETS libblis-static LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1379-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1380-
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1381-
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
1382-
list(APPEND libblis_depends libblis-static)
1453+
endforeach()
1454+
1455+
# Installation rules
1456+
if(BUILD_SHARED_LIBS AND TARGET blis_shared)
1457+
install(TARGETS blis_shared
1458+
EXPORT blisTargets
1459+
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1460+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1461+
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1462+
INCLUDES DESTINATION ${CMAKE_INSTALL_PREFIX}/include
1463+
)
13831464
endif()
13841465

1466+
if((BUILD_STATIC_LIBS OR NOT BUILD_SHARED_LIBS) AND TARGET blis_static)
1467+
install(TARGETS blis_static
1468+
EXPORT blisTargets
1469+
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1470+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1471+
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
1472+
INCLUDES DESTINATION ${CMAKE_INSTALL_PREFIX}/include
1473+
)
1474+
endif()
1475+
1476+
# Install headers
1477+
install(FILES ${BLIS_PUBLIC_HEADERS}
1478+
DESTINATION ${CMAKE_INSTALL_PREFIX}/include
1479+
)
1480+
13851481
if(NOT WIN32)
13861482
# Install package-config file.
13871483
install(FILES ${CMAKE_BINARY_DIR}/${PC_OUT_FILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig)
13881484
endif()
13891485

13901486
# Set libblis to the shared or static libblis depending on the option setting.
1391-
if(TEST_WITH_SHARED)
1392-
set(libblis_link libblis-shared)
1487+
if(TEST_WITH_SHARED AND TARGET blis_shared)
1488+
set(libblis_link blis_shared)
1489+
elseif(TARGET blis_static)
1490+
set(libblis_link blis_static)
13931491
else()
1394-
set(libblis_link libblis-static)
1492+
message(FATAL_ERROR "No suitable BLIS library target found")
13951493
endif()
13961494

13971495
# --- Primary targets ---
1496+
set(libblis_depends "")
1497+
if(TARGET blis_shared)
1498+
list(APPEND libblis_depends blis_shared)
1499+
endif()
1500+
if(TARGET blis_static)
1501+
list(APPEND libblis_depends blis_static)
1502+
endif()
1503+
13981504
add_custom_target(libblis DEPENDS ${libblis_depends})
13991505
add_custom_target(libs DEPENDS ${libblis})
14001506

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,10 @@ endif # ifeq ($(IS_WIN),no)
12471247
# --- Query current configuration ---
12481248

12491249
showconfig: check-env
1250+
@echo "CC (C compiler): $(CC)"
1251+
@echo "CXX (C++ compiler): $(CXX)"
1252+
@echo "CFLAGS: $(CFLAGS)"
1253+
@echo "-------------------------"
12501254
@echo "configuration family: $(CONFIG_NAME)"
12511255
@echo "sub-configurations: $(CONFIG_LIST)"
12521256
@echo "requisite kernels sets: $(KERNEL_LIST)"

addon/CMakeLists.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,11 @@ function(generate_addon_targets addon_target)
166166
set_target_properties(${addon_target}_C99_KERNEL_ADDON PROPERTIES FOLDER object-libs-targets)
167167
endif()
168168

169-
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") AND (CMAKE_C_COMPILER_VERSION VERSION_LESS 11.2.0))
170-
# Collect all subdirectory paths that have at least one file with suffix in ADDON_CXX_SUFS list.
171-
get_filepaths_with_suffixes(LOCAL_SOURCE_CXX_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${addon_target}" "${ADDON_CXX_SUFS}")
172-
endif()
169+
# Note: C++ files (JIT code) are not collected here.
170+
# The main CMakeLists.txt already filters out aocl_gemm addon for compilers
171+
# that don't support BF16 intrinsics (GCC < 11.2, Clang < 12.0).
172+
# For supported compilers, we only use C files with intrinsics, not JIT.
173+
set(LOCAL_SOURCE_CXX_FILES "")
173174

174175
# Only generate the object library if there is at least one source file.
175176
list(LENGTH LOCAL_SOURCE_CXX_FILES size)

addon/aocl_gemm/frame/bf16bf16f32/lpgemm_bf16.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ LPGEMM_5LOOP_AVX512BF16(bfloat16,bfloat16,float,bf16bf16f32of32)
343343
#if (defined(BLIS_KERNELS_ZEN4) && (!defined(LPGEMM_BF16_JIT)))
344344
// Handle using LPGEMV when m or/and n equal to 1
345345
// The avx512 check will be removed when avx2 kernels added in future
346-
if ( (n == 1) || ( m == 1 ) )
346+
// Avoiding m == 1 rerouting on AVX512 codepath for now
347+
if ( n == 1 )
347348
{
348349
lpgemv_rowvar_bf16bf16f32of32( m, n, k,
349350
a, rs_a, cs_a, mtag_a,

bench/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ endif
9494
#BLIS_LIB := $(BLIS_LIB_PATH)/libblis-mt.a
9595

9696
# BLAS library path(s). This is where the BLAS libraries reside.
97-
BLAS_LIB_PATH := $(HOME)/mylibs/openblas/lib
97+
BLAS_LIB_PATH := /usr/lib/x86_64-linux-gnu
9898

9999
MKL_LIB_PATH := ${MKLROOT}/lib/intel64
100100

bench/bench_amaxv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ int main( int argc, char** argv )
9494
printf("Error opening output file %s\n", argv[2]);
9595
exit(1);
9696
}
97+
if (argc > 3)
98+
{
99+
n_repeats = atoi(argv[3]);
100+
}
97101

98102
fprintf(fout, "Func Dt n incx max_index gflops\n");
99103

@@ -102,7 +106,7 @@ int main( int argc, char** argv )
102106
char tmp[256]; // to store function name, line no present in logs.
103107

104108
// {S,D,C,Z} {n incx}
105-
while (fscanf(fin, "%s %c " INT_FS INT_FS " \n",
109+
while (fscanf(fin, "%s %c " INT_FS INT_FS"%*[^\n]",
106110
tmp, &dt_ch, &n, &incx) == 4)
107111
{
108112

bench/bench_asumv.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,29 @@ int main( int argc, char** argv )
6767
FILE* fin = NULL;
6868
FILE* fout = NULL;
6969

70-
n_repeats = N_REPEAT; // This macro will get from Makefile.
70+
n_repeats = N_REPEAT; // This macro will get from Makefile.
7171

7272
if (argc < 3)
73-
{
74-
printf("Usage: ./test_asumv_XX.x input.csv output.csv\n");
75-
exit(1);
76-
}
73+
{
74+
printf("Usage: ./test_asumv_XX.x input.csv output.csv\n");
75+
exit(1);
76+
}
7777
fin = fopen(argv[1], "r");
7878
if (fin == NULL)
79-
{
80-
printf("Error opening the file %s\n", argv[1]);
81-
exit(1);
82-
}
79+
{
80+
printf("Error opening the file %s\n", argv[1]);
81+
exit(1);
82+
}
8383
fout = fopen(argv[2], "w");
8484
if (fout == NULL)
85-
{
86-
printf("Error opening output file %s\n", argv[2]);
87-
exit(1);
88-
}
85+
{
86+
printf("Error opening output file %s\n", argv[2]);
87+
exit(1);
88+
}
89+
if (argc > 3)
90+
{
91+
n_repeats = atoi(argv[3]);
92+
}
8993

9094
fprintf(fout, "Func Dt n incx gflops\n");
9195

@@ -95,7 +99,7 @@ int main( int argc, char** argv )
9599

96100

97101
// {S,D,C,Z} {n incx}
98-
while (fscanf(fin, "%s %c " INT_FS INT_FS "\n",
102+
while (fscanf(fin, "%s %c " INT_FS INT_FS"%*[^\n]",
99103
tmp, &dt_ch, &n, &incx) == 4)
100104
{
101105

bench/bench_axpbyv.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ int main( int argc, char** argv )
8383
printf( "Error opening output file %s\n", argv[2] );
8484
exit( 1 );
8585
}
86+
if (argc > 3)
87+
{
88+
n_repeats = atoi(argv[3]);
89+
}
8690

8791
#ifdef DEBUG
8892
fprintf( fout, "gflops\n" );
@@ -98,7 +102,7 @@ int main( int argc, char** argv )
98102

99103
// {function name} {S, D, C, Z} {n}
100104
// {alpha_r} {alpha_i} {incx} {beta_r} {beta_i} {incy}
101-
while ( fscanf( fin, "%s %c " INT_FS " %lf %lf " INT_FS " %lf %lf " INT_FS "\n",
105+
while ( fscanf( fin, "%s %c " INT_FS " %lf %lf " INT_FS " %lf %lf " INT_FS"%*[^\n]",
102106
tmp, &dt_ch, &n,
103107
&alpha_r, &alpha_i, &incx, &beta_r, &beta_i, &incy ) == 9 )
104108
{

0 commit comments

Comments
 (0)