Skip to content

Commit

Permalink
Fix TODO to use libxsmm for VNNI check (NFC)
Browse files Browse the repository at this point in the history
Does not change the semantics, just makes sure to use a libxsmm call
instead of macros.

Working towards plaidml#561
  • Loading branch information
rengolin committed May 24, 2023
1 parent 6ed4e7e commit 3a97a8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/TPP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ add_mlir_library(MLIRTPP

target_include_directories(MLIRTPP
PUBLIC
${XSMM_INCLUDE_DIRS}
$<BUILD_INTERFACE:${TPP_GEN_INCLUDE_DIR}>
$<BUILD_INTERFACE:${TPP_MAIN_INCLUDE_DIR}>
)
16 changes: 5 additions & 11 deletions lib/TPP/VNNIUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@
#include "mlir/IR/TypeUtilities.h"
#include "mlir/IR/Types.h"

#include "libxsmm.h"

namespace mlir {
namespace vnni {
namespace utils {

std::optional<int64_t> getVnniBlockingFactor(Type type) {
auto elementType = getElementTypeOrSelf(type);
if (!elementType.isBF16())
return std::nullopt;
// @ TODO we should call LIBXSMM here to query the
// VNNI packing factor we need to match to
#if defined(__x86_64__)
return 2;
#elif defined(__aarch64__)
return 4;
#else
#error Unsupported architecture
#endif
if (elementType.isBF16())
return libxsmm_cpuid_dot_pack_factor(LIBXSMM_DATATYPE_BF16);
return std::nullopt;
}

bool isBF16Type(Type type) {
Expand Down

0 comments on commit 3a97a8a

Please sign in to comment.