Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
iree_hal.h File Reference

SPIR-V compiler-and-loader targets from IREE HAL devices. More...

Go to the source code of this file.

Data Structures

struct  loomc_spirv_iree_hal_target_options_t
 SPIR-V target options for an IREE HAL Vulkan device. More...

Functions

loomc_status_t loomc_target_select_spirv_iree_hal (loomc_target_environment_t *target_environment, const loomc_spirv_iree_hal_target_options_t *options, loomc_allocator_t allocator, loomc_iree_hal_target_selection_t *out_selection, loomc_result_t **out_result)
 Selects a SPIR-V compiler-and-loader target from an IREE HAL Vulkan device.
const loomc_iree_hal_target_provider_t * loomc_spirv_iree_hal_target_provider (void)
 Returns the generic IREE HAL router provider for SPIR-V/Vulkan devices.

Detailed Description

SPIR-V compiler-and-loader targets from IREE HAL devices.

This optional leaf adapts an IREE HAL Vulkan device into the public SPIR-V target profile fact model. It does not expose Vulkan headers or driver private types. The adapter uses stable HAL device queries such as vulkan.device :: api_version and vulkan.feature :: buffer_device_address, then creates an ordinary loomc_target_profile_t with SPIR-V facts and diagnostics.

The initial execution profile targets IREE HAL's raw Vulkan BDA SPIR-V executable target. Devices that cannot support that execution mode return a failed result with structured diagnostics instead of forcing callers to infer support from status codes.

Example
Select a SPIR-V target directly from an IREE HAL Vulkan device:
.structure_size = sizeof(loomc_spirv_iree_hal_target_options_t),
.identifier = loomc_make_cstring_view("jit-vulkan"),
.device = device,
.physical_device_affinity = 0,
};
loomc_result_t* result = NULL;
target_environment, &options, loomc_allocator_system(), &selection,
&result);
if (!loomc_status_is_ok(status)) return status;
if (!loomc_result_succeeded(result)) {
// Inspect diagnostics before deciding whether to fall back or skip.
}
loomc_allocator_t loomc_allocator_system(void)
Returns a process-global system allocator.
@ LOOMC_STRUCTURE_TYPE_SPIRV_IREE_HAL_TARGET_OPTIONS
loomc_spirv_iree_hal_target_options_t.
Definition base.h:255
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
void loomc_result_release(loomc_result_t *result)
Releases result from one owner.
bool loomc_result_succeeded(const loomc_result_t *result)
Returns true when result succeeded.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:71
loomc_status_t loomc_target_select_spirv_iree_hal(loomc_target_environment_t *target_environment, const loomc_spirv_iree_hal_target_options_t *options, loomc_allocator_t allocator, loomc_iree_hal_target_selection_t *out_selection, loomc_result_t **out_result)
Selects a SPIR-V compiler-and-loader target from an IREE HAL Vulkan device.
One compiler-and-loader target selected from an IREE HAL device.
Definition iree_hal.h:79
loomc_target_profile_t * target_profile
Complete Loom target profile retained for the caller.
Definition iree_hal.h:83
SPIR-V target options for an IREE HAL Vulkan device.
Definition spirv/iree_hal.h:57
void loomc_target_profile_release(loomc_target_profile_t *profile)
Releases a target profile from one owner.

Function Documentation

◆ loomc_spirv_iree_hal_target_provider()

const loomc_iree_hal_target_provider_t * loomc_spirv_iree_hal_target_provider ( void )

Returns the generic IREE HAL router provider for SPIR-V/Vulkan devices.

Returns
Process-lifetime provider descriptor. The returned pointer is immutable and may be placed directly in a loomc_iree_hal_target_options_t::providers array.

◆ loomc_target_select_spirv_iree_hal()

loomc_status_t loomc_target_select_spirv_iree_hal ( loomc_target_environment_t * target_environment,
const loomc_spirv_iree_hal_target_options_t * options,
loomc_allocator_t allocator,
loomc_iree_hal_target_selection_t * out_selection,
loomc_result_t ** out_result )

Selects a SPIR-V compiler-and-loader target from an IREE HAL Vulkan device.

Parameters
target_environmentSPIR-V target environment that will own the profile.
optionsSPIR-V IREE HAL target options.
allocatorHost allocator used for result and profile storage.
out_selectionReceives one complete target selection when the result succeeds. Receives zero on failed result.
out_resultReceives a retained result containing adapter or SPIR-V profile diagnostics.
Returns
OK when target selection completed far enough to report a result. Non-OK statuses represent API misuse or infrastructure failures before a result could be produced.
Ownership
The caller owns out_result on an OK return and releases it with loomc_result_release. When a profile is produced, the caller owns the returned profile reference with loomc_target_profile_release. The executable target remains borrowed from the device.
Thread safety
The adapter holds no mutable process-global state. It may be called concurrently for different invocations. The supplied HAL device must satisfy its own thread-safety contract.