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

[ESI][Runtime] Poll method and optional service thread polling #7460

Merged
merged 2 commits into from
Aug 8, 2024

Conversation

teqdruid
Copy link
Contributor

@teqdruid teqdruid commented Aug 7, 2024

Add a poll method to ports, a master poll method to the Accelerator, and the ability to poll from the service thread. Also, only spin up the service thread if it's requested.

The service thread polling (in particular) required some ownership changes: Accelerator objects now belong to the AcceleratorConnection so that the ports aren't destructed before the service thread gets shutdown (which causes an invalid memory access). This particular binding isn't ideal, is brittle, and will be an issue for anything doing the polling. Resolving #7457 should mitigate this issue.

Backends are now required to call disconnect in their destructor.

@teqdruid teqdruid added the ESI label Aug 7, 2024
@teqdruid teqdruid requested a review from mortbopet August 7, 2024 16:05
lib/Dialect/ESI/runtime/cpp/include/esi/Ports.h Outdated Show resolved Hide resolved
const Type *type;

/// Method called by poll() to actually poll the channel if the channel is
/// connected.
virtual bool pollImpl() { return false; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't a user get some kind of feedback if they called this on something which they expected to have a poll implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Feedback of what sort? Whether or not one has to run this function is very much backend dependent so I don't want like an exception being thrown if a user calls it on a backend which doesn't need it.

Add a poll method to ports, a master poll method to the Accelerator, and
the ability to poll from the service thread. Also, only spin up the
service thread if it's requested.

The service thread polling (in particular) required some ownership
changes: Accelerator objects now belong to the AcceleratorConnection so
that the ports aren't destructed before the service thread gets shutdown
(which causes an invalid memory access). This particular binding isn't
ideal, is brittle, and will be an issue for anything doing the polling.
Resolving #7457 should mitigate this issue.

Backends are now _required_ to call `disconnect` in their destructor.
@teqdruid teqdruid merged commit ad91378 into main Aug 8, 2024
2 checks passed
@teqdruid teqdruid deleted the teqdruid/esirt-poll branch August 8, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants