Skip to content

Commit

Permalink
#2063: Update void* to std::byte* in Payload Envelope
Browse files Browse the repository at this point in the history
  • Loading branch information
thearusable committed Mar 14, 2024
1 parent 919688d commit 2a8ffcd
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/vt/group/msg/group_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ struct GroupListMsg : GroupInfoMsg<GroupMsg<::vt::PayloadMessage>> {
)
{
setPut(
in_range->getBound(),
reinterpret_cast<const std::byte*>(in_range->getBound()),
in_range->getSize() * sizeof(RangeType::BoundType)
);
}

RangeType getRange() {
auto const& ptr = static_cast<RangeType::BoundType*>(getPut());
auto const& ptr = reinterpret_cast<RangeType::BoundType*>(getPut());
return region::ShallowList(ptr, getCount());
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/vt/messaging/active.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ void ActiveMessenger::finishPendingActiveMsgAsyncRecv(InProgressIRecv* irecv) {
);
}

envelopeSetPutPtrOnly(msg->env, put_ptr);
envelopeSetPutPtrOnly(msg->env, reinterpret_cast<std::byte*>(put_ptr));
put_finished = true;
} else {
/*bool const put_delivered = */recvDataMsg(
Expand Down
6 changes: 3 additions & 3 deletions src/vt/messaging/envelope/payload_envelope.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ namespace vt {

/** \file */

using PutPtrType = void*;
using PutPtrConstType = void const*;
using PutPtrType = std::byte*;
using PutPtrConstType = std::byte const*;
using PutEnvSizeType = size_t;
using PutUnderEnvelopeT = EpochTagEnvelope;

Expand All @@ -64,7 +64,7 @@ using PutUnderEnvelopeT = EpochTagEnvelope;
template <typename EnvelopeT, typename SizeT>
struct PutEnvelope {
using isByteCopyable = std::true_type;
using PtrType = void*;
using PtrType = std::byte*;
using EnvSizeType = SizeT;
using UnderEnvelopeT = EnvelopeT;

Expand Down
4 changes: 2 additions & 2 deletions src/vt/messaging/message/put_message.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ namespace vt { namespace messaging {

template <typename MessageT>
struct PutMessageComponent : MessageT {
void setPut(void const* const ptr, size_t const size) {
void setPut(std::byte const* const ptr, size_t const size) {
envelopeSetPutPtr(MessageT::env, ptr, size);
}
void* getPut() {
std::byte* getPut() {
return envelopeGetPutPtr(MessageT::env);
}
size_t getPutSize() {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/active/test_active_bcast_put.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct TestActiveBroadcastPut : TestParameterHarnessNode {
fmt::print("{}: test_handler: cnt={}\n", this_node, handler_count);
#endif

auto const ptr = static_cast<int*>(msg->getPut());
auto const ptr = reinterpret_cast<int*>(msg->getPut());
auto const size = msg->getPutSize();

#if DEBUG_TEST_HARNESS_PRINT || 1
Expand Down Expand Up @@ -126,7 +126,7 @@ TEST_P(TestActiveBroadcastPut, test_type_safe_active_fn_bcast2) {
if (my_node == root) {
for (int i = 0; i < num_msg_sent; i++) {
auto msg = makeMessage<PutTestMessage>();
msg->setPut(put_payload.data(), put_size * sizeof(int));
msg->setPut(reinterpret_cast<std::byte*>(put_payload.data()), put_size * sizeof(int));
theMsg()->broadcastMsg<test_handler>(msg);
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/active/test_active_send.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ struct TestActiveSend : TestParallelHarness {
}

static void test_handler_small_put(PutTestMessage* msg) {
auto ptr = static_cast<int*>(msg->getPut());
auto ptr = reinterpret_cast<int*>(msg->getPut());
auto size = msg->getPutSize();
#if DEBUG_TEST_HARNESS_PRINT
auto const& this_node = theContext()->getNode();
Expand All @@ -109,7 +109,7 @@ struct TestActiveSend : TestParallelHarness {
}

static void test_handler_large_put(PutTestMessage* msg) {
auto ptr = static_cast<int*>(msg->getPut());
auto ptr = reinterpret_cast<int*>(msg->getPut());
auto size = msg->getPutSize();
#if DEBUG_TEST_HARNESS_PRINT
auto const& this_node = theContext()->getNode();
Expand Down Expand Up @@ -190,7 +190,7 @@ TEST_F(TestActiveSend, test_type_safe_active_fn_send_small_put) {
if (my_node == from_node) {
for (int i = 0; i < num_msg_sent; i++) {
auto msg = makeMessage<PutTestMessage>();
msg->setPut(test_vec.data(), sizeof(int)*test_vec.size());
msg->setPut(reinterpret_cast<std::byte*>(test_vec.data()), sizeof(int)*test_vec.size());
#if DEBUG_TEST_HARNESS_PRINT
fmt::print("{}: sendMsg: (put) i={}\n", my_node, i);
#endif
Expand All @@ -215,7 +215,7 @@ TEST_F(TestActiveSend, test_type_safe_active_fn_send_large_put) {
if (my_node == from_node) {
for (int i = 0; i < num_msg_sent; i++) {
auto msg = makeMessage<PutTestMessage>();
msg->setPut(test_vec_2.data(), sizeof(int)*test_vec_2.size());
msg->setPut(reinterpret_cast<std::byte*>(test_vec_2.data()), sizeof(int)*test_vec_2.size());
#if DEBUG_TEST_HARNESS_PRINT
fmt::print("{}: sendMsg: (put) i={}\n", my_node, i);
#endif
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/active/test_active_send_put.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct TestActiveSendPut : TestParameterHarnessNode {
}

static void test_handler(PutTestMessage* msg) {
auto ptr = static_cast<int*>(msg->getPut());
auto ptr = reinterpret_cast<int*>(msg->getPut());
auto size = msg->getPutSize();
#if DEBUG_TEST_HARNESS_PRINT
auto const& this_node = theContext()->getNode();
Expand Down Expand Up @@ -109,7 +109,7 @@ TEST_P(TestActiveSendPut, test_active_fn_send_put_param) {
auto msg = makeMessage<PutTestMessage>(
static_cast<int>(test_vec_2.size())
);
msg->setPut(test_vec_2.data(), sizeof(int)*test_vec_2.size());
msg->setPut(reinterpret_cast<std::byte*>(test_vec_2.data()), sizeof(int)*test_vec_2.size());
#if DEBUG_TEST_HARNESS_PRINT
fmt::print("{}: sendMsg: (put) i={}\n", my_node, i);
#endif
Expand Down

0 comments on commit 2a8ffcd

Please sign in to comment.