iree/hal/local/task_queue.c
// Allocates and initializes a iree_hal_task_queue_retire_cmd_t task.
// The command will own an arena that can be used for other submission-related
// allocations.
Allocates and initializes a iree_hal_task_queue_retire_cmd_t task.
The command will own an arena that can be used for other submission-related
allocations.
Allocates and initializes a iree_hal_task_queue_retire_cmd_t task . The command will own an arena that can be used for other submission - related allocations .
static iree_status_t iree_hal_task_queue_retire_cmd_allocate(
    iree_task_scope_t* scope,
    const iree_hal_semaphore_list_t* signal_semaphores,
    iree_arena_block_pool_t* block_pool,
    iree_hal_task_queue_retire_cmd_t** out_cmd) {
  iree_arena_allocator_t arena;
  iree_arena_initialize(block_pool, &arena);
  iree_hal_task_queue_retire_cmd_t* cmd = NULL;
  iree_status_t status =
      iree_arena_allocate(&arena, sizeof(*cmd), (void**)&cmd);
  if (iree_status_is_ok(status)) {
    iree_task_call_initialize(
        scope, iree_task_make_call_closure(iree_hal_task_queue_retire_cmd, 0),
        &cmd->task);
    iree_task_set_cleanup_fn(&cmd->task.header,
                             iree_hal_task_queue_retire_cmd_cleanup);
  }
  if (iree_status_is_ok(status)) {
    status = iree_hal_semaphore_list_clone(signal_semaphores, &arena,
                                           &cmd->signal_semaphores);
  }
  if (iree_status_is_ok(status)) {
    memcpy(&cmd->arena, &arena, sizeof(cmd->arena));
    *out_cmd = cmd;
  } else {
    iree_arena_deinitialize(&arena);
  }
  return status;
}
static iree_status_t iree_hal_task_queue_retire_cmd_allocate ( iree_task_scope_t * scope , const iree_hal_semaphore_list_t * signal_semaphores , iree_arena_block_pool_t * block_pool , iree_hal_task_queue_retire_cmd_t * * out_cmd ) { iree_arena_allocator_t arena ; iree_arena_initialize ( block_pool , & arena ) ; iree_hal_task_queue_retire_cmd_t * cmd = NULL ; iree_status_t status = iree_arena_allocate ( & arena , sizeof ( * cmd ) , ( void * * ) & cmd ) ; if ( iree_status_is_ok ( status ) ) { iree_task_call_initialize ( scope , iree_task_make_call_closure ( iree_hal_task_queue_retire_cmd , 0 ) , & cmd -> task ) ; iree_task_set_cleanup_fn ( & cmd -> task . header , iree_hal_task_queue_retire_cmd_cleanup ) ; } if ( iree_status_is_ok ( status ) ) { status = iree_hal_semaphore_list_clone ( signal_semaphores , & arena , & cmd -> signal_semaphores ) ; } if ( iree_status_is_ok ( status ) ) { memcpy ( & cmd -> arena , & arena , sizeof ( cmd -> arena ) ) ; * out_cmd = cmd ; } else { iree_arena_deinitialize ( & arena ) ; } return status ; }
Allocates and initializes a iree_hal_task_queue_retire_cmd_t task.
Allocates and initializes a iree_hal_task_queue_retire_cmd_t task .
// Make an arena we'll use for allocating the command itself. // Allocate the command from the arena. // Clone the signal semaphores from the batch - we retain them and their // payloads. // Transfer ownership of the arena to command.