-
Notifications
You must be signed in to change notification settings - Fork 37
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
Implement Async IO Select Hostcalls #188
Conversation
I've used this to run the tests for the JS SDK which use the async_io module and everything looks to be working correctly 🙌 -- fastly/js-compute-runtime#293 |
daae9ef
to
9731ae9
Compare
I finally fixed up the PR to work for all items again and the tests should be passing and with it working on the JS SDK side I'm reasonably confident the code works as intended. |
lib/src/wiggle_abi/async_io_impl.rs
Outdated
@@ -0,0 +1 @@ | |||
|
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.
Looks like an empty file, should be removed.
.await? as u32; | ||
|
||
let item = | ||
self.take_async_item(pending_req_handles.get(done_index).unwrap().read()?.into())?; |
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.
self.take_async_item(pending_req_handles.get(done_index).unwrap().read()?.into())?; | |
self.take_async_item(pending_req_handles[done_index].read()?.into())?; |
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.
I thought this would work but turns out pending_req_handles
is a &GuestPtr<[PendingReqHandle]> and we can't index directly. I tried out some other things but they were either longer or even more complex for little gain and so I think we need to just keep this unfortunately @aturon
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.
Ah ok, no worries!
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.
Looks great!
However, there aren't tests of the new async_io functionality. We should be able to re-use the C@E tests directly here, so it should be easy to add. While the existing tests give coverage of select over pending requests, I think it's important to have fuller of the new API.
Update for todays work: I'm still working on it. The C@E tests have some functionality around handling when to accept requests as well as synchronizing that's a bit hard to replicate. I've got something started, but it's slow going for now. Hopefully I'll have something by tomorrow as I don't expect to get it done in the next hour before I clock out today. |
3421a53
to
9fa9420
Compare
Figured it all out! Squashed all my WIP commits to make the history cleaner! |
And updated the code to remove uneeded printlns and make sure we reinsert items using a Drop guard |
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.
AWESOME WORK! 🎉
Thank you for seeing this through, it'll be great to get it merged.
AWESOME WORK! 🎉 Thank you for seeing this through, it'll be great to get it merged. |
dcf6737
to
2ec56d1
Compare
This commit adds the fastly_async_io hostcalls `select` and `is_ready` to Viceroy. Up to this point we only would do `select` for things like `PendingRequest`. Now we abstract over an `AsyncItem` which could be a `PendingRequest`, `StreamingBody`, or `Body` and you can call `select` over any of these async io operations. Most of this code is to accomodate these changes while maintaining the behavior of `select` for `PendingRequest` utilizing these new calls and creating the `AsyncItem` enum to hold all of these differing types in the same `async_item` map. We also add an integration test similar to the C@E platform's to make sure that we implement the behavior correctly. With this we can be confident that select works the way we intend it too! As a bonus side effect of these changes we also add async support for hosts in our testing code in Viceroy which gives us some more flexibility in what we can accomplish or use!
8dc2c95
to
3c9e62b
Compare
This change refines the comment on why we've cfged out a test on windows with a link to the issue tracker for those curious as to why this is the case. Co-authored-by: Aaron Turon <[email protected]>
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.
🎉 💯
This commit adds the fastly_async_io hostcalls
select
andis_ready
to Viceroy. Up to this point we only would do
select
for things likePendingRequest
. Now we abstract over anAsyncItem
which could be aPendingRequest
,StreamingBody
, orBody
and you can callselect
over any of these async io operations. Most of this code is to
accomodate these changes while maintaining the behavior of
select
forPendingRequest
utilizing these new calls and creating theAsyncItem
enum to hold all of these differing types in the same
async_item
map.We also add an integration test similar to the C@E platform's to make
sure that we implement the behavior correctly. With this we can be
confident that select works the way we intend it too! As a bonus side
effect of these changes we also add async support for hosts in our
testing code in Viceroy which gives us some more flexibility in what we
can accomplish or use!