Skip to main content

link_kernels

Macro link_kernels 

Source
macro_rules! link_kernels {
    ($sym:ident) => { ... };
}
Expand description

Declare the query entry point of a statically linked IREE executable library and yield it as a LibraryQueryFn.

iree-compile --iree-hal-target-backends=llvm-cpu with static-library output produces an object file plus a header naming its query function (for example my_model_linked_library_query). Link the object into the firmware and pass the symbol here; give the result to Device::local_sync_static.

§Contract

$sym must name the query function of an IREE static library, emitted by iree-compile alongside the object file (the *_library_query symbol in its generated header). The macro declares, it cannot verify: naming any other symbol misdeclares its ABI, and invoking the device on it is undefined behaviour.

let device = Device::local_sync_static(
    &arena,
    &[iree_embedded::link_kernels!(my_model_linked_library_query)],
)?;