Skip to content

[mlir][index] Add CAPI #127039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions mlir/include/mlir-c/Dialect/Index.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//===-- mlir-c/Dialect/Index.h - C API for Index 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_INDEX_H
#define MLIR_C_DIALECT_INDEX_H

#include "mlir-c/IR.h"

#ifdef __cplusplus
extern "C" {
#endif

MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Index, index);

#ifdef __cplusplus
}
#endif

#endif // MLIR_C_DIALECT_INDEX_H
9 changes: 9 additions & 0 deletions mlir/lib/CAPI/Dialect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ add_mlir_upstream_c_api_library(MLIRCAPIGPU
MLIRPass
)

add_mlir_upstream_c_api_library(MLIRCAPIIndex
Index.cpp

PARTIAL_SOURCES_INTENDED
LINK_LIBS PUBLIC
MLIRCAPIIR
MLIRIndexDialect
)

add_mlir_upstream_c_api_library(MLIRCAPIIRDL
IRDL.cpp

Expand Down
13 changes: 13 additions & 0 deletions mlir/lib/CAPI/Dialect/Index.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//===- Index.cpp - C Interface for Index 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-c/Dialect/Index.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/Dialect/Index/IR/IndexDialect.h"

MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Index, index, mlir::index::IndexDialect)