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

SPIR-V target profiles from IREE HAL devices. More...

Go to the source code of this file.

Data Structures

struct  loomc_spirv_iree_hal_profile_options_t
 SPIR-V profile options for an IREE HAL Vulkan device. More...

Functions

loomc_status_t loomc_target_profile_create_spirv_iree_hal (loomc_target_environment_t *target_environment, const loomc_spirv_iree_hal_profile_options_t *options, loomc_allocator_t allocator, loomc_target_profile_t **out_profile, loomc_result_t **out_result)
 Creates a SPIR-V target profile from an IREE HAL Vulkan device.
const loomc_iree_hal_profile_provider_tloomc_spirv_iree_hal_profile_provider (void)
 Returns the generic IREE HAL router provider for SPIR-V/Vulkan devices.

Detailed Description

SPIR-V target profiles 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
Create a SPIR-V profile directly from an IREE HAL Vulkan device:
.structure_size = sizeof(loomc_spirv_iree_hal_profile_options_t),
.identifier = loomc_make_cstring_view("jit-vulkan"),
.device = device,
.physical_device_affinity = 0,
};
loomc_target_profile_t* profile = NULL;
loomc_result_t* result = NULL;
target_environment, &options, loomc_allocator_system(), &profile,
&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_PROFILE_OPTIONS
loomc_spirv_iree_hal_profile_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:63
loomc_status_t loomc_target_profile_create_spirv_iree_hal(loomc_target_environment_t *target_environment, const loomc_spirv_iree_hal_profile_options_t *options, loomc_allocator_t allocator, loomc_target_profile_t **out_profile, loomc_result_t **out_result)
Creates a SPIR-V target profile from an IREE HAL Vulkan device.
SPIR-V profile options for an IREE HAL Vulkan device.
Definition spirv/iree_hal.h:56
struct loomc_target_profile_t loomc_target_profile_t
Prepared immutable target profile.
Definition target.h:135

Function Documentation

◆ loomc_spirv_iree_hal_profile_provider()

const loomc_iree_hal_profile_provider_t * loomc_spirv_iree_hal_profile_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_profile_options_t::providers array.

◆ loomc_target_profile_create_spirv_iree_hal()

loomc_status_t loomc_target_profile_create_spirv_iree_hal ( loomc_target_environment_t * target_environment,
const loomc_spirv_iree_hal_profile_options_t * options,
loomc_allocator_t allocator,
loomc_target_profile_t ** out_profile,
loomc_result_t ** out_result )

Creates a SPIR-V target profile from an IREE HAL Vulkan device.

Parameters
target_environmentSPIR-V target environment that will own the profile.
optionsSPIR-V IREE HAL profile options.
allocatorHost allocator used for result and profile storage.
out_profileReceives one retained profile when the result succeeds. Receives NULL on failed result.
out_resultReceives a retained result containing adapter or SPIR-V profile diagnostics.
Returns
OK when profile creation 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 reference and releases it with loomc_target_profile_release.
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.