Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of async execution. #91

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stellaraccident
Copy link
Collaborator

@stellaraccident stellaraccident commented Jan 16, 2023

  • Only implements async execution and async d2h.
  • Need to come up with a better way to bridge async completion signals to EventInstance::OnReady callback.
  • There is room here for more of a scheduler that has some knowledge of the transfer and execution timeline. Will be needed when joining h2d transfer timelines.

* Only implements async execution and asynd d2h.
* Need to come up with a better way to bridge async completion signals to EventInstance::OnReady callback.
* There is room here for more of a scheduler that has some knowledge of the transfer and execution timeline. Will be needed when joining h2d transfer timelines.
/*wait_semaphore_list=*/iree_hal_fence_semaphore_list(done_fence()),
/*signal_semaphore_list=*/iree_hal_semaphore_list_empty(),
iree_hal_buffer_view_buffer(buffer_view_.get()));
return iree_ok_status();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return iree_ok_status();

// Import the destination (host) buffer as an iree_hal_buffer_t so that we
// can issue copy commands.
iree::vm::ref<iree_hal_buffer_t> dst_buffer;
iree_hal_buffer_params_t dst_buffer_params = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll want to set the type to IREE_HAL_MEMORY_TYPE_HOST_LOCAL | IREE_HAL_MEMORY_TYPE_DEVICE_VISIBLE

IREE_RETURN_IF_ERROR(iree_hal_device_queue_execute(
device_.device(), IREE_HAL_QUEUE_AFFINITY_ANY,
/*wait_semaphore_list=*/iree_hal_fence_semaphore_list(ready_fence_.get()),
/*signal_semaphore_list=*/iree_hal_semaphore_list_empty(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RE comment above: you'll want a signal fence for this so when it's implemented you'll be able to hook on to that to get your event signal callback (or ideally if it's a standard event type like an fd/HANDLE import it so we can signal it directly from the GPU). You'll at least need the signal so that you ensure you don't schedule more work while this copy is outstanding: you need to make sure nothing is able to mutate the device buffer.

Comment on lines +603 to +605
// IREE_RETURN_IF_ERROR(iree_hal_fence_create_at(transfer_timeline_.get(), 0,
// client_.host_allocator(),
// &transfer_now_fence_));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// IREE_RETURN_IF_ERROR(iree_hal_fence_create_at(transfer_timeline_.get(), 0,
// client_.host_allocator(),
// &transfer_now_fence_));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants