mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
feat(compiler): Add op interface SDFGConvertibleOpInterface
This adds a new operation interface `SDFGConvertibleOpInterface` that allows an operation to specify how it is converted to an SDFG process. The interface consists of a single method `convert` that receives as the arguments the DFG created using `SDFG.init`, a set of SDFG input streams corresponding to the operands and a set of output streams for results. The order of the input and output streams corresponds to the order of the operands and output values, respectively.
This commit is contained in:
@@ -1 +1,2 @@
|
||||
add_subdirectory(Interfaces)
|
||||
add_subdirectory(IR)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
add_mlir_interface(SDFGConvertibleInterface)
|
||||
@@ -0,0 +1,14 @@
|
||||
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
|
||||
// Exceptions. See
|
||||
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
|
||||
// for license information.
|
||||
|
||||
#ifndef CONCRETELANG_DIALECT_SDFG_INTERFACES_SDFGCONVERTIBLEINTERFACE_H
|
||||
#define CONCRETELANG_DIALECT_SDFG_INTERFACES_SDFGCONVERTIBLEINTERFACE_H
|
||||
|
||||
#include "mlir/IR/ImplicitLocOpBuilder.h"
|
||||
|
||||
#include "concretelang/Dialect/SDFG/IR/SDFGOps.h"
|
||||
#include "concretelang/Dialect/SDFG/Interfaces/SDFGConvertibleInterface.h.inc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef CONCRETELANG_DIALECT_SDFG_INTERFACES_SDFGCONVERTIBLEINTERFACE
|
||||
#define CONCRETELANG_DIALECT_SDFG_INTERFACES_SDFGCONVERTIBLEINTERFACE
|
||||
|
||||
include "mlir/IR/OpBase.td"
|
||||
|
||||
def SDFG_SDFGConvertibleOpInterface : OpInterface<"SDFGConvertibleOpInterface"> {
|
||||
let description = [{
|
||||
Interface for operations processing a scalar that can be batched
|
||||
if invoked multiple times with different, independent operands.
|
||||
}];
|
||||
let cppNamespace = "::mlir::concretelang::SDFG";
|
||||
|
||||
let methods = [
|
||||
InterfaceMethod<[{
|
||||
Create the associated operation and return it as a value.
|
||||
}],
|
||||
/*retTy=*/"::mlir::concretelang::SDFG::MakeProcess",
|
||||
/*methodName=*/"convert",
|
||||
/*args=*/(ins "::mlir::ImplicitLocOpBuilder&":$builder,
|
||||
"::mlir::Value":$dfg,
|
||||
"::mlir::ValueRange":$inStreams,
|
||||
"::mlir::ValueRange":$outStreams),
|
||||
/*methodBody=*/"",
|
||||
/*defaultImplementation=*/[{
|
||||
llvm_unreachable("convert not implemented");
|
||||
}]
|
||||
>
|
||||
];
|
||||
}
|
||||
|
||||
#endif // CONCRETELANG_DIALECT_SDFG_INTERFACES_SDFGCONVERTIBLEINTERFACE
|
||||
@@ -241,7 +241,7 @@ const LLVM_STATIC_LIBS: [&str; 51] = [
|
||||
"LLVMX86Info",
|
||||
];
|
||||
|
||||
const CONCRETE_COMPILER_LIBS: [&str; 30] = [
|
||||
const CONCRETE_COMPILER_LIBS: [&str; 31] = [
|
||||
"RTDialect",
|
||||
"RTDialectTransforms",
|
||||
"ConcretelangSupport",
|
||||
@@ -255,6 +255,7 @@ const CONCRETE_COMPILER_LIBS: [&str; 30] = [
|
||||
"TFHEGlobalParametrization",
|
||||
"ConcretelangClientLib",
|
||||
"ConcretelangBConcreteTransforms",
|
||||
"ConcretelangSDFGInterfaces",
|
||||
"CONCRETELANGCAPISupport",
|
||||
"FHELinalgDialect",
|
||||
"ConcretelangInterfaces",
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
add_subdirectory(Interfaces)
|
||||
add_subdirectory(IR)
|
||||
|
||||
14
compiler/lib/Dialect/SDFG/Interfaces/CMakeLists.txt
Normal file
14
compiler/lib/Dialect/SDFG/Interfaces/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
add_mlir_dialect_library(
|
||||
ConcretelangSDFGInterfaces
|
||||
SDFGConvertibleInterface.cpp
|
||||
ADDITIONAL_HEADER_DIRS
|
||||
${PROJECT_SOURCE_DIR}/include/concretelang/Dialect/SDFG
|
||||
DEPENDS
|
||||
mlir-headers
|
||||
LINK_LIBS
|
||||
PUBLIC
|
||||
SDFGDialect
|
||||
MLIRIR
|
||||
MLIRMemRefDialect
|
||||
MLIRPass
|
||||
MLIRTransforms)
|
||||
@@ -0,0 +1,8 @@
|
||||
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
|
||||
// Exceptions. See
|
||||
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
|
||||
// for license information.
|
||||
|
||||
#include "concretelang/Dialect/SDFG/Interfaces/SDFGConvertibleInterface.h"
|
||||
|
||||
#include "concretelang/Dialect/SDFG/Interfaces/SDFGConvertibleInterface.cpp.inc"
|
||||
@@ -27,6 +27,7 @@ add_mlir_library(
|
||||
RTDialectAnalysis
|
||||
ConcretelangTransforms
|
||||
ConcretelangBConcreteTransforms
|
||||
ConcretelangSDFGInterfaces
|
||||
LinalgExtras
|
||||
ConcreteDialectTransforms
|
||||
concrete_optimizer
|
||||
|
||||
Reference in New Issue
Block a user