Skip to content

Commit d5d3aa6

Browse files
Deprecate cub::DeviceSpmv (#3320)
Fixes: #896
1 parent 0e63552 commit d5d3aa6

File tree

4 files changed

+48
-21
lines changed

4 files changed

+48
-21
lines changed

cub/cub/agent/agent_spmv_orig.cuh

+12-3
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ template <int _BLOCK_THREADS,
102102
CacheLoadModifier _VECTOR_VALUES_LOAD_MODIFIER,
103103
bool _DIRECT_LOAD_NONZEROS,
104104
BlockScanAlgorithm _SCAN_ALGORITHM>
105-
struct AgentSpmvPolicy
105+
struct CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead") AgentSpmvPolicy
106106
{
107107
enum
108108
{
@@ -148,7 +148,12 @@ struct AgentSpmvPolicy
148148
* Signed integer type for sequence offsets
149149
*/
150150
template <typename ValueT, typename OffsetT>
151-
struct SpmvParams
151+
struct
152+
// with NVHPC, we get a deprecation warning in the implementation of cudaLaunchKernelEx, which we cannot suppress :/
153+
#if !_CCCL_COMPILER(NVHPC)
154+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
155+
#endif
156+
SpmvParams
152157
{
153158
/// Pointer to the array of \p num_nonzeros values of the corresponding nonzero elements of matrix
154159
/// <b>A</b>.
@@ -211,7 +216,7 @@ template <typename AgentSpmvPolicyT,
211216
bool HAS_ALPHA,
212217
bool HAS_BETA,
213218
int LEGACY_PTX_ARCH = 0>
214-
struct AgentSpmv
219+
struct CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead") AgentSpmv
215220
{
216221
//---------------------------------------------------------------------
217222
// Types and constants
@@ -308,7 +313,9 @@ struct AgentSpmv
308313
/// Reference to temp_storage
309314
_TempStorage& temp_storage;
310315

316+
_CCCL_SUPPRESS_DEPRECATED_PUSH
311317
SpmvParams<ValueT, OffsetT>& spmv_params;
318+
_CCCL_SUPPRESS_DEPRECATED_POP
312319

313320
/// Wrapped pointer to the array of \p num_nonzeros values of the corresponding nonzero elements
314321
/// of matrix <b>A</b>.
@@ -341,6 +348,7 @@ struct AgentSpmv
341348
* @param spmv_params
342349
* SpMV input parameter bundle
343350
*/
351+
_CCCL_SUPPRESS_DEPRECATED_PUSH
344352
_CCCL_DEVICE _CCCL_FORCEINLINE AgentSpmv(TempStorage& temp_storage, SpmvParams<ValueT, OffsetT>& spmv_params)
345353
: temp_storage(temp_storage.Alias())
346354
, spmv_params(spmv_params)
@@ -350,6 +358,7 @@ struct AgentSpmv
350358
, wd_vector_x(spmv_params.d_vector_x)
351359
, wd_vector_y(spmv_params.d_vector_y)
352360
{}
361+
_CCCL_SUPPRESS_DEPRECATED_POP
353362

354363
/**
355364
* @brief Consume a merge tile, specialized for direct-load of nonzeros

cub/cub/device/device_spmv.cuh

+16-13
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ CUB_NAMESPACE_BEGIN
7878
//! @cdp_class{DeviceSpmv}
7979
//!
8080
//! @endrst
81-
struct DeviceSpmv
81+
struct CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead") DeviceSpmv
8282
{
8383
//! @name CSR matrix operations
8484
//! @{
@@ -177,18 +177,19 @@ struct DeviceSpmv
177177
//! **[optional]** CUDA stream to launch kernels within. Default is stream\ :sub:`0`.
178178
//! @endrst
179179
template <typename ValueT>
180-
CUB_RUNTIME_FUNCTION static cudaError_t CsrMV(
181-
void* d_temp_storage,
182-
size_t& temp_storage_bytes,
183-
const ValueT* d_values,
184-
const int* d_row_offsets,
185-
const int* d_column_indices,
186-
const ValueT* d_vector_x,
187-
ValueT* d_vector_y,
188-
int num_rows,
189-
int num_cols,
190-
int num_nonzeros,
191-
cudaStream_t stream = 0)
180+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
181+
CUB_RUNTIME_FUNCTION static cudaError_t
182+
CsrMV(void* d_temp_storage,
183+
size_t& temp_storage_bytes,
184+
const ValueT* d_values,
185+
const int* d_row_offsets,
186+
const int* d_column_indices,
187+
const ValueT* d_vector_x,
188+
ValueT* d_vector_y,
189+
int num_rows,
190+
int num_cols,
191+
int num_nonzeros,
192+
cudaStream_t stream = 0)
192193
{
193194
CUB_DETAIL_NVTX_RANGE_SCOPE_IF(d_temp_storage, "cub::DeviceSpmv::CsrMV");
194195

@@ -204,7 +205,9 @@ struct DeviceSpmv
204205
spmv_params.alpha = ValueT{1};
205206
spmv_params.beta = ValueT{0};
206207

208+
_CCCL_SUPPRESS_DEPRECATED_PUSH
207209
return DispatchSpmv<ValueT, int>::Dispatch(d_temp_storage, temp_storage_bytes, spmv_params, stream);
210+
_CCCL_SUPPRESS_DEPRECATED_POP
208211
}
209212

210213
//! @} end member group

cub/cub/device/dispatch/dispatch_spmv_orig.cuh

+16-5
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,11 @@ CUB_NAMESPACE_BEGIN
8383
* @param[in] spmv_params
8484
* SpMV input parameter bundle
8585
*/
86+
_CCCL_SUPPRESS_DEPRECATED_PUSH
8687
template <typename AgentSpmvPolicyT, typename ValueT, typename OffsetT>
87-
CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmv1ColKernel(SpmvParams<ValueT, OffsetT> spmv_params)
88+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
89+
CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmv1ColKernel(SpmvParams<ValueT, OffsetT> spmv_params) //
90+
_CCCL_SUPPRESS_DEPRECATED_POP
8891
{
8992
using VectorValueIteratorT =
9093
CacheModifiedInputIterator<AgentSpmvPolicyT::VECTOR_VALUES_LOAD_MODIFIER, ValueT, OffsetT>;
@@ -132,8 +135,9 @@ CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmv1ColKernel(SpmvParams<ValueT, Offset
132135
* SpMV input parameter bundle
133136
*/
134137
template <typename SpmvPolicyT, typename OffsetT, typename CoordinateT, typename SpmvParamsT>
135-
CUB_DETAIL_KERNEL_ATTRIBUTES void
136-
DeviceSpmvSearchKernel(int num_merge_tiles, CoordinateT* d_tile_coordinates, SpmvParamsT spmv_params)
138+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
139+
CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmvSearchKernel(
140+
int num_merge_tiles, CoordinateT* d_tile_coordinates, SpmvParamsT spmv_params)
137141
{
138142
/// Constants
139143
enum
@@ -217,6 +221,7 @@ template <typename SpmvPolicyT,
217221
typename CoordinateT,
218222
bool HAS_ALPHA,
219223
bool HAS_BETA>
224+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
220225
__launch_bounds__(int(SpmvPolicyT::BLOCK_THREADS)) CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmvKernel(
221226
SpmvParams<ValueT, OffsetT> spmv_params,
222227
CoordinateT* d_tile_coordinates,
@@ -226,7 +231,9 @@ __launch_bounds__(int(SpmvPolicyT::BLOCK_THREADS)) CUB_DETAIL_KERNEL_ATTRIBUTES
226231
int num_segment_fixup_tiles)
227232
{
228233
// Spmv agent type specialization
234+
_CCCL_SUPPRESS_DEPRECATED_PUSH
229235
using AgentSpmvT = AgentSpmv<SpmvPolicyT, ValueT, OffsetT, HAS_ALPHA, HAS_BETA>;
236+
_CCCL_SUPPRESS_DEPRECATED_POP
230237

231238
// Shared memory for AgentSpmv
232239
__shared__ typename AgentSpmvT::TempStorage temp_storage;
@@ -248,6 +255,7 @@ __launch_bounds__(int(SpmvPolicyT::BLOCK_THREADS)) CUB_DETAIL_KERNEL_ATTRIBUTES
248255
* Whether the input parameter Beta is 0
249256
*/
250257
template <typename ValueT, typename OffsetT, bool HAS_BETA>
258+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
251259
CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmvEmptyMatrixKernel(SpmvParams<ValueT, OffsetT> spmv_params)
252260
{
253261
const int row = static_cast<int>(threadIdx.x + blockIdx.x * blockDim.x);
@@ -298,18 +306,21 @@ CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSpmvEmptyMatrixKernel(SpmvParams<ValueT,
298306
* @param[in] tile_state
299307
* Tile status interface
300308
*/
309+
_CCCL_SUPPRESS_DEPRECATED_PUSH
301310
template <typename AgentSegmentFixupPolicyT,
302311
typename PairsInputIteratorT,
303312
typename AggregatesOutputIteratorT,
304313
typename OffsetT,
305314
typename ScanTileStateT>
315+
CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead")
306316
__launch_bounds__(int(AgentSegmentFixupPolicyT::BLOCK_THREADS))
307317
CUB_DETAIL_KERNEL_ATTRIBUTES void DeviceSegmentFixupKernel(
308318
PairsInputIteratorT d_pairs_in,
309319
AggregatesOutputIteratorT d_aggregates_out,
310320
OffsetT num_items,
311321
int num_tiles,
312-
ScanTileStateT tile_state)
322+
ScanTileStateT tile_state) //
323+
_CCCL_SUPPRESS_DEPRECATED_POP
313324
{
314325
// Thread block type for reducing tiles of value segments
315326
using AgentSegmentFixupT =
@@ -342,7 +353,7 @@ __launch_bounds__(int(AgentSegmentFixupPolicyT::BLOCK_THREADS))
342353
* Signed integer type for global offsets
343354
*/
344355
template <typename ValueT, typename OffsetT>
345-
struct DispatchSpmv
356+
struct CCCL_DEPRECATED_BECAUSE("Use the cuSPARSE library instead") DispatchSpmv
346357
{
347358
//---------------------------------------------------------------------
348359
// Constants and Types

cub/test/test_device_spmv.cu

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
#include <c2h/device_policy.h>
4848
#include <c2h/vector.h>
4949

50+
_CCCL_SUPPRESS_DEPRECATED_PUSH
51+
5052
bool g_verbose = false;
5153

5254
//==============================================================================
@@ -605,3 +607,5 @@ int main(int argc, char** argv)
605607

606608
test_types();
607609
}
610+
611+
_CCCL_SUPPRESS_DEPRECATED_POP

0 commit comments

Comments
 (0)