Skip to content

Commit

Permalink
c++17: add [[fallthrough]] attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
cwpearson committed Nov 30, 2022
1 parent 1efdeee commit 59e3f67
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 29 deletions.
6 changes: 3 additions & 3 deletions graph/impl/KokkosGraph_Distance1Color_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3159,8 +3159,8 @@ void graph_color_impl(KernelHandle *handle,
gch);
break;

case COLORING_VB:
case COLORING_VBBIT:
case COLORING_VB: [[fallthrough]];
case COLORING_VBBIT: [[fallthrough]];
case COLORING_VBCS:
typedef typename Impl::GraphColor_VB<
typename KernelHandle::GraphColoringHandleType, lno_row_view_t_,
Expand All @@ -3170,7 +3170,7 @@ void graph_color_impl(KernelHandle *handle,
gch);
break;

case COLORING_VBD:
case COLORING_VBD: [[fallthrough]];
case COLORING_VBDBIT:
typedef typename Impl::GraphColor_VBD<
typename KernelHandle::GraphColoringHandleType, lno_row_view_t_,
Expand Down
4 changes: 2 additions & 2 deletions graph/impl/KokkosGraph_Distance2Color_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class GraphColorDistance2 {
colors_out = color_view_type("Graph Colors", this->nr);
}
switch (this->gc_handle->get_coloring_algo_type()) {
case COLORING_D2_VB_BIT_EF: using_edge_filtering = true;
case COLORING_D2_VB_BIT:
case COLORING_D2_VB_BIT_EF: using_edge_filtering = true; [[fallthrough]];
case COLORING_D2_VB_BIT: [[fallthrough]];
case COLORING_D2_VB: compute_d2_coloring_vb(colors_out); break;
case COLORING_D2_NB_BIT: compute_d2_coloring_nb(colors_out); break;
case COLORING_D2_SERIAL: compute_d2_coloring_serial(colors_out); break;
Expand Down
10 changes: 5 additions & 5 deletions graph/src/KokkosGraph_Distance1ColorHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,11 @@ class GraphColoringHandle {
*/
void set_defaults(const ColoringAlgorithm &col_algo) {
switch (col_algo) {
case COLORING_VB:
case COLORING_VBBIT:
case COLORING_VBCS:
case COLORING_VBD:
case COLORING_VBDBIT:
case COLORING_VB: [[fallthrough]];
case COLORING_VBBIT: [[fallthrough]];
case COLORING_VBCS: [[fallthrough]];
case COLORING_VBD: [[fallthrough]];
case COLORING_VBDBIT: [[fallthrough]];
case COLORING_SERIAL:
this->conflict_list_type = COLORING_ATOMIC;
this->min_reduction_for_conflictlist = 0.35;
Expand Down
8 changes: 4 additions & 4 deletions graph/src/KokkosGraph_Distance2ColorHandle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,10 @@ class GraphColorDistance2Handle {
*/
void set_defaults(const GraphColoringAlgorithmDistance2& col_algo) {
switch (col_algo) {
case COLORING_D2_SERIAL:
case COLORING_D2_VB:
case COLORING_D2_VB_BIT:
case COLORING_D2_VB_BIT_EF:
case COLORING_D2_SERIAL: [[fallthrough]];
case COLORING_D2_VB: [[fallthrough]];
case COLORING_D2_VB_BIT: [[fallthrough]];
case COLORING_D2_VB_BIT_EF: [[fallthrough]];
case COLORING_D2_NB_BIT:
this->tictoc = false;
this->vb_edge_filtering = false;
Expand Down
14 changes: 7 additions & 7 deletions graph/src/KokkosGraph_Triangle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ void triangle_generic(KernelHandle *handle, typename KernelHandle::nnz_lno_t m,
spgemmHandleType *sh = handle->get_spgemm_handle();
switch (sh->get_algorithm_type()) {
// case SPGEMM_KK_TRIANGLE_LL:
case SPGEMM_KK_TRIANGLE_AI:
case SPGEMM_KK_TRIANGLE_IA:
case SPGEMM_KK_TRIANGLE_IA_UNION:
case SPGEMM_KK_TRIANGLE_AI: [[fallthrough]];
case SPGEMM_KK_TRIANGLE_IA: [[fallthrough]];
case SPGEMM_KK_TRIANGLE_IA_UNION: [[fallthrough]];
default: {
KokkosSparse::Impl::KokkosSPGEMM<
KernelHandle, alno_row_view_t_, alno_nnz_view_t_,
Expand Down Expand Up @@ -347,7 +347,7 @@ void triangle_generic(KernelHandle *handle, typename KernelHandle::nnz_lno_t m,
switch (sh->get_algorithm_type()) {
// IF it is one of below, we perform I^T x (A) or (L).
// so create the transpose of I.
case SPGEMM_KK_TRIANGLE_IA_UNION:
case SPGEMM_KK_TRIANGLE_IA_UNION: [[fallthrough]];
case SPGEMM_KK_TRIANGLE_IA: {
// these are the algorithms that requires transpose of the incidence
// matrix.
Expand Down Expand Up @@ -393,8 +393,8 @@ void triangle_generic(KernelHandle *handle, typename KernelHandle::nnz_lno_t m,
sh->get_lower_triangular_permutation(),
handle->is_dynamic_scheduling());
} break;
case SPGEMM_KK_TRIANGLE_LU:
case SPGEMM_KK_TRIANGLE_LL:
case SPGEMM_KK_TRIANGLE_LU: [[fallthrough]];
case SPGEMM_KK_TRIANGLE_LL: [[fallthrough]];
default: {
break;
}
Expand Down Expand Up @@ -461,7 +461,7 @@ void triangle_generic(KernelHandle *handle, typename KernelHandle::nnz_lno_t m,
}

break;
case SPGEMM_KK_TRIANGLE_IA_UNION:
case SPGEMM_KK_TRIANGLE_IA_UNION: [[fallthrough]];
case SPGEMM_KK_TRIANGLE_IA: {
if (create_lower_triangular) {
KokkosSparse::Impl::KokkosSPGEMM<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ void Trsm(const int NN, const int BlkSize, const int NumCols) {
// when m == n, lower upper does not matter (unit and nonunit)
double flop = 0;
switch (test) {
case 0:
case 0: [[fallthrough]];
case 1: flop = FlopCountLower(BlkSize, NumCols); break;
case 2:
case 3:
case 2: [[fallthrough]];
case 3: [[fallthrough]];
case 4: flop = FlopCountUpper(BlkSize, NumCols); break;
}
flop *= (N * VectorLength);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ void Trsm(const int NN) {
// when m == n, lower upper does not matter (unit and nonunit)
double flop = 0;
switch (test) {
case 0:
case 0: [[fallthrough]];
case 1: flop = FlopCountLower(BlkSize, NumCols); break;
case 2:
case 3:
case 2: [[fallthrough]];
case 3: [[fallthrough]];
case 4: flop = FlopCountUpper(BlkSize, NumCols); break;
}
flop *= (N * VectorLength);
Expand Down
2 changes: 2 additions & 0 deletions perf_test/sparse/KokkosSparse_sptrsv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ int test_sptrsv_perf(std::vector<int> tests, const std::string &lfilename,
#else
std::cout << "CUSPARSE not enabled: Fall through to defaults"
<< std::endl;
[[fallthrough]];
#endif
default:
kh.create_sptrsv_handle(SPTRSVAlgorithm::SEQLVLSCHD_TP1, nrows,
Expand Down Expand Up @@ -709,6 +710,7 @@ int test_sptrsv_perf(std::vector<int> tests, const std::string &lfilename,
#else
std::cout << "CUSPARSE not enabled: Fall through to defaults"
<< std::endl;
[[fallthrough]];
#endif
default:
kh.create_sptrsv_handle(SPTRSVAlgorithm::SEQLVLSCHD_TP1, nrows,
Expand Down
4 changes: 2 additions & 2 deletions sparse/impl/KokkosSparse_spgemm_impl_memaccess.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
cache_1_line_count);
}
} break;
case 2: hyper_thread_ind = 1;
case 2: hyper_thread_ind = 1; [[fallthrough]];
case 1: {
nnz_lno_t result_col_ind =
result_col + (hyper_thread_ind - 1) * b_col_cnt;
Expand Down Expand Up @@ -726,7 +726,7 @@ void KokkosSPGEMM<HandleType, a_row_view_t_, a_lno_nnz_view_t_,
hyper_thread_ind);
}
} break;
case 3:
case 3: [[fallthrough]];
case 4: {
nnz_lno_t row_color = vertex_colors(row);
// if (row_color < 0 || row_color >= num_multi_colors)
Expand Down

0 comments on commit 59e3f67

Please sign in to comment.