/* automatically generated by rust-bindgen 0.73.2 */
#[doc = " Status mode feature bit for source file and line capture."]
pub const LOOMC_STATUS_FEATURE_SOURCE_LOCATION: u32 = 1;
#[doc = " Status mode feature bit for annotated messages."]
pub const LOOMC_STATUS_FEATURE_ANNOTATIONS: u32 = 2;
#[doc = " Status mode feature bit for stack trace capture."]
pub const LOOMC_STATUS_FEATURE_STACK_TRACE: u32 = 4;
pub const LOOMC_STATUS_MODE: u32 = 3;
pub const LOOMC_STATUS_FEATURES: u32 = 7;
#[doc = " Textual Loom module artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_LOOM_TEXT: &[u8; 10] = b"loom-text\0";
#[doc = " Binary Loom bytecode module artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_LOOM_BYTECODE: &[u8; 7] = b"loombc\0";
#[doc = " JSON report artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_JSON: &[u8; 5] = b"json\0";
#[doc = " Loom artifact manifest JSON report artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_ARTIFACT_MANIFEST_JSON: &[u8; 28] =
b"loom-artifact-manifest-json\0";
#[doc = " Loom compile report JSON artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_COMPILE_REPORT_JSON: &[u8; 25] = b"loom-compile-report-json\0";
#[doc = " Loom compile report text artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_COMPILE_REPORT_TEXT: &[u8; 25] = b"loom-compile-report-text\0";
#[doc = " Loose option key overriding `loomc_emit_options_t::identifier`."]
pub const LOOMC_EMIT_OPTION_KEY_IDENTIFIER: &[u8; 16] = b"emit.identifier\0";
#[doc = " Loose option key overriding artifact manifest mode."]
pub const LOOMC_EMIT_OPTION_KEY_ARTIFACT_MANIFEST_MODE: &[u8; 28] =
b"emit.artifact_manifest.mode\0";
#[doc = " Loose option key overriding artifact manifest result identifier."]
pub const LOOMC_EMIT_OPTION_KEY_ARTIFACT_MANIFEST_IDENTIFIER: &[u8; 34] =
b"emit.artifact_manifest.identifier\0";
#[doc = " Loose option key overriding compile report mode."]
pub const LOOMC_EMIT_OPTION_KEY_COMPILE_REPORT_MODE: &[u8; 25] = b"emit.compile_report.mode\0";
#[doc = " Loose option key overriding compile report result identifier."]
pub const LOOMC_EMIT_OPTION_KEY_COMPILE_REPORT_IDENTIFIER: &[u8; 31] =
b"emit.compile_report.identifier\0";
#[doc = " Invalid parent-product requirement ordinal."]
pub const LOOMC_REQUIREMENT_ORDINAL_INVALID: u32 = 4294967295;
#[doc = " Invalid request-local root ordinal."]
pub const LOOMC_REQUEST_ROOT_ORDINAL_INVALID: u32 = 4294967295;
#[doc = " Loom link dependency report JSON artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_LINK_DEPENDENCY_REPORT_JSON: &[u8; 33] =
b"loom-link-dependency-report-json\0";
#[doc = " AMDGPU HSA code object artifact format."]
pub const LOOMC_ARTIFACT_FORMAT_AMDGPU_HSACO: &[u8; 13] = b"amdgpu-hsaco\0";
#[doc = " Canonical Loom-owned XDNA ELF32 executable format."]
pub const LOOMC_ARTIFACT_FORMAT_XDNA: &[u8; 5] = b"xdna\0";
#[doc = " Host allocation and container size type.\n\n Values have the same range as C `size_t`. Public ABI fields use this\n spelling so bindings can mirror one Loom-specific type name rather than\n repeating the C standard library type across the API."]
pub type loomc_host_size_t = usize;
#[repr(C)]
#[derive(Debug)]
pub struct iree_status_handle_t {
_unused: [u8; 0],
}
#[doc = " Opaque status handle.\n\n Small status codes are encoded directly in the pointer value. Rich status\n modes may allocate storage behind the handle and require\n `loomc_status_free` or `loomc_status_consume_code`."]
pub type loomc_status_t = *mut iree_status_handle_t;
#[doc = " Non-owning string view over bytes that need not be NUL-terminated.\n\n @lifetime\n A string view never owns `data`. The API receiving the view documents\n whether it copies the bytes or how long the caller must keep the bytes\n alive."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_string_view_t {
#[doc = " First byte of the string, or `NULL` when the view is empty."]
pub data: *const ::std::os::raw::c_char,
#[doc = " Number of bytes in `data`."]
pub size: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_string_view_t"][::std::mem::size_of::<loomc_string_view_t>() - 16usize];
["Alignment of loomc_string_view_t"][::std::mem::align_of::<loomc_string_view_t>() - 8usize];
["Offset of field: loomc_string_view_t::data"]
[::std::mem::offset_of!(loomc_string_view_t, data) - 0usize];
["Offset of field: loomc_string_view_t::size"]
[::std::mem::offset_of!(loomc_string_view_t, size) - 8usize];
};
impl Default for loomc_string_view_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Non-owning view over immutable bytes.\n\n @lifetime\n A byte span never owns `data`. The API receiving the span documents whether\n it copies the bytes or how long the caller must keep the bytes alive."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_byte_span_t {
#[doc = " First byte of the span, or `NULL` when the span is empty."]
pub data: *const u8,
#[doc = " Number of bytes in `data`."]
pub data_length: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_byte_span_t"][::std::mem::size_of::<loomc_byte_span_t>() - 16usize];
["Alignment of loomc_byte_span_t"][::std::mem::align_of::<loomc_byte_span_t>() - 8usize];
["Offset of field: loomc_byte_span_t::data"]
[::std::mem::offset_of!(loomc_byte_span_t, data) - 0usize];
["Offset of field: loomc_byte_span_t::data_length"]
[::std::mem::offset_of!(loomc_byte_span_t, data_length) - 8usize];
};
impl Default for loomc_byte_span_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Three-dimensional unsigned extent used by Loom C API structs."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct loomc_dimension3_t {
#[doc = " Extent along the x dimension."]
pub x: u32,
#[doc = " Extent along the y dimension."]
pub y: u32,
#[doc = " Extent along the z dimension."]
pub z: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_dimension3_t"][::std::mem::size_of::<loomc_dimension3_t>() - 12usize];
["Alignment of loomc_dimension3_t"][::std::mem::align_of::<loomc_dimension3_t>() - 4usize];
["Offset of field: loomc_dimension3_t::x"]
[::std::mem::offset_of!(loomc_dimension3_t, x) - 0usize];
["Offset of field: loomc_dimension3_t::y"]
[::std::mem::offset_of!(loomc_dimension3_t, y) - 4usize];
["Offset of field: loomc_dimension3_t::z"]
[::std::mem::offset_of!(loomc_dimension3_t, z) - 8usize];
};
#[doc = " No structure type was supplied."]
pub const LOOMC_STRUCTURE_TYPE_NONE: loomc_structure_type_e = 0;
#[doc = " `loomc_source_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SOURCE_OPTIONS: loomc_structure_type_e = 1;
#[doc = " `loomc_workspace_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_WORKSPACE_OPTIONS: loomc_structure_type_e = 2;
#[doc = " `loomc_context_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CONTEXT_OPTIONS: loomc_structure_type_e = 3;
#[doc = " `loomc_link_index_builder_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_INDEX_BUILDER_OPTIONS: loomc_structure_type_e = 4;
#[doc = " `loomc_linker_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINKER_OPTIONS: loomc_structure_type_e = 5;
#[doc = " `loomc_link_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_OPTIONS: loomc_structure_type_e = 6;
#[doc = " `loomc_module_serialize_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_SERIALIZE_OPTIONS: loomc_structure_type_e = 7;
#[doc = " `loomc_module_deserialize_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_DESERIALIZE_OPTIONS: loomc_structure_type_e = 8;
#[doc = " `loomc_compiler_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILER_OPTIONS: loomc_structure_type_e = 9;
#[doc = " `loomc_compile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILE_OPTIONS: loomc_structure_type_e = 10;
#[doc = " `loomc_pass_program_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_PASS_PROGRAM_OPTIONS: loomc_structure_type_e = 11;
#[doc = " `loomc_context_target_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CONTEXT_TARGET_OPTIONS: loomc_structure_type_e = 12;
#[doc = " `loomc_target_pipeline_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_TARGET_PIPELINE_OPTIONS: loomc_structure_type_e = 13;
#[doc = " `loomc_spirv_emit_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_EMIT_OPTIONS: loomc_structure_type_e = 14;
#[doc = " `loomc_target_specialization_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_TARGET_SPECIALIZATION_OPTIONS: loomc_structure_type_e = 16;
#[doc = " `loomc_spirv_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_PROFILE_OPTIONS: loomc_structure_type_e = 17;
#[doc = " `loomc_emit_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS: loomc_structure_type_e = 18;
#[doc = " `loomc_option_dict_t`."]
pub const LOOMC_STRUCTURE_TYPE_OPTION_DICT: loomc_structure_type_e = 19;
#[doc = " `loomc_spirv_vulkaninfo_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_VULKANINFO_PROFILE_OPTIONS: loomc_structure_type_e = 20;
#[doc = " `loomc_source_load_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SOURCE_LOAD_OPTIONS: loomc_structure_type_e = 21;
#[doc = " `loomc_spirv_vulkan_function_table_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_VULKAN_FUNCTION_TABLE: loomc_structure_type_e = 22;
#[doc = " `loomc_spirv_vulkan_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_VULKAN_PROFILE_OPTIONS: loomc_structure_type_e = 23;
#[doc = " `loomc_iree_hal_target_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_IREE_HAL_TARGET_OPTIONS: loomc_structure_type_e = 24;
#[doc = " `loomc_spirv_iree_hal_target_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SPIRV_IREE_HAL_TARGET_OPTIONS: loomc_structure_type_e = 25;
#[doc = " `loomc_module_function_query_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_FUNCTION_QUERY_OPTIONS: loomc_structure_type_e = 26;
#[doc = " `loomc_module_global_query_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_MODULE_GLOBAL_QUERY_OPTIONS: loomc_structure_type_e = 27;
#[doc = " `loomc_amdgpu_profile_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_AMDGPU_PROFILE_OPTIONS: loomc_structure_type_e = 28;
#[doc = " `loomc_artifact_manifest_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_ARTIFACT_MANIFEST_OPTIONS: loomc_structure_type_e = 30;
#[doc = " `loomc_compile_report_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILE_REPORT_OPTIONS: loomc_structure_type_e = 31;
#[doc = " `loomc_sanitizer_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_SANITIZER_OPTIONS: loomc_structure_type_e = 32;
#[doc = " `loomc_launch_config_t`."]
pub const LOOMC_STRUCTURE_TYPE_LAUNCH_CONFIG: loomc_structure_type_e = 34;
#[doc = " `loomc_amdgpu_iree_hal_target_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_AMDGPU_IREE_HAL_TARGET_OPTIONS: loomc_structure_type_e = 35;
#[doc = " `loomc_link_dependency_analysis_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_DEPENDENCY_ANALYSIS_OPTIONS: loomc_structure_type_e = 36;
#[doc = " `loomc_cmd_program_product_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CMD_PROGRAM_PRODUCT_OPTIONS: loomc_structure_type_e = 37;
#[doc = " `loomc_link_request_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_LINK_REQUEST_OPTIONS: loomc_structure_type_e = 38;
#[doc = " `loomc_cmd_program_request_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CMD_PROGRAM_REQUEST_OPTIONS: loomc_structure_type_e = 39;
#[doc = " `loomc_task_pool_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_TASK_POOL_OPTIONS: loomc_structure_type_e = 40;
#[doc = " `loomc_cxx_import_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_CXX_IMPORT_OPTIONS: loomc_structure_type_e = 41;
#[doc = " `loomc_compile_artifact_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_COMPILE_ARTIFACT_OPTIONS: loomc_structure_type_e = 42;
#[doc = " `loomc_pass_trace_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_PASS_TRACE_OPTIONS: loomc_structure_type_e = 43;
#[doc = " `loomc_amdgpu_profile_execution_options_t`."]
pub const LOOMC_STRUCTURE_TYPE_AMDGPU_PROFILE_EXECUTION_OPTIONS: loomc_structure_type_e = 44;
#[doc = " Structure type values used by extensible public descriptors.\n\n Extensible descriptors store one of these values in their `type` field and\n store `sizeof(descriptor_type)` in `structure_size`. Callers zero-initialize\n descriptors and set the fields they use."]
pub type loomc_structure_type_e = ::std::os::raw::c_uint;
#[doc = " Structure type values used by extensible public descriptors.\n\n Extensible descriptors store one of these values in their `type` field and\n store `sizeof(descriptor_type)` in `structure_size`. Callers zero-initialize\n descriptors and set the fields they use."]
pub use self::loomc_structure_type_e as loomc_structure_type_t;
#[doc = " Controls the behavior of a `loomc_allocator_ctl_fn_t` callback."]
pub type loomc_allocator_command_t = u32;
#[doc = " Allocates memory without requiring zero initialization."]
pub const LOOMC_ALLOCATOR_COMMAND_MALLOC: _bindgen_ty_1 = 0;
#[doc = " Allocates memory and zeros it before returning."]
pub const LOOMC_ALLOCATOR_COMMAND_CALLOC: _bindgen_ty_1 = 1;
#[doc = " Resizes an existing allocation."]
pub const LOOMC_ALLOCATOR_COMMAND_REALLOC: _bindgen_ty_1 = 2;
#[doc = " Frees an existing allocation."]
pub const LOOMC_ALLOCATOR_COMMAND_FREE: _bindgen_ty_1 = 3;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
#[doc = " Host allocation control callback.\n\n @param self Callback-owned allocator state pointer.\n @param command Allocation command to perform.\n @param params Command-specific parameter structure.\n @param inout_ptr Pointer to allocation storage. Allocation commands write\n the allocated pointer. Free commands read the pointer to free.\n @return OK on success or a non-OK status when the allocator cannot satisfy\n the command.\n\n @ownership\n Memory returned by an allocator must be freed through the same allocator."]
pub type loomc_allocator_ctl_fn_t = ::std::option::Option<
unsafe extern "C" fn(
self_: *mut ::std::os::raw::c_void,
command: loomc_allocator_command_t,
params: *const ::std::os::raw::c_void,
inout_ptr: *mut *mut ::std::os::raw::c_void,
) -> loomc_status_t,
>;
#[doc = " Host allocator used for persistent Loom object storage.\n\n APIs that take an allocator require `ctl` to be non-NULL. Callers that want\n the process heap must pass `loomc_allocator_system()` explicitly."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_allocator_t {
#[doc = " Callback-owned state pointer."]
pub self_: *mut ::std::os::raw::c_void,
#[doc = " Callback implementing allocation commands."]
pub ctl: loomc_allocator_ctl_fn_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_allocator_t"][::std::mem::size_of::<loomc_allocator_t>() - 16usize];
["Alignment of loomc_allocator_t"][::std::mem::align_of::<loomc_allocator_t>() - 8usize];
["Offset of field: loomc_allocator_t::self_"]
[::std::mem::offset_of!(loomc_allocator_t, self_) - 0usize];
["Offset of field: loomc_allocator_t::ctl"]
[::std::mem::offset_of!(loomc_allocator_t, ctl) - 8usize];
};
impl Default for loomc_allocator_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Immutable logical sequence of bytes stored in one or more segments.\n\n A sequence has constant contents and length. Retained handles may be shared\n across threads and enumerated concurrently."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_byte_sequence_t {
_unused: [u8; 0],
}
#[doc = " Successful operation."]
pub const LOOMC_STATUS_OK: loomc_status_code_e = 0;
#[doc = " Operation was cancelled by the caller."]
pub const LOOMC_STATUS_CANCELLED: loomc_status_code_e = 1;
#[doc = " Unknown error or unmapped failure."]
pub const LOOMC_STATUS_UNKNOWN: loomc_status_code_e = 2;
#[doc = " The caller provided an invalid argument."]
pub const LOOMC_STATUS_INVALID_ARGUMENT: loomc_status_code_e = 3;
#[doc = " A deadline was exceeded before the call completed."]
pub const LOOMC_STATUS_DEADLINE_EXCEEDED: loomc_status_code_e = 4;
#[doc = " A referenced resource could not be found."]
pub const LOOMC_STATUS_NOT_FOUND: loomc_status_code_e = 5;
#[doc = " The resource the caller attempted to create already exists."]
pub const LOOMC_STATUS_ALREADY_EXISTS: loomc_status_code_e = 6;
#[doc = " The caller does not have permission for the requested operation."]
pub const LOOMC_STATUS_PERMISSION_DENIED: loomc_status_code_e = 7;
#[doc = " A required resource was exhausted."]
pub const LOOMC_STATUS_RESOURCE_EXHAUSTED: loomc_status_code_e = 8;
#[doc = " The system is not in a required state for the operation."]
pub const LOOMC_STATUS_FAILED_PRECONDITION: loomc_status_code_e = 9;
#[doc = " The operation was aborted by the system."]
pub const LOOMC_STATUS_ABORTED: loomc_status_code_e = 10;
#[doc = " The operation was attempted outside a valid range."]
pub const LOOMC_STATUS_OUT_OF_RANGE: loomc_status_code_e = 11;
#[doc = " The operation has not been implemented or is not supported."]
pub const LOOMC_STATUS_UNIMPLEMENTED: loomc_status_code_e = 12;
#[doc = " An internal invariant was violated."]
pub const LOOMC_STATUS_INTERNAL: loomc_status_code_e = 13;
#[doc = " The underlying system is currently unavailable."]
pub const LOOMC_STATUS_UNAVAILABLE: loomc_status_code_e = 14;
#[doc = " Unrecoverable data loss or corruption occurred."]
pub const LOOMC_STATUS_DATA_LOSS: loomc_status_code_e = 15;
#[doc = " The requested operation does not have proper authentication."]
pub const LOOMC_STATUS_UNAUTHENTICATED: loomc_status_code_e = 16;
#[doc = " The operation has been deferred and must be resumed later."]
pub const LOOMC_STATUS_DEFERRED: loomc_status_code_e = 17;
#[doc = " The program or environment is incompatible with the request."]
pub const LOOMC_STATUS_INCOMPATIBLE: loomc_status_code_e = 18;
#[doc = " Mask covering all status code bits in a `loomc_status_t` value."]
pub const LOOMC_STATUS_CODE_MASK: loomc_status_code_e = 31;
#[doc = " Stable status codes shared by all Loom status modes.\n\n The numeric values are stable ABI and intentionally match the values used by\n optional IREE adapters so statuses can be passed across that boundary\n without conversion or information loss."]
pub type loomc_status_code_e = ::std::os::raw::c_uint;
#[doc = " Stable status codes shared by all Loom status modes.\n\n The numeric values are stable ABI and intentionally match the values used by\n optional IREE adapters so statuses can be passed across that boundary\n without conversion or information loss."]
pub use self::loomc_status_code_e as loomc_status_code_t;
#[doc = " Immutable source handle.\n\n @thread_safety\n Sources are immutable after creation. Retained source handles may be shared\n across threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_source_t {
_unused: [u8; 0],
}
#[doc = " Source format is unknown and must be inferred by the consumer."]
pub const LOOMC_SOURCE_FORMAT_UNKNOWN: loomc_source_format_e = 0;
#[doc = " Textual `.loom` source."]
pub const LOOMC_SOURCE_FORMAT_TEXT: loomc_source_format_e = 1;
#[doc = " Binary `.loombc` source."]
pub const LOOMC_SOURCE_FORMAT_BYTECODE: loomc_source_format_e = 2;
#[doc = " Source byte format."]
pub type loomc_source_format_e = ::std::os::raw::c_uint;
#[doc = " Source byte format."]
pub use self::loomc_source_format_e as loomc_source_format_t;
#[doc = " Source bytes are borrowed from the caller for the lifetime of the source."]
pub const LOOMC_SOURCE_STORAGE_BORROWED: loomc_source_storage_e = 0;
#[doc = " Source bytes are copied into storage owned by the source."]
pub const LOOMC_SOURCE_STORAGE_COPY: loomc_source_storage_e = 1;
#[doc = " Source bytes are owned externally and released by a caller callback."]
pub const LOOMC_SOURCE_STORAGE_EXTERNAL: loomc_source_storage_e = 2;
#[doc = " Storage policy for source bytes."]
pub type loomc_source_storage_e = ::std::os::raw::c_uint;
#[doc = " Storage policy for source bytes."]
pub use self::loomc_source_storage_e as loomc_source_storage_t;
#[doc = " Callback used to release externally owned source bytes.\n\n @param user_data Caller-provided value from `loomc_source_options_t`.\n @param contents Source bytes being released.\n\n @thread_safety\n The callback is invoked when the last source reference is released. Callers\n that share sources across threads must make the callback safe for whichever\n thread drops the final reference."]
pub type loomc_source_release_fn_t = ::std::option::Option<
unsafe extern "C" fn(user_data: *mut ::std::os::raw::c_void, contents: loomc_byte_span_t),
>;
#[doc = " Source creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_SOURCE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_source_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_source_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_SOURCE_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future source options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Input source format."]
pub format: loomc_source_format_t,
#[doc = " Stable identifier used in diagnostics and provider labels."]
pub identifier: loomc_string_view_t,
#[doc = " Input bytes."]
pub contents: loomc_byte_span_t,
#[doc = " Storage policy for `contents`."]
pub storage: loomc_source_storage_t,
#[doc = " Callback used when `storage` is `LOOMC_SOURCE_STORAGE_EXTERNAL`."]
pub release: loomc_source_release_fn_t,
#[doc = " User data passed to `release`."]
pub release_user_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_source_options_t"][::std::mem::size_of::<loomc_source_options_t>() - 88usize];
["Alignment of loomc_source_options_t"]
[::std::mem::align_of::<loomc_source_options_t>() - 8usize];
["Offset of field: loomc_source_options_t::type_"]
[::std::mem::offset_of!(loomc_source_options_t, type_) - 0usize];
["Offset of field: loomc_source_options_t::structure_size"]
[::std::mem::offset_of!(loomc_source_options_t, structure_size) - 8usize];
["Offset of field: loomc_source_options_t::next"]
[::std::mem::offset_of!(loomc_source_options_t, next) - 16usize];
["Offset of field: loomc_source_options_t::format"]
[::std::mem::offset_of!(loomc_source_options_t, format) - 24usize];
["Offset of field: loomc_source_options_t::identifier"]
[::std::mem::offset_of!(loomc_source_options_t, identifier) - 32usize];
["Offset of field: loomc_source_options_t::contents"]
[::std::mem::offset_of!(loomc_source_options_t, contents) - 48usize];
["Offset of field: loomc_source_options_t::storage"]
[::std::mem::offset_of!(loomc_source_options_t, storage) - 64usize];
["Offset of field: loomc_source_options_t::release"]
[::std::mem::offset_of!(loomc_source_options_t, release) - 72usize];
["Offset of field: loomc_source_options_t::release_user_data"]
[::std::mem::offset_of!(loomc_source_options_t, release_user_data) - 80usize];
};
impl Default for loomc_source_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Executable or loadable binary artifact."]
pub const LOOMC_ARTIFACT_KIND_EXECUTABLE: loomc_artifact_kind_e = 0;
#[doc = " Human-readable textual artifact."]
pub const LOOMC_ARTIFACT_KIND_TEXT: loomc_artifact_kind_e = 1;
#[doc = " Machine-readable report artifact."]
pub const LOOMC_ARTIFACT_KIND_REPORT: loomc_artifact_kind_e = 2;
#[doc = " Loom module artifact. The format indicates text or bytecode."]
pub const LOOMC_ARTIFACT_KIND_MODULE: loomc_artifact_kind_e = 3;
#[doc = " Compiled kernel launch-configuration program."]
pub const LOOMC_ARTIFACT_KIND_LAUNCH_CONFIG: loomc_artifact_kind_e = 4;
#[doc = " Artifact category."]
pub type loomc_artifact_kind_e = ::std::os::raw::c_uint;
#[doc = " Artifact category."]
pub use self::loomc_artifact_kind_e as loomc_artifact_kind_t;
#[doc = " Borrowed artifact view owned by a producer-specific result or product.\n\n @lifetime\n Artifact strings and the contents reference are owned by the\n operation-specific object that returned this view. They remain valid until\n that owner is released. Callers retaining contents independently use\n `loomc_byte_sequence_retain`."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_artifact_t {
#[doc = " Artifact kind."]
pub kind: loomc_artifact_kind_t,
#[doc = " Stable format string, such as `amdgpu-hsaco`, `spirv`,\n `LOOMC_ARTIFACT_FORMAT_LOOM_TEXT`, or `LOOMC_ARTIFACT_FORMAT_JSON`."]
pub format: loomc_string_view_t,
#[doc = " Human-readable artifact identifier."]
pub identifier: loomc_string_view_t,
#[doc = " Immutable artifact bytes. Valid artifacts always provide a non-NULL\n sequence, including for empty contents."]
pub contents: *mut loomc_byte_sequence_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_artifact_t"][::std::mem::size_of::<loomc_artifact_t>() - 48usize];
["Alignment of loomc_artifact_t"][::std::mem::align_of::<loomc_artifact_t>() - 8usize];
["Offset of field: loomc_artifact_t::kind"]
[::std::mem::offset_of!(loomc_artifact_t, kind) - 0usize];
["Offset of field: loomc_artifact_t::format"]
[::std::mem::offset_of!(loomc_artifact_t, format) - 8usize];
["Offset of field: loomc_artifact_t::identifier"]
[::std::mem::offset_of!(loomc_artifact_t, identifier) - 24usize];
["Offset of field: loomc_artifact_t::contents"]
[::std::mem::offset_of!(loomc_artifact_t, contents) - 40usize];
};
impl Default for loomc_artifact_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Does not request an artifact manifest."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_NONE: loomc_artifact_manifest_mode_e = 0;
#[doc = " Requests stable artifact, target, function, global, and summary ABI facts."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_SUMMARY: loomc_artifact_manifest_mode_e = 1;
#[doc = " Requests summary facts plus detail arrays such as function parameters."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_DETAILS: loomc_artifact_manifest_mode_e = 2;
#[doc = " Requests artifact-bound analysis facts when available."]
pub const LOOMC_ARTIFACT_MANIFEST_MODE_ANALYSIS: loomc_artifact_manifest_mode_e = 3;
#[doc = " Artifact manifest detail mode."]
pub type loomc_artifact_manifest_mode_e = ::std::os::raw::c_uint;
#[doc = " Artifact manifest detail mode."]
pub use self::loomc_artifact_manifest_mode_e as loomc_artifact_manifest_mode_t;
#[doc = " Artifact manifest emission options.\n\n Attach this descriptor through `loomc_emit_options_t::next`. The descriptor\n controls sidecar manifest production for the emitted target artifact. It\n does not compile source, run passes, or write filesystem paths."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_artifact_manifest_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_ARTIFACT_MANIFEST_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next invocation option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Selected manifest detail mode."]
pub mode: loomc_artifact_manifest_mode_t,
#[doc = " Result artifact identifier for the manifest JSON. Empty derives from the\n emitted artifact identifier by appending `.manifest.json`."]
pub identifier: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_artifact_manifest_options_t"]
[::std::mem::size_of::<loomc_artifact_manifest_options_t>() - 48usize];
["Alignment of loomc_artifact_manifest_options_t"]
[::std::mem::align_of::<loomc_artifact_manifest_options_t>() - 8usize];
["Offset of field: loomc_artifact_manifest_options_t::type_"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, type_) - 0usize];
["Offset of field: loomc_artifact_manifest_options_t::structure_size"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, structure_size) - 8usize];
["Offset of field: loomc_artifact_manifest_options_t::next"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, next) - 16usize];
["Offset of field: loomc_artifact_manifest_options_t::mode"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, mode) - 24usize];
["Offset of field: loomc_artifact_manifest_options_t::identifier"]
[::std::mem::offset_of!(loomc_artifact_manifest_options_t, identifier) - 32usize];
};
impl Default for loomc_artifact_manifest_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Single configuration key/value binding.\n\n @lifetime\n Binding strings are borrowed by the descriptor that contains them unless an\n operation explicitly documents that it copies the bindings."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_config_binding_t {
#[doc = " Config key, with a leading `@` accepted by normalization."]
pub key: loomc_string_view_t,
#[doc = " Config value spelling."]
pub value: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_config_binding_t"][::std::mem::size_of::<loomc_config_binding_t>() - 32usize];
["Alignment of loomc_config_binding_t"]
[::std::mem::align_of::<loomc_config_binding_t>() - 8usize];
["Offset of field: loomc_config_binding_t::key"]
[::std::mem::offset_of!(loomc_config_binding_t, key) - 0usize];
["Offset of field: loomc_config_binding_t::value"]
[::std::mem::offset_of!(loomc_config_binding_t, value) - 16usize];
};
impl Default for loomc_config_binding_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Require all final operation config values to be resolved."]
pub const LOOMC_CONFIG_POLICY_FLAG_REQUIRE_RESOLVED: loomc_config_policy_flag_bits_e = 1;
#[doc = " Configuration validation and resolution policy bit values."]
pub type loomc_config_policy_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_config_policy_flag_bits_t` values."]
pub type loomc_config_policy_flags_t = u32;
#[doc = " Text configuration options attached to a link or command-product operation.\n\n The plain binding array and optional JSON/JSONC object string normalize into\n the same key/value binding set. When both spellings define the same key, the\n explicit `bindings` entry overrides the JSON object entry.\n\n @lifetime\n All views and arrays are borrowed for the duration of the API call unless\n the consuming operation explicitly documents a longer copy."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_config_options_t {
#[doc = " Plain key/value bindings."]
pub bindings: *const loomc_config_binding_t,
#[doc = " Number of entries in `bindings`."]
pub binding_count: loomc_host_size_t,
#[doc = " Optional JSON/JSONC object string normalized into the same binding set."]
pub json_object: loomc_string_view_t,
#[doc = " Config validation and resolution policy flags."]
pub flags: loomc_config_policy_flags_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_config_options_t"][::std::mem::size_of::<loomc_config_options_t>() - 40usize];
["Alignment of loomc_config_options_t"]
[::std::mem::align_of::<loomc_config_options_t>() - 8usize];
["Offset of field: loomc_config_options_t::bindings"]
[::std::mem::offset_of!(loomc_config_options_t, bindings) - 0usize];
["Offset of field: loomc_config_options_t::binding_count"]
[::std::mem::offset_of!(loomc_config_options_t, binding_count) - 8usize];
["Offset of field: loomc_config_options_t::json_object"]
[::std::mem::offset_of!(loomc_config_options_t, json_object) - 16usize];
["Offset of field: loomc_config_options_t::flags"]
[::std::mem::offset_of!(loomc_config_options_t, flags) - 32usize];
};
impl Default for loomc_config_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Emits the stable structured JSON representation."]
pub const LOOMC_COMPILE_REPORT_FORMAT_JSON: loomc_compile_report_format_e = 0;
#[doc = " Emits bounded human-readable text."]
pub const LOOMC_COMPILE_REPORT_FORMAT_TEXT: loomc_compile_report_format_e = 1;
#[doc = " Compile report serialization format."]
pub type loomc_compile_report_format_e = ::std::os::raw::c_uint;
#[doc = " Compile report serialization format."]
pub use self::loomc_compile_report_format_e as loomc_compile_report_format_t;
#[doc = " Does not request a compile report."]
pub const LOOMC_COMPILE_REPORT_MODE_NONE: loomc_compile_report_mode_e = 0;
#[doc = " Requests stable target, status, artifact, and summary compiler facts."]
pub const LOOMC_COMPILE_REPORT_MODE_SUMMARY: loomc_compile_report_mode_e = 1;
#[doc = " Requests summary facts plus detail rows when producers support them."]
pub const LOOMC_COMPILE_REPORT_MODE_DETAILS: loomc_compile_report_mode_e = 2;
#[doc = " Compile report detail mode."]
pub type loomc_compile_report_mode_e = ::std::os::raw::c_uint;
#[doc = " Compile report detail mode."]
pub use self::loomc_compile_report_mode_e as loomc_compile_report_mode_t;
#[doc = " Compile report emission options.\n\n Attach this descriptor through `loomc_emit_options_t::next`. The descriptor\n controls report production for the target-artifact transaction, including\n transactions rejected before emission. It does not run compilation passes,\n force target analyses, or write filesystem paths."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_compile_report_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_COMPILE_REPORT_OPTIONS`\n when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next invocation option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Selected report detail mode."]
pub mode: loomc_compile_report_mode_t,
#[doc = " Report serialization format. Zero selects structured JSON."]
pub format: loomc_compile_report_format_t,
#[doc = " Result artifact identifier for the compile report. Empty derives from the\n emitted artifact identifier by appending `.compile-report.json` or\n `.compile-report.txt` according to `format`. It remains empty when\n compilation fails before selecting an emitter and no artifact identifier\n was provided."]
pub identifier: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_compile_report_options_t"]
[::std::mem::size_of::<loomc_compile_report_options_t>() - 48usize];
["Alignment of loomc_compile_report_options_t"]
[::std::mem::align_of::<loomc_compile_report_options_t>() - 8usize];
["Offset of field: loomc_compile_report_options_t::type_"]
[::std::mem::offset_of!(loomc_compile_report_options_t, type_) - 0usize];
["Offset of field: loomc_compile_report_options_t::structure_size"]
[::std::mem::offset_of!(loomc_compile_report_options_t, structure_size) - 8usize];
["Offset of field: loomc_compile_report_options_t::next"]
[::std::mem::offset_of!(loomc_compile_report_options_t, next) - 16usize];
["Offset of field: loomc_compile_report_options_t::mode"]
[::std::mem::offset_of!(loomc_compile_report_options_t, mode) - 24usize];
["Offset of field: loomc_compile_report_options_t::format"]
[::std::mem::offset_of!(loomc_compile_report_options_t, format) - 28usize];
["Offset of field: loomc_compile_report_options_t::identifier"]
[::std::mem::offset_of!(loomc_compile_report_options_t, identifier) - 32usize];
};
impl Default for loomc_compile_report_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Immutable Loom API context.\n\n @thread_safety\n Contexts are immutable after creation and may be shared across threads.\n Operations that need mutable source-location tables serialize that mutation\n through their owning builder or invocation object rather than exposing it on\n the context API."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_context_t {
_unused: [u8; 0],
}
#[doc = " Retain exact source contents referenced by admitted IR. This is the\n default and allows later compiler diagnostics to render source excerpts."]
pub const LOOMC_SOURCE_RETENTION_EXACT: loomc_source_retention_e = 0;
#[doc = " Retain source identifiers and available coordinates without source\n contents. Structured diagnostics remain available without keeping\n authored files live with modules, results, or text link indexes."]
pub const LOOMC_SOURCE_RETENTION_METADATA_ONLY: loomc_source_retention_e = 1;
#[doc = " Retention policy for source contents used to enrich diagnostics."]
pub type loomc_source_retention_e = ::std::os::raw::c_uint;
#[doc = " Retention policy for source contents used to enrich diagnostics."]
pub use self::loomc_source_retention_e as loomc_source_retention_t;
#[doc = " Context creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_CONTEXT_OPTIONS`, set `structure_size` to\n `sizeof(loomc_context_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_context_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_CONTEXT_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for context options such as\n `loomc_context_target_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Source-content retention for operations using this context. Serialized\n bytecode retained by a reusable link index is operational linker input\n and is not governed by this diagnostic policy."]
pub source_retention: loomc_source_retention_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_context_options_t"][::std::mem::size_of::<loomc_context_options_t>() - 32usize];
["Alignment of loomc_context_options_t"]
[::std::mem::align_of::<loomc_context_options_t>() - 8usize];
["Offset of field: loomc_context_options_t::type_"]
[::std::mem::offset_of!(loomc_context_options_t, type_) - 0usize];
["Offset of field: loomc_context_options_t::structure_size"]
[::std::mem::offset_of!(loomc_context_options_t, structure_size) - 8usize];
["Offset of field: loomc_context_options_t::next"]
[::std::mem::offset_of!(loomc_context_options_t, next) - 16usize];
["Offset of field: loomc_context_options_t::source_retention"]
[::std::mem::offset_of!(loomc_context_options_t, source_retention) - 24usize];
};
impl Default for loomc_context_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Informational note."]
pub const LOOMC_DIAGNOSTIC_SEVERITY_NOTE: loomc_diagnostic_severity_e = 0;
#[doc = " Warning that does not make the operation fail."]
pub const LOOMC_DIAGNOSTIC_SEVERITY_WARNING: loomc_diagnostic_severity_e = 1;
#[doc = " Error that makes the operation fail."]
pub const LOOMC_DIAGNOSTIC_SEVERITY_ERROR: loomc_diagnostic_severity_e = 2;
#[doc = " Diagnostic severity."]
pub type loomc_diagnostic_severity_e = ::std::os::raw::c_uint;
#[doc = " Diagnostic severity."]
pub use self::loomc_diagnostic_severity_e as loomc_diagnostic_severity_t;
#[doc = " Source range attached to a diagnostic.\n\n Byte offsets are zero-based and line/column values are one-based when\n available. A zero line or column means the location was not computed or is\n not meaningful for the source format. A source can retain its identifier\n without contents; recorded byte offsets and line/column values remain valid\n against a caller-owned copy of the identified source. Unknown byte offsets\n are zero.\n\n @lifetime\n The source pointer is retained by the owning result when present. The range\n view remains valid until that result is released."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_source_range_t {
#[doc = " Source identity with optional contents, or NULL for an unknown source."]
pub source: *const loomc_source_t,
#[doc = " First byte in source contents covered by the range."]
pub start: loomc_host_size_t,
#[doc = " One-past-last byte in source contents covered by the range."]
pub end: loomc_host_size_t,
#[doc = " One-based starting line, or zero when unavailable."]
pub start_line: u32,
#[doc = " One-based starting column, or zero when unavailable."]
pub start_column: u32,
#[doc = " One-based ending line, or zero when unavailable."]
pub end_line: u32,
#[doc = " One-based ending column, or zero when unavailable."]
pub end_column: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_source_range_t"][::std::mem::size_of::<loomc_source_range_t>() - 40usize];
["Alignment of loomc_source_range_t"][::std::mem::align_of::<loomc_source_range_t>() - 8usize];
["Offset of field: loomc_source_range_t::source"]
[::std::mem::offset_of!(loomc_source_range_t, source) - 0usize];
["Offset of field: loomc_source_range_t::start"]
[::std::mem::offset_of!(loomc_source_range_t, start) - 8usize];
["Offset of field: loomc_source_range_t::end"]
[::std::mem::offset_of!(loomc_source_range_t, end) - 16usize];
["Offset of field: loomc_source_range_t::start_line"]
[::std::mem::offset_of!(loomc_source_range_t, start_line) - 24usize];
["Offset of field: loomc_source_range_t::start_column"]
[::std::mem::offset_of!(loomc_source_range_t, start_column) - 28usize];
["Offset of field: loomc_source_range_t::end_line"]
[::std::mem::offset_of!(loomc_source_range_t, end_line) - 32usize];
["Offset of field: loomc_source_range_t::end_column"]
[::std::mem::offset_of!(loomc_source_range_t, end_column) - 36usize];
};
impl Default for loomc_source_range_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " A labeled source location providing context for a primary diagnostic.\n\n Examples include a callee's declaration or the previous use of a value.\n The owning result retains the label and source identity. Source contents\n are optional, as with the primary range."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_diagnostic_related_location_t {
#[doc = " Human-readable relationship, such as \"contract defined here\"."]
pub label: loomc_string_view_t,
#[doc = " Source range of the related location."]
pub range: loomc_source_range_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_diagnostic_related_location_t"]
[::std::mem::size_of::<loomc_diagnostic_related_location_t>() - 56usize];
["Alignment of loomc_diagnostic_related_location_t"]
[::std::mem::align_of::<loomc_diagnostic_related_location_t>() - 8usize];
["Offset of field: loomc_diagnostic_related_location_t::label"]
[::std::mem::offset_of!(loomc_diagnostic_related_location_t, label) - 0usize];
["Offset of field: loomc_diagnostic_related_location_t::range"]
[::std::mem::offset_of!(loomc_diagnostic_related_location_t, range) - 16usize];
};
impl Default for loomc_diagnostic_related_location_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " A named diagnostic parameter rendered for structured consumers.\n\n Parameter values use the same canonical human-readable spelling as the\n diagnostic message. This keeps compiler-owned parameter variants and type\n handles behind the LoomC boundary while allowing tools to match or report\n structured values without parsing message text."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_diagnostic_parameter_t {
#[doc = " Stable parameter name from the diagnostic definition."]
pub name: loomc_string_view_t,
#[doc = " Canonical human-readable parameter value."]
pub value: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_diagnostic_parameter_t"]
[::std::mem::size_of::<loomc_diagnostic_parameter_t>() - 32usize];
["Alignment of loomc_diagnostic_parameter_t"]
[::std::mem::align_of::<loomc_diagnostic_parameter_t>() - 8usize];
["Offset of field: loomc_diagnostic_parameter_t::name"]
[::std::mem::offset_of!(loomc_diagnostic_parameter_t, name) - 0usize];
["Offset of field: loomc_diagnostic_parameter_t::value"]
[::std::mem::offset_of!(loomc_diagnostic_parameter_t, value) - 16usize];
};
impl Default for loomc_diagnostic_parameter_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Borrowed diagnostic view owned by a result object.\n\n @lifetime\n Diagnostic strings, parameters, related locations, and source ranges are\n owned by the result that returned this view. They remain valid until that\n result is released."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_diagnostic_t {
#[doc = " Diagnostic severity."]
pub severity: loomc_diagnostic_severity_t,
#[doc = " Stable diagnostic code."]
pub code: loomc_string_view_t,
#[doc = " Human-readable rendered message."]
pub message: loomc_string_view_t,
#[doc = " Canonical human-readable rendering of the complete diagnostic.\n\n This includes source excerpts, carets, fix hints, and related locations\n when available, and ends with a newline. It is intended for terminal and\n log presentation; tools requiring stable data should consume the\n structured fields instead. The view is empty when no canonical rendering\n is available."]
pub formatted_text: loomc_string_view_t,
#[doc = " Primary source range."]
pub range: loomc_source_range_t,
#[doc = " Related locations in producer order, or NULL when the count is zero."]
pub related_locations: *const loomc_diagnostic_related_location_t,
#[doc = " Number of entries in related_locations."]
pub related_location_count: loomc_host_size_t,
#[doc = " Number of additional resolved locations omitted by the producer's limit."]
pub related_location_omitted_count: loomc_host_size_t,
#[doc = " Named rendered parameters in diagnostic-definition order, or NULL when\n the count is zero."]
pub parameters: *const loomc_diagnostic_parameter_t,
#[doc = " Number of entries in parameters."]
pub parameter_count: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_diagnostic_t"][::std::mem::size_of::<loomc_diagnostic_t>() - 136usize];
["Alignment of loomc_diagnostic_t"][::std::mem::align_of::<loomc_diagnostic_t>() - 8usize];
["Offset of field: loomc_diagnostic_t::severity"]
[::std::mem::offset_of!(loomc_diagnostic_t, severity) - 0usize];
["Offset of field: loomc_diagnostic_t::code"]
[::std::mem::offset_of!(loomc_diagnostic_t, code) - 8usize];
["Offset of field: loomc_diagnostic_t::message"]
[::std::mem::offset_of!(loomc_diagnostic_t, message) - 24usize];
["Offset of field: loomc_diagnostic_t::formatted_text"]
[::std::mem::offset_of!(loomc_diagnostic_t, formatted_text) - 40usize];
["Offset of field: loomc_diagnostic_t::range"]
[::std::mem::offset_of!(loomc_diagnostic_t, range) - 56usize];
["Offset of field: loomc_diagnostic_t::related_locations"]
[::std::mem::offset_of!(loomc_diagnostic_t, related_locations) - 96usize];
["Offset of field: loomc_diagnostic_t::related_location_count"]
[::std::mem::offset_of!(loomc_diagnostic_t, related_location_count) - 104usize];
["Offset of field: loomc_diagnostic_t::related_location_omitted_count"]
[::std::mem::offset_of!(loomc_diagnostic_t, related_location_omitted_count) - 112usize];
["Offset of field: loomc_diagnostic_t::parameters"]
[::std::mem::offset_of!(loomc_diagnostic_t, parameters) - 120usize];
["Offset of field: loomc_diagnostic_t::parameter_count"]
[::std::mem::offset_of!(loomc_diagnostic_t, parameter_count) - 128usize];
};
impl Default for loomc_diagnostic_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Immutable operation result.\n\n @thread_safety\n Results are immutable after creation. Retained result handles may be shared\n across threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_result_t {
_unused: [u8; 0],
}
#[doc = " Mutable per-worker scratch workspace.\n\n @thread_safety\n A workspace is not internally synchronized. Calls that mutate the same\n workspace require external synchronization. Distinct workspaces may be used\n concurrently by different threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_workspace_t {
_unused: [u8; 0],
}
#[doc = " Workspace creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_WORKSPACE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_workspace_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_workspace_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_WORKSPACE_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future workspace options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Total bytes acquired from the host allocator per fixed-size arena block.\n Internal tracking metadata consumes part of this capacity."]
pub block_size: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_workspace_options_t"]
[::std::mem::size_of::<loomc_workspace_options_t>() - 32usize];
["Alignment of loomc_workspace_options_t"]
[::std::mem::align_of::<loomc_workspace_options_t>() - 8usize];
["Offset of field: loomc_workspace_options_t::type_"]
[::std::mem::offset_of!(loomc_workspace_options_t, type_) - 0usize];
["Offset of field: loomc_workspace_options_t::structure_size"]
[::std::mem::offset_of!(loomc_workspace_options_t, structure_size) - 8usize];
["Offset of field: loomc_workspace_options_t::next"]
[::std::mem::offset_of!(loomc_workspace_options_t, next) - 16usize];
["Offset of field: loomc_workspace_options_t::block_size"]
[::std::mem::offset_of!(loomc_workspace_options_t, block_size) - 24usize];
};
impl Default for loomc_workspace_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Opaque parsed, linked, optimized, or lowered module.\n\n Modules use arena storage from the workspace that created, linked, cloned,\n or deserialized them. Releasing a module returns its active arena blocks to\n that workspace. A module retains the workspace, so release ordering is\n memory-safe, but keeping modules live across `loomc_workspace_trim` keeps\n their storage live too.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. Module contents\n are not internally synchronized. Read-only operations such as serialization\n may run concurrently with other read-only operations when the caller\n guarantees that no mutating module operation is active. Mutating operations\n such as compiling a module require exclusive access to that module handle."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_module_t {
_unused: [u8; 0],
}
#[doc = " Function symbol is visible outside the module for linking."]
pub const LOOMC_MODULE_FUNCTION_FLAG_PUBLIC: loomc_module_function_flag_bits_e = 1;
#[doc = " `loomc_module_function_try_get_export_info` can return export metadata."]
pub const LOOMC_MODULE_FUNCTION_FLAG_HAS_EXPORT_INFO: loomc_module_function_flag_bits_e = 2;
#[doc = " Module function metadata flag bits."]
pub type loomc_module_function_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " `loomc_module_function_export_info_t::export_symbol` is present."]
pub const LOOMC_MODULE_FUNCTION_EXPORT_FLAG_HAS_SYMBOL: loomc_module_function_export_flag_bits_e =
1;
#[doc = " Export metadata flag bits."]
pub type loomc_module_function_export_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Global symbol is visible outside the module for linking."]
pub const LOOMC_MODULE_GLOBAL_FLAG_PUBLIC: loomc_module_global_flag_bits_e = 1;
#[doc = " Module global metadata flag bits."]
pub type loomc_module_global_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Prefer target-low assembly syntax using each function's representation\n contract, with canonical text as a lossless fallback."]
pub const LOOMC_MODULE_TEXT_PRESENTATION_DEFAULT: loomc_module_text_presentation_e = 0;
#[doc = " Force canonical text with descriptor-backed target-low operations printed\n as ordinary `low.op<...>` operations."]
pub const LOOMC_MODULE_TEXT_PRESENTATION_GENERIC: loomc_module_text_presentation_e = 1;
#[doc = " Require descriptor-backed target-low assembly syntax for every\n self-describing target-low function. Serialization fails when a function\n has no lossless assembly spelling for its representation contract."]
pub const LOOMC_MODULE_TEXT_PRESENTATION_LOW_ASM: loomc_module_text_presentation_e = 2;
#[doc = " Text presentation policy used when serializing `.loom` text."]
pub type loomc_module_text_presentation_e = ::std::os::raw::c_uint;
#[doc = " Text presentation policy used when serializing `.loom` text."]
pub use self::loomc_module_text_presentation_e as loomc_module_text_presentation_t;
#[doc = " Module serialization options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_MODULE_SERIALIZE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_module_serialize_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_module_serialize_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_MODULE_SERIALIZE_OPTIONS`\n when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future serialization options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Output source format. Unknown selects textual `.loom`."]
pub format: loomc_source_format_t,
#[doc = " Identifier to attach to a returned source. Empty uses a format-specific\n default. Path and `FILE*` serialization do not interpret this field."]
pub identifier: loomc_string_view_t,
#[doc = " Presentation policy for textual `.loom` output."]
pub text_presentation: loomc_module_text_presentation_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_module_serialize_options_t"]
[::std::mem::size_of::<loomc_module_serialize_options_t>() - 56usize];
["Alignment of loomc_module_serialize_options_t"]
[::std::mem::align_of::<loomc_module_serialize_options_t>() - 8usize];
["Offset of field: loomc_module_serialize_options_t::type_"]
[::std::mem::offset_of!(loomc_module_serialize_options_t, type_) - 0usize];
["Offset of field: loomc_module_serialize_options_t::structure_size"]
[::std::mem::offset_of!(loomc_module_serialize_options_t, structure_size) - 8usize];
["Offset of field: loomc_module_serialize_options_t::next"]
[::std::mem::offset_of!(loomc_module_serialize_options_t, next) - 16usize];
["Offset of field: loomc_module_serialize_options_t::format"]
[::std::mem::offset_of!(loomc_module_serialize_options_t, format) - 24usize];
["Offset of field: loomc_module_serialize_options_t::identifier"]
[::std::mem::offset_of!(loomc_module_serialize_options_t, identifier) - 32usize];
["Offset of field: loomc_module_serialize_options_t::text_presentation"]
[::std::mem::offset_of!(loomc_module_serialize_options_t, text_presentation) - 48usize];
};
impl Default for loomc_module_serialize_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Prepared immutable pass program.\n\n Pass programs are separate from compilers so JITs and autotuners can cache\n common pipelines, choose among several prepared programs per invocation, or\n sweep pipeline configurations without constructing many compiler handles.\n Pass programs remain target-independent. Target-aware predicates resolve\n each function's durable target when the program executes.\n\n @thread_safety\n Pass programs are immutable after creation and may be shared across worker\n threads. Retain/release operations are safe from multiple threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_pass_program_t {
_unused: [u8; 0],
}
#[doc = " Bitset of `loomc_sanitizer_check_bit_e` values selecting assertion classes."]
pub type loomc_sanitizer_checks_t = u64;
#[doc = " Bitset of `loomc_sanitizer_flag_bit_e` values controlling sanitizer\n behavior."]
pub type loomc_sanitizer_flags_t = u32;
#[doc = " Use the target's default structured sanitizer report path."]
pub const LOOMC_SANITIZER_REPORTING_MODE_DEFAULT: loomc_sanitizer_reporting_mode_e = 0;
#[doc = " Trap directly on sanitizer failures without emitting structured reports."]
pub const LOOMC_SANITIZER_REPORTING_MODE_TRAP: loomc_sanitizer_reporting_mode_e = 1;
#[doc = " Emit structured sanitizer reports without using a direct trap."]
pub const LOOMC_SANITIZER_REPORTING_MODE_REPORT_ONLY: loomc_sanitizer_reporting_mode_e = 2;
#[doc = " Target-specific behavior when a lowered sanitizer assertion fails."]
pub type loomc_sanitizer_reporting_mode_e = ::std::os::raw::c_uint;
#[doc = " Target-specific behavior when a lowered sanitizer assertion fails."]
pub use self::loomc_sanitizer_reporting_mode_e as loomc_sanitizer_reporting_mode_t;
#[doc = " Invocation option extension that enables sanitizer assertions.\n\n Attach this descriptor to `loomc_target_pipeline_options_t::next` when the\n target pipeline should contain sanitizer pass slots. The target pipeline\n treats `checks == 0` as disabled and emits no sanitizer pass IR. The\n reporting mode is carried to the target assertion lowering path."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_sanitizer_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_SANITIZER_OPTIONS`."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next invocation option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Assertion classes enabled by the caller."]
pub checks: loomc_sanitizer_checks_t,
#[doc = " Additional behavior flags enabled by the caller."]
pub flags: loomc_sanitizer_flags_t,
#[doc = " Target failure reporting behavior for lowered sanitizer assertions."]
pub reporting_mode: loomc_sanitizer_reporting_mode_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_sanitizer_options_t"]
[::std::mem::size_of::<loomc_sanitizer_options_t>() - 40usize];
["Alignment of loomc_sanitizer_options_t"]
[::std::mem::align_of::<loomc_sanitizer_options_t>() - 8usize];
["Offset of field: loomc_sanitizer_options_t::type_"]
[::std::mem::offset_of!(loomc_sanitizer_options_t, type_) - 0usize];
["Offset of field: loomc_sanitizer_options_t::structure_size"]
[::std::mem::offset_of!(loomc_sanitizer_options_t, structure_size) - 8usize];
["Offset of field: loomc_sanitizer_options_t::next"]
[::std::mem::offset_of!(loomc_sanitizer_options_t, next) - 16usize];
["Offset of field: loomc_sanitizer_options_t::checks"]
[::std::mem::offset_of!(loomc_sanitizer_options_t, checks) - 24usize];
["Offset of field: loomc_sanitizer_options_t::flags"]
[::std::mem::offset_of!(loomc_sanitizer_options_t, flags) - 32usize];
["Offset of field: loomc_sanitizer_options_t::reporting_mode"]
[::std::mem::offset_of!(loomc_sanitizer_options_t, reporting_mode) - 36usize];
};
impl Default for loomc_sanitizer_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Prepared immutable target environment.\n\n A target environment owns target provider composition selected by the\n linked binary. It should be created once per target provider set and reused\n across contexts, compilers, pass programs, and worker threads.\n\n @thread_safety\n Target environments are immutable after creation and may be shared across\n threads. Retain/release operations are safe from multiple threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_target_environment_t {
_unused: [u8; 0],
}
#[doc = " Prepared immutable target profile.\n\n A target profile owns normalized target facts and any target-family payload\n needed by compiler passes or emitters. Profiles are separate from contexts\n and compilers so embedders can cache one profile per device, saved hardware\n profile, or cross-compilation bucket.\n\n @thread_safety\n Target profiles are immutable after creation and may be shared across\n threads. Retain/release operations are safe from multiple threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_target_profile_t {
_unused: [u8; 0],
}
#[doc = " Context option extension that registers a target environment.\n\n Put this descriptor on `loomc_context_options_t::next` so target dialects\n are registered before the context is finalized. The context retains the\n target environment on success; the caller may release its reference after\n `loomc_context_create` returns."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_context_target_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_CONTEXT_TARGET_OPTIONS`."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next context option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Target environment to register with the context."]
pub target_environment: *mut loomc_target_environment_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_context_target_options_t"]
[::std::mem::size_of::<loomc_context_target_options_t>() - 32usize];
["Alignment of loomc_context_target_options_t"]
[::std::mem::align_of::<loomc_context_target_options_t>() - 8usize];
["Offset of field: loomc_context_target_options_t::type_"]
[::std::mem::offset_of!(loomc_context_target_options_t, type_) - 0usize];
["Offset of field: loomc_context_target_options_t::structure_size"]
[::std::mem::offset_of!(loomc_context_target_options_t, structure_size) - 8usize];
["Offset of field: loomc_context_target_options_t::next"]
[::std::mem::offset_of!(loomc_context_target_options_t, next) - 16usize];
["Offset of field: loomc_context_target_options_t::target_environment"]
[::std::mem::offset_of!(loomc_context_target_options_t, target_environment) - 24usize];
};
impl Default for loomc_context_target_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Lower source/kernel IR to target-low IR prepared for target emission."]
pub const LOOMC_TARGET_PIPELINE_KIND_PREPARED_LOW: loomc_target_pipeline_kind_e = 0;
#[doc = " Lower source/kernel IR to target-low IR before target ABI/resource\n materialization and packetization preparation."]
pub const LOOMC_TARGET_PIPELINE_KIND_SOURCE_LOW: loomc_target_pipeline_kind_e = 1;
#[doc = " Target lowering pipeline boundary."]
pub type loomc_target_pipeline_kind_e = ::std::os::raw::c_uint;
#[doc = " Target lowering pipeline boundary."]
pub use self::loomc_target_pipeline_kind_e as loomc_target_pipeline_kind_t;
#[doc = " Lower source structured control flow to explicit CFG before source-to-low."]
pub const LOOMC_TARGET_CONTROL_FLOW_LOWERING_CFG: loomc_target_control_flow_lowering_e = 0;
#[doc = " Preserve supported structured control flow into target-low IR."]
pub const LOOMC_TARGET_CONTROL_FLOW_LOWERING_STRUCTURED_LOW: loomc_target_control_flow_lowering_e =
1;
#[doc = " Control-flow shape selected for source-to-low lowering."]
pub type loomc_target_control_flow_lowering_e = ::std::os::raw::c_uint;
#[doc = " Control-flow shape selected for source-to-low lowering."]
pub use self::loomc_target_control_flow_lowering_e as loomc_target_control_flow_lowering_t;
#[doc = " Target pipeline creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_TARGET_PIPELINE_OPTIONS`, set `structure_size` to\n `sizeof(loomc_target_pipeline_options_t)`, and fill the requested fields.\n A zero-initialized descriptor selects the prepared target-low pipeline with\n CFG control-flow lowering."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_target_pipeline_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_TARGET_PIPELINE_OPTIONS`\n when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for target pipeline options such as\n `loomc_sanitizer_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Stable identifier used for the synthetic pipeline module and diagnostics.\n Empty selects a library-defined identifier."]
pub identifier: loomc_string_view_t,
#[doc = " Target pipeline boundary to build."]
pub kind: loomc_target_pipeline_kind_t,
#[doc = " Control-flow shape selected for the source-to-low boundary."]
pub control_flow_lowering: loomc_target_control_flow_lowering_t,
#[doc = " Maximum source-to-low diagnostics. Zero uses source-to-low's default."]
pub source_to_low_max_errors: u32,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_target_pipeline_options_t"]
[::std::mem::size_of::<loomc_target_pipeline_options_t>() - 56usize];
["Alignment of loomc_target_pipeline_options_t"]
[::std::mem::align_of::<loomc_target_pipeline_options_t>() - 8usize];
["Offset of field: loomc_target_pipeline_options_t::type_"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, type_) - 0usize];
["Offset of field: loomc_target_pipeline_options_t::structure_size"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, structure_size) - 8usize];
["Offset of field: loomc_target_pipeline_options_t::next"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, next) - 16usize];
["Offset of field: loomc_target_pipeline_options_t::identifier"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, identifier) - 24usize];
["Offset of field: loomc_target_pipeline_options_t::kind"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, kind) - 40usize];
["Offset of field: loomc_target_pipeline_options_t::control_flow_lowering"]
[::std::mem::offset_of!(loomc_target_pipeline_options_t, control_flow_lowering) - 44usize];
["Offset of field: loomc_target_pipeline_options_t::source_to_low_max_errors"][::std::mem::offset_of!(
loomc_target_pipeline_options_t,
source_to_low_max_errors
) - 48usize];
};
impl Default for loomc_target_pipeline_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Emit artifact request flags."]
pub type loomc_emit_artifact_flags_t = u32;
#[doc = " Request the primary loadable artifact. A zero flag value also requests\n the primary artifact."]
pub const LOOMC_EMIT_ARTIFACT_FLAG_PRIMARY: loomc_emit_artifact_flag_bits_e = 1;
#[doc = " Emit artifact request flag bits."]
pub type loomc_emit_artifact_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Target emission options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS`, set `structure_size` to\n `sizeof(loomc_emit_options_t)`, and fill the requested fields. Attach\n `loomc_artifact_manifest_options_t`, `loomc_compile_report_options_t`,\n `loomc_option_dict_t`, and target-specific descriptors through `next`."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_emit_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_EMIT_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for emission options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Artifact format to emit. Empty selects the only linked emitter and fails\n if the target environment has zero or multiple emitters."]
pub artifact_format: loomc_string_view_t,
#[doc = " Artifact identifier for the primary output. Empty selects the emitter's\n default identifier."]
pub identifier: loomc_string_view_t,
#[doc = " Requested artifact classes. Zero requests the primary artifact."]
pub artifact_flags: loomc_emit_artifact_flags_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_emit_options_t"][::std::mem::size_of::<loomc_emit_options_t>() - 64usize];
["Alignment of loomc_emit_options_t"][::std::mem::align_of::<loomc_emit_options_t>() - 8usize];
["Offset of field: loomc_emit_options_t::type_"]
[::std::mem::offset_of!(loomc_emit_options_t, type_) - 0usize];
["Offset of field: loomc_emit_options_t::structure_size"]
[::std::mem::offset_of!(loomc_emit_options_t, structure_size) - 8usize];
["Offset of field: loomc_emit_options_t::next"]
[::std::mem::offset_of!(loomc_emit_options_t, next) - 16usize];
["Offset of field: loomc_emit_options_t::artifact_format"]
[::std::mem::offset_of!(loomc_emit_options_t, artifact_format) - 24usize];
["Offset of field: loomc_emit_options_t::identifier"]
[::std::mem::offset_of!(loomc_emit_options_t, identifier) - 40usize];
["Offset of field: loomc_emit_options_t::artifact_flags"]
[::std::mem::offset_of!(loomc_emit_options_t, artifact_flags) - 56usize];
};
impl Default for loomc_emit_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Human-readable event metadata followed by textual Loom IR."]
pub const LOOMC_PASS_TRACE_FORMAT_TEXT: loomc_pass_trace_format_e = 0;
#[doc = " One JSON object per event with JSON-escaped textual Loom IR."]
pub const LOOMC_PASS_TRACE_FORMAT_JSONL: loomc_pass_trace_format_e = 1;
#[doc = " Formatted pass trace representation."]
pub type loomc_pass_trace_format_e = ::std::os::raw::c_uint;
#[doc = " Formatted pass trace representation."]
pub use self::loomc_pass_trace_format_e as loomc_pass_trace_format_t;
#[doc = " Trace the IR immediately before every pass invocation."]
pub const LOOMC_PASS_TRACE_FLAG_BEFORE_ALL: loomc_pass_trace_flag_bits_e = 1;
#[doc = " Trace the IR immediately after every pass invocation."]
pub const LOOMC_PASS_TRACE_FLAG_AFTER_ALL: loomc_pass_trace_flag_bits_e = 2;
#[doc = " Pass trace selection bits."]
pub type loomc_pass_trace_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_pass_trace_flag_bits_t`."]
pub type loomc_pass_trace_flags_t = u32;
#[doc = " Writes one ordered trace fragment.\n\n `fragment` is borrowed only for the callback duration and may contain any\n number of bytes, including one byte. Returning a non-OK status stops the\n compile operation and transfers ownership of that status to Loom."]
pub type loomc_pass_trace_write_fn_t = ::std::option::Option<
unsafe extern "C" fn(
user_data: *mut ::std::os::raw::c_void,
fragment: loomc_string_view_t,
) -> loomc_status_t,
>;
#[doc = " Borrowed destination for one sequential pass trace."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_pass_trace_sink_t {
#[doc = " Function invoked for each ordered trace fragment."]
pub write: loomc_pass_trace_write_fn_t,
#[doc = " Opaque value passed to `write`."]
pub user_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_pass_trace_sink_t"][::std::mem::size_of::<loomc_pass_trace_sink_t>() - 16usize];
["Alignment of loomc_pass_trace_sink_t"]
[::std::mem::align_of::<loomc_pass_trace_sink_t>() - 8usize];
["Offset of field: loomc_pass_trace_sink_t::write"]
[::std::mem::offset_of!(loomc_pass_trace_sink_t, write) - 0usize];
["Offset of field: loomc_pass_trace_sink_t::user_data"]
[::std::mem::offset_of!(loomc_pass_trace_sink_t, user_data) - 8usize];
};
impl Default for loomc_pass_trace_sink_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Snapshot immediately before the selected pass invocation."]
pub const LOOMC_PASS_TRACE_POINT_BEFORE: loomc_pass_trace_point_e = 0;
#[doc = " Snapshot immediately after the selected pass invocation."]
pub const LOOMC_PASS_TRACE_POINT_AFTER: loomc_pass_trace_point_e = 1;
#[doc = " Pass trace boundary point."]
pub type loomc_pass_trace_point_e = ::std::os::raw::c_uint;
#[doc = " Pass trace boundary point."]
pub use self::loomc_pass_trace_point_e as loomc_pass_trace_point_t;
#[doc = " Stable metadata available when opening one per-event artifact."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_pass_trace_event_t {
#[doc = " Zero-based ordinal among events emitted by this compile invocation."]
pub event_ordinal: loomc_host_size_t,
#[doc = " Boundary represented by this event."]
pub point: loomc_pass_trace_point_t,
#[doc = " Stable key of the pass invoked at this boundary."]
pub pass_key: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_pass_trace_event_t"]
[::std::mem::size_of::<loomc_pass_trace_event_t>() - 32usize];
["Alignment of loomc_pass_trace_event_t"]
[::std::mem::align_of::<loomc_pass_trace_event_t>() - 8usize];
["Offset of field: loomc_pass_trace_event_t::event_ordinal"]
[::std::mem::offset_of!(loomc_pass_trace_event_t, event_ordinal) - 0usize];
["Offset of field: loomc_pass_trace_event_t::point"]
[::std::mem::offset_of!(loomc_pass_trace_event_t, point) - 8usize];
["Offset of field: loomc_pass_trace_event_t::pass_key"]
[::std::mem::offset_of!(loomc_pass_trace_event_t, pass_key) - 16usize];
};
impl Default for loomc_pass_trace_event_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Caller-owned destination for one per-event trace artifact."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_pass_trace_artifact_t {
#[doc = " Non-empty reference written into the sequential trace event.\n\n The reference may be a bundle-relative path, URI, object-store key, or\n another caller-defined identity. Loom never opens or interprets it."]
pub reference: loomc_string_view_t,
#[doc = " Destination receiving this event's textual IR snapshot."]
pub sink: loomc_pass_trace_sink_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_pass_trace_artifact_t"]
[::std::mem::size_of::<loomc_pass_trace_artifact_t>() - 32usize];
["Alignment of loomc_pass_trace_artifact_t"]
[::std::mem::align_of::<loomc_pass_trace_artifact_t>() - 8usize];
["Offset of field: loomc_pass_trace_artifact_t::reference"]
[::std::mem::offset_of!(loomc_pass_trace_artifact_t, reference) - 0usize];
["Offset of field: loomc_pass_trace_artifact_t::sink"]
[::std::mem::offset_of!(loomc_pass_trace_artifact_t, sink) - 16usize];
};
impl Default for loomc_pass_trace_artifact_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Opens one destination for a selected trace event.\n\n `event` is borrowed only for the callback duration. On an OK return,\n `out_artifact` must contain a non-empty reference and write callback that\n remain live until the matching close callback. A non-OK return retains all\n destination ownership with the callback and is not followed by close."]
pub type loomc_pass_trace_artifact_open_fn_t = ::std::option::Option<
unsafe extern "C" fn(
user_data: *mut ::std::os::raw::c_void,
event: *const loomc_pass_trace_event_t,
out_artifact: *mut loomc_pass_trace_artifact_t,
) -> loomc_status_t,
>;
#[doc = " Closes one destination successfully returned from open.\n\n Close is invoked exactly once after a successful open, including when a\n sequential or artifact write fails. The callback releases all resources\n associated with `artifact` and transfers any returned status to Loom."]
pub type loomc_pass_trace_artifact_close_fn_t = ::std::option::Option<
unsafe extern "C" fn(
user_data: *mut ::std::os::raw::c_void,
artifact: *mut loomc_pass_trace_artifact_t,
) -> loomc_status_t,
>;
#[doc = " Optional per-event artifact destination callbacks."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_pass_trace_artifact_sink_t {
#[doc = " Function opening one selected event artifact."]
pub open: loomc_pass_trace_artifact_open_fn_t,
#[doc = " Function closing one successfully opened event artifact."]
pub close: loomc_pass_trace_artifact_close_fn_t,
#[doc = " Opaque value passed to `open` and `close`."]
pub user_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_pass_trace_artifact_sink_t"]
[::std::mem::size_of::<loomc_pass_trace_artifact_sink_t>() - 24usize];
["Alignment of loomc_pass_trace_artifact_sink_t"]
[::std::mem::align_of::<loomc_pass_trace_artifact_sink_t>() - 8usize];
["Offset of field: loomc_pass_trace_artifact_sink_t::open"]
[::std::mem::offset_of!(loomc_pass_trace_artifact_sink_t, open) - 0usize];
["Offset of field: loomc_pass_trace_artifact_sink_t::close"]
[::std::mem::offset_of!(loomc_pass_trace_artifact_sink_t, close) - 8usize];
["Offset of field: loomc_pass_trace_artifact_sink_t::user_data"]
[::std::mem::offset_of!(loomc_pass_trace_artifact_sink_t, user_data) - 16usize];
};
impl Default for loomc_pass_trace_artifact_sink_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Pass trace options for one compile artifact invocation.\n\n Attach this descriptor to `loomc_compile_artifact_options_t::next`.\n Before and after filters match a pass key, an authored `pass.pipeline`\n symbol, or the compiler-defined stage name. The compiler supplies stage\n names and target-aware textual assembly; callers do not reconstruct either\n from internal compiler state.\n\n The descriptor and every borrowed string remain live only for the\n synchronous compile call. The write callback may be invoked many times and\n must preserve fragment order."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_pass_trace_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_PASS_TRACE_OPTIONS`."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Next compile-artifact option extension."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Formatted representation written to `sink`."]
pub format: loomc_pass_trace_format_t,
#[doc = " Boundary selection flags."]
pub flags: loomc_pass_trace_flags_t,
#[doc = " Tool identity included in event metadata. Empty uses the format's\n unknown-value representation."]
pub tool_name: loomc_string_view_t,
#[doc = " Input identity included in event metadata. Empty uses the format's\n unknown-value representation."]
pub input_identifier: loomc_string_view_t,
#[doc = " Pass keys, pipeline symbols, or stage names traced before invocation.\n\n Compiler-defined stages are `pipeline-text` for textual and empty pass\n programs, `pipeline-symbol` for authored pipeline symbols, `source-low`\n for source-to-low target programs, and `prepared-low` for complete target\n artifact programs."]
pub before_filters: *const loomc_string_view_t,
#[doc = " Number of entries in `before_filters`."]
pub before_filter_count: loomc_host_size_t,
#[doc = " Pass keys, pipeline symbols, or stage names traced after invocation."]
pub after_filters: *const loomc_string_view_t,
#[doc = " Number of entries in `after_filters`."]
pub after_filter_count: loomc_host_size_t,
#[doc = " Destination receiving the complete formatted trace in order."]
pub sink: loomc_pass_trace_sink_t,
#[doc = " Optional destinations for per-event textual IR snapshots.\n\n When open and close are NULL, the sequential trace embeds each selected\n snapshot inline. When both are present, the sequential trace records the\n artifact reference and the artifact sink receives the corresponding\n snapshot without buffering in Loom."]
pub artifact_sink: loomc_pass_trace_artifact_sink_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_pass_trace_options_t"]
[::std::mem::size_of::<loomc_pass_trace_options_t>() - 136usize];
["Alignment of loomc_pass_trace_options_t"]
[::std::mem::align_of::<loomc_pass_trace_options_t>() - 8usize];
["Offset of field: loomc_pass_trace_options_t::type_"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, type_) - 0usize];
["Offset of field: loomc_pass_trace_options_t::structure_size"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, structure_size) - 8usize];
["Offset of field: loomc_pass_trace_options_t::next"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, next) - 16usize];
["Offset of field: loomc_pass_trace_options_t::format"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, format) - 24usize];
["Offset of field: loomc_pass_trace_options_t::flags"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, flags) - 28usize];
["Offset of field: loomc_pass_trace_options_t::tool_name"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, tool_name) - 32usize];
["Offset of field: loomc_pass_trace_options_t::input_identifier"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, input_identifier) - 48usize];
["Offset of field: loomc_pass_trace_options_t::before_filters"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, before_filters) - 64usize];
["Offset of field: loomc_pass_trace_options_t::before_filter_count"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, before_filter_count) - 72usize];
["Offset of field: loomc_pass_trace_options_t::after_filters"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, after_filters) - 80usize];
["Offset of field: loomc_pass_trace_options_t::after_filter_count"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, after_filter_count) - 88usize];
["Offset of field: loomc_pass_trace_options_t::sink"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, sink) - 96usize];
["Offset of field: loomc_pass_trace_options_t::artifact_sink"]
[::std::mem::offset_of!(loomc_pass_trace_options_t, artifact_sink) - 112usize];
};
impl Default for loomc_pass_trace_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Prepared immutable compiler.\n\n A compiler is intended to be created once and reused across many\n invocations. It must not require repeated filesystem access on the hot path.\n Pass pipelines are prepared as `loomc_pass_program_t` handles and selected\n per invocation.\n\n @thread_safety\n Prepared compilers are immutable after creation and may be shared across\n threads. Invocation-local scratch belongs in `loomc_workspace_t`."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_compiler_t {
_unused: [u8; 0],
}
#[doc = " Return textual Loom module IR after successful compilation."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_MODULE_TEXT: loomc_compile_artifact_flag_bits_e = 1;
#[doc = " Return binary Loom bytecode after successful compilation."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_MODULE_BYTECODE: loomc_compile_artifact_flag_bits_e = 2;
#[doc = " Return a JSON compile report artifact. Reports are emitted for completed\n invocations, including failed results that still returned diagnostics."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_REPORT_JSON: loomc_compile_artifact_flag_bits_e = 4;
#[doc = " Return the compiled host launch-config program for all kernel entries.\n\n The selected pass program must lower source kernel entries through the\n normal source-to-low boundary. The artifact contains one pure function\n per exported kernel and is loaded with\n `loomc_launch_config_program_load`."]
pub const LOOMC_COMPILE_ARTIFACT_FLAG_LAUNCH_CONFIG: loomc_compile_artifact_flag_bits_e = 8;
#[doc = " Compile artifact request bits."]
pub type loomc_compile_artifact_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_compile_artifact_flag_bits_t`."]
pub type loomc_compile_artifact_flags_t = u32;
#[doc = " Compiler creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_COMPILER_OPTIONS`, set `structure_size` to\n `sizeof(loomc_compiler_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_compiler_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_COMPILER_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future compiler options."]
pub next: *const ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_compiler_options_t"]
[::std::mem::size_of::<loomc_compiler_options_t>() - 24usize];
["Alignment of loomc_compiler_options_t"]
[::std::mem::align_of::<loomc_compiler_options_t>() - 8usize];
["Offset of field: loomc_compiler_options_t::type_"]
[::std::mem::offset_of!(loomc_compiler_options_t, type_) - 0usize];
["Offset of field: loomc_compiler_options_t::structure_size"]
[::std::mem::offset_of!(loomc_compiler_options_t, structure_size) - 8usize];
["Offset of field: loomc_compiler_options_t::next"]
[::std::mem::offset_of!(loomc_compiler_options_t, next) - 16usize];
};
impl Default for loomc_compiler_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Complete target-artifact compilation options.\n\n This descriptor selects one homogeneous set of kernel or module roots,\n optional target specialization, typed configuration, and target emission.\n Root names preserve caller order. When both root lists are empty the\n compiler derives the module's single default entry category; mixed default\n categories fail. Explicit roots and exclusions are mutually exclusive.\n `loomc_sanitizer_options_t` may be attached to `next` when `pass_program`\n is NULL to override the emitter default pipeline's sanitizer settings.\n `loomc_pass_trace_options_t` may be attached to stream selected\n pass-boundary IR while either a supplied or default program executes.\n Artifact manifests apply only to loadable kernel requests; requesting one\n for module roots fails at compile-request resolution before passes run."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_compile_artifact_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_COMPILE_ARTIFACT_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for compile-artifact options such as\n `loomc_sanitizer_options_t` and `loomc_pass_trace_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Explicit root symbol names, or NULL to derive default roots."]
pub roots: *const loomc_string_view_t,
#[doc = " Number of entries in `roots`."]
pub root_count: loomc_host_size_t,
#[doc = " Default root symbol names to exclude, or NULL for no exclusions."]
pub excluded_roots: *const loomc_string_view_t,
#[doc = " Number of entries in `excluded_roots`."]
pub excluded_root_count: loomc_host_size_t,
#[doc = " Optional complete target profile applied at the compile boundary."]
pub target_profile: *mut loomc_target_profile_t,
#[doc = " Optional typed configuration applied before root resolution."]
pub config: *const loomc_config_options_t,
#[doc = " Optional target emission options. Its artifact format participates in\n compile request resolution so compilation and emission select one emitter."]
pub emit_options: *const loomc_emit_options_t,
#[doc = " Additional compiler-side artifacts returned with the primary target\n artifact. Currently only `LOOMC_COMPILE_ARTIFACT_FLAG_LAUNCH_CONFIG` is\n accepted. Zero keeps launch-program construction and serialization off\n the compilation path."]
pub artifact_flags: loomc_compile_artifact_flags_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_compile_artifact_options_t"]
[::std::mem::size_of::<loomc_compile_artifact_options_t>() - 88usize];
["Alignment of loomc_compile_artifact_options_t"]
[::std::mem::align_of::<loomc_compile_artifact_options_t>() - 8usize];
["Offset of field: loomc_compile_artifact_options_t::type_"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, type_) - 0usize];
["Offset of field: loomc_compile_artifact_options_t::structure_size"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, structure_size) - 8usize];
["Offset of field: loomc_compile_artifact_options_t::next"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, next) - 16usize];
["Offset of field: loomc_compile_artifact_options_t::roots"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, roots) - 24usize];
["Offset of field: loomc_compile_artifact_options_t::root_count"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, root_count) - 32usize];
["Offset of field: loomc_compile_artifact_options_t::excluded_roots"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, excluded_roots) - 40usize];
["Offset of field: loomc_compile_artifact_options_t::excluded_root_count"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, excluded_root_count) - 48usize];
["Offset of field: loomc_compile_artifact_options_t::target_profile"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, target_profile) - 56usize];
["Offset of field: loomc_compile_artifact_options_t::config"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, config) - 64usize];
["Offset of field: loomc_compile_artifact_options_t::emit_options"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, emit_options) - 72usize];
["Offset of field: loomc_compile_artifact_options_t::artifact_flags"]
[::std::mem::offset_of!(loomc_compile_artifact_options_t, artifact_flags) - 80usize];
};
impl Default for loomc_compile_artifact_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Loaded program containing compiled kernel launch configurations.\n\n A program corresponds to one kernel compilation invocation and may describe\n entries later emitted across multiple executable artifacts. Function names\n match the public export names in those artifacts; launch-config function\n tokens and executable function tokens remain local to their respective\n objects.\n\n @thread_safety\n Programs are thread-compatible. Invocation reuses program-owned scratch and\n must not overlap another invocation on the same program. Callers requiring\n overlapping invocation use distinct loaded programs or externally\n synchronize access."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_launch_config_program_t {
_unused: [u8; 0],
}
#[doc = " Program-local launch-config function token.\n\n Tokens are meaningful only with the program that returned them. Public\n export names are the stable identity used to bind independently loaded\n executable and launch-config products."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct loomc_launch_config_function_t {
#[doc = " Program-local function value."]
pub value: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_launch_config_function_t"]
[::std::mem::size_of::<loomc_launch_config_function_t>() - 8usize];
["Alignment of loomc_launch_config_function_t"]
[::std::mem::align_of::<loomc_launch_config_function_t>() - 8usize];
["Offset of field: loomc_launch_config_function_t::value"]
[::std::mem::offset_of!(loomc_launch_config_function_t, value) - 0usize];
};
#[doc = " Complete concrete configuration for one compiled kernel launch.\n\n Callers zero-initialize this structure, set `type` to\n `LOOMC_STRUCTURE_TYPE_LAUNCH_CONFIG`, set `structure_size` to\n `sizeof(loomc_launch_config_t)`, and pass it to\n `loomc_launch_config_program_invoke`."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_launch_config_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_LAUNCH_CONFIG` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Unordered extension chain for additional launch properties."]
pub next: *mut ::std::os::raw::c_void,
#[doc = " Number of workgroups dispatched along each dimension."]
pub workgroup_count: loomc_dimension3_t,
#[doc = " Number of invocations in each workgroup along each dimension.\n\n Every dimension is nonzero after successful evaluation."]
pub workgroup_size: loomc_dimension3_t,
#[doc = " Number of workgroups in each cooperative cluster dimension.\n\n Kernels that do not use clustered launch report `{1, 1, 1}`."]
pub workgroup_cluster_size: loomc_dimension3_t,
#[doc = " Number of invocations in each hardware subgroup.\n\n Zero indicates that the compiled target has no fixed subgroup size."]
pub subgroup_size: u32,
#[doc = " Total workgroup-local storage required per workgroup, in bytes.\n\n This is the final total capacity required by the compiled kernel,\n including storage derived from workload facts during compilation. Target\n adapters map this total requirement to their launch ABI; it is not\n necessarily an API's additional dynamic-shared-memory argument."]
pub workgroup_storage_bytes: u64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_launch_config_t"][::std::mem::size_of::<loomc_launch_config_t>() - 72usize];
["Alignment of loomc_launch_config_t"]
[::std::mem::align_of::<loomc_launch_config_t>() - 8usize];
["Offset of field: loomc_launch_config_t::type_"]
[::std::mem::offset_of!(loomc_launch_config_t, type_) - 0usize];
["Offset of field: loomc_launch_config_t::structure_size"]
[::std::mem::offset_of!(loomc_launch_config_t, structure_size) - 8usize];
["Offset of field: loomc_launch_config_t::next"]
[::std::mem::offset_of!(loomc_launch_config_t, next) - 16usize];
["Offset of field: loomc_launch_config_t::workgroup_count"]
[::std::mem::offset_of!(loomc_launch_config_t, workgroup_count) - 24usize];
["Offset of field: loomc_launch_config_t::workgroup_size"]
[::std::mem::offset_of!(loomc_launch_config_t, workgroup_size) - 36usize];
["Offset of field: loomc_launch_config_t::workgroup_cluster_size"]
[::std::mem::offset_of!(loomc_launch_config_t, workgroup_cluster_size) - 48usize];
["Offset of field: loomc_launch_config_t::subgroup_size"]
[::std::mem::offset_of!(loomc_launch_config_t, subgroup_size) - 60usize];
["Offset of field: loomc_launch_config_t::workgroup_storage_bytes"]
[::std::mem::offset_of!(loomc_launch_config_t, workgroup_storage_bytes) - 64usize];
};
impl Default for loomc_launch_config_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Mutable builder used to construct a frozen link index.\n\n @thread_safety\n Reserving slots and finishing a builder require exclusive access. Distinct\n already-reserved slots may be filled concurrently when each slot is filled\n by at most one thread and no thread calls finish until all fills have\n joined."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_link_index_builder_t {
_unused: [u8; 0],
}
#[doc = " Frozen immutable link index.\n\n @thread_safety\n Frozen indexes are immutable and may be shared by many linker invocations\n across many threads."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_link_index_t {
_unused: [u8; 0],
}
#[doc = " Direct sources jointly owned by the module being assembled."]
pub const LOOMC_LINK_PROVIDER_ROLE_INPUT: loomc_link_provider_role_e = 0;
#[doc = " Separate libraries contributing exported exact definitions and templates."]
pub const LOOMC_LINK_PROVIDER_ROLE_LIBRARY: loomc_link_provider_role_e = 1;
#[doc = " Linkage role assigned to a source provider in a link index."]
pub type loomc_link_provider_role_e = ::std::os::raw::c_uint;
#[doc = " Linkage role assigned to a source provider in a link index."]
pub use self::loomc_link_provider_role_e as loomc_link_provider_role_t;
#[doc = " Symbol is publicly visible in its source module."]
pub const LOOMC_LINK_SYMBOL_FLAG_PUBLIC: loomc_link_symbol_flag_bits_e = 1;
#[doc = " Symbol is an import declaration supplied by another provider/module."]
pub const LOOMC_LINK_SYMBOL_FLAG_IMPORT: loomc_link_symbol_flag_bits_e = 2;
#[doc = " Symbol is exported from its provider/module."]
pub const LOOMC_LINK_SYMBOL_FLAG_EXPORT: loomc_link_symbol_flag_bits_e = 4;
#[doc = " Symbol is declaration-like and may be superseded by a concrete definition."]
pub const LOOMC_LINK_SYMBOL_FLAG_DECLARATION: loomc_link_symbol_flag_bits_e = 8;
#[doc = " Symbol is a concrete definition owned by its provider."]
pub const LOOMC_LINK_SYMBOL_FLAG_CONCRETE_DEFINITION: loomc_link_symbol_flag_bits_e = 16;
#[doc = " Symbol implements the config symbol interface."]
pub const LOOMC_LINK_SYMBOL_FLAG_CONFIG: loomc_link_symbol_flag_bits_e = 32;
#[doc = " Symbol exists only for test or benchmark tooling."]
pub const LOOMC_LINK_SYMBOL_FLAG_TEST_ONLY: loomc_link_symbol_flag_bits_e = 64;
#[doc = " Source symbol is explicitly preserved by ordinary symbol pruning."]
pub const LOOMC_LINK_SYMBOL_FLAG_RETAIN: loomc_link_symbol_flag_bits_e = 128;
#[doc = " Link-index symbol flag bit values."]
pub type loomc_link_symbol_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Link-index builder creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_LINK_INDEX_BUILDER_OPTIONS`, set `structure_size` to\n `sizeof(loomc_link_index_builder_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_link_index_builder_options_t {
#[doc = " Structure type. Must be\n `LOOMC_STRUCTURE_TYPE_LINK_INDEX_BUILDER_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future builder options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Total bytes acquired from the host allocator per persistent frozen-index\n block. Internal tracking metadata consumes part of this capacity."]
pub block_size: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_index_builder_options_t"]
[::std::mem::size_of::<loomc_link_index_builder_options_t>() - 32usize];
["Alignment of loomc_link_index_builder_options_t"]
[::std::mem::align_of::<loomc_link_index_builder_options_t>() - 8usize];
["Offset of field: loomc_link_index_builder_options_t::type_"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, type_) - 0usize];
["Offset of field: loomc_link_index_builder_options_t::structure_size"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, structure_size) - 8usize];
["Offset of field: loomc_link_index_builder_options_t::next"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, next) - 16usize];
["Offset of field: loomc_link_index_builder_options_t::block_size"]
[::std::mem::offset_of!(loomc_link_index_builder_options_t, block_size) - 24usize];
};
impl Default for loomc_link_index_builder_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Deterministic source slot reserved by a link-index builder.\n\n Slots are stable within a builder. Parallel workers fill distinct slots so\n provider order and diagnostics do not depend on fill scheduling order."]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct loomc_link_index_source_slot_t {
#[doc = " Deterministic provider slot ordinal reserved by the builder."]
pub ordinal: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_index_source_slot_t"]
[::std::mem::size_of::<loomc_link_index_source_slot_t>() - 8usize];
["Alignment of loomc_link_index_source_slot_t"]
[::std::mem::align_of::<loomc_link_index_source_slot_t>() - 8usize];
["Offset of field: loomc_link_index_source_slot_t::ordinal"]
[::std::mem::offset_of!(loomc_link_index_source_slot_t, ordinal) - 0usize];
};
#[doc = " Source provider options used when adding sources to a link index.\n\n @lifetime\n String views are borrowed for the duration of the builder call that consumes\n this descriptor unless that call explicitly documents a copy."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_link_index_source_options_t {
#[doc = " Stable provider label for diagnostics and private-name determinism."]
pub provider_name: loomc_string_view_t,
#[doc = " Provider linkage role."]
pub role: loomc_link_provider_role_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_index_source_options_t"]
[::std::mem::size_of::<loomc_link_index_source_options_t>() - 24usize];
["Alignment of loomc_link_index_source_options_t"]
[::std::mem::align_of::<loomc_link_index_source_options_t>() - 8usize];
["Offset of field: loomc_link_index_source_options_t::provider_name"]
[::std::mem::offset_of!(loomc_link_index_source_options_t, provider_name) - 0usize];
["Offset of field: loomc_link_index_source_options_t::role"]
[::std::mem::offset_of!(loomc_link_index_source_options_t, role) - 16usize];
};
impl Default for loomc_link_index_source_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Prepared immutable linker.\n\n A linker owns validated link-time configuration. Frozen indexes carry\n reusable provider state and are supplied per invocation.\n\n @thread_safety\n Prepared linkers are immutable after creation and may be shared across\n threads. Invocation-local scratch belongs in `loomc_workspace_t`."]
#[repr(C)]
#[derive(Debug)]
pub struct loomc_linker_t {
_unused: [u8; 0],
}
#[doc = " Linker creation options.\n\n Callers zero-initialize this descriptor, set `type` to\n `LOOMC_STRUCTURE_TYPE_LINKER_OPTIONS`, set `structure_size` to\n `sizeof(loomc_linker_options_t)`, and fill the requested fields."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_linker_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_LINKER_OPTIONS` when\n nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Extension chain for future linker options."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Default output module name for invocations that do not override it."]
pub module_name: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_linker_options_t"][::std::mem::size_of::<loomc_linker_options_t>() - 40usize];
["Alignment of loomc_linker_options_t"]
[::std::mem::align_of::<loomc_linker_options_t>() - 8usize];
["Offset of field: loomc_linker_options_t::type_"]
[::std::mem::offset_of!(loomc_linker_options_t, type_) - 0usize];
["Offset of field: loomc_linker_options_t::structure_size"]
[::std::mem::offset_of!(loomc_linker_options_t, structure_size) - 8usize];
["Offset of field: loomc_linker_options_t::next"]
[::std::mem::offset_of!(loomc_linker_options_t, next) - 16usize];
["Offset of field: loomc_linker_options_t::module_name"]
[::std::mem::offset_of!(loomc_linker_options_t, module_name) - 24usize];
};
impl Default for loomc_linker_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Select exported INPUT-provider symbols as roots and compute their closure."]
pub const LOOMC_LINK_FLAG_INCLUDE_INPUT_EXPORTS: loomc_link_flag_bits_e = 1;
#[doc = " Preserve reachable unresolved symbol references for a later link.\n Template applicability remains open to later specialization independently\n of this flag."]
pub const LOOMC_LINK_FLAG_ALLOW_UNRESOLVED_SYMBOLS: loomc_link_flag_bits_e = 2;
#[doc = " Strip symbols used only by test or benchmark tooling."]
pub const LOOMC_LINK_FLAG_STRIP_TEST_SYMBOLS: loomc_link_flag_bits_e = 4;
#[doc = " Link operation flags."]
pub type loomc_link_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of `loomc_link_flag_bits_t` values."]
pub type loomc_link_flags_t = u32;
#[doc = " Merge every primary-input symbol into one relocatable module. Library\n providers are not materialized."]
pub const LOOMC_LINK_MODE_MERGE: loomc_link_mode_e = 0;
#[doc = " Retain explicit roots or exported primary-input roots and their reachable\n closure through the complete supplied library universe. Selected root\n providers contribute all of their exported symbols as roots without\n changing provider visibility."]
pub const LOOMC_LINK_MODE_LINK: loomc_link_mode_e = 1;
#[doc = " Link product selection mode."]
pub type loomc_link_mode_e = ::std::os::raw::c_uint;
#[doc = " Link product selection mode."]
pub use self::loomc_link_mode_e as loomc_link_mode_t;
#[doc = " Link invocation options.\n\n A link invocation consumes a frozen index and returns either a retained\n module or a failed result with diagnostics. Merge mode materializes only\n primary INPUT providers and preserves unresolved contracts. Link mode\n selects a dependency closure from explicit roots or exported primary roots\n plus the exports of selected root providers across the complete supplied\n library universe. Linking preserves every target carried by the selected\n symbols. Target-specialization extensions participate in template-provider\n selection and project exact target facts into the standalone linked output.\n Config options materialize on the linked output for this invocation; frozen\n indexes and reusable input/library modules are never mutated by link-time\n specialization.\n Template choices that depend on unavailable caller or target facts retain\n their viable providers until compilation. A closed library universe does\n not require template applicability to be resolved at the link boundary."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_link_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_LINK_OPTIONS` when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Optional invocation extensions such as\n `loomc_target_specialization_options_t`."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Frozen provider index to link."]
pub link_index: *mut loomc_link_index_t,
#[doc = " Output module name for this invocation. Empty uses the linker's default."]
pub module_name: loomc_string_view_t,
#[doc = " Product selection mode. Zero defaults to `LOOMC_LINK_MODE_MERGE`."]
pub mode: loomc_link_mode_t,
#[doc = " Root symbol names for link mode. Function-like roots are retained as\n module-boundary entries in the linked output."]
pub root_symbols: *const loomc_string_view_t,
#[doc = " Number of entries in `root_symbols`."]
pub root_symbol_count: loomc_host_size_t,
#[doc = " Link operation flags."]
pub flags: loomc_link_flags_t,
#[doc = " Per-invocation config bindings materialized into the linked output module."]
pub config: loomc_config_options_t,
#[doc = " Provider ordinals whose exported symbols are roots in link mode. This\n selects public API surfaces without changing provider linkage roles or\n making private symbols visible across provider boundaries."]
pub root_provider_ordinals: *const loomc_host_size_t,
#[doc = " Number of entries in `root_provider_ordinals`."]
pub root_provider_count: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_link_options_t"][::std::mem::size_of::<loomc_link_options_t>() - 136usize];
["Alignment of loomc_link_options_t"][::std::mem::align_of::<loomc_link_options_t>() - 8usize];
["Offset of field: loomc_link_options_t::type_"]
[::std::mem::offset_of!(loomc_link_options_t, type_) - 0usize];
["Offset of field: loomc_link_options_t::structure_size"]
[::std::mem::offset_of!(loomc_link_options_t, structure_size) - 8usize];
["Offset of field: loomc_link_options_t::next"]
[::std::mem::offset_of!(loomc_link_options_t, next) - 16usize];
["Offset of field: loomc_link_options_t::link_index"]
[::std::mem::offset_of!(loomc_link_options_t, link_index) - 24usize];
["Offset of field: loomc_link_options_t::module_name"]
[::std::mem::offset_of!(loomc_link_options_t, module_name) - 32usize];
["Offset of field: loomc_link_options_t::mode"]
[::std::mem::offset_of!(loomc_link_options_t, mode) - 48usize];
["Offset of field: loomc_link_options_t::root_symbols"]
[::std::mem::offset_of!(loomc_link_options_t, root_symbols) - 56usize];
["Offset of field: loomc_link_options_t::root_symbol_count"]
[::std::mem::offset_of!(loomc_link_options_t, root_symbol_count) - 64usize];
["Offset of field: loomc_link_options_t::flags"]
[::std::mem::offset_of!(loomc_link_options_t, flags) - 72usize];
["Offset of field: loomc_link_options_t::config"]
[::std::mem::offset_of!(loomc_link_options_t, config) - 80usize];
["Offset of field: loomc_link_options_t::root_provider_ordinals"]
[::std::mem::offset_of!(loomc_link_options_t, root_provider_ordinals) - 120usize];
["Offset of field: loomc_link_options_t::root_provider_count"]
[::std::mem::offset_of!(loomc_link_options_t, root_provider_count) - 128usize];
};
impl Default for loomc_link_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Emits a schema-versioned JSON dependency report on success or failure."]
pub const LOOMC_LINK_DEPENDENCY_ARTIFACT_FLAG_REPORT_JSON:
loomc_link_dependency_artifact_flag_bits_e = 1;
#[doc = " Dependency-analysis artifact flag bit values."]
pub type loomc_link_dependency_artifact_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " The target identity does not constrain the feature."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_ANY: loomc_amdgpu_target_feature_state_e = 0;
#[doc = " The selected target is known not to support the feature."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_UNSUPPORTED: loomc_amdgpu_target_feature_state_e = 1;
#[doc = " The feature is explicitly disabled, such as `xnack-`."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_OFF: loomc_amdgpu_target_feature_state_e = 2;
#[doc = " The feature is explicitly enabled, such as `sramecc+`."]
pub const LOOMC_AMDGPU_TARGET_FEATURE_ON: loomc_amdgpu_target_feature_state_e = 3;
#[doc = " Normalized state of one AMDHSA target-ID feature."]
pub type loomc_amdgpu_target_feature_state_e = ::std::os::raw::c_uint;
#[doc = " Normalized state of one AMDHSA target-ID feature."]
pub use self::loomc_amdgpu_target_feature_state_e as loomc_amdgpu_target_feature_state_t;
#[doc = " Structured AMDHSA target-ID feature states."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_amdhsa_feature_states_t {
#[doc = " SRAM ECC target-ID feature state."]
pub sramecc: loomc_amdgpu_target_feature_state_t,
#[doc = " XNACK target-ID feature state."]
pub xnack: loomc_amdgpu_target_feature_state_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_amdhsa_feature_states_t"]
[::std::mem::size_of::<loomc_amdgpu_amdhsa_feature_states_t>() - 8usize];
["Alignment of loomc_amdgpu_amdhsa_feature_states_t"]
[::std::mem::align_of::<loomc_amdgpu_amdhsa_feature_states_t>() - 4usize];
["Offset of field: loomc_amdgpu_amdhsa_feature_states_t::sramecc"]
[::std::mem::offset_of!(loomc_amdgpu_amdhsa_feature_states_t, sramecc) - 0usize];
["Offset of field: loomc_amdgpu_amdhsa_feature_states_t::xnack"]
[::std::mem::offset_of!(loomc_amdgpu_amdhsa_feature_states_t, xnack) - 4usize];
};
impl Default for loomc_amdgpu_amdhsa_feature_states_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Complete structured AMDGPU identity used to construct a target profile."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_target_identity_t {
#[doc = " Exact, generic, or overlay AMDGPU target selector, such as `gfx1151`,\n `gfx11-generic`, or `gfx1250-a0`."]
pub target: loomc_string_view_t,
#[doc = " Structured AMDHSA target-ID feature states."]
pub amdhsa_features: loomc_amdgpu_amdhsa_feature_states_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_target_identity_t"]
[::std::mem::size_of::<loomc_amdgpu_target_identity_t>() - 24usize];
["Alignment of loomc_amdgpu_target_identity_t"]
[::std::mem::align_of::<loomc_amdgpu_target_identity_t>() - 8usize];
["Offset of field: loomc_amdgpu_target_identity_t::target"]
[::std::mem::offset_of!(loomc_amdgpu_target_identity_t, target) - 0usize];
["Offset of field: loomc_amdgpu_target_identity_t::amdhsa_features"]
[::std::mem::offset_of!(loomc_amdgpu_target_identity_t, amdhsa_features) - 16usize];
};
impl Default for loomc_amdgpu_target_identity_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub const LOOMC_AMDGPU_PROCESSOR_MODE_DEFAULT: loomc_amdgpu_processor_mode_e = 0;
pub const LOOMC_AMDGPU_PROCESSOR_MODE_CU: loomc_amdgpu_processor_mode_e = 1;
pub const LOOMC_AMDGPU_PROCESSOR_MODE_WGP: loomc_amdgpu_processor_mode_e = 2;
#[doc = " Workgroup scheduling domain. Explicit modes require a GFX11/GFX12 target."]
pub type loomc_amdgpu_processor_mode_e = ::std::os::raw::c_uint;
#[doc = " Workgroup scheduling domain. Explicit modes require a GFX11/GFX12 target."]
pub use self::loomc_amdgpu_processor_mode_e as loomc_amdgpu_processor_mode_t;
#[doc = " Optional execution policy attached to AMDGPU profile options.\n This controls both occupancy calculations and the emitted kernel descriptor.\n It does not change the physical target identity or floating-point semantics."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_profile_execution_options_t {
#[doc = " Must be LOOMC_STRUCTURE_TYPE_AMDGPU_PROFILE_EXECUTION_OPTIONS."]
pub type_: loomc_structure_type_t,
#[doc = " Must be at least sizeof(loomc_amdgpu_profile_execution_options_t)."]
pub structure_size: loomc_host_size_t,
#[doc = " Reserved; must be NULL."]
pub next: *const ::std::os::raw::c_void,
pub processor_mode: loomc_amdgpu_processor_mode_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_profile_execution_options_t"]
[::std::mem::size_of::<loomc_amdgpu_profile_execution_options_t>() - 32usize];
["Alignment of loomc_amdgpu_profile_execution_options_t"]
[::std::mem::align_of::<loomc_amdgpu_profile_execution_options_t>() - 8usize];
["Offset of field: loomc_amdgpu_profile_execution_options_t::type_"]
[::std::mem::offset_of!(loomc_amdgpu_profile_execution_options_t, type_) - 0usize];
["Offset of field: loomc_amdgpu_profile_execution_options_t::structure_size"]
[::std::mem::offset_of!(loomc_amdgpu_profile_execution_options_t, structure_size) - 8usize];
["Offset of field: loomc_amdgpu_profile_execution_options_t::next"]
[::std::mem::offset_of!(loomc_amdgpu_profile_execution_options_t, next) - 16usize];
["Offset of field: loomc_amdgpu_profile_execution_options_t::processor_mode"][::std::mem::offset_of!(
loomc_amdgpu_profile_execution_options_t,
processor_mode
) - 24usize];
};
impl Default for loomc_amdgpu_profile_execution_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " AMDGPU target profile creation options."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_amdgpu_profile_options_t {
#[doc = " Structure type. Must be `LOOMC_STRUCTURE_TYPE_AMDGPU_PROFILE_OPTIONS`\n when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes."]
pub structure_size: loomc_host_size_t,
#[doc = " Optional loomc_amdgpu_profile_execution_options_t, or NULL."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Stable profile identifier used in diagnostics.\n\n Empty uses `identity.target`."]
pub identifier: loomc_string_view_t,
#[doc = " Structured AMDGPU target identity."]
pub identity: loomc_amdgpu_target_identity_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_amdgpu_profile_options_t"]
[::std::mem::size_of::<loomc_amdgpu_profile_options_t>() - 64usize];
["Alignment of loomc_amdgpu_profile_options_t"]
[::std::mem::align_of::<loomc_amdgpu_profile_options_t>() - 8usize];
["Offset of field: loomc_amdgpu_profile_options_t::type_"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, type_) - 0usize];
["Offset of field: loomc_amdgpu_profile_options_t::structure_size"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, structure_size) - 8usize];
["Offset of field: loomc_amdgpu_profile_options_t::next"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, next) - 16usize];
["Offset of field: loomc_amdgpu_profile_options_t::identifier"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, identifier) - 24usize];
["Offset of field: loomc_amdgpu_profile_options_t::identity"]
[::std::mem::offset_of!(loomc_amdgpu_profile_options_t, identity) - 40usize];
};
impl Default for loomc_amdgpu_profile_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " 32-bit int; 64-bit long and pointers."]
pub const LOOMC_CXX_DATA_MODEL_LP64: loomc_cxx_data_model_e = 0;
#[doc = " 32-bit int and long; 64-bit pointers."]
pub const LOOMC_CXX_DATA_MODEL_LLP64: loomc_cxx_data_model_e = 1;
#[doc = " 32-bit int, long, and pointers."]
pub const LOOMC_CXX_DATA_MODEL_ILP32: loomc_cxx_data_model_e = 2;
#[doc = " Source integer and pointer layout, independent of the importing process."]
pub type loomc_cxx_data_model_e = ::std::os::raw::c_uint;
#[doc = " Source integer and pointer layout, independent of the importing process."]
pub use self::loomc_cxx_data_model_e as loomc_cxx_data_model_t;
#[doc = " Permit approximate mathematical functions (Loom's AFN contract)."]
pub const LOOMC_CXX_IMPORT_FLAG_APPROXIMATE_FUNCTIONS: loomc_cxx_import_flag_bits_e = 1;
#[doc = " Omit the embedded system include root; use caller paths/providers only."]
pub const LOOMC_CXX_IMPORT_FLAG_NO_BUILTIN_INCLUDES: loomc_cxx_import_flag_bits_e = 2;
#[doc = " Explicit source permissions and include delivery policy."]
pub type loomc_cxx_import_flag_bits_e = ::std::os::raw::c_uint;
#[doc = " Bitmask of loomc_cxx_import_flag_bits_t values."]
pub type loomc_cxx_import_flags_t = u32;
#[doc = " Resolves a candidate include path to immutable source bytes.\n\n Paths follow ordinary quote, user, system, and include_next search rules.\n Candidate paths use generic '/' separators on every host.\n Return OK with a NULL output for a missing candidate. Other failures return\n status with a NULL output. A found source uses UNKNOWN format; its contents\n supply the header and the candidate path determines include identity.\n\n @param user_data Caller state from the provider descriptor.\n @param path Candidate path borrowed for this callback.\n @param out_source Receives one retained source or NULL for a missing path.\n @return OK for found/missing candidates, or a provider failure status.\n\n @ownership\n A successful non-NULL output transfers one retained reference to the\n importer. A cache can retain its own reference and return another. The\n importer releases the reference once it has copied the bytes.\n\n @thread_safety\n Calls are synchronous and sequential within one import. A provider shared\n by concurrent imports must synchronize its own mutable state."]
pub type loomc_cxx_source_provider_fn_t = ::std::option::Option<
unsafe extern "C" fn(
user_data: *mut ::std::os::raw::c_void,
path: loomc_string_view_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t,
>;
#[doc = " Optional source provider replacing filesystem include reads."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_cxx_source_provider_t {
#[doc = " Callback, or NULL to read ordinary filesystem paths."]
pub fn_: loomc_cxx_source_provider_fn_t,
#[doc = " Caller-owned state borrowed until import returns."]
pub user_data: *mut ::std::os::raw::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_cxx_source_provider_t"]
[::std::mem::size_of::<loomc_cxx_source_provider_t>() - 16usize];
["Alignment of loomc_cxx_source_provider_t"]
[::std::mem::align_of::<loomc_cxx_source_provider_t>() - 8usize];
["Offset of field: loomc_cxx_source_provider_t::fn_"]
[::std::mem::offset_of!(loomc_cxx_source_provider_t, fn_) - 0usize];
["Offset of field: loomc_cxx_source_provider_t::user_data"]
[::std::mem::offset_of!(loomc_cxx_source_provider_t, user_data) - 8usize];
};
impl Default for loomc_cxx_source_provider_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Preprocessor definition applied after the frontend's predefined macros."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_cxx_define_t {
#[doc = " Macro name, including parameters for a function-like macro."]
pub name: loomc_string_view_t,
#[doc = " Replacement token text; empty defines an empty macro."]
pub value: loomc_string_view_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_cxx_define_t"][::std::mem::size_of::<loomc_cxx_define_t>() - 32usize];
["Alignment of loomc_cxx_define_t"][::std::mem::align_of::<loomc_cxx_define_t>() - 8usize];
["Offset of field: loomc_cxx_define_t::name"]
[::std::mem::offset_of!(loomc_cxx_define_t, name) - 0usize];
["Offset of field: loomc_cxx_define_t::value"]
[::std::mem::offset_of!(loomc_cxx_define_t, value) - 16usize];
};
impl Default for loomc_cxx_define_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[doc = " Configuration for one source translation unit.\n\n Zero initialization selects C++26, LP64, strict math, visible definitions\n as roots, and the embedded facade system root when built into the library.\n All strings, arrays, and callback state are borrowed until import returns."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct loomc_cxx_import_options_t {
#[doc = " Structure type; LOOMC_STRUCTURE_TYPE_CXX_IMPORT_OPTIONS when nonzero."]
pub type_: loomc_structure_type_t,
#[doc = " Size of this structure in bytes, or zero."]
pub structure_size: loomc_host_size_t,
#[doc = " Reserved extension chain. Must be NULL."]
pub next: *const ::std::os::raw::c_void,
#[doc = " Frontend standard spelling, such as c23 or c++26. Empty selects c++26."]
pub standard: loomc_string_view_t,
#[doc = " Source ABI triple, independent of output target selection."]
pub triple: loomc_string_view_t,
#[doc = " Source integer and pointer layout."]
pub data_model: loomc_cxx_data_model_t,
#[doc = " Source permissions and include delivery flags."]
pub flags: loomc_cxx_import_flags_t,
#[doc = " Optional include provider; embedded headers are resolved separately."]
pub source_provider: loomc_cxx_source_provider_t,
#[doc = " User include directories, searched after quoted local includes."]
pub include_paths: *const loomc_string_view_t,
#[doc = " Number of user include directories."]
pub include_path_count: loomc_host_size_t,
#[doc = " System include directories, searched before the embedded system root."]
pub system_include_paths: *const loomc_string_view_t,
#[doc = " Number of system include directories."]
pub system_include_path_count: loomc_host_size_t,
#[doc = " Ordered macro definitions."]
pub defines: *const loomc_cxx_define_t,
#[doc = " Number of macro definitions."]
pub define_count: loomc_host_size_t,
#[doc = " Qualified source function names to export. Empty exports visible concrete\n definitions; reached helpers remain private when roots are explicit."]
pub roots: *const loomc_string_view_t,
#[doc = " Number of explicitly selected roots."]
pub root_count: loomc_host_size_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of loomc_cxx_import_options_t"]
[::std::mem::size_of::<loomc_cxx_import_options_t>() - 144usize];
["Alignment of loomc_cxx_import_options_t"]
[::std::mem::align_of::<loomc_cxx_import_options_t>() - 8usize];
["Offset of field: loomc_cxx_import_options_t::type_"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, type_) - 0usize];
["Offset of field: loomc_cxx_import_options_t::structure_size"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, structure_size) - 8usize];
["Offset of field: loomc_cxx_import_options_t::next"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, next) - 16usize];
["Offset of field: loomc_cxx_import_options_t::standard"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, standard) - 24usize];
["Offset of field: loomc_cxx_import_options_t::triple"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, triple) - 40usize];
["Offset of field: loomc_cxx_import_options_t::data_model"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, data_model) - 56usize];
["Offset of field: loomc_cxx_import_options_t::flags"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, flags) - 60usize];
["Offset of field: loomc_cxx_import_options_t::source_provider"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, source_provider) - 64usize];
["Offset of field: loomc_cxx_import_options_t::include_paths"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, include_paths) - 80usize];
["Offset of field: loomc_cxx_import_options_t::include_path_count"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, include_path_count) - 88usize];
["Offset of field: loomc_cxx_import_options_t::system_include_paths"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, system_include_paths) - 96usize];
["Offset of field: loomc_cxx_import_options_t::system_include_path_count"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, system_include_path_count) - 104usize];
["Offset of field: loomc_cxx_import_options_t::defines"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, defines) - 112usize];
["Offset of field: loomc_cxx_import_options_t::define_count"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, define_count) - 120usize];
["Offset of field: loomc_cxx_import_options_t::roots"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, roots) - 128usize];
["Offset of field: loomc_cxx_import_options_t::root_count"]
[::std::mem::offset_of!(loomc_cxx_import_options_t, root_count) - 136usize];
};
impl Default for loomc_cxx_import_options_t {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub struct Loomc {
__library: ::libloading::Library,
pub loomc_allocator_system: unsafe extern "C" fn() -> loomc_allocator_t,
pub loomc_allocator_free:
unsafe extern "C" fn(allocator: loomc_allocator_t, ptr: *mut ::std::os::raw::c_void),
pub loomc_byte_sequence_create_copy: unsafe extern "C" fn(
contents: loomc_byte_span_t,
allocator: loomc_allocator_t,
out_sequence: *mut *mut loomc_byte_sequence_t,
) -> loomc_status_t,
pub loomc_byte_sequence_release: unsafe extern "C" fn(sequence: *mut loomc_byte_sequence_t),
pub loomc_byte_sequence_length:
unsafe extern "C" fn(sequence: *const loomc_byte_sequence_t) -> u64,
pub loomc_byte_sequence_clone: unsafe extern "C" fn(
sequence: *const loomc_byte_sequence_t,
allocator: loomc_allocator_t,
out_span: *mut loomc_byte_span_t,
) -> loomc_status_t,
pub loomc_status_allocate: unsafe extern "C" fn(
code: loomc_status_code_t,
file: *const ::std::os::raw::c_char,
line: u32,
message: loomc_string_view_t,
) -> loomc_status_t,
pub loomc_status_free: unsafe extern "C" fn(status: loomc_status_t),
pub loomc_status_format: unsafe extern "C" fn(
status: loomc_status_t,
buffer_capacity: loomc_host_size_t,
buffer: *mut ::std::os::raw::c_char,
out_length: *mut loomc_host_size_t,
) -> bool,
pub loomc_source_create: unsafe extern "C" fn(
options: *const loomc_source_options_t,
allocator: loomc_allocator_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t,
pub loomc_source_release: unsafe extern "C" fn(source: *mut loomc_source_t),
pub loomc_source_identifier:
unsafe extern "C" fn(source: *const loomc_source_t) -> loomc_string_view_t,
pub loomc_context_create: unsafe extern "C" fn(
options: *const loomc_context_options_t,
allocator: loomc_allocator_t,
out_context: *mut *mut loomc_context_t,
) -> loomc_status_t,
pub loomc_context_release: unsafe extern "C" fn(context: *mut loomc_context_t),
pub loomc_result_release: unsafe extern "C" fn(result: *mut loomc_result_t),
pub loomc_result_succeeded: unsafe extern "C" fn(result: *const loomc_result_t) -> bool,
pub loomc_result_diagnostic_count:
unsafe extern "C" fn(result: *const loomc_result_t) -> loomc_host_size_t,
pub loomc_result_diagnostic_at: unsafe extern "C" fn(
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_diagnostic_t,
pub loomc_result_artifact_count:
unsafe extern "C" fn(result: *const loomc_result_t) -> loomc_host_size_t,
pub loomc_result_artifact_at: unsafe extern "C" fn(
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_artifact_t,
pub loomc_workspace_create: unsafe extern "C" fn(
options: *const loomc_workspace_options_t,
allocator: loomc_allocator_t,
out_workspace: *mut *mut loomc_workspace_t,
) -> loomc_status_t,
pub loomc_workspace_trim: unsafe extern "C" fn(workspace: *mut loomc_workspace_t),
pub loomc_workspace_release: unsafe extern "C" fn(workspace: *mut loomc_workspace_t),
pub loomc_module_release: unsafe extern "C" fn(module: *mut loomc_module_t),
pub loomc_module_serialize_to_source: unsafe extern "C" fn(
module: *const loomc_module_t,
options: *const loomc_module_serialize_options_t,
allocator: loomc_allocator_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t,
pub loomc_pass_program_release: unsafe extern "C" fn(pass_program: *mut loomc_pass_program_t),
pub loomc_pass_program_create_from_target_pipeline: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_target_pipeline_options_t,
allocator: loomc_allocator_t,
out_pass_program: *mut *mut loomc_pass_program_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_target_profile_release: unsafe extern "C" fn(profile: *mut loomc_target_profile_t),
pub loomc_target_environment_release:
unsafe extern "C" fn(target_environment: *mut loomc_target_environment_t),
pub loomc_compiler_create: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_compiler_options_t,
allocator: loomc_allocator_t,
out_compiler: *mut *mut loomc_compiler_t,
) -> loomc_status_t,
pub loomc_compile_artifact: unsafe extern "C" fn(
compiler: *mut loomc_compiler_t,
workspace: *mut loomc_workspace_t,
pass_program: *const loomc_pass_program_t,
module: *mut loomc_module_t,
options: *const loomc_compile_artifact_options_t,
allocator: loomc_allocator_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_compiler_release: unsafe extern "C" fn(compiler: *mut loomc_compiler_t),
pub loomc_launch_config_program_load: unsafe extern "C" fn(
artifact: *const loomc_artifact_t,
allocator: loomc_allocator_t,
out_program: *mut *mut loomc_launch_config_program_t,
) -> loomc_status_t,
pub loomc_launch_config_program_release:
unsafe extern "C" fn(program: *mut loomc_launch_config_program_t),
pub loomc_launch_config_program_lookup_function: unsafe extern "C" fn(
program: *const loomc_launch_config_program_t,
export_name: loomc_string_view_t,
out_function: *mut loomc_launch_config_function_t,
) -> loomc_status_t,
pub loomc_launch_config_program_invoke: unsafe extern "C" fn(
program: *mut loomc_launch_config_program_t,
function: loomc_launch_config_function_t,
workload_argument_bits: *const u64,
workload_argument_count: loomc_host_size_t,
out_config: *mut loomc_launch_config_t,
) -> loomc_status_t,
pub loomc_link_index_builder_create: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_link_index_builder_options_t,
allocator: loomc_allocator_t,
out_builder: *mut *mut loomc_link_index_builder_t,
) -> loomc_status_t,
pub loomc_link_index_builder_release:
unsafe extern "C" fn(builder: *mut loomc_link_index_builder_t),
pub loomc_link_index_builder_add_source: unsafe extern "C" fn(
builder: *mut loomc_link_index_builder_t,
source: *mut loomc_source_t,
options: *const loomc_link_index_source_options_t,
out_slot: *mut loomc_link_index_source_slot_t,
) -> loomc_status_t,
pub loomc_link_index_builder_finish: unsafe extern "C" fn(
builder: *mut loomc_link_index_builder_t,
out_link_index: *mut *mut loomc_link_index_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_link_index_release: unsafe extern "C" fn(link_index: *mut loomc_link_index_t),
pub loomc_linker_create: unsafe extern "C" fn(
context: *mut loomc_context_t,
options: *const loomc_linker_options_t,
allocator: loomc_allocator_t,
out_linker: *mut *mut loomc_linker_t,
) -> loomc_status_t,
pub loomc_link_module: unsafe extern "C" fn(
linker: *mut loomc_linker_t,
workspace: *mut loomc_workspace_t,
options: *const loomc_link_options_t,
out_module: *mut *mut loomc_module_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
pub loomc_linker_release: unsafe extern "C" fn(linker: *mut loomc_linker_t),
pub loomc_target_environment_create_amdgpu: unsafe extern "C" fn(
allocator: loomc_allocator_t,
out_target_environment: *mut *mut loomc_target_environment_t,
) -> loomc_status_t,
pub loomc_target_profile_create_amdgpu: unsafe extern "C" fn(
target_environment: *mut loomc_target_environment_t,
options: *const loomc_amdgpu_profile_options_t,
allocator: loomc_allocator_t,
out_profile: *mut *mut loomc_target_profile_t,
) -> loomc_status_t,
pub loomc_target_environment_create_xdna: unsafe extern "C" fn(
allocator: loomc_allocator_t,
out_target_environment: *mut *mut loomc_target_environment_t,
) -> loomc_status_t,
pub loomc_target_profile_create_xdna: unsafe extern "C" fn(
target_environment: *mut loomc_target_environment_t,
device_key: loomc_string_view_t,
allocator: loomc_allocator_t,
out_profile: *mut *mut loomc_target_profile_t,
) -> loomc_status_t,
pub loomc_module_import_cxx: unsafe extern "C" fn(
context: *mut loomc_context_t,
workspace: *mut loomc_workspace_t,
source: *const loomc_source_t,
options: *const loomc_cxx_import_options_t,
allocator: loomc_allocator_t,
out_module: *mut *mut loomc_module_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t,
}
impl Loomc {
pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
where
P: AsRef<::std::ffi::OsStr>,
{
let path = path.as_ref();
let library = ::libloading::Library::new(path)?;
Self::from_library(library)
}
pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
where
L: Into<::libloading::Library>,
{
let __library = library.into();
let loomc_allocator_system = __library.get(b"loomc_allocator_system\0").map(|sym| *sym)?;
let loomc_allocator_free = __library.get(b"loomc_allocator_free\0").map(|sym| *sym)?;
let loomc_byte_sequence_create_copy = __library
.get(b"loomc_byte_sequence_create_copy\0")
.map(|sym| *sym)?;
let loomc_byte_sequence_release = __library
.get(b"loomc_byte_sequence_release\0")
.map(|sym| *sym)?;
let loomc_byte_sequence_length = __library
.get(b"loomc_byte_sequence_length\0")
.map(|sym| *sym)?;
let loomc_byte_sequence_clone = __library
.get(b"loomc_byte_sequence_clone\0")
.map(|sym| *sym)?;
let loomc_status_allocate = __library.get(b"loomc_status_allocate\0").map(|sym| *sym)?;
let loomc_status_free = __library.get(b"loomc_status_free\0").map(|sym| *sym)?;
let loomc_status_format = __library.get(b"loomc_status_format\0").map(|sym| *sym)?;
let loomc_source_create = __library.get(b"loomc_source_create\0").map(|sym| *sym)?;
let loomc_source_release = __library.get(b"loomc_source_release\0").map(|sym| *sym)?;
let loomc_source_identifier = __library
.get(b"loomc_source_identifier\0")
.map(|sym| *sym)?;
let loomc_context_create = __library.get(b"loomc_context_create\0").map(|sym| *sym)?;
let loomc_context_release = __library.get(b"loomc_context_release\0").map(|sym| *sym)?;
let loomc_result_release = __library.get(b"loomc_result_release\0").map(|sym| *sym)?;
let loomc_result_succeeded = __library.get(b"loomc_result_succeeded\0").map(|sym| *sym)?;
let loomc_result_diagnostic_count = __library
.get(b"loomc_result_diagnostic_count\0")
.map(|sym| *sym)?;
let loomc_result_diagnostic_at = __library
.get(b"loomc_result_diagnostic_at\0")
.map(|sym| *sym)?;
let loomc_result_artifact_count = __library
.get(b"loomc_result_artifact_count\0")
.map(|sym| *sym)?;
let loomc_result_artifact_at = __library
.get(b"loomc_result_artifact_at\0")
.map(|sym| *sym)?;
let loomc_workspace_create = __library.get(b"loomc_workspace_create\0").map(|sym| *sym)?;
let loomc_workspace_trim = __library.get(b"loomc_workspace_trim\0").map(|sym| *sym)?;
let loomc_workspace_release = __library
.get(b"loomc_workspace_release\0")
.map(|sym| *sym)?;
let loomc_module_release = __library.get(b"loomc_module_release\0").map(|sym| *sym)?;
let loomc_module_serialize_to_source = __library
.get(b"loomc_module_serialize_to_source\0")
.map(|sym| *sym)?;
let loomc_pass_program_release = __library
.get(b"loomc_pass_program_release\0")
.map(|sym| *sym)?;
let loomc_pass_program_create_from_target_pipeline = __library
.get(b"loomc_pass_program_create_from_target_pipeline\0")
.map(|sym| *sym)?;
let loomc_target_profile_release = __library
.get(b"loomc_target_profile_release\0")
.map(|sym| *sym)?;
let loomc_target_environment_release = __library
.get(b"loomc_target_environment_release\0")
.map(|sym| *sym)?;
let loomc_compiler_create = __library.get(b"loomc_compiler_create\0").map(|sym| *sym)?;
let loomc_compile_artifact = __library.get(b"loomc_compile_artifact\0").map(|sym| *sym)?;
let loomc_compiler_release = __library.get(b"loomc_compiler_release\0").map(|sym| *sym)?;
let loomc_launch_config_program_load = __library
.get(b"loomc_launch_config_program_load\0")
.map(|sym| *sym)?;
let loomc_launch_config_program_release = __library
.get(b"loomc_launch_config_program_release\0")
.map(|sym| *sym)?;
let loomc_launch_config_program_lookup_function = __library
.get(b"loomc_launch_config_program_lookup_function\0")
.map(|sym| *sym)?;
let loomc_launch_config_program_invoke = __library
.get(b"loomc_launch_config_program_invoke\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_create = __library
.get(b"loomc_link_index_builder_create\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_release = __library
.get(b"loomc_link_index_builder_release\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_add_source = __library
.get(b"loomc_link_index_builder_add_source\0")
.map(|sym| *sym)?;
let loomc_link_index_builder_finish = __library
.get(b"loomc_link_index_builder_finish\0")
.map(|sym| *sym)?;
let loomc_link_index_release = __library
.get(b"loomc_link_index_release\0")
.map(|sym| *sym)?;
let loomc_linker_create = __library.get(b"loomc_linker_create\0").map(|sym| *sym)?;
let loomc_link_module = __library.get(b"loomc_link_module\0").map(|sym| *sym)?;
let loomc_linker_release = __library.get(b"loomc_linker_release\0").map(|sym| *sym)?;
let loomc_target_environment_create_amdgpu = __library
.get(b"loomc_target_environment_create_amdgpu\0")
.map(|sym| *sym)?;
let loomc_target_profile_create_amdgpu = __library
.get(b"loomc_target_profile_create_amdgpu\0")
.map(|sym| *sym)?;
let loomc_target_environment_create_xdna = __library
.get(b"loomc_target_environment_create_xdna\0")
.map(|sym| *sym)?;
let loomc_target_profile_create_xdna = __library
.get(b"loomc_target_profile_create_xdna\0")
.map(|sym| *sym)?;
let loomc_module_import_cxx = __library
.get(b"loomc_module_import_cxx\0")
.map(|sym| *sym)?;
Ok(Loomc {
__library,
loomc_allocator_system,
loomc_allocator_free,
loomc_byte_sequence_create_copy,
loomc_byte_sequence_release,
loomc_byte_sequence_length,
loomc_byte_sequence_clone,
loomc_status_allocate,
loomc_status_free,
loomc_status_format,
loomc_source_create,
loomc_source_release,
loomc_source_identifier,
loomc_context_create,
loomc_context_release,
loomc_result_release,
loomc_result_succeeded,
loomc_result_diagnostic_count,
loomc_result_diagnostic_at,
loomc_result_artifact_count,
loomc_result_artifact_at,
loomc_workspace_create,
loomc_workspace_trim,
loomc_workspace_release,
loomc_module_release,
loomc_module_serialize_to_source,
loomc_pass_program_release,
loomc_pass_program_create_from_target_pipeline,
loomc_target_profile_release,
loomc_target_environment_release,
loomc_compiler_create,
loomc_compile_artifact,
loomc_compiler_release,
loomc_launch_config_program_load,
loomc_launch_config_program_release,
loomc_launch_config_program_lookup_function,
loomc_launch_config_program_invoke,
loomc_link_index_builder_create,
loomc_link_index_builder_release,
loomc_link_index_builder_add_source,
loomc_link_index_builder_finish,
loomc_link_index_release,
loomc_linker_create,
loomc_link_module,
loomc_linker_release,
loomc_target_environment_create_amdgpu,
loomc_target_profile_create_amdgpu,
loomc_target_environment_create_xdna,
loomc_target_profile_create_xdna,
loomc_module_import_cxx,
})
}
#[doc = " Returns a process-global system allocator.\n\n @return Allocator backed by the process heap."]
pub unsafe fn loomc_allocator_system(&self) -> loomc_allocator_t {
(self.loomc_allocator_system)()
}
#[doc = " Frees memory previously returned by `allocator`.\n\n @param allocator Allocator that returned `ptr`.\n @param ptr Allocation to free. Passing `NULL` is allowed.\n\n When `ptr` is non-NULL, `allocator.ctl` must also be non-NULL. Invalid\n allocator values are programmer errors because this function has no status\n channel."]
pub unsafe fn loomc_allocator_free(
&self,
allocator: loomc_allocator_t,
ptr: *mut ::std::os::raw::c_void,
) {
(self.loomc_allocator_free)(allocator, ptr)
}
#[doc = " Creates a sequence containing a copy of `contents`.\n\n @param contents Bytes copied into immutable sequence storage.\n @param allocator Host allocator owning the returned sequence and storage.\n @param out_sequence Receives one retained sequence on success.\n @return OK when the sequence was created.\n\n Empty contents produce a real non-NULL empty sequence. The caller releases\n the returned reference with `loomc_byte_sequence_release`."]
pub unsafe fn loomc_byte_sequence_create_copy(
&self,
contents: loomc_byte_span_t,
allocator: loomc_allocator_t,
out_sequence: *mut *mut loomc_byte_sequence_t,
) -> loomc_status_t {
(self.loomc_byte_sequence_create_copy)(contents, allocator, out_sequence)
}
#[doc = " Releases `sequence` from one owner. Passing `NULL` is allowed.\n\n @param sequence Sequence to release."]
pub unsafe fn loomc_byte_sequence_release(&self, sequence: *mut loomc_byte_sequence_t) {
(self.loomc_byte_sequence_release)(sequence)
}
#[doc = " Returns the logical byte length of `sequence`.\n\n @param sequence Sequence to inspect, or NULL.\n @return Sequence length, or zero for a NULL sequence."]
pub unsafe fn loomc_byte_sequence_length(&self, sequence: *const loomc_byte_sequence_t) -> u64 {
(self.loomc_byte_sequence_length)(sequence)
}
#[doc = " Clones `sequence` into one contiguous allocator-owned span.\n\n @param sequence Sequence to clone.\n @param allocator Host allocator owning the returned storage.\n @param out_span Receives the contiguous clone on success.\n @return OK when the complete sequence was cloned.\n\n The caller frees `out_span->data` with `allocator`. Empty sequences return\n an empty span without allocating. On failure `out_span` is empty."]
pub unsafe fn loomc_byte_sequence_clone(
&self,
sequence: *const loomc_byte_sequence_t,
allocator: loomc_allocator_t,
out_span: *mut loomc_byte_span_t,
) -> loomc_status_t {
(self.loomc_byte_sequence_clone)(sequence, allocator, out_span)
}
#[doc = " Allocates a rich status when enabled by `LOOMC_STATUS_MODE`.\n\n @param code Status code to report.\n @param file Source file path associated with the failure.\n @param line Source line associated with the failure.\n @param message Primary human-readable message. The message bytes are copied\n when rich status storage is enabled.\n @return A status carrying `code` and any rich payload enabled by the current\n status mode.\n\n @ownership\n Non-OK returned statuses must eventually be passed to `loomc_status_free`,\n `loomc_status_consume_code`, or `loomc_status_join`."]
pub unsafe fn loomc_status_allocate(
&self,
code: loomc_status_code_t,
file: *const ::std::os::raw::c_char,
line: u32,
message: loomc_string_view_t,
) -> loomc_status_t {
(self.loomc_status_allocate)(code, file, line, message)
}
#[doc = " Frees status storage, if any.\n\n @param status Status to free. Passing OK or a code-only status is allowed."]
pub unsafe fn loomc_status_free(&self, status: loomc_status_t) {
(self.loomc_status_free)(status)
}
#[doc = " Formats `status` into `buffer` using the two-pass pattern.\n\n @param status Status to format.\n @param buffer_capacity Number of bytes available in `buffer`.\n @param buffer Output buffer, or `NULL` when querying the required length.\n @param out_length Receives the number of bytes required or written,\n excluding any trailing NUL byte.\n @return True when `buffer` was large enough and formatting completed.\n\n @lifetime\n Formatted bytes are owned by the caller-provided buffer."]
pub unsafe fn loomc_status_format(
&self,
status: loomc_status_t,
buffer_capacity: loomc_host_size_t,
buffer: *mut ::std::os::raw::c_char,
out_length: *mut loomc_host_size_t,
) -> bool {
(self.loomc_status_format)(status, buffer_capacity, buffer, out_length)
}
#[doc = " Creates an immutable source handle.\n\n @param options Source format, identity, bytes, and storage policy.\n @param allocator Host allocator used for source-owned storage.\n @param out_source Receives one retained source on success.\n @return OK when the source was created. Invalid argument is returned for\n malformed descriptors or impossible storage/release combinations.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_source_release`.\n\n @lifetime\n The source always copies `options->identifier`. Source contents are\n borrowed, copied, or externally released according to `options->storage`.\n Borrowed contents must outlive the source.\n\n @thread_safety\n The returned source is immutable and may be shared across threads."]
pub unsafe fn loomc_source_create(
&self,
options: *const loomc_source_options_t,
allocator: loomc_allocator_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t {
(self.loomc_source_create)(options, allocator, out_source)
}
#[doc = " Releases `source` from one owner.\n\n @param source Source to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe to perform from multiple threads. The\n source is destroyed when the final reference is released."]
pub unsafe fn loomc_source_release(&self, source: *mut loomc_source_t) {
(self.loomc_source_release)(source)
}
#[doc = " Returns the source identifier.\n\n @param source Source to inspect.\n @return Borrowed identifier view owned by `source`.\n\n @lifetime\n The returned view remains valid until `source` is released."]
pub unsafe fn loomc_source_identifier(
&self,
source: *const loomc_source_t,
) -> loomc_string_view_t {
(self.loomc_source_identifier)(source)
}
#[doc = " Creates a reusable Loom API context.\n\n @param options Context options, or `NULL` for defaults.\n @param allocator Host allocator used for context-owned storage.\n @param out_context Receives one retained context on success.\n @return OK when the context was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_context_release`.\n\n @thread_safety\n The returned context is immutable and may be shared across prepared tools\n and worker threads."]
pub unsafe fn loomc_context_create(
&self,
options: *const loomc_context_options_t,
allocator: loomc_allocator_t,
out_context: *mut *mut loomc_context_t,
) -> loomc_status_t {
(self.loomc_context_create)(options, allocator, out_context)
}
#[doc = " Releases `context` from one owner.\n\n @param context Context to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe to perform from multiple threads. The\n context is destroyed when the final reference is released."]
pub unsafe fn loomc_context_release(&self, context: *mut loomc_context_t) {
(self.loomc_context_release)(context)
}
#[doc = " Releases `result` from one owner.\n\n @param result Result to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe to perform from multiple threads. The\n result is destroyed when the final reference is released."]
pub unsafe fn loomc_result_release(&self, result: *mut loomc_result_t) {
(self.loomc_result_release)(result)
}
#[doc = " Returns true when `result` succeeded.\n\n @param result Result to inspect.\n @return True when `loomc_result_state(result)` is\n `LOOMC_RESULT_STATE_SUCCEEDED`."]
pub unsafe fn loomc_result_succeeded(&self, result: *const loomc_result_t) -> bool {
(self.loomc_result_succeeded)(result)
}
#[doc = " Returns the number of diagnostics attached to `result`.\n\n @param result Result to inspect.\n @return Diagnostic count."]
pub unsafe fn loomc_result_diagnostic_count(
&self,
result: *const loomc_result_t,
) -> loomc_host_size_t {
(self.loomc_result_diagnostic_count)(result)
}
#[doc = " Returns a diagnostic by index.\n\n @param result Result to inspect.\n @param index Zero-based diagnostic index.\n @return Borrowed diagnostic view, or `NULL` when `index` is out of range.\n\n @lifetime\n The returned pointer remains valid until `result` is released."]
pub unsafe fn loomc_result_diagnostic_at(
&self,
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_diagnostic_t {
(self.loomc_result_diagnostic_at)(result, index)
}
#[doc = " Returns the number of artifacts attached to `result`.\n\n @param result Result to inspect.\n @return Artifact count."]
pub unsafe fn loomc_result_artifact_count(
&self,
result: *const loomc_result_t,
) -> loomc_host_size_t {
(self.loomc_result_artifact_count)(result)
}
#[doc = " Returns an artifact by index.\n\n @param result Result to inspect.\n @param index Zero-based artifact index.\n @return Borrowed artifact view, or `NULL` when `index` is out of range.\n\n @lifetime\n The returned pointer remains valid until `result` is released."]
pub unsafe fn loomc_result_artifact_at(
&self,
result: *const loomc_result_t,
index: loomc_host_size_t,
) -> *const loomc_artifact_t {
(self.loomc_result_artifact_at)(result, index)
}
#[doc = " Creates a mutable workspace for one worker at a time.\n\n @param options Workspace allocation options, or `NULL` for defaults.\n @param allocator Host allocator used for workspace-owned storage.\n @param out_workspace Receives the created workspace on success.\n @return OK when the workspace was created.\n\n @ownership\n The caller owns the returned workspace and releases it with\n `loomc_workspace_release`.\n\n @lifetime\n Sources, retained results, frozen link indexes, prepared linkers, and\n prepared compilers do not use workspace arena storage unless an operation\n descriptor explicitly says so. Modules created, linked, cloned, or\n deserialized with a workspace retain that workspace and return their arena\n blocks when released.\n\n @thread_safety\n The returned workspace is mutable scratch and is intended for one worker at\n a time."]
pub unsafe fn loomc_workspace_create(
&self,
options: *const loomc_workspace_options_t,
allocator: loomc_allocator_t,
out_workspace: *mut *mut loomc_workspace_t,
) -> loomc_status_t {
(self.loomc_workspace_create)(options, allocator, out_workspace)
}
#[doc = " Trims idle arena blocks owned by `workspace`.\n\n @param workspace Workspace to trim.\n\n @lifetime\n Trim returns blocks that are already idle in the workspace block pool to the\n host allocator. Retained modules created from this workspace remain valid\n across trim, but their active arena blocks cannot be reused until those\n modules are released. Results, sources, frozen indexes, and prepared tools\n remain valid.\n\n @thread_safety\n External synchronization is required if another thread may be using the same\n workspace."]
pub unsafe fn loomc_workspace_trim(&self, workspace: *mut loomc_workspace_t) {
(self.loomc_workspace_trim)(workspace)
}
#[doc = " Releases `workspace` and all storage it owns.\n\n @param workspace Workspace to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The workspace is\n destroyed when the final reference is released; no thread may be mutating it\n at that moment."]
pub unsafe fn loomc_workspace_release(&self, workspace: *mut loomc_workspace_t) {
(self.loomc_workspace_release)(workspace)
}
#[doc = " Releases an opaque module from one owner.\n\n @param module Module to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are intended to be safe from multiple threads. The\n module is destroyed when the final reference is released."]
pub unsafe fn loomc_module_release(&self, module: *mut loomc_module_t) {
(self.loomc_module_release)(module)
}
#[doc = " Serializes a module into an immutable source handle.\n\n @param module Module to serialize.\n @param options Serialization options. `NULL` selects textual `.loom`.\n @param allocator Host allocator used for source-owned storage.\n @param out_source Receives one retained source on success.\n @return OK when serialization succeeded.\n\n @ownership\n The caller owns the returned source and releases it with\n `loomc_source_release`. Serialized bytes are owned by that source and remain\n valid until the source is released.\n\n @par Resolved Targets\n When a prior compilation retained resolved function targets outside the\n module IR, serialization first projects them into a derived module without\n mutating the source. The resulting source is self-contained and can be\n deserialized in a fresh context without the original profiles.\n Serialization fails when an exact target definition cannot be materialized;\n it never silently emits the less-specific authored target.\n\n @thread_safety\n Serialization is read-only with respect to `module`. Concurrent\n serialization of the same module is valid when the caller guarantees that no\n mutating operation is active."]
pub unsafe fn loomc_module_serialize_to_source(
&self,
module: *const loomc_module_t,
options: *const loomc_module_serialize_options_t,
allocator: loomc_allocator_t,
out_source: *mut *mut loomc_source_t,
) -> loomc_status_t {
(self.loomc_module_serialize_to_source)(module, options, allocator, out_source)
}
#[doc = " Releases a pass program from one owner.\n\n @param pass_program Pass program to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The pass program\n is destroyed when the final reference is released."]
pub unsafe fn loomc_pass_program_release(&self, pass_program: *mut loomc_pass_program_t) {
(self.loomc_pass_program_release)(pass_program)
}
#[doc = " Creates a prepared target lowering pass program.\n\n The context must have been created with a target environment using\n `loomc_context_target_options_t`. The returned pass program is an ordinary\n `loomc_pass_program_t` and is passed to `loomc_compile_module` like any\n other prepared pipeline.\n\n @param context Context whose target environment selects the target package.\n @param options Target pipeline options, or `NULL` for defaults.\n @param allocator Host allocator used for pass-program and result storage.\n @param out_pass_program Receives one retained pass program when the result\n succeeds. Receives `NULL` when target pipeline preparation fails.\n @param out_result Receives a retained result containing pipeline\n preparation diagnostics and operation state.\n @return OK when the creation operation completed far enough to report a\n result. Non-OK statuses represent API misuse or infrastructure failures\n before a result could be produced.\n\n @ownership\n The caller owns `out_result` on an OK return and releases it with\n `loomc_result_release`. When a pass program is produced, the caller owns the\n returned reference and releases it with `loomc_pass_program_release`.\n\n @thread_safety\n The returned pass program is immutable and may be shared across worker\n threads.\n\n @par Sanitizer Assertions\n `loomc_sanitizer_options_t` may be attached to\n `loomc_target_pipeline_options_t::next`. Nonzero check bits insert\n sanitizer pass slots at the target pipeline's semantic assertion boundary."]
pub unsafe fn loomc_pass_program_create_from_target_pipeline(
&self,
context: *mut loomc_context_t,
options: *const loomc_target_pipeline_options_t,
allocator: loomc_allocator_t,
out_pass_program: *mut *mut loomc_pass_program_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_pass_program_create_from_target_pipeline)(
context,
options,
allocator,
out_pass_program,
out_result,
)
}
#[doc = " Releases a target profile from one owner.\n\n @param profile Target profile to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The profile is\n destroyed when the final reference is released."]
pub unsafe fn loomc_target_profile_release(&self, profile: *mut loomc_target_profile_t) {
(self.loomc_target_profile_release)(profile)
}
#[doc = " Releases a target environment from one owner.\n\n @param target_environment Target environment to release. Passing `NULL` is\n allowed.\n\n @thread_safety\n Retain/release operations are safe from multiple threads. The environment\n is destroyed when the final reference is released."]
pub unsafe fn loomc_target_environment_release(
&self,
target_environment: *mut loomc_target_environment_t,
) {
(self.loomc_target_environment_release)(target_environment)
}
#[doc = " Creates a prepared immutable compiler.\n\n @param context Context shared with modules compiled by this compiler.\n @param options Compiler configuration, or `NULL` for defaults.\n @param allocator Host allocator used for compiler-owned storage.\n @param out_compiler Receives one retained compiler on success.\n @return OK when the compiler was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_compiler_release`.\n\n @thread_safety\n The returned compiler is immutable and may be shared across worker threads."]
pub unsafe fn loomc_compiler_create(
&self,
context: *mut loomc_context_t,
options: *const loomc_compiler_options_t,
allocator: loomc_allocator_t,
out_compiler: *mut *mut loomc_compiler_t,
) -> loomc_status_t {
(self.loomc_compiler_create)(context, options, allocator, out_compiler)
}
#[doc = " Compiles one mutable module through final target artifact emission.\n\n The operation verifies and configures the input, resolves and materializes\n one core compile request, executes one pass program, and emits through the\n request's selected target emitter. Diagnostics and all primary or sidecar\n artifacts share one result and preserve operation order.\n\n @param compiler Prepared compiler whose context owns `module`.\n @param workspace Invocation-local scratch workspace.\n @param pass_program Optional prepared pass program. NULL selects the target\n emitter's default prepared-low pipeline. Pass an explicitly empty prepared\n program to perform no compiler transformations.\n @param module Mutable input module. Root materialization and compilation may\n replace or rewrite its internal IR while preserving the public handle.\n @param options Complete artifact options, or NULL for inferred roots,\n authored targets, empty configuration, and canonical emission.\n @param allocator Host allocator used for result and default-pipeline state.\n @param out_result Receives one retained result for the complete operation.\n @return OK when the operation ran far enough to return a result. Non-OK\n statuses represent API misuse or infrastructure failure.\n\n @ownership\n The caller retains `module` and owns `out_result` on an OK return. The\n result owns its diagnostics and artifacts and is released with\n `loomc_result_release`.\n\n @lifetime\n The operation borrows every option view, profile, and prepared pass program\n only for the duration of the call. Returned data does not borrow them or the\n workspace.\n\n @thread_safety\n Compiler, profile, and pass-program handles may be shared. Each concurrent\n invocation requires a distinct workspace and mutable module."]
pub unsafe fn loomc_compile_artifact(
&self,
compiler: *mut loomc_compiler_t,
workspace: *mut loomc_workspace_t,
pass_program: *const loomc_pass_program_t,
module: *mut loomc_module_t,
options: *const loomc_compile_artifact_options_t,
allocator: loomc_allocator_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_compile_artifact)(
compiler,
workspace,
pass_program,
module,
options,
allocator,
out_result,
)
}
#[doc = " Releases a prepared compiler from one owner.\n\n @param compiler Compiler to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are intended to be safe from multiple threads. The\n compiler is destroyed when the final reference is released."]
pub unsafe fn loomc_compiler_release(&self, compiler: *mut loomc_compiler_t) {
(self.loomc_compiler_release)(compiler)
}
#[doc = " Loads and verifies a compiled launch-config program.\n\n The artifact must be the launch-config companion emitted from the same\n kernel compilation used to produce the matching executable artifacts. The\n loader validates the external bytes and constructs a program ready for\n invocation.\n\n @param artifact Launch-config artifact to load. The artifact descriptor and\n its strings are borrowed for the duration of the call.\n @param allocator Host allocator used for program-owned state.\n @param out_program Receives one retained program on success.\n @return OK when the artifact is valid and every exported function has a\n complete launch-config contract.\n\n @ownership\n The caller releases the returned program with\n `loomc_launch_config_program_release`."]
pub unsafe fn loomc_launch_config_program_load(
&self,
artifact: *const loomc_artifact_t,
allocator: loomc_allocator_t,
out_program: *mut *mut loomc_launch_config_program_t,
) -> loomc_status_t {
(self.loomc_launch_config_program_load)(artifact, allocator, out_program)
}
#[doc = " Releases `program` from one owner. Passing `NULL` is allowed.\n\n @param program Program to release. Passing `NULL` is allowed."]
pub unsafe fn loomc_launch_config_program_release(
&self,
program: *mut loomc_launch_config_program_t,
) {
(self.loomc_launch_config_program_release)(program)
}
#[doc = " Resolves a compiled kernel export name to a program-local function token.\n\n @param program Program to search.\n @param export_name Exact public name of the matching executable entry.\n This is an artifact name rather than a Loom symbol reference. Every\n non-empty byte spelling is matched exactly, including names whose first\n byte is `@`.\n @param out_function Receives a program-local token on success.\n @return OK when the function exists, `LOOMC_STATUS_NOT_FOUND` when the\n program has no matching function, or an argument status for malformed\n input."]
pub unsafe fn loomc_launch_config_program_lookup_function(
&self,
program: *const loomc_launch_config_program_t,
export_name: loomc_string_view_t,
out_function: *mut loomc_launch_config_function_t,
) -> loomc_status_t {
(self.loomc_launch_config_program_lookup_function)(program, export_name, out_function)
}
#[doc = " Invokes one compiled launch-config function for one kernel workload.\n\n Workload arguments map positionally to the selected kernel entry's authored\n launch workload. Each slot contains the raw bits of one scalar argument in\n its least-significant N bits, where N is the scalar bit width; higher bits\n are ignored. Signed integers and index values use two's-complement\n representation, offsets use unsigned representation, and floating-point\n values use their declared FP8, IEEE, or bfloat representation. Index and\n offset arguments consume all 64 bits. An offset greater than `INT64_MAX`\n cannot be represented by the current exact-fact domain and is rejected.\n\n The function token must have been returned by `program`. Invocation\n validates argument count, scalar values, and authored value predicates\n before writing `out_config`. A successful return provides every launch\n property required by the compiled kernel entry. The operation performs no\n source compilation or string lookup. The program caches invocation scratch;\n an invocation may acquire allocator storage when the selected function\n requires more scratch than previous invocations.\n\n @param program Loaded launch-config program.\n @param function Program-local function to invoke.\n @param workload_argument_bits Positional raw scalar argument bits, or\n `NULL` when `workload_argument_count` is zero.\n @param workload_argument_count Number of argument slots.\n @param out_config Caller-initialized complete result storage.\n @return OK when invocation produced a complete launch configuration."]
pub unsafe fn loomc_launch_config_program_invoke(
&self,
program: *mut loomc_launch_config_program_t,
function: loomc_launch_config_function_t,
workload_argument_bits: *const u64,
workload_argument_count: loomc_host_size_t,
out_config: *mut loomc_launch_config_t,
) -> loomc_status_t {
(self.loomc_launch_config_program_invoke)(
program,
function,
workload_argument_bits,
workload_argument_count,
out_config,
)
}
#[doc = " Creates an empty link-index builder.\n\n @param context Reusable Loom API context retained by the builder.\n @param options Builder options, or `NULL` for defaults.\n @param allocator Host allocator used for builder and frozen-index storage.\n @param out_builder Receives the mutable builder on success.\n @return OK when the builder was created.\n\n @ownership\n The caller owns the returned builder and releases it with\n `loomc_link_index_builder_release`."]
pub unsafe fn loomc_link_index_builder_create(
&self,
context: *mut loomc_context_t,
options: *const loomc_link_index_builder_options_t,
allocator: loomc_allocator_t,
out_builder: *mut *mut loomc_link_index_builder_t,
) -> loomc_status_t {
(self.loomc_link_index_builder_create)(context, options, allocator, out_builder)
}
#[doc = " Releases a link-index builder.\n\n @param builder Builder to release. Passing `NULL` is allowed.\n\n @thread_safety\n No other thread may be reserving, filling, or finishing `builder`."]
pub unsafe fn loomc_link_index_builder_release(
&self,
builder: *mut loomc_link_index_builder_t,
) {
(self.loomc_link_index_builder_release)(builder)
}
#[doc = " Reserves and fills the next source slot.\n\n @param builder Builder to mutate.\n @param source Source retained by the builder on success.\n @param options Provider options copied by this call, or `NULL` for defaults.\n @param out_slot Receives the source slot, or `NULL` if not needed.\n @return OK when the source was queued for indexing."]
pub unsafe fn loomc_link_index_builder_add_source(
&self,
builder: *mut loomc_link_index_builder_t,
source: *mut loomc_source_t,
options: *const loomc_link_index_source_options_t,
out_slot: *mut loomc_link_index_source_slot_t,
) -> loomc_status_t {
(self.loomc_link_index_builder_add_source)(builder, source, options, out_slot)
}
#[doc = " Finishes a builder into a frozen immutable link index.\n\n @param builder Builder to finish. The builder becomes finished after this\n call returns OK, whether the operation result succeeded or failed.\n @param out_link_index Receives one retained frozen index when the result\n state is succeeded.\n @param out_result Receives one retained result describing indexing outcome.\n @return OK when a result was produced. Non-OK status means API or\n infrastructure failure prevented result production.\n\n @ownership\n Finishing does not consume `builder`; the caller still releases it with\n `loomc_link_index_builder_release` after the call returns. The caller owns\n `out_link_index` on successful result state and releases it with\n `loomc_link_index_release`. The caller owns `out_result` and releases it\n with `loomc_result_release`.\n\n @error_contract\n Invalid Loom text, malformed bytecode, empty reserved slots, and unsupported\n source formats produce OK status plus a failed result with diagnostics."]
pub unsafe fn loomc_link_index_builder_finish(
&self,
builder: *mut loomc_link_index_builder_t,
out_link_index: *mut *mut loomc_link_index_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_link_index_builder_finish)(builder, out_link_index, out_result)
}
#[doc = " Releases a frozen link index from one owner.\n\n @param link_index Link index to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations for frozen indexes are intended to be safe from\n multiple threads. No mutation occurs after the index is frozen."]
pub unsafe fn loomc_link_index_release(&self, link_index: *mut loomc_link_index_t) {
(self.loomc_link_index_release)(link_index)
}
#[doc = " Creates a prepared immutable linker.\n\n @param context Context shared with all link indexes used by this linker.\n @param options Linker configuration, or `NULL` for defaults.\n @param allocator Host allocator used for linker-owned storage.\n @param out_linker Receives one retained linker on success.\n @return OK when the linker was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_linker_release`.\n\n @thread_safety\n The returned linker is immutable and may be shared across worker threads."]
pub unsafe fn loomc_linker_create(
&self,
context: *mut loomc_context_t,
options: *const loomc_linker_options_t,
allocator: loomc_allocator_t,
out_linker: *mut *mut loomc_linker_t,
) -> loomc_status_t {
(self.loomc_linker_create)(context, options, allocator, out_linker)
}
#[doc = " Links a frozen index into an opaque module.\n\n @param linker Prepared linker.\n @param workspace Invocation-local scratch workspace.\n @param options Link invocation options.\n @param out_module Receives a retained linked module when the result\n succeeds. Receives `NULL` when the result fails.\n @param out_result Receives a retained result for the operation.\n @return OK when the invocation ran to a result. Non-OK statuses represent\n API misuse or infrastructure failures before a result could be produced.\n\n @ownership\n The caller owns `out_module` when non-NULL and releases it with\n `loomc_module_release`. The caller always owns `out_result` on an OK return\n and releases it with `loomc_result_release`.\n\n @lifetime\n Returned results do not borrow from `workspace` and remain valid after\n `loomc_workspace_trim`. Returned modules retain `workspace` and keep their\n arena blocks live until released.\n\n @thread_safety\n Calls using the same linker may run concurrently when each call uses a\n distinct workspace. The same workspace requires external synchronization.\n"]
pub unsafe fn loomc_link_module(
&self,
linker: *mut loomc_linker_t,
workspace: *mut loomc_workspace_t,
options: *const loomc_link_options_t,
out_module: *mut *mut loomc_module_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_link_module)(linker, workspace, options, out_module, out_result)
}
#[doc = " Releases a prepared linker from one owner.\n\n @param linker Linker to release. Passing `NULL` is allowed.\n\n @thread_safety\n Retain/release operations are intended to be safe from multiple threads. The\n linker is destroyed when the final reference is released."]
pub unsafe fn loomc_linker_release(&self, linker: *mut loomc_linker_t) {
(self.loomc_linker_release)(linker)
}
#[doc = " Creates a target environment containing the AMDGPU target package.\n\n @param allocator Host allocator used for target-environment storage.\n @param out_target_environment Receives one retained target environment on\n success.\n @return OK when the target environment was created.\n\n @ownership\n The caller owns the returned reference and releases it with\n `loomc_target_environment_release`."]
pub unsafe fn loomc_target_environment_create_amdgpu(
&self,
allocator: loomc_allocator_t,
out_target_environment: *mut *mut loomc_target_environment_t,
) -> loomc_status_t {
(self.loomc_target_environment_create_amdgpu)(allocator, out_target_environment)
}
#[doc = " Creates an AMDGPU target profile from a canonical target selector.\n\n @param target_environment AMDGPU-capable target environment.\n @param options Profile options. Required.\n @param allocator Host allocator used for profile storage.\n @param out_profile Receives one retained profile on success.\n @return OK when the target is known, HSACO-capable, and has a supported Loom\n descriptor-family bundle.\n\n @ownership\n The caller owns the returned profile and releases it with\n `loomc_target_profile_release`."]
pub unsafe fn loomc_target_profile_create_amdgpu(
&self,
target_environment: *mut loomc_target_environment_t,
options: *const loomc_amdgpu_profile_options_t,
allocator: loomc_allocator_t,
out_profile: *mut *mut loomc_target_profile_t,
) -> loomc_status_t {
(self.loomc_target_profile_create_amdgpu)(
target_environment,
options,
allocator,
out_profile,
)
}
#[doc = " Creates a target environment containing the AIE2P XDNA compiler and emitter.\n\n @param allocator Host allocator used for target-environment storage.\n @param out_target_environment Receives one retained environment on success.\n @return OK when the target environment was created.\n\n @ownership\n The caller releases the returned reference with\n `loomc_target_environment_release`. The environment can be shared by\n compiler instances and workspaces across JIT invocations."]
pub unsafe fn loomc_target_environment_create_xdna(
&self,
allocator: loomc_allocator_t,
out_target_environment: *mut *mut loomc_target_environment_t,
) -> loomc_status_t {
(self.loomc_target_environment_create_xdna)(allocator, out_target_environment)
}
#[doc = " Creates an immutable profile for a supported AIE2P device key.\n\n The key identifies the array geometry and register/configuration ABI, for\n example `amd.xdna.strix_halo.17f0_11`. This is an offline lookup; it does\n not probe hardware. Unknown keys fail instead of assuming a compatible\n device. Supply the profile through ordinary\n `loomc_target_specialization_options_t` function or target-declaration\n bindings. The compiled function versions retain their device facts through\n emission, so no separate emit profile is needed.\n\n @param target_environment Environment containing the AIE2P target package.\n @param device_key Exact device key; the view need not be NUL-terminated.\n @param allocator Host allocator used for the profile handle.\n @param out_profile Receives one retained profile on success, NULL on\n failure.\n @return OK on success; invalid argument for an unsupported key or\n environment.\n\n @ownership\n The caller releases the returned reference with\n `loomc_target_profile_release`. The profile copies the device key and\n retains the target environment. The profile is immutable and may be reused\n across threads and compilations."]
pub unsafe fn loomc_target_profile_create_xdna(
&self,
target_environment: *mut loomc_target_environment_t,
device_key: loomc_string_view_t,
allocator: loomc_allocator_t,
out_profile: *mut *mut loomc_target_profile_t,
) -> loomc_status_t {
(self.loomc_target_profile_create_xdna)(
target_environment,
device_key,
allocator,
out_profile,
)
}
#[doc = " Imports C/C++ source into a verified High IR module, without cleanup passes.\n\n @param context Immutable context containing the core dialects.\n @param workspace Workspace backing the returned module's arena storage.\n @param source Source with UNKNOWN format. Its identifier labels diagnostics\n and supplies the main file's path for quoted include lookup.\n @param options Source configuration, or NULL for defaults.\n @param allocator Host allocator for public handles and temporary adapters.\n @param out_module Receives one owned module on successful source admission.\n @param out_result Receives one owned result with retained diagnostics.\n @return OK for successful import or diagnosed source rejection. Rejection\n returns a failed result and NULL module. Infrastructure/API failures return\n non-OK status and NULL outputs. C++ exceptions never cross this boundary.\n\n @ownership\n Release outputs with loomc_module_release and loomc_result_release. The\n module retains its context/workspace. The result owns diagnostic contents.\n\n @lifetime\n Source/include bytes, options, and callback state may be released on return.\n Neither the module nor the result retains borrowed frontend or AST storage.\n\n @thread_safety\n Each import requires exclusive access to its workspace. Concurrent imports\n may share an immutable context and immutable source handles."]
pub unsafe fn loomc_module_import_cxx(
&self,
context: *mut loomc_context_t,
workspace: *mut loomc_workspace_t,
source: *const loomc_source_t,
options: *const loomc_cxx_import_options_t,
allocator: loomc_allocator_t,
out_module: *mut *mut loomc_module_t,
out_result: *mut *mut loomc_result_t,
) -> loomc_status_t {
(self.loomc_module_import_cxx)(
context, workspace, source, options, allocator, out_module, out_result,
)
}
}