2323#include < rapidsmpf/memory/buffer_resource.hpp>
2424#include < rapidsmpf/owning_wrapper.hpp>
2525#include < rapidsmpf/streaming/core/channel.hpp>
26+ #include < rapidsmpf/utils/string.hpp>
2627
2728#include < cstdint>
2829#include < memory>
@@ -50,12 +51,13 @@ class StreamingTableChunk : public BaseStreamingFixture,
5051 memory_limits, // memory_limits
5152 std::chrono::milliseconds{1 }, // periodic_spill_check
5253 stream_pool, // stream_pool
53- rapidsmpf::Statistics::disabled () // statistics
54- );
54+ rapidsmpf::Statistics::disabled (), // statistics
55+ spill_dir. path () );
5556 ctx = std::make_shared<rapidsmpf::streaming::Context>(
5657 options, GlobalEnvironment->comm_ ->logger (), br);
5758 }
5859
60+ TempDir spill_dir;
5961 cuda::stream_ref stream{cudaStream_t{cudaStreamDefault}};
6062 rmm::mr::cuda_memory_resource mr_cuda;
6163 std::shared_ptr<rapidsmpf::BufferResource> br;
@@ -172,7 +174,9 @@ TEST_F(StreamingTableChunk, FromPackedDataOnDevice)
172174
173175INSTANTIATE_TEST_SUITE_P (StreamingTableChunkWithSpillTargets,
174176 StreamingTableChunk,
175- ::testing::ValuesIn (rapidsmpf::SPILL_TARGET_MEMORY_TYPES ),
177+ ::testing::ValuesIn ({rapidsmpf::MemoryType::PINNED_HOST ,
178+ rapidsmpf::MemoryType::HOST ,
179+ rapidsmpf::MemoryType::DISK }),
176180 [](testing::TestParamInfo<rapidsmpf::MemoryType> const & info) {
177181 return std::string{rapidsmpf::to_string (info.param )};
178182 });
@@ -304,9 +308,12 @@ TEST_P(StreamingTableChunk, DeviceToHostRoundTripCopy)
304308 }
305309 }
306310
307- // Host to host copy.
308- auto host_res2 = br->reserve_or_fail (host_copy.data_alloc_size (spill_mem_type), spill_mem_type);
309- auto host_copy2 = host_copy.copy (host_res2);
311+ // Disk-to-disk copies are unsupported; keep the disk chunk for the round trip.
312+ auto host_copy2 = [&] {
313+ if (spill_mem_type == rapidsmpf::MemoryType::DISK ) { return std::move (host_copy); }
314+ auto host_res2 = br->reserve_or_fail (host_copy.data_alloc_size (spill_mem_type), spill_mem_type);
315+ return host_copy.copy (host_res2);
316+ }();
310317 EXPECT_FALSE (host_copy2.is_available ());
311318 EXPECT_TRUE (host_copy2.is_spillable ());
312319 EXPECT_EQ (host_copy2.stream ().get (), stream.get ());
@@ -371,7 +378,8 @@ TEST_P(StreamingTableChunk, SpillTrackingOnHostCopy)
371378 std::unordered_map<rapidsmpf::MemoryType, std::int64_t >{},
372379 std::nullopt ,
373380 std::make_shared<rapidsmpf::StreamPool>(16 ),
374- stats);
381+ stats,
382+ spill_dir.path ());
375383
376384 auto samples = [&stats] {
377385 return stats->has_stat (" buffer-spilled-time" ) ? stats->get_stat (" buffer-spilled-time" ).count ()
@@ -392,10 +400,14 @@ TEST_P(StreamingTableChunk, SpillTrackingOnHostCopy)
392400 // no token and must not be reported as a spill.
393401 std::ignore = round_trip (random_table_with_index (2025 , 0 , 0 , 5 ));
394402 EXPECT_EQ (samples (), 0UL );
403+ auto const spill_mem_name = rapidsmpf::to_lower (rapidsmpf::to_string (spill_mem_type));
404+ EXPECT_FALSE (stats->has_stat (" copy-device-to-" + spill_mem_name + " -bytes" ));
405+ EXPECT_FALSE (stats->has_stat (" copy-" + spill_mem_name + " -to-device-bytes" ));
395406
396407 // A non-empty one does leave the device, so the round trip is recorded once.
397408 std::ignore = round_trip (random_table_with_index (2025 , 64 , 0 , 5 ));
398409 EXPECT_EQ (samples (), 1UL );
410+ EXPECT_GT (stats->get_stat (" copy-device-to-" + spill_mem_name + " -bytes" ).value (), 0 );
399411}
400412
401413TEST_F (StreamingTableChunk, ToMessageRoundTrip)
0 commit comments