Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exp/bench select load acquire #1

Open
wants to merge 2 commits into
base: fix/in-place-copy-if
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions cub/cub/agent/single_pass_scan_operators.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <cub/util_temporary_storage.cuh>
#include <cub/warp/warp_reduce.cuh>

#include <cuda/atomic>
#include <cuda/std/type_traits>

#include <iterator>
Expand Down Expand Up @@ -511,7 +512,7 @@ using default_reduce_by_key_delay_constructor_t =
/**
* Tile status interface.
*/
template <typename T, bool SINGLE_WORD = Traits<T>::PRIMITIVE>
template <typename T, bool SINGLE_WORD = (Traits<T>::PRIMITIVE && sizeof(T)<8)>
struct ScanTileState;

/**
Expand Down Expand Up @@ -677,16 +678,17 @@ struct ScanTileState<T, true>
WaitForValid(int tile_idx, StatusWord& status, T& value, DelayT delay_or_prevent_hoisting = {})
{
TileDescriptor tile_descriptor;
::cuda::atomic_ref<TxnWord, cuda::thread_scope_device> atomic_ref_tile_descriptor{d_tile_descriptors[TILE_STATUS_PADDING + tile_idx]};

{
TxnWord alias = detail::load_relaxed(d_tile_descriptors + TILE_STATUS_PADDING + tile_idx);
TxnWord alias = atomic_ref_tile_descriptor.load(::cuda::memory_order_acquire);
tile_descriptor = reinterpret_cast<TileDescriptor&>(alias);
}

while (WARP_ANY((tile_descriptor.status == SCAN_TILE_INVALID), 0xffffffff))
{
delay_or_prevent_hoisting();
TxnWord alias = detail::load_relaxed(d_tile_descriptors + TILE_STATUS_PADDING + tile_idx);
TxnWord alias = atomic_ref_tile_descriptor.load(::cuda::memory_order_acquire);
tile_descriptor = reinterpret_cast<TileDescriptor&>(alias);
}

Expand All @@ -700,7 +702,8 @@ struct ScanTileState<T, true>
*/
_CCCL_DEVICE _CCCL_FORCEINLINE T LoadValid(int tile_idx)
{
TxnWord alias = d_tile_descriptors[TILE_STATUS_PADDING + tile_idx];
::cuda::atomic_ref<TxnWord, cuda::thread_scope_device> atomic_ref_tile_descriptor{d_tile_descriptors[TILE_STATUS_PADDING + tile_idx]};
TxnWord alias = atomic_ref_tile_descriptor.load(cuda::memory_order_acquire);
TileDescriptor tile_descriptor = reinterpret_cast<TileDescriptor&>(alias);
return tile_descriptor.value;
}
Expand Down
3 changes: 1 addition & 2 deletions cub/test/catch2_test_device_select_if.cu
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ struct multiply_n
return x * multiplier;
}
};

using all_types =
c2h::type_list<std::uint8_t,
std::uint16_t,
Expand All @@ -166,7 +165,7 @@ using all_types =
using types = c2h::
type_list<std::uint8_t, std::uint32_t, ulonglong4, c2h::custom_type_t<c2h::less_comparable_t, c2h::equal_comparable_t>>;

using offset_types = c2h::type_list<std::int32_t, std::int64_t>;
using offset_types = c2h::type_list<std::int32_t>;

CUB_TEST("DeviceSelect::If can run with empty input", "[device][select_if]", types)
{
Expand Down
Loading