Skip to content

Commit

Permalink
Revert response sender changes
Browse files Browse the repository at this point in the history
  • Loading branch information
krishung5 committed Nov 8, 2023
1 parent 3246685 commit 543187c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/infer_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ InferRequest::InferRequest(
#ifdef TRITON_PB_STUB
pb_cancel_ =
std::make_shared<PbCancel>(response_factory_address_, request_address_);
response_sender_ = Stub::GetOrCreateInstance()->GetResponseSender(
response_sender_ = std::make_shared<ResponseSender>(
request_address_, response_factory_address_,
Stub::GetOrCreateInstance()->SharedMemory(), pb_cancel_);
#endif
Expand Down Expand Up @@ -399,7 +399,7 @@ InferRequest::InferRequest(
#ifdef TRITON_PB_STUB
pb_cancel_ =
std::make_shared<PbCancel>(response_factory_address_, request_address_);
response_sender_ = Stub::GetOrCreateInstance()->GetResponseSender(
response_sender_ = std::make_shared<ResponseSender>(
request_address_, response_factory_address_,
Stub::GetOrCreateInstance()->SharedMemory(), pb_cancel_);
#endif
Expand Down
20 changes: 0 additions & 20 deletions src/pb_stub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1386,26 +1386,6 @@ Stub::ProcessBLSResponseDecoupled(std::unique_ptr<IPCMessage>& ipc_message)
}
}

std::shared_ptr<ResponseSender>
Stub::GetResponseSender(
intptr_t request_address, intptr_t response_factory_address,
std::unique_ptr<SharedMemoryManager>& shm_pool,
const std::shared_ptr<PbCancel>& pb_cancel)
{
std::lock_guard<std::mutex> lock(response_sender_map_mu_);
if (response_sender_map_.find(request_address) !=
response_sender_map_.end()) {
return response_sender_map_[request_address];
} else {
auto response_sender = std::make_shared<ResponseSender>(
request_address, response_factory_address, shm_pool, pb_cancel);
response_sender_map_.insert(
std::pair<intptr_t, std::shared_ptr<ResponseSender>>(
request_address, response_sender));
return response_sender;
}
}

std::unique_ptr<Logger> Logger::log_instance_;

std::unique_ptr<Logger>&
Expand Down
10 changes: 0 additions & 10 deletions src/pb_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,13 +357,6 @@ class Stub {
/// Get the CUDA memory pool address from the parent process.
void GetCUDAMemoryPoolAddress(std::unique_ptr<IPCMessage>& ipc_message);

/// Get the response sender associated with the request, or create a new one
/// if it does not exist in the map.
std::shared_ptr<ResponseSender> GetResponseSender(
intptr_t request_address, intptr_t response_factory_address,
std::unique_ptr<SharedMemoryManager>& shm_pool,
const std::shared_ptr<PbCancel>& pb_cancel);

private:
bi::interprocess_mutex* stub_mutex_;
bi::interprocess_condition* stub_cond_;
Expand Down Expand Up @@ -402,9 +395,6 @@ class Stub {
response_iterator_map_;
std::mutex dlpack_proxy_stream_pool_mu_;
std::unordered_map<int, cudaStream_t> dlpack_proxy_stream_pool_;
std::mutex response_sender_map_mu_;
std::unordered_map<intptr_t, std::shared_ptr<ResponseSender>>
response_sender_map_;
};

template <typename MessageType>
Expand Down

0 comments on commit 543187c

Please sign in to comment.