Skip to content
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

Add missing dialects to C API #82190

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

mofeing
Copy link

@mofeing mofeing commented Feb 18, 2024

We are trying to make a wrapper of MLIR for Julia in https://github.com/JuliaLabs/MLIR.jl, but some dialects are missing in libMLIR-C. This PR adds them.

Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 18, 2024

@llvm/pr-subscribers-mlir-shape
@llvm/pr-subscribers-mlir-sve
@llvm/pr-subscribers-mlir-func
@llvm/pr-subscribers-mlir-scf
@llvm/pr-subscribers-mlir-emitc
@llvm/pr-subscribers-openacc
@llvm/pr-subscribers-mlir-bufferization
@llvm/pr-subscribers-mlir-spirv
@llvm/pr-subscribers-mlir-memref
@llvm/pr-subscribers-mlir-mlprogram
@llvm/pr-subscribers-mlir-llvm
@llvm/pr-subscribers-mlir-gpu
@llvm/pr-subscribers-mlir-openacc

@llvm/pr-subscribers-mlir

Author: Sergio Sánchez Ramírez (mofeing)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/82190.diff

18 Files Affected:

  • (added) mlir/include/mlir-c/Dialect/AMX.h (+25)
  • (added) mlir/include/mlir-c/Dialect/Affine.h (+25)
  • (added) mlir/include/mlir-c/Dialect/ArmNeon.h (+26)
  • (added) mlir/include/mlir-c/Dialect/ArmSME.h (+25)
  • (added) mlir/include/mlir-c/Dialect/ArmSVE.h (+25)
  • (added) mlir/include/mlir-c/Dialect/Bufferization.h (+25)
  • (added) mlir/include/mlir-c/Dialect/Complex.h (+25)
  • (added) mlir/include/mlir-c/Dialect/DLTI.h (+25)
  • (added) mlir/include/mlir-c/Dialect/EmitC.h (+25)
  • (added) mlir/include/mlir-c/Dialect/IRDL.h (+25)
  • (added) mlir/include/mlir-c/Dialect/Index.h (+25)
  • (added) mlir/include/mlir-c/Dialect/MPI.h (+25)
  • (added) mlir/include/mlir-c/Dialect/Mesh.h (+25)
  • (added) mlir/include/mlir-c/Dialect/OpenACC.h (+25)
  • (added) mlir/include/mlir-c/Dialect/PDLInterp.h (+25)
  • (added) mlir/include/mlir-c/Dialect/Tosa.h (+25)
  • (added) mlir/include/mlir-c/Dialect/UB.h (+25)
  • (added) mlir/include/mlir-c/Dialect/x86Vector.h (+25)
diff --git a/mlir/include/mlir-c/Dialect/AMX.h b/mlir/include/mlir-c/Dialect/AMX.h
new file mode 100644
index 00000000000000..ac4695a107ae60
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/AMX.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/AMX.h - C API for AMX 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_AMX_H
+#define MLIR_C_DIALECT_AMX_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(AMX, amx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_AMX_H
diff --git a/mlir/include/mlir-c/Dialect/Affine.h b/mlir/include/mlir-c/Dialect/Affine.h
new file mode 100644
index 00000000000000..0f4e010f91255c
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Affine.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/Affine.h - C API for Affine 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_AFFINE_H
+#define MLIR_C_DIALECT_AFFINE_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Affine, affine);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_AFFINE_H
diff --git a/mlir/include/mlir-c/Dialect/ArmNeon.h b/mlir/include/mlir-c/Dialect/ArmNeon.h
new file mode 100644
index 00000000000000..fdc859d9ff631b
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/ArmNeon.h
@@ -0,0 +1,26 @@
+//===-- mlir-c/Dialect/ArmNeon.h - C API for ArmNeon 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_ARMNEON_H
+#define MLIR_C_DIALECT_ARMNEON_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(ArmNeon, arm_neon);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_ARMNEON_H
diff --git a/mlir/include/mlir-c/Dialect/ArmSME.h b/mlir/include/mlir-c/Dialect/ArmSME.h
new file mode 100644
index 00000000000000..a27f38e5b65f47
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/ArmSME.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/ArmSME.h - C API for ArmSME 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_ARMSME_H
+#define MLIR_C_DIALECT_ARMSME_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(ArmSME, arm_sme);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_ARMSME_H
diff --git a/mlir/include/mlir-c/Dialect/ArmSVE.h b/mlir/include/mlir-c/Dialect/ArmSVE.h
new file mode 100644
index 00000000000000..8f5838c6304464
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/ArmSVE.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/ArmSVE.h - C API for ArmSVE 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_ARMSME_H
+#define MLIR_C_DIALECT_ARMSME_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(ArmSVE, arm_sve);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_ARMSME_H
diff --git a/mlir/include/mlir-c/Dialect/Bufferization.h b/mlir/include/mlir-c/Dialect/Bufferization.h
new file mode 100644
index 00000000000000..76c2c16be53b2c
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Bufferization.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/Bufferization.h - C API for Bufferization 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_BUFFERIZATION_H
+#define MLIR_C_DIALECT_BUFFERIZATION_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Bufferization, bufferization);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_BUFFERIZATION_H
diff --git a/mlir/include/mlir-c/Dialect/Complex.h b/mlir/include/mlir-c/Dialect/Complex.h
new file mode 100644
index 00000000000000..75d6c50fc8c136
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Complex.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/Complex.h - C API for Complex 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_COMPLEX_H
+#define MLIR_C_DIALECT_COMPLEX_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Complex, complex);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_COMPLEX_H
diff --git a/mlir/include/mlir-c/Dialect/DLTI.h b/mlir/include/mlir-c/Dialect/DLTI.h
new file mode 100644
index 00000000000000..d0f79d9c4bc6a7
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/DLTI.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/DLTI.h - C API for DLTI 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_DLTI_H
+#define MLIR_C_DIALECT_DLTI_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(DLTI, dlti);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_DLTI_H
diff --git a/mlir/include/mlir-c/Dialect/EmitC.h b/mlir/include/mlir-c/Dialect/EmitC.h
new file mode 100644
index 00000000000000..3c38e7fb539bc6
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/EmitC.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/EmitC.h - C API for EmitC 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_EMITC_H
+#define MLIR_C_DIALECT_EMITC_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(EmitC, emitc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_EMITC_H
diff --git a/mlir/include/mlir-c/Dialect/IRDL.h b/mlir/include/mlir-c/Dialect/IRDL.h
new file mode 100644
index 00000000000000..30838b63355f5a
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/IRDL.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/IRDL.h - C API for IRDL 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_IRDL_H
+#define MLIR_C_DIALECT_IRDL_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(IRDL, irdl);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_IRDL_H
diff --git a/mlir/include/mlir-c/Dialect/Index.h b/mlir/include/mlir-c/Dialect/Index.h
new file mode 100644
index 00000000000000..c75c37a29d7c6f
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Index.h
@@ -0,0 +1,25 @@
+//===-- 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
diff --git a/mlir/include/mlir-c/Dialect/MPI.h b/mlir/include/mlir-c/Dialect/MPI.h
new file mode 100644
index 00000000000000..c90c3db7bdcc6f
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/MPI.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/MPI.h - C API for MPI 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_MPI_H
+#define MLIR_C_DIALECT_MPI_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(MPI, mpi);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_MPI_H
diff --git a/mlir/include/mlir-c/Dialect/Mesh.h b/mlir/include/mlir-c/Dialect/Mesh.h
new file mode 100644
index 00000000000000..7d00562e441c22
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Mesh.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/Mesh.h - C API for Mesh 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_MESH_H
+#define MLIR_C_DIALECT_MESH_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Mesh, mesh);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_MESH_H
diff --git a/mlir/include/mlir-c/Dialect/OpenACC.h b/mlir/include/mlir-c/Dialect/OpenACC.h
new file mode 100644
index 00000000000000..c37e75d2a23dac
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/OpenACC.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/OpenACC.h - C API for OpenACC 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_OPENACC_H
+#define MLIR_C_DIALECT_OPENACC_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(OpenACC, acc);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_OPENACC_H
diff --git a/mlir/include/mlir-c/Dialect/PDLInterp.h b/mlir/include/mlir-c/Dialect/PDLInterp.h
new file mode 100644
index 00000000000000..49a5a7a934a98a
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/PDLInterp.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/PDLInterp.h - C API for PDLInterp 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_PDLINTERP_H
+#define MLIR_C_DIALECT_PDLINTERP_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(PDLInterp, pdl_interp);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_PDLINTERP_H
diff --git a/mlir/include/mlir-c/Dialect/Tosa.h b/mlir/include/mlir-c/Dialect/Tosa.h
new file mode 100644
index 00000000000000..b16a1d86c258a7
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/Tosa.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/Tosa.h - C API for Tosa 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_TOSA_H
+#define MLIR_C_DIALECT_TOSA_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(Tosa, tosa);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_TOSA_H
diff --git a/mlir/include/mlir-c/Dialect/UB.h b/mlir/include/mlir-c/Dialect/UB.h
new file mode 100644
index 00000000000000..e9d64348a17276
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/UB.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/UB.h - C API for UB 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_UB_H
+#define MLIR_C_DIALECT_UB_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(UB, ub);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_UB_H
diff --git a/mlir/include/mlir-c/Dialect/x86Vector.h b/mlir/include/mlir-c/Dialect/x86Vector.h
new file mode 100644
index 00000000000000..013e294b032004
--- /dev/null
+++ b/mlir/include/mlir-c/Dialect/x86Vector.h
@@ -0,0 +1,25 @@
+//===-- mlir-c/Dialect/x86Vector.h - C API for x86Vector 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_X86VECTOR_H
+#define MLIR_C_DIALECT_X86VECTOR_H
+
+#include "mlir-c/IR.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(x86Vector, x86vector);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // MLIR_C_DIALECT_X86VECTOR_H

Copy link

github-actions bot commented Feb 18, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@nicolasvasilache nicolasvasilache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks!

Any plan to also add the pass support (see e.g. https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir-c/Dialect/GPU.h#L26) ?

@mofeing
Copy link
Author

mofeing commented Feb 18, 2024

Any plan to also add the pass support (see e.g. main/mlir/include/mlir-c/Dialect/GPU.h#L26) ?

@nicolasvasilache done!

@nicolasvasilache
Copy link
Contributor

Any plan to also add the pass support (see e.g. main/mlir/include/mlir-c/Dialect/GPU.h#L26) ?

@nicolasvasilache done!

that was fast, awesome :)

@llvmbot llvmbot added the bazel "Peripheral" support tier build system: utils/bazel label Jul 29, 2024
@mofeing
Copy link
Author

mofeing commented Aug 11, 2024

@nicolasvasilache @aartbik Any news for merging this?

@MacDue
Copy link
Member

MacDue commented Aug 12, 2024

There are now some CMake errors that need fixing, otherwise, I don't see why this can't land (it's been approved)

@@ -1,5 +1,7 @@
set(LLVM_TARGET_DEFINITIONS Passes.td)
mlir_tablegen(Passes.h.inc -gen-pass-decls -name EmitC)
mlir_tablegen(Passes.capi.h.inc -gen-pass-capi-header --prefix EmitC)
mlir_tablegen(Passes.capi.cpp.inc -gen-pass-capi-impl --prefix EmitC)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's building now, but it looks like the generated Passes.capi.cpp.inc implementation files are not actually being used.

From looking at how it's done for other dialects, it looks like you still need to create a .cpp file, and include it:

//===- GPUPasses.cpp - C API for GPU Dialect Passes ----------------------===//
//
// 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/CAPI/Pass.h"
#include "mlir/Dialect/GPU/Transforms/Passes.h"
#include "mlir/Pass/Pass.h"
// Must include the declarations as they carry important visibility attributes.
#include "mlir/Dialect/GPU/Transforms/Passes.capi.h.inc"
using namespace mlir;
#ifdef __cplusplus
extern "C" {
#endif
#include "mlir/Dialect/GPU/Transforms/Passes.capi.cpp.inc"
#ifdef __cplusplus
}
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(otherwise, using any of these CAPIs will result in linker errors)

@mofeing
Copy link
Author

mofeing commented Aug 15, 2024

@MacDue now all checks pass!

@MacDue
Copy link
Member

MacDue commented Aug 15, 2024

@MacDue now all checks pass!

I see that 🙂 -- however, I did notice this PR is missing the .cpp files for the CAPIs (currently this just exposes the headers, but if you try to use the APIs you'll get a linker error). See my previous comment: #82190 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants