Skip to content

Commit f30e5e9

Browse files
committed
fixup! bugprone-misplaced-widening-cast
1 parent 78a7c81 commit f30e5e9

5 files changed

Lines changed: 8 additions & 11 deletions

File tree

cub/cub/agent/agent_merge.cuh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@ struct agent_t
7878
struct alignas(cub::detail::LoadToSharedBufferAlignBytes<ValueT>()) buffer_t
7979
{
8080
// Need extra bytes of padding for TMA because this static buffer has to hold the two dynamically sized buffers.
81-
static constexpr int bytes_needed =
82-
cub::detail::LoadToSharedBufferSizeBytes<ValueT>(items_per_tile + 1) // NOLINT(bugprone-misplaced-widening-cast)
83-
+ (alignof(ValueT) < bl2sh_minimum_align ? 2 * bl2sh_minimum_align : 0);
81+
static constexpr int bytes_needed = cub::detail::LoadToSharedBufferSizeBytes<ValueT>(items_per_tile + 1ULL)
82+
+ (alignof(ValueT) < bl2sh_minimum_align ? 2 * bl2sh_minimum_align : 0);
8483

8584
char c_array[bytes_needed];
8685
};

cub/cub/agent/agent_topk.cuh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,14 @@ struct AgentTopK
360360
{
361361
key_in_t thread_data[items_per_thread];
362362

363-
const OffsetT items_per_pass = static_cast<OffsetT>(tile_items) * gridDim.x;
363+
const OffsetT items_per_pass =
364+
static_cast<OffsetT>(tile_items * gridDim.x); // NOLINT(bugprone-misplaced-widening-cast)
364365
const OffsetT total_num_blocks = ::cuda::ceil_div(num_items, tile_items);
365366

366367
const OffsetT num_remaining_elements = num_items % tile_items;
367368
const OffsetT last_block_id = (total_num_blocks - 1) % gridDim.x;
368369

369-
OffsetT tile_base = static_cast<OffsetT>(blockIdx.x) * tile_items;
370+
OffsetT tile_base = static_cast<OffsetT>(blockIdx.x * tile_items); // NOLINT(bugprone-misplaced-widening-cast)
370371
OffsetT offset = threadIdx.x * items_per_thread + tile_base;
371372

372373
for (int i_block = blockIdx.x; i_block < total_num_blocks - 1; i_block += gridDim.x)

cub/cub/device/dispatch/dispatch_batch_memcpy.cuh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ __launch_bounds__(int(current_policy<PolicySelector>().large_buffer.threads_per_
103103

104104
constexpr uint32_t BLOCK_THREADS = static_cast<uint32_t>(policy.threads_per_block);
105105
constexpr uint32_t ITEMS_PER_THREAD = static_cast<uint32_t>(policy.bytes_per_thread);
106-
constexpr BufferSizeT TILE_SIZE =
107-
static_cast<BufferSizeT>(BLOCK_THREADS * ITEMS_PER_THREAD); // NOLINT(bugprone-misplaced-widening-cast)
106+
constexpr BufferSizeT TILE_SIZE = static_cast<BufferSizeT>(BLOCK_THREADS) * ITEMS_PER_THREAD;
108107

109108
BufferOffsetT num_blev_buffers = buffer_offset_tile.LoadValid(last_tile_offset);
110109

cub/cub/device/dispatch/dispatch_segmented_reduce.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ CUB_RUNTIME_FUNCTION _CCCL_FORCEINLINE auto dispatch_fixed_size(
782782
return cudaSuccess;
783783
}
784784

785-
const auto num_segments_per_invocation =
785+
constexpr auto num_segments_per_invocation =
786786
static_cast<::cuda::std::int64_t>(::cuda::std::numeric_limits<::cuda::std::int32_t>::max());
787787
const ::cuda::std::int64_t num_invocations = ::cuda::ceil_div(num_segments, num_segments_per_invocation);
788788

cub/cub/device/dispatch/dispatch_segmented_sort.cuh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,9 +1360,7 @@ CUB_RUNTIME_FUNCTION _CCCL_FORCEINLINE auto dispatch(
13601360
auto large_segments_selector = kernel_source.LargeSegmentsSelector(
13611361
active_policy.medium_segment.items_per_tile(), d_begin_offsets, d_end_offsets);
13621362
auto small_segments_selector = kernel_source.SmallSegmentsSelector(
1363-
active_policy.small_segment.items_per_tile() + 1, // NOLINT(bugprone-misplaced-widening-cast)
1364-
d_begin_offsets,
1365-
d_end_offsets);
1363+
static_cast<OffsetT>(active_policy.small_segment.items_per_tile()) + 1, d_begin_offsets, d_end_offsets);
13661364

13671365
auto device_partition_temp_storage = keys_slot->create_alias<uint8_t>();
13681366
if (partition_segments)

0 commit comments

Comments
 (0)