Remove unused functions from the CUDA backend which call slow CUDA attribute
query APIs.
MODIFY
thrust/system/cuda/detail/core/util.h
thrust/system/cuda/detail/core/util.h
#include <thrust/system/cuda/detail/cub/block/block_store.cuh>
#include <thrust/system/cuda/detail/cub/block/block_scan.cuh>
-
THRUST_BEGIN_NS
namespace cuda_cub {
@@ -433,63 +432,8 @@ namespace core {
/////////////////////////
/////////////////////////
- inline cudaError_t CUB_RUNTIME_FUNCTION
- get_occ_device_properties(cudaOccDeviceProp &occ_prop, int dev_id)
- {
- cudaError_t status = cudaSuccess;
-#ifdef __CUDA_ARCH__
- {
- cudaOccDeviceProp &o = occ_prop;
- //
- status = cudaDeviceGetAttribute(&o.computeMajor,
- cudaDevAttrComputeCapabilityMajor,
- dev_id);
- status = cudaDeviceGetAttribute(&o.computeMinor,
- cudaDevAttrComputeCapabilityMinor,
- dev_id);
- status = cudaDeviceGetAttribute(&o.maxThreadsPerBlock,
- cudaDevAttrMaxThreadsPerBlock,
- dev_id);
- status = cudaDeviceGetAttribute(&o.maxThreadsPerMultiprocessor,
- cudaDevAttrMaxThreadsPerMultiProcessor,
- dev_id);
- status = cudaDeviceGetAttribute(&o.regsPerBlock,
- cudaDevAttrMaxRegistersPerBlock,
- dev_id);
- status = cudaDeviceGetAttribute(&o.regsPerMultiprocessor,
- cudaDevAttrMaxRegistersPerMultiprocessor,
- dev_id);
- status = cudaDeviceGetAttribute(&o.warpSize,
- cudaDevAttrWarpSize,
- dev_id);
-
- int i32value;
- status = cudaDeviceGetAttribute(&i32value,
- cudaDevAttrMaxSharedMemoryPerBlock,
- dev_id);
- o.sharedMemPerBlock = static_cast<size_t>(i32value);
-
- status = cudaDeviceGetAttribute(&i32value,
- cudaDevAttrMaxSharedMemoryPerMultiprocessor,
- dev_id);
- o.sharedMemPerMultiprocessor = static_cast<size_t>(i32value);
-
- status = cudaDeviceGetAttribute(&o.numSms,
- cudaDevAttrMultiProcessorCount,
- dev_id);
- }
-#else
- {
- cudaDeviceProp props;
- status = cudaGetDeviceProperties(&props, dev_id);
- occ_prop = cudaOccDeviceProp(props);
- }
-#endif
- return status;
- }
-
- int CUB_RUNTIME_FUNCTION
- inline get_sm_count()
+ THRUST_RUNTIME_FUNCTION
+ int get_sm_count()
{
int dev_id;
cuda_cub::throw_on_error(cudaGetDevice(&dev_id),
@@ -547,51 +491,6 @@ namespace core {
return 0;
}
- template <class Kernel>
- int CUB_RUNTIME_FUNCTION
- get_max_block_size(Kernel k)
- {
- int devId;
- cuda_cub::throw_on_error(cudaGetDevice(&devId),
- "get_max_block_size :"
- "failed to cudaGetDevice");
-
- cudaOccDeviceProp occ_prop;
- cuda_cub::throw_on_error(get_occ_device_properties(occ_prop, devId),
- "get_max_block_size: "
- "failed to cudaGetDeviceProperties");
-
-
- cudaFuncAttributes attribs;
- cuda_cub::throw_on_error(cudaFuncGetAttributes(&attribs, reinterpret_cast<void *>(k)),
- "get_max_block_size: "
- "failed to cudaFuncGetAttributes");
- cudaOccFuncAttributes occ_attrib(attribs);
-
-
- cudaFuncCache cacheConfig;
- cuda_cub::throw_on_error(cudaDeviceGetCacheConfig(&cacheConfig),
- "get_max_block_size: "
- "failed to cudaDeviceGetCacheConfig");
-
- cudaOccDeviceState occ_state;
- occ_state.cacheConfig = (cudaOccCacheConfig)cacheConfig;
- int block_size = 0;
- int min_grid_size = 0;
- cudaOccError occ_status = cudaOccMaxPotentialOccupancyBlockSize(&min_grid_size,
- &block_size,
- &occ_prop,
- &occ_attrib,
- &occ_state,
- 0);
- if (CUDA_OCC_SUCCESS != occ_status || block_size <= 0)
- cuda_cub::throw_on_error(cudaErrorInvalidConfiguration,
- "get_max_block_size: "
- "failed to cudaOccMaxPotentialOccupancyBlockSize");
-
- return block_size;
- }
-
// LoadIterator
// ------------
// if trivial iterator is passed, wrap loads into LDG

Remove unused functions from the CUDA backend which call slow CUDA attribute
query APIs.