Skip to content

Commit

Permalink
Half-done
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed May 6, 2023
1 parent 9c2acdf commit f88c6c8
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 30 deletions.
42 changes: 42 additions & 0 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## Benchmarks

### Ready

- radix sort
- keys
- pairs
- merge sort
- keys
- pairs
- reduce
- sum
- max
- scan
- sum
- max

### In Progress

- select
- flagged
- if

### TODO

- adjacent difference
- left
- right
- histogram
- even
- range
- partition
- flagged
- if
- rle
- encode
- non trivial runs
- reduce
- by key
- scan
- by key
- segmented
1 change: 1 addition & 0 deletions benchmarks/bench/select/flagged.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <cub/device/device_reduce.cuh>
60 changes: 30 additions & 30 deletions cub/device/dispatch/dispatch_select_if.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,31 @@ __global__ void DeviceSelectSweepKernel(
}


namespace detail
{

template <class InputT, bool MayAlias>
struct device_select_policy_hub
{
struct Policy350 : ChainedPolicy<350, Policy350, Policy350>
{
static constexpr int NOMINAL_4B_ITEMS_PER_THREAD = 10;

static constexpr int ITEMS_PER_THREAD =
CUB_MIN(NOMINAL_4B_ITEMS_PER_THREAD,
CUB_MAX(1, (NOMINAL_4B_ITEMS_PER_THREAD * 4 / sizeof(InputT))));

using SelectIfPolicyT = AgentSelectIfPolicy<128,
ITEMS_PER_THREAD,
BLOCK_LOAD_DIRECT,
MayAlias ? LOAD_CA : LOAD_LDG,
BLOCK_SCAN_WARP_SCANS>;
};

using MaxPolicy = Policy350;
};

} // detail


/******************************************************************************
Expand All @@ -125,8 +150,10 @@ template <
typename EqualityOpT, ///< Equality operator type (NullType if selection functor or selection flags is to be used for selection)
typename OffsetT, ///< Signed integer type for global offsets
bool KEEP_REJECTS, ///< Whether or not we push rejected items to the back of the output
bool MayAlias = false>
struct DispatchSelectIf
bool MayAlias = false,
typename SelectedPolicy =
detail::device_select_policy_hub<cub::detail::value_t<InputIteratorT>, MayAlias>>
struct DispatchSelectIf : SelectedPolicy
{
/******************************************************************************
* Types and constants
Expand All @@ -147,35 +174,8 @@ struct DispatchSelectIf
typedef ScanTileState<OffsetT> ScanTileStateT;


/******************************************************************************
* Tuning policies
******************************************************************************/

/// SM35
struct Policy350
{
enum {
NOMINAL_4B_ITEMS_PER_THREAD = 10,
ITEMS_PER_THREAD = CUB_MIN(NOMINAL_4B_ITEMS_PER_THREAD, CUB_MAX(1, (NOMINAL_4B_ITEMS_PER_THREAD * 4 / sizeof(InputT)))),
};

typedef AgentSelectIfPolicy<
128,
ITEMS_PER_THREAD,
BLOCK_LOAD_DIRECT,
MayAlias ? LOAD_CA : LOAD_LDG,
BLOCK_SCAN_WARP_SCANS>
SelectIfPolicyT;
};

/******************************************************************************
* Tuning policies of current PTX compiler pass
******************************************************************************/

typedef Policy350 PtxPolicy;

// "Opaque" policies (whose parameterizations aren't reflected in the type signature)
struct PtxSelectIfPolicyT : PtxPolicy::SelectIfPolicyT {};
struct PtxSelectIfPolicyT : SelectedPolicy::SelectIfPolicyT {};


/******************************************************************************
Expand Down

0 comments on commit f88c6c8

Please sign in to comment.