summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2019-09-06 19:21:59 +0000
committerLang Hames <lhames@gmail.com>2019-09-06 19:21:59 +0000
commitc1105111b39384b959edee9c91ae543d57a5a795 (patch)
tree86f75e254baa5aef8f9ddfbaba349ff0098f1700 /llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
parent335676ee62167c021c17b90489b49c1015116556 (diff)
downloadbcm5719-llvm-c1105111b39384b959edee9c91ae543d57a5a795.tar.gz
bcm5719-llvm-c1105111b39384b959edee9c91ae543d57a5a795.zip
[ORC] Make sure RPC channel-send is called in blocking calls and responses.
ORC-RPC batches calls by default, and the channel's send method must be called to transfer any buffered calls to the remote. The call to send was missing on responses and blocking calls in the SingleThreadedRPCEndpoint. This patch adds the necessary calls and modifies the RPC unit test to check for them. llvm-svn: 371245
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/QueueChannel.h')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/QueueChannel.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h b/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
index 511f038dec1..1909693ecb1 100644
--- a/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
+++ b/llvm/unittests/ExecutionEngine/Orc/QueueChannel.h
@@ -80,6 +80,30 @@ public:
QueueChannel(QueueChannel&&) = delete;
QueueChannel& operator=(QueueChannel&&) = delete;
+ template <typename FunctionIdT, typename SequenceIdT>
+ Error startSendMessage(const FunctionIdT &FnId, const SequenceIdT &SeqNo) {
+ ++InFlightOutgoingMessages;
+ return orc::rpc::RawByteChannel::startSendMessage(FnId, SeqNo);
+ }
+
+ Error endSendMessage() {
+ --InFlightOutgoingMessages;
+ ++CompletedOutgoingMessages;
+ return orc::rpc::RawByteChannel::endSendMessage();
+ }
+
+ template <typename FunctionIdT, typename SequenceNumberT>
+ Error startReceiveMessage(FunctionIdT &FnId, SequenceNumberT &SeqNo) {
+ ++InFlightIncomingMessages;
+ return orc::rpc::RawByteChannel::startReceiveMessage(FnId, SeqNo);
+ }
+
+ Error endReceiveMessage() {
+ --InFlightIncomingMessages;
+ ++CompletedIncomingMessages;
+ return orc::rpc::RawByteChannel::endReceiveMessage();
+ }
+
Error readBytes(char *Dst, unsigned Size) override {
std::unique_lock<std::mutex> Lock(InQueue->getMutex());
while (Size) {
@@ -112,7 +136,10 @@ public:
return Error::success();
}
- Error send() override { return Error::success(); }
+ Error send() override {
+ ++SendCalls;
+ return Error::success();
+ }
void close() {
auto ChannelClosed = []() { return make_error<QueueChannelClosedError>(); };
@@ -124,6 +151,11 @@ public:
uint64_t NumWritten = 0;
uint64_t NumRead = 0;
+ std::atomic<size_t> InFlightIncomingMessages{0};
+ std::atomic<size_t> CompletedIncomingMessages{0};
+ std::atomic<size_t> InFlightOutgoingMessages{0};
+ std::atomic<size_t> CompletedOutgoingMessages{0};
+ std::atomic<size_t> SendCalls{0};
private:
OpenPOWER on IntegriCloud