-
Notifications
You must be signed in to change notification settings - Fork 299
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] Read ports now invoke callbacks #7186
Conversation
354970d
to
2e8fac3
Compare
2e8fac3
to
f1d632e
Compare
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.
AFAICT this solves the multiple-readers problem, but doesn't solve the function service call problem.
The following code still does not guarantee that calls to a function is ordered wrt. the order of which the argument port was called
circt/lib/Dialect/ESI/runtime/cpp/lib/Services.cpp
Lines 118 to 119 in 18d2872
arg.write(argData); | |
return result.readAsync(); |
I.e. the following interleaving of two calls C1 and C2 is possible
C1 arg.write
C2 arg.write
C2 result.readAsync
C1 result.readAsync
So there must be a lock added to FuncService::Function::call
to ensure that readAsync
is always called for function call n
before function call n+1
occurs.
@mortbopet: if you're not blocked on this, I'm actually gonna finish the gRPC conversion first so that I don't have to screw around with the capnp backend to adapt it to the changes we discussed. |
f1d632e
to
284f792
Compare
284f792
to
4bacb31
Compare
We've switched from a polling 'pull' method to a callback-based 'push' mechanism for read ports. Polling (via std::futures) is built on top of the push mechanism. The read-ordering problem has also been fixed by using std::futures exclusively for polling schemes. They also allow for poll-wait-notify schemes without any chances on our part.
4bacb31
to
a975939
Compare
I think switching to callbacks made things more elegant. |
ReadChannelPort(const Type *type) : ChannelPort(type) {} | ||
virtual void disconnect() override { mode = Mode::Disconnected; } |
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.
With these split modes, and different modes having different member variables associated with them, i'd personally split those into two separate ReadChannelPort
-derived classes to avoid any confusion/misuse/leak between the two API modes.
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 is something I considered. The problem is that these channel ports are constructed when the system gets built from the manifest, not when the user locates them. So the user doesn't have the chance to specify the type before getting the reference to them.
We've switched from a polling 'pull' method to a callback-based 'push' mechanism for read ports. Polling (via std::futures) is built on top of the push mechanism. The read-ordering problem has also been fixed by using std::futures exclusively for polling schemes. They also allow for poll-wait-notify schemes without any changes on our part.
We've switched from a polling 'pull' method to a callback-based 'push'
mechanism for read ports. Polling (via std::futures) is built on top of
the push mechanism.
The read-ordering problem has also been fixed by using std::futures
exclusively for polling schemes. They also allow for poll-wait-notify
schemes without any changes on our part.