mlir.dialects._async_ops_gen¶
Attributes¶
Classes¶
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
An async function is like a normal function, but supports non-blocking |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
|
The |
Functions¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Module Contents¶
- mlir.dialects._async_ops_gen._ods_ir¶
- class mlir.dialects._async_ops_gen._Dialect(descriptor: object)¶
Bases:
_ods_ir- DIALECT_NAMESPACE = 'async'¶
- class mlir.dialects._async_ops_gen.AddToGroupOp(operand, group, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.add_to_groupadds an async token or value to the async group. Returns the rank of the added element in the group. This rank is fixed for the group lifetime.Example:
%0 = async.create_group %size : !async.group %1 = ... : !async.token %2 = async.add_to_group %1, %0 : !async.token
- OPERATION_NAME = 'async.add_to_group'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- group() _ods_ir¶
- rank() _ods_ir¶
- mlir.dialects._async_ops_gen.add_to_group(operand, group, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.AwaitAllOp(operand, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.await_alloperation waits until all the tokens or values in the group become ready.Example:
%0 = async.create_group %size : !async.group %1 = ... : !async.token %2 = async.add_to_group %1, %0 : !async.token %3 = ... : !async.token %4 = async.add_to_group %2, %0 : !async.token async.await_all %0
- OPERATION_NAME = 'async.await_all'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- mlir.dialects._async_ops_gen.await_all(operand, *, loc=None, ip=None) AwaitAllOp¶
- class mlir.dialects._async_ops_gen.AwaitOp(result, operand, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.awaitoperation waits until the argument becomes ready, and for theasync.valuearguments it unwraps the underlying valueExample:
%0 = ... : !async.token async.await %0 : !async.token %1 = ... : !async.value<f32> %2 = async.await %1 : !async.value<f32>
- OPERATION_NAME = 'async.await'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- result() _ods_ir | None¶
Shortcut to get an op result if it has only one (throws an error otherwise).
- mlir.dialects._async_ops_gen.await_(result, operand, *, loc=None, ip=None) _ods_ir | _ods_ir | AwaitOp¶
- class mlir.dialects._async_ops_gen.CallOp(result, callee, operands_, *, arg_attrs=None, res_attrs=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.calloperation represents a direct call to an async function that is within the same symbol scope as the call. The operands and result types of the call must match the specified async function type. The callee is encoded as a symbol reference attribute named “callee”.Example:
%2 = async.call @my_add(%0, %1) : (f32, f32) -> !async.value<f32>
- OPERATION_NAME = 'async.call'¶
- _ODS_REGIONS = (0, True)¶
- operands_() _ods_ir¶
- callee() _ods_ir¶
- arg_attrs() _ods_ir | None¶
- res_attrs() _ods_ir | None¶
- mlir.dialects._async_ops_gen.call(result, callee, operands_, *, arg_attrs=None, res_attrs=None, loc=None, ip=None) _ods_ir | _ods_ir | CallOp¶
- class mlir.dialects._async_ops_gen.CoroBeginOp(id, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.coro.beginallocates a coroutine frame and returns a handle to the coroutine.- OPERATION_NAME = 'async.coro.begin'¶
- _ODS_REGIONS = (0, True)¶
- id() _ods_ir¶
- handle() _ods_ir¶
- mlir.dialects._async_ops_gen.coro_begin(id, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.CoroEndOp(handle, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.coro.endmarks the point where a coroutine needs to return control back to the caller if it is not an initial invocation of the coroutine. It the start part of the coroutine is is no-op.- OPERATION_NAME = 'async.coro.end'¶
- _ODS_REGIONS = (0, True)¶
- handle() _ods_ir¶
- class mlir.dialects._async_ops_gen.CoroFreeOp(id, handle, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.coro.freedeallocates the coroutine frame created by the async.coro.begin operation.- OPERATION_NAME = 'async.coro.free'¶
- _ODS_REGIONS = (0, True)¶
- id() _ods_ir¶
- handle() _ods_ir¶
- mlir.dialects._async_ops_gen.coro_free(id, handle, *, loc=None, ip=None) CoroFreeOp¶
- class mlir.dialects._async_ops_gen.CoroIdOp(*, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.coro.idreturns a switched-resume coroutine identifier.- OPERATION_NAME = 'async.coro.id'¶
- _ODS_REGIONS = (0, True)¶
- id() _ods_ir¶
- mlir.dialects._async_ops_gen.coro_id(*, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.CoroSaveOp(handle, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.coro.savessaves the coroutine state.- OPERATION_NAME = 'async.coro.save'¶
- _ODS_REGIONS = (0, True)¶
- handle() _ods_ir¶
- state() _ods_ir¶
- mlir.dialects._async_ops_gen.coro_save(handle, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.CoroSuspendOp(state, suspendDest, resumeDest, cleanupDest, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.coro.suspendsuspends the coroutine and transfers control to thesuspendsuccessor. If suspended coroutine later resumed it will transfer control to theresumesuccessor. If it is destroyed it will transfer control to the thecleanupsuccessor.In switched-resume lowering coroutine can be already in resumed state when suspend operation is called, in this case control will be transferred to the
resumesuccessor skipping thesuspendsuccessor.- OPERATION_NAME = 'async.coro.suspend'¶
- _ODS_REGIONS = (0, True)¶
- state() _ods_ir¶
- mlir.dialects._async_ops_gen.coro_suspend(state, suspend_dest, resume_dest, cleanup_dest, *, loc=None, ip=None) CoroSuspendOp¶
- class mlir.dialects._async_ops_gen.CreateGroupOp(size, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.create_groupallocates an empty async group. Async tokens or values can be added to this group later. The size of the group must be specified at construction time, andawait_alloperation will first wait until the number of added tokens or values reaches the group size.Example:
%size = ... : index %group = async.create_group %size : !async.group ... async.await_all %group
- OPERATION_NAME = 'async.create_group'¶
- _ODS_REGIONS = (0, True)¶
- size() _ods_ir¶
- result() _ods_ir¶
Shortcut to get an op result if it has only one (throws an error otherwise).
- mlir.dialects._async_ops_gen.create_group(size, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.ExecuteOp(token, bodyResults, dependencies, bodyOperands, *, loc=None, ip=None)¶
Bases:
_ods_irThe
bodyregion attached to theasync.executeoperation semantically can be executed concurrently with the successor operation. In the followup example “compute0” can be executed concurrently with “compute1”.The actual concurrency semantics depends on the dialect lowering to the executable format. Fully sequential execution (“compute0” completes before “compute1” starts) is a completely legal execution.
Because concurrent execution is not guaranteed, it is illegal to create an implicit dependency from “compute1” to “compute0” (e.g. via shared global state). All dependencies must be made explicit with async execute arguments (
async.tokenorasync.value).async.executeoperation takesasync.tokendependencies andasync.valueoperands separately, and starts execution of the attached body region only when all tokens and values become ready.Example:
%dependency = ... : !async.token %value = ... : !async.value<f32> %token, %results = async.execute [%dependency](%value as %unwrapped: !async.value<f32>) -> !async.value<!some.type> { %0 = "compute0"(%unwrapped): (f32) -> !some.type async.yield %0 : !some.type } %1 = "compute1"(...) : !some.type
In the example above asynchronous execution starts only after dependency token and value argument become ready. Unwrapped value passed to the attached body region as an %unwrapped value of f32 type.
- OPERATION_NAME = 'async.execute'¶
- _ODS_OPERAND_SEGMENTS¶
- _ODS_REGIONS = (1, True)¶
- dependencies() _ods_ir¶
- bodyOperands() _ods_ir¶
- token() _ods_ir¶
- bodyResults() _ods_ir¶
- bodyRegion() _ods_ir¶
- mlir.dialects._async_ops_gen.execute(token, body_results, dependencies, body_operands, *, loc=None, ip=None) _ods_ir | _ods_ir | ExecuteOp¶
- class mlir.dialects._async_ops_gen.FuncOp(sym_name, function_type, *, sym_visibility=None, arg_attrs=None, res_attrs=None, loc=None, ip=None)¶
Bases:
_ods_irAn async function is like a normal function, but supports non-blocking await. Internally, async function is lowered to the LLVM coroutinue with async runtime intrinsic. It can return an async token and/or async values. The token represents the execution state of async function and can be used when users want to express dependencies on some side effects, e.g., the token becomes available once every thing in the func body is executed.
Example:
// Async function can't return void, it always must be some async thing. async.func @async.0() -> !async.token { return } // Function returns only async value. async.func @async.1() -> !async.value<i32> { %0 = arith.constant 42 : i32 return %0 : i32 } // Implicit token can be added to return types. async.func @async.2() -> !async.token, !async.value<i32> { %0 = arith.constant 42 : i32 return %0 : i32 }
- OPERATION_NAME = 'async.func'¶
- _ODS_REGIONS = (1, True)¶
- sym_name() _ods_ir¶
- function_type() _ods_ir¶
- sym_visibility() _ods_ir | None¶
- arg_attrs() _ods_ir | None¶
- res_attrs() _ods_ir | None¶
- body() _ods_ir¶
- mlir.dialects._async_ops_gen.func(sym_name, function_type, *, sym_visibility=None, arg_attrs=None, res_attrs=None, loc=None, ip=None) FuncOp¶
- class mlir.dialects._async_ops_gen.ReturnOp(operands_, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.returnis a special terminator operation for Async function.Example:
async.func @foo() : !async.token { return }
- OPERATION_NAME = 'async.return'¶
- _ODS_REGIONS = (0, True)¶
- operands_() _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeAddRefOp(operand, count, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.add_refoperation adds a reference(s) to async value (token, value or group).- OPERATION_NAME = 'async.runtime.add_ref'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- count() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_add_ref(operand, count, *, loc=None, ip=None) RuntimeAddRefOp¶
- class mlir.dialects._async_ops_gen.RuntimeAddToGroupOp(operand, group, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.add_to_groupadds an async token or value to the async group. Returns the rank of the added element in the group.- OPERATION_NAME = 'async.runtime.add_to_group'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- group() _ods_ir¶
- rank() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_add_to_group(operand, group, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeAwaitAndResumeOp(operand, handle, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.await_and_resumeoperation awaits for the operand to become available or error and resumes the coroutine on a thread managed by the runtime.- OPERATION_NAME = 'async.runtime.await_and_resume'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- handle() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_await_and_resume(operand, handle, *, loc=None, ip=None) RuntimeAwaitAndResumeOp¶
- class mlir.dialects._async_ops_gen.RuntimeAwaitOp(operand, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.awaitoperation blocks the caller thread until the operand becomes available or error.- OPERATION_NAME = 'async.runtime.await'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_await(operand, *, loc=None, ip=None) RuntimeAwaitOp¶
- class mlir.dialects._async_ops_gen.RuntimeCreateGroupOp(size, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.create_groupoperation creates an async dialect group of the given size. Group created in the empty state.- OPERATION_NAME = 'async.runtime.create_group'¶
- _ODS_REGIONS = (0, True)¶
- size() _ods_ir¶
- result() _ods_ir¶
Shortcut to get an op result if it has only one (throws an error otherwise).
- mlir.dialects._async_ops_gen.runtime_create_group(size, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeCreateOp(result, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.createoperation creates an async dialect token or value. Tokens and values are created in the non-ready state.- OPERATION_NAME = 'async.runtime.create'¶
- _ODS_REGIONS = (0, True)¶
- result() _ods_ir¶
Shortcut to get an op result if it has only one (throws an error otherwise).
- mlir.dialects._async_ops_gen.runtime_create(result, *, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeDropRefOp(operand, count, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.drop_refoperation drops a reference(s) to async value (token, value or group).- OPERATION_NAME = 'async.runtime.drop_ref'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- count() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_drop_ref(operand, count, *, loc=None, ip=None) RuntimeDropRefOp¶
- class mlir.dialects._async_ops_gen.RuntimeIsErrorOp(operand, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.is_erroroperation returns true if the token, value or group (any of the async runtime values) is in the error state. It is the caller responsibility to check error state after the call toawaitor resuming afterawait_and_resume.- OPERATION_NAME = 'async.runtime.is_error'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- is_error() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_is_error(operand, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeLoadOp(storage, *, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.loadoperation loads the value from the runtime async.value storage.- OPERATION_NAME = 'async.runtime.load'¶
- _ODS_REGIONS = (0, True)¶
- storage() _ods_ir¶
- result() _ods_ir¶
Shortcut to get an op result if it has only one (throws an error otherwise).
- mlir.dialects._async_ops_gen.runtime_load(storage, *, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeNumWorkerThreadsOp(*, results=None, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.num_worker_threadsoperation gets the number of threads in the threadpool from the runtime.- OPERATION_NAME = 'async.runtime.num_worker_threads'¶
- _ODS_REGIONS = (0, True)¶
- result() _ods_ir¶
Shortcut to get an op result if it has only one (throws an error otherwise).
- mlir.dialects._async_ops_gen.runtime_num_worker_threads(*, results=None, loc=None, ip=None) _ods_ir¶
- class mlir.dialects._async_ops_gen.RuntimeResumeOp(handle, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.resumeoperation resumes the coroutine on a thread managed by the runtime.- OPERATION_NAME = 'async.runtime.resume'¶
- _ODS_REGIONS = (0, True)¶
- handle() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_resume(handle, *, loc=None, ip=None) RuntimeResumeOp¶
- class mlir.dialects._async_ops_gen.RuntimeSetAvailableOp(operand, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.set_availableoperation switches async token or value state to available.- OPERATION_NAME = 'async.runtime.set_available'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_set_available(operand, *, loc=None, ip=None) RuntimeSetAvailableOp¶
- class mlir.dialects._async_ops_gen.RuntimeSetErrorOp(operand, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.set_erroroperation switches async token or value state to error.- OPERATION_NAME = 'async.runtime.set_error'¶
- _ODS_REGIONS = (0, True)¶
- operand() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_set_error(operand, *, loc=None, ip=None) RuntimeSetErrorOp¶
- class mlir.dialects._async_ops_gen.RuntimeStoreOp(value, storage, *, loc=None, ip=None)¶
Bases:
_ods_irThe
async.runtime.storeoperation stores the value into the runtime async.value storage.- OPERATION_NAME = 'async.runtime.store'¶
- _ODS_REGIONS = (0, True)¶
- value() _ods_ir¶
- storage() _ods_ir¶
- mlir.dialects._async_ops_gen.runtime_store(value, storage, *, loc=None, ip=None) RuntimeStoreOp¶