mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
This commit contains several incremental improvements towards a clear
interface for lambdas:
- Unification of static and JIT compilation by using the static
compilation path of `CompilerEngine` within a new subclass
`JitCompilerEngine`.
- Clear ownership for compilation artefacts through
`CompilationContext`, making it impossible to destroy objects used
directly or indirectly before destruction of their users.
- Clear interface for lambdas generated by the compiler through
`JitCompilerEngine::Lambda` with a templated call operator,
encapsulating otherwise manual orchestration of `CompilerEngine`,
`JITLambda`, and `CompilerEngine::Argument`.
- Improved error handling through `llvm::Expected<T>` and proper
error checking following the conventions for `llvm::Expected<T>`
and `llvm::Error`.
Co-authored-by: youben11 <ayoub.benaissa@zama.ai>
38 lines
941 B
C++
38 lines
941 B
C++
#ifndef ZAMALANG_C_SUPPORT_COMPILER_ENGINE_H
|
|
#define ZAMALANG_C_SUPPORT_COMPILER_ENGINE_H
|
|
|
|
#include "mlir-c/IR.h"
|
|
#include "mlir-c/Registration.h"
|
|
#include "zamalang/Support/CompilerEngine.h"
|
|
#include "zamalang/Support/ExecutionArgument.h"
|
|
#include "zamalang/Support/Jit.h"
|
|
#include "zamalang/Support/JitCompilerEngine.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct lambda {
|
|
mlir::zamalang::JitCompilerEngine::Lambda *ptr;
|
|
};
|
|
typedef struct lambda lambda;
|
|
|
|
struct executionArguments {
|
|
mlir::zamalang::ExecutionArgument *data;
|
|
size_t size;
|
|
};
|
|
typedef struct executionArguments exectuionArguments;
|
|
|
|
MLIR_CAPI_EXPORTED mlir::zamalang::JitCompilerEngine::Lambda
|
|
buildLambda(const char *module, const char *funcName);
|
|
|
|
MLIR_CAPI_EXPORTED uint64_t invokeLambda(lambda l, executionArguments args);
|
|
|
|
MLIR_CAPI_EXPORTED std::string roundTrip(const char *module);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // ZAMALANG_C_SUPPORT_COMPILER_ENGINE_H
|