Skip to content
Merged
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
8 changes: 4 additions & 4 deletions csrc/src/block_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ struct BlockInfo {
}

template <typename index_t>
__forceinline__ __device__ index_t zoh_offset(const index_t batch_stride, const int bidb
__forceinline__ __device__ index_t zoh_offset(const index_t batch_stride, const int row_stride, const int bidb
) const {
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The row_stride parameter is declared as int while batch_stride uses index_t; consider making row_stride an index_t as well to maintain consistency and avoid implicit narrowing or overflow.

Copilot uses AI. Check for mistakes.
return bidb * batch_stride;
return sum_s_q == -1 ? bidb * batch_stride : uint32_t(sum_s_q) * row_stride;
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Casting sum_s_q to uint32_t may narrow its value and doesn’t match index_t; consider using static_cast<index_t>(sum_s_q) * static_cast<index_t>(row_stride).

Copilot uses AI. Check for mistakes.
}

template <typename index_t>
__forceinline__ __device__ index_t active_mask_offset(const index_t batch_stride, const int bidb) const {
return bidb * batch_stride;
__forceinline__ __device__ index_t active_mask_offset(const index_t batch_stride, int row_stride, const int bidb) const {
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The row_stride parameter here omits the const qualifier present in zoh_offset; for consistency, mark it const int or better yet const index_t.

Suggested change
__forceinline__ __device__ index_t active_mask_offset(const index_t batch_stride, int row_stride, const int bidb) const {
__forceinline__ __device__ index_t active_mask_offset(const index_t batch_stride, const int row_stride, const int bidb) const {

Copilot uses AI. Check for mistakes.
return sum_s_q == -1 ? bidb * batch_stride : uint32_t(sum_s_q) * row_stride;
Comment on lines +39 to +46
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in zoh_offset and active_mask_offset is identical; consider extracting the conditional expression into a shared helper to reduce duplication.

Copilot uses AI. Check for mistakes.
}

const int sum_s_q;
Expand Down