12#include "iree/base/api.h"
49#if defined(__cplusplus)
50#define LOOMC_IREE_STATIC_ASSERT static_assert
52#define LOOMC_IREE_STATIC_ASSERT _Static_assert
56 sizeof(iree_string_view_t),
57 "loomc_string_view_t must match iree_string_view_t");
59 offsetof(iree_string_view_t, data),
60 "string view data fields must match");
62 offsetof(iree_string_view_t, size),
63 "string view size fields must match");
65 sizeof(iree_const_byte_span_t),
66 "loomc_byte_span_t must match iree_const_byte_span_t");
68 offsetof(iree_const_byte_span_t, data),
69 "byte span data fields must match");
71 offsetof(iree_const_byte_span_t, data_length),
72 "byte span length fields must match");
74 "status code values must match");
76 "status code values must match");
78 "status code values must match");
80 IREE_STATUS_INVALID_ARGUMENT,
81 "status code values must match");
83 IREE_STATUS_DEADLINE_EXCEEDED,
84 "status code values must match");
86 "status code values must match");
88 IREE_STATUS_ALREADY_EXISTS,
89 "status code values must match");
91 IREE_STATUS_PERMISSION_DENIED,
92 "status code values must match");
94 IREE_STATUS_RESOURCE_EXHAUSTED,
95 "status code values must match");
97 IREE_STATUS_FAILED_PRECONDITION,
98 "status code values must match");
100 "status code values must match");
102 "status code values must match");
104 IREE_STATUS_UNIMPLEMENTED,
105 "status code values must match");
107 "status code values must match");
109 "status code values must match");
111 "status code values must match");
113 IREE_STATUS_UNAUTHENTICATED,
114 "status code values must match");
116 "status code values must match");
118 "status code values must match");
120 "status code masks must match");
122 "status feature modes must match");
124 IREE_ALLOCATOR_COMMAND_MALLOC,
125 "allocator malloc commands must match");
127 IREE_ALLOCATOR_COMMAND_CALLOC,
128 "allocator calloc commands must match");
130 IREE_ALLOCATOR_COMMAND_REALLOC,
131 "allocator realloc commands must match");
133 IREE_ALLOCATOR_COMMAND_FREE,
134 "allocator free commands must match");
136 sizeof(iree_allocator_alloc_params_t),
137 "allocator parameter structures must match");
140 offsetof(iree_allocator_alloc_params_t,
142 "allocator parameter byte lengths must match");
154static inline loomc_status_t loomc_status_from_iree(iree_status_t status) {
166static inline iree_status_t iree_status_from_loomc(
loomc_status_t status) {
178 iree_string_view_t value) {
179 return loomc_make_string_view(value.data, value.size);
189static inline iree_string_view_t iree_string_view_from_loomc(
191 return iree_make_string_view(value.
data, value.
size);
202 iree_const_byte_span_t value) {
203 return loomc_make_byte_span(value.data, value.data_length);
213static inline iree_const_byte_span_t iree_const_byte_span_from_loomc(
227 iree_allocator_t allocator) {
243static inline iree_allocator_t iree_allocator_from_loomc(
245 IREE_ASSERT_ARGUMENT(loomc_allocator_is_valid(allocator));
246 iree_allocator_t value = {
253#undef LOOMC_IREE_STATIC_ASSERT
@ LOOMC_ALLOCATOR_COMMAND_REALLOC
Resizes an existing allocation.
Definition base.h:336
@ LOOMC_ALLOCATOR_COMMAND_MALLOC
Allocates memory without requiring zero initialization.
Definition base.h:330
@ LOOMC_ALLOCATOR_COMMAND_CALLOC
Allocates memory and zeros it before returning.
Definition base.h:333
@ LOOMC_ALLOCATOR_COMMAND_FREE
Frees an existing allocation.
Definition base.h:339
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
Umbrella include for the public Loom C API.
@ LOOMC_STATUS_PERMISSION_DENIED
The caller does not have permission for the requested operation.
Definition status.h:113
@ LOOMC_STATUS_INVALID_ARGUMENT
The caller provided an invalid argument.
Definition status.h:101
@ LOOMC_STATUS_INCOMPATIBLE
The program or environment is incompatible with the request.
Definition status.h:146
@ LOOMC_STATUS_CODE_MASK
Mask covering all status code bits in a loomc_status_t value.
Definition status.h:149
@ LOOMC_STATUS_UNKNOWN
Unknown error or unmapped failure.
Definition status.h:98
@ LOOMC_STATUS_UNAUTHENTICATED
The requested operation does not have proper authentication.
Definition status.h:140
@ LOOMC_STATUS_OK
Successful operation.
Definition status.h:92
@ LOOMC_STATUS_NOT_FOUND
A referenced resource could not be found.
Definition status.h:107
@ LOOMC_STATUS_DEADLINE_EXCEEDED
A deadline was exceeded before the call completed.
Definition status.h:104
@ LOOMC_STATUS_INTERNAL
An internal invariant was violated.
Definition status.h:131
@ LOOMC_STATUS_FAILED_PRECONDITION
The system is not in a required state for the operation.
Definition status.h:119
@ LOOMC_STATUS_DEFERRED
The operation has been deferred and must be resumed later.
Definition status.h:143
@ LOOMC_STATUS_RESOURCE_EXHAUSTED
A required resource was exhausted.
Definition status.h:116
@ LOOMC_STATUS_DATA_LOSS
Unrecoverable data loss or corruption occurred.
Definition status.h:137
@ LOOMC_STATUS_CANCELLED
Operation was cancelled by the caller.
Definition status.h:95
@ LOOMC_STATUS_ABORTED
The operation was aborted by the system.
Definition status.h:122
@ LOOMC_STATUS_ALREADY_EXISTS
The resource the caller attempted to create already exists.
Definition status.h:110
@ LOOMC_STATUS_UNIMPLEMENTED
The operation has not been implemented or is not supported.
Definition status.h:128
@ LOOMC_STATUS_OUT_OF_RANGE
The operation was attempted outside a valid range.
Definition status.h:125
@ LOOMC_STATUS_UNAVAILABLE
The underlying system is currently unavailable.
Definition status.h:134
#define LOOMC_STATUS_FEATURES
Feature bit mask derived from LOOMC_STATUS_MODE.
Definition status.h:81
Allocation parameters passed to loomc_allocator_ctl_fn_t callbacks.
Definition base.h:346
Host allocator used for persistent Loom object storage.
Definition base.h:375
loomc_allocator_ctl_fn_t ctl
Callback implementing allocation commands.
Definition base.h:380
void * self
Callback-owned state pointer.
Definition base.h:377
Non-owning view over immutable bytes.
Definition base.h:128
loomc_host_size_t data_length
Number of bytes in data.
Definition base.h:133
const uint8_t * data
First byte of the span, or NULL when the span is empty.
Definition base.h:130
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63
const char * data
First byte of the string, or NULL when the view is empty.
Definition base.h:65
loomc_host_size_t size
Number of bytes in data.
Definition base.h:68