Skip to content

Commit

Permalink
fix a strange bug of cuda 11
Browse files Browse the repository at this point in the history
  • Loading branch information
FindDefinition committed Jan 30, 2021
1 parent f22dd9a commit fad3000
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/spconv/indice.cu
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ int create_conv_indice_pair_p2_cuda(
auto kernelVolume = indiceNum.size(0);
if (numActIn == 0)
return 0;
bool failed = false;
tv::dispatch_torch<int32_t>(indicesIn.scalar_type(), [&](auto IndexValue) {
using Index = TV_DECLTYPE(IndexValue);
using IndexGrid = int32_t;
Expand All @@ -131,7 +132,8 @@ int create_conv_indice_pair_p2_cuda(
cudaFree(d_values);
TV_CHECK_CUDA_ERR_V2("cudaFree failed");
if (!res) {
return -1; // use -1 to tell outside use CPU implementation
failed = true;
return;
}
assignIndiceOutKernel<Index, NDim>
<<<tv::cuda::getBlocks(numAct), tv::cuda::CUDA_NUM_THREADS, 0,
Expand Down Expand Up @@ -190,6 +192,9 @@ int create_conv_indice_pair_p2_cuda(
}
});
});
if (failed){
return -1;
}
return numAct;
}

Expand All @@ -211,6 +216,8 @@ int create_submconv_indice_pair_cuda(
auto kernelVolume = indiceNum.size(0);
if (numActIn == 0)
return 0;
bool failed = false;

tv::dispatch_torch<int32_t>(indicesIn.scalar_type(), [&](auto IndexValue) {
using Index = TV_DECLTYPE(IndexValue);
using IndexGrid = int32_t;
Expand Down Expand Up @@ -245,7 +252,8 @@ int create_submconv_indice_pair_cuda(
cudaFree(d_keyvalues);
TV_CHECK_CUDA_ERR_V2("cudaFree failed");
if (!res) {
return -1; // use -1 to tell outside use CPU implementation
failed = true;
return;
}
auto tableSize = table.get_table_size();
auto tableData = table.data();
Expand Down Expand Up @@ -349,6 +357,10 @@ int create_submconv_indice_pair_cuda(
}
});
});
if (failed){
return -1;
}

return numActIn;
}

Expand Down

1 comment on commit fad3000

@nachovizzo
Copy link

Choose a reason for hiding this comment

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

Is this inspired by the solution provided in #245 (comment). Does this solve that issue?

Please # to comment.