Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boundary check in indexing #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 12 additions & 4 deletions csrc/vertical_slash_index.cu
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,20 @@ __global__ void convert_vertical_slash_indexes_kernel(

int tmp_col_cnt = 0, tmp_blk_cnt = 0;
int s = 0, v = 0;
int v_idx = vertical_indexes[v++];
int s_idx = slash_indexes[s++];
while (s_idx >= end_m) {

// in case of vs are empty
int v_idx = (v < NNZ_V) ? vertical_indexes[v++] : (end_m + BLOCK_SIZE_M);
int s_idx = (s < NNZ_S) ? slash_indexes[s++] : -1;

// make sure s_idx is valid
while (s_idx >= end_m && s < NNZ_S) {
s_idx = slash_indexes[s++];
}
s_idx = max(end_m - s_idx, BLOCK_SIZE_M);
if (s_idx >= end_m) {
s_idx = end_m + BLOCK_SIZE_M;
} else {
s_idx = max(end_m - s_idx, BLOCK_SIZE_M);
}
int range_start = s_idx - BLOCK_SIZE_M, range_end = s_idx;
while (1) {
if (v_idx < range_end) {
Expand Down