[Mlir-commits] [mlir] 9181673 - [mlir][c] Init MLProgram C API
Jacques Pienaar
llvmlistbot at llvm.org
Mon Oct 3 09:38:27 PDT 2022
Author: Jacques Pienaar
Date: 2022-10-03T09:38:17-07:00
New Revision: 9181673bef5e1b27c8b53c950c4fcd6196f4076a
URL: https://github.com/llvm/llvm-project/commit/9181673bef5e1b27c8b53c950c4fcd6196f4076a
DIFF: https://github.com/llvm/llvm-project/commit/9181673bef5e1b27c8b53c950c4fcd6196f4076a.diff
LOG: [mlir][c] Init MLProgram C API
Add MLIR upstream C api library definition.
Differential Revision: https://reviews.llvm.org/D135083
Added:
mlir/include/mlir-c/Dialect/MLProgram.h
mlir/lib/CAPI/Dialect/MLProgram.cpp
Modified:
mlir/lib/CAPI/Dialect/CMakeLists.txt
Removed:
################################################################################
diff --git a/mlir/include/mlir-c/Dialect/MLProgram.h b/mlir/include/mlir-c/Dialect/MLProgram.h
new file mode 100644
index 0000000000000..0874955e35b27
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/MLProgram.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/MLProgram.h - C API for MLProgram dialect --*- C -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
+// Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_C_DIALECT_MLPROGRAM_H
+#define MLIR_C_DIALECT_MLPROGRAM_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(MLProgram, ml_program);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_MLPROGRAM_H
diff --git a/mlir/lib/CAPI/Dialect/CMakeLists.txt b/mlir/lib/CAPI/Dialect/CMakeLists.txt
index e5173ffd38abd..2f36040a2e8b3 100644
--- a/mlir/lib/CAPI/Dialect/CMakeLists.txt
+++ b/mlir/lib/CAPI/Dialect/CMakeLists.txt
@@ -60,6 +60,15 @@ add_mlir_upstream_c_api_library(MLIRCAPILinalg
MLIRLinalgTransforms
)
+add_mlir_upstream_c_api_library(MLIRCAPIMLProgram
+ MLProgram.cpp
+
+ PARTIAL_SOURCES_INTENDED
+ LINK_LIBS PUBLIC
+ MLIRCAPIIR
+ MLIRMLProgramDialect
+)
+
add_mlir_upstream_c_api_library(MLIRCAPISCF
SCF.cpp
diff --git a/mlir/lib/CAPI/Dialect/MLProgram.cpp b/mlir/lib/CAPI/Dialect/MLProgram.cpp
new file mode 100644
index 0000000000000..525b958d995a7
--- /dev/null
+++ b/mlir/lib/CAPI/Dialect/MLProgram.cpp
@@ -0,0 +1,14 @@
+//===- MLProgram.cpp - C Interface for MLProgram dialect ------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Dialect/MLProgram/IR/MLProgram.h"
+#include "mlir-c/Dialect/MLProgram.h"
+#include "mlir/CAPI/Registration.h"
+
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(MLProgram, ml_program,
+ mlir::ml_program::MLProgramDialect)
More information about the Mlir-commits
mailing list