Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
target.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_H_
8#define LOOMC_TARGET_H_
9
10#include "loomc/context.h"
11#include "loomc/pass.h"
12#include "loomc/result.h"
13#include "loomc/sanitizer.h"
14
110
111#ifdef __cplusplus
112extern "C" {
113#endif
114
125
137
153
174
183
197
229
244
259
262
271
312
345 loomc_context_t* context, const loomc_target_pipeline_options_t* options,
346 loomc_allocator_t allocator, loomc_pass_program_t** out_pass_program,
347 loomc_result_t** out_result);
348
371 loomc_target_environment_t* target_environment,
372 loomc_string_view_t specification, loomc_allocator_t allocator,
373 loomc_target_profile_t** out_profile);
374
399 loomc_target_profile_t* base_profile, uint32_t execution_unit_count,
400 loomc_allocator_t allocator, loomc_target_profile_t** out_profile);
401
409 loomc_target_profile_t* profile);
410
419 loomc_target_profile_t* profile);
420
437 const loomc_target_profile_t* lhs, const loomc_target_profile_t* rhs);
438
464 loomc_host_size_t environment_count,
465 loomc_target_environment_t* const* environments,
466 loomc_allocator_t allocator,
467 loomc_target_environment_t** out_target_environment);
468
478 const loomc_target_environment_t* target_environment);
479
491 const loomc_target_environment_t* target_environment,
492 loomc_host_size_t ordinal);
493
503 const loomc_target_environment_t* target_environment);
504
515 const loomc_target_environment_t* target_environment,
516 loomc_host_size_t ordinal);
517
525 loomc_target_environment_t* target_environment);
526
536 loomc_target_environment_t* target_environment);
537
538#ifdef __cplusplus
539} // extern "C"
540#endif
541
542#endif // LOOMC_TARGET_H_
#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
Reusable Loom API context.
struct loomc_context_t loomc_context_t
Immutable Loom API context.
Definition context.h:63
Prepared pass programs.
struct loomc_pass_program_t loomc_pass_program_t
Prepared immutable pass program.
Definition pass.h:88
Shared operation result container.
struct loomc_result_t loomc_result_t
Immutable operation result.
Definition result.h:71
Sanitizer compile options.
Host allocator used for persistent Loom object storage.
Definition base.h:426
Context option extension that registers a target environment.
Definition target.h:160
loomc_target_environment_t * target_environment
Target environment to register with the context.
Definition target.h:172
const void * next
Next context option extension.
Definition target.h:169
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition target.h:166
loomc_structure_type_t type
Structure type.
Definition target.h:163
Non-owning string view over bytes that need not be NUL-terminated.
Definition base.h:63
One authored target declaration to bind to one target profile.
Definition target.h:190
loomc_string_view_t target_symbol
Target declaration symbol name. A leading @ is accepted.
Definition target.h:192
loomc_target_profile_t * target_profile
Complete target profile borrowed for the invocation.
Definition target.h:195
Target pipeline creation options.
Definition target.h:279
loomc_target_control_flow_lowering_t control_flow_lowering
Control-flow shape selected for the source-to-low boundary.
Definition target.h:299
loomc_target_pipeline_kind_t kind
Target pipeline boundary to build.
Definition target.h:296
uint32_t reserved
Reserved padding preserving the original descriptor ABI boundary.
Definition target.h:305
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition target.h:285
loomc_structure_type_t type
Structure type.
Definition target.h:282
loomc_source_to_low_diagnostic_flags_t source_to_low_diagnostic_flags
Optional source-to-low diagnostic remarks to emit while selecting target-low operations.
Definition target.h:310
const void * next
Extension chain for target pipeline options such as loomc_sanitizer_options_t.
Definition target.h:289
uint32_t source_to_low_max_errors
Maximum source-to-low diagnostics. Zero uses source-to-low's default.
Definition target.h:302
loomc_string_view_t identifier
Stable identifier used for the synthetic pipeline module and diagnostics.
Definition target.h:293
Option extension carrying target specialization inputs.
Definition target.h:206
loomc_host_size_t target_binding_count
Number of rows in target_bindings.
Definition target.h:227
const void * next
Additional option extensions in the same unordered chain.
Definition target.h:215
const loomc_target_specialization_t * specializations
Specialization rows borrowed for the invocation.
Definition target.h:218
const loomc_target_binding_t * target_bindings
Target declaration binding rows borrowed for the invocation.
Definition target.h:224
loomc_structure_type_t type
Structure type.
Definition target.h:209
loomc_host_size_t structure_size
Size of this structure in bytes.
Definition target.h:212
loomc_host_size_t specialization_count
Number of rows in specializations.
Definition target.h:221
One function version to specialize to one structured target profile.
Definition target.h:176
loomc_target_profile_t * target_profile
Complete target profile borrowed for the invocation.
Definition target.h:181
loomc_string_view_t function_symbol
Function symbol name. A leading @ is accepted.
Definition target.h:178
void loomc_target_profile_release(loomc_target_profile_t *profile)
Releases a target profile from one owner.
loomc_status_t loomc_target_profile_select(loomc_target_environment_t *target_environment, loomc_string_view_t specification, loomc_allocator_t allocator, loomc_target_profile_t **out_profile)
Selects a complete named profile from a target environment.
struct loomc_target_environment_t loomc_target_environment_t
Prepared immutable target environment.
Definition target.h:124
loomc_status_t loomc_target_environment_create(loomc_host_size_t environment_count, loomc_target_environment_t *const *environments, loomc_allocator_t allocator, loomc_target_environment_t **out_target_environment)
Creates one immutable environment from explicitly selected target packages.
loomc_status_t loomc_target_profile_refine_execution_unit_count(loomc_target_profile_t *base_profile, uint32_t execution_unit_count, loomc_allocator_t allocator, loomc_target_profile_t **out_profile)
Refines a complete profile with a known deployment execution-unit count.
uint32_t loomc_source_to_low_diagnostic_flags_t
Bitmask of loomc_source_to_low_diagnostic_flag_bits_t values.
Definition target.h:261
loomc_target_control_flow_lowering_t
Control-flow shape selected for source-to-low lowering.
Definition target.h:264
@ LOOMC_TARGET_CONTROL_FLOW_LOWERING_CFG
Lower source structured control flow to explicit CFG before source-to-low.
Definition target.h:266
@ LOOMC_TARGET_CONTROL_FLOW_LOWERING_STRUCTURED_LOW
Preserve supported structured control flow into target-low IR.
Definition target.h:269
void loomc_target_environment_retain(loomc_target_environment_t *target_environment)
Retains a target environment for another owner.
bool loomc_target_profile_equal(const loomc_target_profile_t *lhs, const loomc_target_profile_t *rhs)
Compares exact immutable profile inputs without allocating or compiling.
loomc_target_fact_state_t
Three-valued target fact state.
Definition target.h:143
@ LOOMC_TARGET_FACT_STATE_UNKNOWN
No fact has been supplied yet.
Definition target.h:145
@ LOOMC_TARGET_FACT_STATE_FALSE
The fact is known to be unavailable or false.
Definition target.h:148
@ LOOMC_TARGET_FACT_STATE_TRUE
The fact is known to be available or true.
Definition target.h:151
loomc_string_view_t loomc_target_environment_artifact_format_at(const loomc_target_environment_t *target_environment, loomc_host_size_t ordinal)
Returns a public artifact format by ordinal.
loomc_host_size_t loomc_target_environment_artifact_format_count(const loomc_target_environment_t *target_environment)
Returns the number of public artifact formats in a target environment.
loomc_target_pipeline_kind_t
Target lowering pipeline boundary.
Definition target.h:231
@ LOOMC_TARGET_PIPELINE_KIND_SOURCE_LOW_ARTIFACTS
Lower source/kernel IR to target-low IR prepared for human-facing target-low assembly printing.
Definition target.h:242
@ LOOMC_TARGET_PIPELINE_KIND_PREPARED_LOW
Lower source/kernel IR to target-low IR prepared for target emission.
Definition target.h:233
@ LOOMC_TARGET_PIPELINE_KIND_SOURCE_LOW
Lower source/kernel IR to target-low IR before target ABI/resource materialization and packetization ...
Definition target.h:237
loomc_host_size_t loomc_target_environment_target_family_count(const loomc_target_environment_t *target_environment)
Returns the number of target families in a target environment.
loomc_string_view_t loomc_target_environment_target_family_at(const loomc_target_environment_t *target_environment, loomc_host_size_t ordinal)
Returns a target family name by ordinal.
loomc_status_t loomc_pass_program_create_from_target_pipeline(loomc_context_t *context, const loomc_target_pipeline_options_t *options, loomc_allocator_t allocator, loomc_pass_program_t **out_pass_program, loomc_result_t **out_result)
Creates a prepared target lowering pass program.
void loomc_target_environment_release(loomc_target_environment_t *target_environment)
Releases a target environment from one owner.
struct loomc_target_profile_t loomc_target_profile_t
Prepared immutable target profile.
Definition target.h:136
void loomc_target_profile_retain(loomc_target_profile_t *profile)
Retains a target profile for another owner.
loomc_source_to_low_diagnostic_flag_bits_t
Optional source-to-low diagnostic flag bits.
Definition target.h:246
@ LOOMC_SOURCE_TO_LOW_DIAGNOSTIC_OPERAND_FORM
Emit target operand-form selection remarks when supported by the target.
Definition target.h:252
@ LOOMC_SOURCE_TO_LOW_DIAGNOSTIC_ALL
All source-to-low diagnostic flags known to this header.
Definition target.h:255
@ LOOMC_SOURCE_TO_LOW_DIAGNOSTIC_MEMORY_ACCESS
Emit target source-memory decision remarks, including access, cache-policy, and prefetch selection wh...
Definition target.h:249