@@ -93,7 +93,7 @@ namespace hpx::parcelset::policies::gasnet {
9393 // progress (one io_service driver per arena plus any HPX thread that runs
9494 // the background-works callback), the arena scan may read a source's
9595 // consumed mirror while the thread delivering that source's pages writes
96- // it. Relaxed ordering suffices — they are local-only watermarks used to
96+ // it. Relaxed ordering suffices, they are local-only watermarks used to
9797 // derive slot indices and to decide "published vs consumed".
9898 //
9999 // One MTU-sized page == one chunk (message_header + payload), matching
@@ -129,7 +129,7 @@ namespace hpx::parcelset::policies::gasnet {
129129 // CRC32, table-driven, over the payload bytes only. The header
130130 // fields are validated structurally (exact geometry) and by
131131 // message-id/sequence cross-checks, so the checksum does not need
132- // to cover the header itself — which keeps the sender and receiver
132+ // to cover the header itself, which keeps the sender and receiver
133133 // able to recompute it over a single contiguous byte range (the
134134 // transferred payload region).
135135 //
@@ -192,8 +192,8 @@ namespace hpx::parcelset::policies::gasnet {
192192 // below gives bit-identical results to the instruction path).
193193 template <bool Hw, typename Step>
194194 inline std::uint32_t crc_pages_impl (unsigned char const * data,
195- std::size_t size, Step step, std:: uint32_t (*byte_step)(
196- std::uint32_t , unsigned char ))
195+ std::size_t size, Step step,
196+ std::uint32_t (*byte_step)( std::uint32_t , unsigned char ))
197197 {
198198 std::uint32_t a = 0xFFFFFFFFu , b = 0xFFFFFFFFu , c = 0xFFFFFFFFu ;
199199 while (size >= 24 )
@@ -294,7 +294,8 @@ namespace hpx::parcelset::policies::gasnet {
294294 return page_checksum_sw (data, size);
295295 }
296296
297- inline std::uint64_t message_total_size (message_header const & h) noexcept
297+ inline std::uint64_t message_total_size (
298+ message_header const & h) noexcept
298299 {
299300 return (std::uint64_t (h.total_size_high ) << 32 ) | h.total_size_low ;
300301 }
@@ -346,9 +347,8 @@ namespace hpx::parcelset::policies::gasnet {
346347 if (offset > total_size)
347348 return false ;
348349
349- if (chunk_size_for (
350- h.chunk_index , h.num_chunks , total_size, payload_size) >
351- payload_size)
350+ if (chunk_size_for (h.chunk_index , h.num_chunks , total_size,
351+ payload_size) > payload_size)
352352 return false ;
353353
354354 std::uint64_t const expected_chunks =
@@ -379,8 +379,8 @@ namespace hpx::parcelset::policies::gasnet {
379379 chunk_size = chunk_size_for (header.chunk_index , header.num_chunks ,
380380 total_size, payload_size);
381381
382- return !use_checksum || header. checksum ==
383- crc32 (page + header_size, chunk_size);
382+ return !use_checksum ||
383+ header. checksum == crc32 (page + header_size, chunk_size);
384384 }
385385
386386 // Set by parcelport::do_stop(): by then the HPX scheduler and AGAS are
@@ -424,8 +424,9 @@ namespace hpx::parcelset::policies::gasnet {
424424 //
425425 // 2 * npes * slots * mtu + 2 * npes^2 * 4 + npes * 4 bytes
426426 //
427- // With the defaults (slots=8, mtu=64 KiB, the smallest automatic value) the footprint is ~1 MiB per
428- // added PE, so a 1024-PE run occupies ~1 GiB of registered memory.
427+ // With the defaults (slots=8, mtu=64 KiB, the smallest automatic
428+ // value) the footprint is ~1 MiB per added PE, so a 1024-PE run
429+ // occupies ~1 GiB of registered memory.
429430 // The constructor asserts the carve fits the segment attached in
430431 // hpx::util::gasnet_environment::init().
431432 static constexpr std::size_t symmetric_bytes (
@@ -437,8 +438,8 @@ namespace hpx::parcelset::policies::gasnet {
437438
438439 mailbox_array () = default ;
439440
440- mailbox_array (std::size_t num_pes, std::size_t my_pe,
441- std::size_t mtu, std:: size_t slots_per_dst, bool checksum = true ,
441+ mailbox_array (std::size_t num_pes, std::size_t my_pe, std:: size_t mtu,
442+ std::size_t slots_per_dst, bool checksum = true ,
442443 std::size_t probe_window = default_probe_window)
443444 : num_pes_(num_pes)
444445 , my_pe_(my_pe)
@@ -475,12 +476,13 @@ namespace hpx::parcelset::policies::gasnet {
475476 " gasnet::mailbox_array::mailbox_array" ,
476477 " mailbox carve of " + std::to_string (bytes) +
477478 " bytes does not fit the registered segment (" +
478- std::to_string (hpx::util::gasnet_environment::segment_size ()) +
479+ std::to_string (
480+ hpx::util::gasnet_environment::segment_size ()) +
479481 " bytes) on PE " + std::to_string (my_pe_));
480482 }
481483
482- unsigned char * base =
483- static_cast < unsigned char *>( hpx::util::gasnet_environment::segment_addr ());
484+ unsigned char * base = static_cast < unsigned char *>(
485+ hpx::util::gasnet_environment::segment_addr ());
484486 base_ = base;
485487 carved_bytes_ = bytes;
486488
@@ -723,12 +725,12 @@ namespace hpx::parcelset::policies::gasnet {
723725 // Each probe is a single local relaxed load of src's produced counter
724726 // (produced_beg_[src*npes+my_pe]): GASNet RDMA leaves the sender's
725727 // put of the data page *and* that counter directly in our registered
726- // segment, so no remote read is needed to "pull" delivery — the bytes
728+ // segment, so no remote read is needed to "pull" delivery, the bytes
727729 // are already visible. This is the GASNet counterpart of the
728730 // openshmem code's shmem_uint32_atomic_fetch ping-pong, and it costs
729731 // zero remote round-trips.
730- int try_detect_pe_notification (std:: size_t arena_idx = 0 ,
731- std::size_t arena_cnt = 0 ) const noexcept
732+ int try_detect_pe_notification (
733+ std::size_t arena_idx = 0 , std:: size_t arena_cnt = 0 ) const noexcept
732734 {
733735 if (arena_cnt == 0 )
734736 {
@@ -743,9 +745,8 @@ namespace hpx::parcelset::policies::gasnet {
743745 return -1 ;
744746 }
745747
746- std::size_t const window = probe_window_ == 0 ?
747- width :
748- (std::min)(width, probe_window_);
748+ std::size_t const window =
749+ probe_window_ == 0 ? width : (std::min) (width, probe_window_);
749750
750751 // Rotate the scan start point so no single (lowest-index) ready
751752 // source can hog this arena. A fixed low-to-high scan always
@@ -757,9 +758,8 @@ namespace hpx::parcelset::policies::gasnet {
757758 // ready source is probed within 'width' consecutive calls.
758759 std::size_t const slot =
759760 arena_idx < num_pes_ ? arena_idx : num_pes_ - 1 ;
760- std::size_t start =
761- lo + (scan_rotate_[slot].fetch_add (1 ,
762- std::memory_order_relaxed) %
761+ std::size_t start = lo +
762+ (scan_rotate_[slot].fetch_add (1 , std::memory_order_relaxed) %
763763 width);
764764
765765 for (std::size_t k = 0 ; k < window; ++k)
@@ -780,8 +780,7 @@ namespace hpx::parcelset::policies::gasnet {
780780 // data memcpy precedes a release fence), and the acquire
781781 // then orders our downstream reads of the landing page.
782782 std::uint32_t const produced =
783- std::atomic_ref<std::uint32_t >(
784- produced_beg_[w])
783+ std::atomic_ref<std::uint32_t >(produced_beg_[w])
785784 .load (std::memory_order_acquire);
786785 std::uint32_t const consumed =
787786 consumed_locals_[src].load (std::memory_order_relaxed);
@@ -907,8 +906,8 @@ namespace hpx::parcelset::policies::gasnet {
907906 note_send_stall (dst_pe);
908907 return 0 ;
909908 }
910- return (std::min)(
911- slots_per_dst_ - static_cast <std::size_t >(in_flight),
909+ return (
910+ std::min) ( slots_per_dst_ - static_cast <std::size_t >(in_flight),
912911 max_batch);
913912 }
914913
@@ -940,7 +939,8 @@ namespace hpx::parcelset::policies::gasnet {
940939 for (std::size_t k = 0 ; k < n; ++k)
941940 {
942941 std::size_t const slot = (produced + k) % slots_per_dst_;
943- std::memcpy (rx_beg_ + (my_pe_ * slots_per_dst_ + slot) * mtu_,
942+ std::memcpy (
943+ rx_beg_ + (my_pe_ * slots_per_dst_ + slot) * mtu_,
944944 tx_page_at (dst_pe, k), counts[k]);
945945 }
946946 std::atomic_ref<std::uint32_t >(produced_beg_[w])
@@ -1016,8 +1016,7 @@ namespace hpx::parcelset::policies::gasnet {
10161016 // credit put's visibility (remote path): once we observe the
10171017 // page published, the landing-page bytes are safe to memcpy.
10181018 std::uint32_t produced =
1019- std::atomic_ref<std::uint32_t >(
1020- produced_beg_[w])
1019+ std::atomic_ref<std::uint32_t >(produced_beg_[w])
10211020 .load (std::memory_order_acquire);
10221021 // Modular (wrap-safe) comparison, symmetric with send_batch(): the
10231022 // in-flight page count is (produced - consumed) mod 2^32 and is
@@ -1072,10 +1071,9 @@ namespace hpx::parcelset::policies::gasnet {
10721071 // receive reservation, since draining is what advances 'consumed'.
10731072 bool page_ready (std::size_t const src) const noexcept
10741073 {
1075- std::uint32_t const produced =
1076- std::atomic_ref<std::uint32_t >(
1077- produced_beg_[src * num_pes_ + my_pe_])
1078- .load (std::memory_order_acquire);
1074+ std::uint32_t const produced = std::atomic_ref<std::uint32_t >(
1075+ produced_beg_[src * num_pes_ + my_pe_])
1076+ .load (std::memory_order_acquire);
10791077 std::uint32_t const consumed =
10801078 consumed_locals_[src].load (std::memory_order_relaxed);
10811079 return produced != consumed;
@@ -1205,7 +1203,8 @@ namespace hpx::parcelset::policies::gasnet {
12051203 // that the chunks it collects all belong to one message.
12061204 std::uint64_t next_message_id () noexcept
12071205 {
1208- return message_sequence_.fetch_add (1 , std::memory_order_relaxed) + 1 ;
1206+ return message_sequence_.fetch_add (1 , std::memory_order_relaxed) +
1207+ 1 ;
12091208 }
12101209
12111210 private:
@@ -1222,7 +1221,8 @@ namespace hpx::parcelset::policies::gasnet {
12221221 std::fprintf (stderr,
12231222 " gasnet::mailbox_array: PE %zu has had %llu back-pressure "
12241223 " polls (window full or NB region in flight) to PE %zu\n " ,
1225- my_pe_, static_cast <unsigned long long >(stall_warn_interval),
1224+ my_pe_,
1225+ static_cast <unsigned long long >(stall_warn_interval),
12261226 dst_pe);
12271227 }
12281228 }
@@ -1235,7 +1235,8 @@ namespace hpx::parcelset::policies::gasnet {
12351235 std::fprintf (stderr,
12361236 " gasnet::mailbox_array: PE %zu has had %llu back-pressure "
12371237 " polls (credit-return region in flight) from PE %zu\n " ,
1238- my_pe_, static_cast <unsigned long long >(stall_warn_interval),
1238+ my_pe_,
1239+ static_cast <unsigned long long >(stall_warn_interval),
12391240 src_pe);
12401241 }
12411242 }
0 commit comments