Program Listing for File ExecutorCAPI.h

Return to documentation for file (runtime/include/ExecutorCAPI.h)

// Copyright 2026 Xanadu Quantum Technologies Inc.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

//     http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once
#ifndef EXECUTORCAPI_H
#define EXECUTORCAPI_H

#include <stddef.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

// Executor Runtime API. This is expected to be called by the host program to establish an executor
// session. Including open a session, send the binary to the executor, launch the kernel on the
// executor and close the session.
int64_t __catalyst__executor__open(const char *addr);
int64_t __catalyst__executor__send_binary(int64_t session, const char *path, uint32_t format);
void __catalyst__executor__launch(int64_t session, const char *entry_symbol, const char *object,
                                  size_t num_inputs, void *const *input_descs,
                                  const size_t *input_ranks, const size_t *input_elem_sizes,
                                  size_t num_outputs, void *const *output_descs,
                                  const size_t *output_ranks, const size_t *output_elem_sizes);
int64_t __catalyst__executor__launch_async(int64_t session, const char *entry_symbol,
                                           const char *object);
void __catalyst__executor__await(int64_t token);
int32_t __catalyst__executor__call_wrapper(int64_t session, const char *symbol,
                                           const char *args_buf, size_t args_size, void **out_buf,
                                           size_t *out_size);
void __catalyst__executor__free_result(void *buf);

int64_t __catalyst__executor__close(int64_t session);

#ifdef __cplusplus
} // extern "C"
#endif

#endif