-
Notifications
You must be signed in to change notification settings - Fork 47
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
base: main
Are you sure you want to change the base?
Conversation
stellaraccident
commented
Jan 16, 2023
•
edited by jpienaar
Loading
edited by jpienaar
- 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.
cd28a70
to
e2212a6
Compare
/*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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 = { |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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.
// IREE_RETURN_IF_ERROR(iree_hal_fence_create_at(transfer_timeline_.get(), 0, | ||
// client_.host_allocator(), | ||
// &transfer_now_fence_)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// IREE_RETURN_IF_ERROR(iree_hal_fence_create_at(transfer_timeline_.get(), 0, | |
// client_.host_allocator(), | |
// &transfer_now_fence_)); |