Skip to content

Commit

Permalink
extern c
Browse files Browse the repository at this point in the history
  • Loading branch information
abhigunj committed Sep 6, 2024
1 parent 3cc3767 commit 6774d51
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions stablehlo/integrations/c/StablehloApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ limitations under the License.
#include "mlir-c/IR.h"
#include "mlir-c/Support.h"

#ifdef __cplusplus
extern "C" {
#endif

// Get the current StableHLO API version.
//
// This value is incremented as needed to help integrate API changes.
Expand Down Expand Up @@ -72,7 +76,7 @@ stablehloGetSmallerVersion(MlirStringRef version1, MlirStringRef version2,
// `targetVersion` version of StableHLO, e.g. if it's using new or removed
// features, or if it involves unsupported dialects.
// Returns false on failure.
MLIR_CAPI_EXPORTED MlirLogicalResult stablehloSerializePortableArtifact(
MLIR_CAPI_EXPORTED MlirLogicalResult stablehloSerializePortableArtifactFromString(
MlirStringRef moduleStr, MlirStringRef targetVersion,
MlirStringCallback callback, void* userData);

Expand All @@ -82,7 +86,7 @@ MLIR_CAPI_EXPORTED MlirLogicalResult stablehloSerializePortableArtifact(
// `targetVersion` version of StableHLO, e.g. if it's using new or removed
// features, or if it involves unsupported dialects.
// Returns false on failure.
MLIR_CAPI_EXPORTED MlirLogicalResult stablehloSerializePortableArtifact(
MLIR_CAPI_EXPORTED MlirLogicalResult stablehloSerializePortableArtifactFromModule(
MlirModule moduleStr, MlirStringRef targetVersion,
MlirStringCallback callback, void* userData);

Expand All @@ -104,12 +108,12 @@ MLIR_CAPI_EXPORTED MlirLogicalResult stablehloDeserializePortableArtifact(
// StableHLO, e.g. if it's using incompatible features.
//
// Returns empty module on failure.
MLIR_CAPI_EXPORTED MlirModule stablehloDeserializePortableArtifact(
MLIR_CAPI_EXPORTED MlirModule stablehloDeserializePortableArtifactNoError(
MlirStringRef artifactStr, MlirContext ctx);

// Call the Interpreter, returns MlirArrayAttr of dense element
// MlirAttribute results
MLIR_CAPI_EXPORTED MlirModule stablehloDeserializePortableArtifact(
MLIR_CAPI_EXPORTED MlirModule stablehloDeserializePortableArtifactToMlirArrayAttr(
MlirStringRef artifactStr, MlirContext ctx);

// Entrypoint for calling the StableHLO reference interpreter.
Expand All @@ -120,4 +124,8 @@ MLIR_CAPI_EXPORTED MlirAttribute stablehloEvalModule(MlirModule module,
MlirAttribute const* args,
int* errorCode);

#ifdef __cplusplus
}
#endif

#endif // STABLEHLO_INTEGRATIONS_C_STABLEHLOAPI_H_

0 comments on commit 6774d51

Please sign in to comment.