Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
program.h
Go to the documentation of this file.
1// Copyright 2026 The IREE Authors
2//
3// Licensed under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
7#ifndef LOOMC_TARGET_CMD_PROGRAM_H_
8#define LOOMC_TARGET_CMD_PROGRAM_H_
9
10#include "loomc/artifact.h"
11#include "loomc/config.h"
12#include "loomc/context.h"
13#include "loomc/link_index.h"
14#include "loomc/module.h"
15#include "loomc/product.h"
16#include "loomc/result.h"
17#include "loomc/target.h"
18#include "loomc/workspace.h"
19
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
66#define LOOMC_ARTIFACT_FORMAT_CMD_PROGRAM "loom-command"
67
69typedef enum loomc_cmd_program_product_flag_bits_e {
74
77
135
181
240
263
273
307 loomc_workspace_t* workspace,
309 loomc_allocator_t allocator, loomc_product_t** out_product,
310 loomc_result_t** out_result);
311
349 loomc_context_t* context, loomc_workspace_t* workspace,
350 const loomc_request_t* request,
352 loomc_allocator_t allocator, loomc_product_t** out_product,
353 loomc_result_t** out_result);
354
388 loomc_workspace_t* workspace, const loomc_module_t* module,
390 loomc_allocator_t allocator, loomc_product_t** out_product,
391 loomc_result_t** out_result);
392
401
408
416 const loomc_product_t* product, loomc_host_size_t ordinal,
417 loomc_cmd_program_t* out_program);
418
425 const loomc_product_t* product);
426
434 const loomc_product_t* product, loomc_host_size_t ordinal,
435 loomc_cmd_entry_requirement_t* out_requirement);
436
437#ifdef __cplusplus
438} // extern "C"
439#endif
440
441#endif // LOOMC_TARGET_CMD_PROGRAM_H_
In-memory output artifacts produced by compiler operations.
#define LOOMC_API_EXPORT
Exports a public Loom C API symbol from a shared library build.
Definition base.h:34
size_t loomc_host_size_t
Host allocation and container size type.
Definition base.h:45
loomc_structure_type_t
Structure type values used by extensible public descriptors.
Definition base.h:181
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
Text and JSON configuration bindings.
Reusable Loom API context.
struct loomc_context_t loomc_context_t
Immutable Loom API context.
Definition context.h:63
Opaque in-memory Loom modules.
struct loomc_module_t loomc_module_t
Opaque parsed, linked, optimized, or lowered module.
Definition module.h:90
Immutable compiler products and their recursively published requests.
struct loomc_product_t loomc_product_t
Immutable successful compiler product.
Definition product.h:66
uint32_t loomc_requirement_ordinal_t
Parent-product-local requirement ordinal.
Definition product.h:126
struct loomc_request_t loomc_request_t
Immutable independently compilable product request.
Definition product.h:167
struct loomc_product_descriptor_t loomc_product_descriptor_t
Opaque process-local identity for one product representation.
Definition product.h:51
loomc_status_t loomc_cmd_program_product_build(loomc_workspace_t *workspace, const loomc_cmd_program_product_options_t *options, loomc_allocator_t allocator, loomc_product_t **out_product, loomc_result_t **out_result)
Builds portable command programs and optional kernel source requests.
loomc_status_t loomc_cmd_program_product_build_module(loomc_workspace_t *workspace, const loomc_module_t *module, const loomc_cmd_program_module_options_t *options, loomc_allocator_t allocator, loomc_product_t **out_product, loomc_result_t **out_result)
Builds portable command programs from a materialized module.
bool loomc_cmd_program_product_program_at(const loomc_product_t *product, loomc_host_size_t ordinal, loomc_cmd_program_t *out_program)
Returns serialized command-root metadata by product-local ordinal.
loomc_host_size_t loomc_cmd_program_product_program_count(const loomc_product_t *product)
Returns the number of serialized command roots in product.
loomc_status_t loomc_cmd_program_product_build_request(loomc_context_t *context, loomc_workspace_t *workspace, const loomc_request_t *request, const loomc_cmd_program_request_options_t *options, loomc_allocator_t allocator, loomc_product_t **out_product, loomc_result_t **out_result)
Builds portable command programs from an ordinary bytecode request.
uint32_t loomc_cmd_program_product_flags_t
Bitmask of loomc_cmd_program_product_flag_bits_t values.
Definition program.h:76
loomc_host_size_t loomc_cmd_program_product_entry_requirement_count(const loomc_product_t *product)
Returns the number of product-wide executable-entry requirements.
loomc_cmd_program_product_flag_bits_t
Command-product operation flag bits.
Definition program.h:69
@ LOOMC_CMD_PROGRAM_PRODUCT_FLAG_INCLUDE_INPUT_EXPORTS
Select exported command definitions from INPUT providers in addition to explicitly supplied roots.
Definition program.h:72
bool loomc_cmd_program_product_entry_requirement_at(const loomc_product_t *product, loomc_host_size_t ordinal, loomc_cmd_entry_requirement_t *out_requirement)
Returns an executable-entry requirement by product-local ordinal.
const loomc_product_descriptor_t * loomc_cmd_program_product_descriptor(void)
Returns the process-local command-product descriptor.
Shared operation result container.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:71
Host allocator used for persistent Loom object storage.
Definition base.h:414
Borrowed artifact view owned by a producer-specific result or product.
Definition artifact.h:78
One product-wide executable-entry binding requirement.
Definition program.h:269
loomc_string_view_t symbol
Logical kernel entry symbol without a leading @.
Definition program.h:271
Command-product options for one invocation-local materialized module.
Definition program.h:187
loomc_structure_type_t type
Structure type.
Definition program.h:190
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition program.h:193
loomc_config_options_t config
Per-invocation config bindings applied during selective materialization.
Definition program.h:219
const void * next
Optional invocation extensions such as loomc_target_specialization_options_t.
Definition program.h:197
loomc_cmd_program_product_flags_t flags
Product construction flags.
Definition program.h:216
const loomc_string_view_t * root_symbols
Command symbols in the materialized module, with or without a leading @.
Definition program.h:209
loomc_request_sink_t request_sink
Optional sink enabling source-backed kernel request publication.
Definition program.h:238
loomc_string_view_t provider_name
Stable provider label for diagnostics and private-name determinism.
Definition program.h:205
const loomc_link_index_t * library_index
Optional frozen library-only index used to resolve module declarations.
Definition program.h:201
loomc_host_size_t root_symbol_count
Number of entries in root_symbols.
Definition program.h:212
const loomc_target_profile_t * target_profile
Optional execution profile for every selected kernel entry and launch configuration.
Definition program.h:232
Command-product construction options.
Definition program.h:84
loomc_config_options_t config
Per-invocation config bindings applied during selective materialization.
Definition program.h:114
loomc_link_index_t * link_index
Frozen provider index containing command and kernel sources.
Definition program.h:97
const loomc_target_profile_t * target_profile
Optional execution profile for all selected kernel entries and their launch configurations.
Definition program.h:127
loomc_cmd_program_product_flags_t flags
Product construction flags.
Definition program.h:111
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition program.h:90
const loomc_host_size_t * root_symbol_ordinals
Index-wide symbol ordinals of explicit command roots.
Definition program.h:105
loomc_host_size_t root_symbol_count
Number of entries in root_symbol_ordinals.
Definition program.h:108
loomc_request_sink_t request_sink
Optional sink enabling source-backed request publication.
Definition program.h:133
loomc_structure_type_t type
Structure type.
Definition program.h:87
const void * next
Optional invocation extensions such as loomc_target_specialization_options_t.
Definition program.h:94
Command-product options for an ordinary bytecode request.
Definition program.h:143
loomc_structure_type_t type
Structure type.
Definition program.h:146
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition program.h:149
const loomc_target_profile_t * target_profile
Optional execution profile for all selected kernel entries and their launch configurations.
Definition program.h:173
loomc_request_sink_t request_sink
Optional sink enabling source-backed kernel request publication.
Definition program.h:179
const loomc_link_index_t * library_index
Optional frozen library-only index used to resolve request declarations.
Definition program.h:157
const void * next
Optional invocation extensions such as loomc_target_specialization_options_t.
Definition program.h:153
loomc_config_options_t config
Per-invocation config bindings applied during selective materialization.
Definition program.h:160
One serialized command root and its executable-entry projection.
Definition program.h:246
const loomc_requirement_ordinal_t * entry_requirement_ordinals
Product-local entry requirement ordinals in root-local slot order.
Definition program.h:258
loomc_host_size_t entry_requirement_count
Number of entries in entry_requirement_ordinals.
Definition program.h:261
loomc_artifact_t artifact
Portable command-program artifact.
Definition program.h:255
loomc_string_view_t symbol
Root symbol without a leading @.
Definition program.h:248
Text configuration bindings and resolution policy shared by API operations.
Definition config.h:78
Optional destination for streamed product requests.
Definition product.h:223
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63
Prepared target environments and target lowering pipelines.
struct loomc_target_profile_t loomc_target_profile_t
Prepared immutable target profile.
Definition target.h:136
Per-worker scratch workspace.
struct loomc_workspace_t loomc_workspace_t
Mutable per-worker scratch workspace.
Definition workspace.h:54