Skip to content

Commit

Permalink
Resolved failing test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwins990 committed Dec 4, 2024
1 parent 9946de0 commit d886f40
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 deletions.
36 changes: 16 additions & 20 deletions cmake/developer_package/compile_flags/os_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,47 +99,44 @@ endmacro()
# Checks whether compiler for passed language supports SVE code compilation
#

macro(ov_check_compiler_supports_sve lang flags)
macro(ov_check_compiler_supports_sve flags)
# Code to compile
set(SVE_CODE "
#include <arm_sve.h>
int main() {
svfloat64_t a;
a = svdup_n_f64(0);
(void)a; // to avoid warnings
return 0;
}")

# Save the current state of required flags
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})

# Set the flags necessary for compiling the test code with SVE support
set(CMAKE_REQUIRED_FLAGS "${CMAKE_${lang}_FLAGS_INIT} ${flags}")
set(CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS_INIT} ${flags}")

# Check if the source code compiles with the given flags for the specified language (C or C++)
if(lang STREQUAL "CXX")
CHECK_CXX_SOURCE_COMPILES("${SVE_CODE}" ${lang}_HAS_SVE)
else()
CHECK_C_SOURCE_COMPILES("${SVE_CODE}" ${lang}_HAS_SVE)
endif()
CHECK_CXX_SOURCE_COMPILES("${SVE_CODE}" CXX_HAS_SVE)

# If the compilation test is successful, set appropriate variables indicating support
if(${lang}_HAS_SVE)
set(${lang}_SVE_FOUND TRUE CACHE BOOL "SVE available on host")
set(${lang}_SVE_FOUND TRUE CACHE BOOL "${lang} SVE support")
set(${lang}_SVE_FLAGS "${flags}" CACHE STRING "${lang} SVE flags")
if(CXX_HAS_SVE)
set(CXX_SVE_FOUND TRUE CACHE BOOL "SVE available on host")
set(CXX_SVE_FOUND TRUE CACHE BOOL "CXX SVE support")
set(CXX_SVE_FLAGS "${flags}" CACHE STRING "CXX SVE flags")
endif()

# Restore the original state of required flags
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})

# If the compilation test fails, indicate that the support is not found
if(NOT ${lang}_SVE_FOUND)
set(${lang}_SVE_FOUND FALSE CACHE BOOL "${lang} SVE support")
set(${lang}_SVE_FLAGS "" CACHE STRING "${lang} SVE flags")
if(NOT CXX_SVE_FOUND)
set(CXX_SVE_FOUND FALSE CACHE BOOL "CXX SVE support")
set(CXX_SVE_FLAGS "" CACHE STRING "CXX SVE flags")
endif()

# Mark the variables as advanced to hide them in the default CMake GUI
mark_as_advanced(${lang}_SVE_FOUND ${lang}_SVE_FLAGS)
mark_as_advanced(CXX_SVE_FOUND CXX_SVE_FLAGS)
endmacro()

#
Expand Down Expand Up @@ -264,17 +261,16 @@ endmacro()
#
macro(ov_arm_sve_optimization_flags flags)
# Check for compiler SVE support
ov_check_compiler_supports_sve(CXX "-march=armv8-a+sve")
ov_check_compiler_supports_sve(C "-march=armv8-a+sve")

ov_check_compiler_supports_sve("-march=armv8-a+sve")

if(OV_COMPILER_IS_INTEL_LLVM)
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# nothing should be required here
elseif(ANDROID)
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(${flags} -Wno-unused-command-line-argument)
if(CXX_SVE_FOUND AND C_SVE_FOUND)
if(CXX_SVE_FOUND)
list(APPEND ${flags} -march=armv8-a+sve)
else()
message(WARNING "SVE is not supported on this Android ABI: ${ANDROID_ABI}")
Expand All @@ -287,7 +283,7 @@ macro(ov_arm_sve_optimization_flags flags)
set(${flags} -O2)

# Add flag for SVE if supported
if(CXX_SVE_FOUND AND C_SVE_FOUND)
if(CXX_SVE_FOUND)
list(APPEND ${flags} -march=armv8-a+sve)
endif()
if(NOT CMAKE_CL_64)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ BrgemmKernel::BrgemmKernel(size_t M,
ldb(ldb),
ldc(ldc),
b_transposed(b_transposed),
inType(inType),
b_accumulate(b_accumulate) {
inType(inType) {
// blocking M
bool is_bf16 = inType == ov::element::bf16;
M_blk = matmulOptimalM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class BrgemmKernel {
size_t packedBSize = 0;
size_t packedASize = 0;
ov::element::Type inType;
bool b_accumulate = false;
static constexpr size_t MHA_BRGEMM_KERNELS_NUM = 8;
static constexpr size_t matmulOptimalM = 32;
struct brgemmCtx {
Expand Down

0 comments on commit d886f40

Please sign in to comment.