Loom C API
Public Loom compiler C API
Loading...
Searching...
No Matches
task.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_TASK_H_
8#define LOOMC_TASK_H_
9
10#include "loomc/status.h"
11
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
31typedef struct loomc_task_t loomc_task_t;
32
50
63
72 loomc_task_t* out_task);
73
83 loomc_host_size_t worker_ordinal);
84
91
103 void* user_data, loomc_task_t* task);
104
113
124 loomc_task_t* task);
125
126#ifdef __cplusplus
127} // extern "C"
128#endif
129
130#endif // LOOMC_TASK_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
#define LOOMC_API_PTR
Marks a public callback function pointer type.
Definition base.h:38
struct iree_status_handle_t * loomc_status_t
Opaque status handle.
Definition base.h:55
Status codes and rich infrastructure error reporting.
Borrowed destination for generic tasks.
Definition task.h:106
void * user_data
Opaque state passed to submit.
Definition task.h:111
loomc_task_submit_fn_t submit
Callback accepting one task.
Definition task.h:108
Base embedded at offset zero in one caller-defined work record.
Definition task.h:51
const loomc_task_vtable_t * vtable
Static callbacks implementing the concrete task.
Definition task.h:53
loomc_task_t * next
Sink-owned intrusive link while the accepted task is queued.
Definition task.h:61
Stateless callbacks for one task representation.
Definition task.h:34
void(* destroy)(loomc_task_t *task)
Destroys task storage after execution or rejected-submission cleanup.
Definition task.h:48
void(* execute)(loomc_task_t *task, loomc_host_size_t worker_ordinal)
Executes task exactly once without destroying its storage.
Definition task.h:44
void loomc_task_execute(loomc_task_t *task, loomc_host_size_t worker_ordinal)
Executes and then destroys an accepted task.
loomc_status_t(* loomc_task_submit_fn_t)(void *user_data, loomc_task_t *task)
Accepts ownership of one generic task.
Definition task.h:102
void loomc_task_destroy(loomc_task_t *task)
Destroys a task without executing it.
loomc_status_t loomc_task_sink_submit(loomc_task_sink_t sink, loomc_task_t *task)
Submits a task and transfers ownership on success.
void loomc_task_initialize(const loomc_task_vtable_t *vtable, loomc_task_t *out_task)
Initializes a caller-allocated task base.