Skip to content

Commit

Permalink
avoid empty count_nonzeros kernel launches
Browse files Browse the repository at this point in the history
  • Loading branch information
upsj committed Jul 16, 2020
1 parent 624ec75 commit 496120c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cuda/matrix/sellp_kernels.cu
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ void count_nonzeros(std::shared_ptr<const CudaExecutor> exec,
size_type *result)
{
const auto num_rows = source->get_size()[0];

if (num_rows <= 0) {
*result = 0;
return;
}

const auto slice_size = source->get_slice_size();
const auto slice_sets = source->get_const_slice_sets();
const auto values = source->get_const_values();
Expand Down
6 changes: 6 additions & 0 deletions hip/matrix/sellp_kernels.hip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ void count_nonzeros(std::shared_ptr<const HipExecutor> exec,
size_type *result)
{
const auto num_rows = source->get_size()[0];

if (num_rows <= 0) {
*result = 0;
return;
}

const auto slice_size = source->get_slice_size();
const auto slice_sets = source->get_const_slice_sets();
const auto values = source->get_const_values();
Expand Down

0 comments on commit 496120c

Please sign in to comment.