Skip to content

Commit

Permalink
fix(compiler): move the use of conflicting symbols to the runtime lib
Browse files Browse the repository at this point in the history
  • Loading branch information
youben11 authored and BourgerieQuentin committed Jul 5, 2024
1 parent fac5c0a commit 8cf8d99
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_RUNTIME_UTILS_H
#define CONCRETELANG_RUNTIME_UTILS_H

#include "llvm/Support/TargetSelect.h"

namespace mlir {
namespace concretelang {

// Mainly a wrapper to some LLVM functions. The reason to have this wrapper is
// to avoid linking conflicts between the python binary extension, and LLVM.
void LLVMInitializeNativeTarget();

} // namespace concretelang
} // namespace mlir

#endif
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
add_compile_options(-fsized-deallocation)

if(CONCRETELANG_CUDA_SUPPORT)
add_library(ConcretelangRuntime SHARED context.cpp simulation.cpp wrappers.cpp DFRuntime.cpp key_manager.cpp
add_library(ConcretelangRuntime SHARED context.cpp utils.cpp simulation.cpp wrappers.cpp DFRuntime.cpp key_manager.cpp
GPUDFG.cpp)
target_link_libraries(ConcretelangRuntime PRIVATE hwloc)
else()
add_library(ConcretelangRuntime SHARED context.cpp simulation.cpp wrappers.cpp DFRuntime.cpp key_manager.cpp
add_library(ConcretelangRuntime SHARED context.cpp utils.cpp simulation.cpp wrappers.cpp DFRuntime.cpp key_manager.cpp
GPUDFG.cpp)
endif()

Expand Down
15 changes: 15 additions & 0 deletions compilers/concrete-compiler/compiler/lib/Runtime/utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#include "concretelang/Runtime/utils.h"

namespace mlir {
namespace concretelang {
void LLVMInitializeNativeTarget() {
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
}
} // namespace concretelang
} // namespace mlir
4 changes: 2 additions & 2 deletions compilers/concrete-compiler/compiler/lib/Support/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "concretelang/Dialect/RT/Transforms/Passes.h"
#include "concretelang/Dialect/TFHE/Analysis/ExtractStatistics.h"
#include "concretelang/Dialect/TFHE/Transforms/Transforms.h"
#include "concretelang/Runtime/utils.h"
#include "concretelang/Support/CompilerEngine.h"
#include "concretelang/Support/Error.h"
#include "concretelang/Support/Pipeline.h"
Expand Down Expand Up @@ -611,8 +612,7 @@ std::unique_ptr<llvm::Module>
lowerLLVMDialectToLLVMIR(mlir::MLIRContext &context,
llvm::LLVMContext &llvmContext,
mlir::ModuleOp &module) {
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
mlir::concretelang::LLVMInitializeNativeTarget();
mlir::registerLLVMDialectTranslation(*module->getContext());
mlir::registerOpenMPDialectTranslation(*module->getContext());

Expand Down

0 comments on commit 8cf8d99

Please sign in to comment.