Skip to content

Commit d16b60f

Browse files
authored
Fix export of cpu/gpu handler (#1311)
* Fix export of cpu/gpu handler * fix header import
1 parent 97b1dc8 commit d16b60f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/enzyme_ad/jax/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ cc_library(
2626
srcs = ["gpu.cc"],
2727
copts = ["-Wno-vla-cxx-extension"],
2828
deps = [
29+
"@llvm-project//mlir:CAPIIR",
2930
"@xla//xla/ffi:ffi_api",
3031
"@xla//xla/ffi/api:ffi",
3132
],
@@ -35,6 +36,7 @@ cc_library(
3536
name = "cpu",
3637
srcs = ["cpu.cc"],
3738
deps = [
39+
"@llvm-project//mlir:CAPIIR",
3840
"@xla//xla/service:custom_call_status",
3941
"@xla//xla/service:custom_call_target_registry",
4042
],

src/enzyme_ad/jax/cpu.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#include "xla/service/custom_call_target_registry.h"
33
#include <cstring>
44

5+
#include "mlir-c/Support.h"
6+
57
template <bool withError> struct CallInfo;
68

79
template <> struct CallInfo<false> {
@@ -28,7 +30,7 @@ void forwarding_custom_call(void *out, const void **in, const void *opaque_ptr,
2830
}
2931
}
3032

31-
extern "C" void RegisterEnzymeXLACPUHandler() {
33+
extern "C" MLIR_CAPI_EXPORTED void RegisterEnzymeXLACPUHandler() {
3234
xla::CustomCallTargetRegistry::Global()->Register(
3335
"enzymexla_compile_cpu", (void *)&forwarding_custom_call<false>, "Host");
3436
xla::CustomCallTargetRegistry::Global()->Register(

src/enzyme_ad/jax/gpu.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#include "xla/ffi/api/ffi.h"
22
#include "xla/ffi/ffi_api.h"
33

4+
#include "mlir-c/Support.h"
5+
46
template <bool withError> struct CallInfo;
57

68
template <> struct CallInfo<false> {
@@ -138,7 +140,7 @@ XLA_FFI_Error *execute(XLA_FFI_CallFrame *call_frame) {
138140
return nullptr;
139141
}
140142

141-
extern "C" void RegisterEnzymeXLAGPUHandler() {
143+
extern "C" MLIR_CAPI_EXPORTED void RegisterEnzymeXLAGPUHandler() {
142144
XLA_FFI_Handler_Bundle bundle = {instantiate, prepare, initialize<false>,
143145
execute<false>};
144146

0 commit comments

Comments
 (0)