Skip to content

Commit

Permalink
Merge remote-tracking branch 'slyalin/mlir' into binary_eltwise_broad…
Browse files Browse the repository at this point in the history
…cast
  • Loading branch information
slyalin committed Jul 25, 2024
2 parents 516e201 + 1c34cbf commit 6ace93b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 32 deletions.
6 changes: 1 addition & 5 deletions cmake/tpp-mlir.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,7 @@ if (TPP_MLIR_DIR)
tpp_xsmm_runner_utils
)
function(add_tpp_mlir_includes target)
target_include_directories(${target}
PRIVATE
${TPP_MLIR_DIR}/../include
${TPP_MLIR_DIR}/include
${TPP_MLIR_DIR}/../runtime)
target_include_directories(${target} PRIVATE ${TPP_MLIR_DIR}/../include ${TPP_MLIR_DIR}/include)
endfunction()
function(add_tpp_mlir_libs target)
target_link_directories(${target} PRIVATE ${TPP_MLIR_DIR}/lib)
Expand Down
30 changes: 3 additions & 27 deletions src/common/transformations/src/transformations/mlir/mlir_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

#include "mlir_op.hpp"

#include <vector>
#include <algorithm>
#include <functional>
#include <memory>
#include <string>
#include <vector>

#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Pass/PassManager.h"

// TODO: Prune unused headers -- it's hard to understand needed ones
#include "llvm/ADT/SmallVector.h"
#include "llvm/MC/TargetRegistry.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/InitLLVM.h"
Expand Down Expand Up @@ -55,16 +54,8 @@
#include "mlir/Target/LLVMIR/ModuleTranslation.h"

#ifdef TPP_MLIR // If TPP is available
# if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
# include <dlfcn.h>
# else
# error "Unsupported OS"
# endif

# include "PerfRunnerUtils.h"
# include "TPP/PassBundles.h"
# include "TPP/Passes.h"
# include "openvino/util/file_util.hpp"
#include "TPP/PassBundles.h"
#include "TPP/Passes.h"
#endif

namespace {
Expand Down Expand Up @@ -264,19 +255,6 @@ namespace mlir {

using namespace ::mlir;

static std::string get_xsmm_runner_path() {
#if defined(__APPLE__) || defined(__linux__) || defined(__EMSCRIPTEN__)
// TODO: Add multiplatform shared library search support.
Dl_info info;
if (dladdr(reinterpret_cast<void*>(perf_start_timer), &info) == 0) {
llvm::errs() << "failed to find XSMM Runner library\n";
abort();
}
return ov::util::get_absolute_file_path(info.dli_fname);
#else
# error "Unsupported OS"
#endif
}

MLIREvaluate::MLIREvaluate(OwningOpRef<mlir::ModuleOp> _module) : module(std::move(_module)) {
if (true) {
Expand All @@ -303,8 +281,6 @@ MLIREvaluate::MLIREvaluate(OwningOpRef<mlir::ModuleOp> _module) : module(std::mo
engineOptions.transformer = optPipeline; // opt level looks to be overriden in lowerToLLVMIR, but is still used
// in `create` independently
engineOptions.llvmModuleBuilder = lowerToLLVMIR;
std::string xsmmLibPath = get_xsmm_runner_path();
engineOptions.sharedLibPaths = SmallVector<StringRef>{xsmmLibPath};
auto maybeEngine = mlir::ExecutionEngine::create(module.get(), engineOptions);
if (maybeEngine) {
engine = std::move(maybeEngine.get());
Expand Down

0 comments on commit 6ace93b

Please sign in to comment.