From 59e3f671dad9d4976e9810efdb83beea10709007 Mon Sep 17 00:00:00 2001 From: Carl Pearson Date: Thu, 11 Aug 2022 15:51:30 -0600 Subject: [PATCH] c++17: add [[fallthrough]] attribute --- graph/impl/KokkosGraph_Distance1Color_impl.hpp | 6 +++--- graph/impl/KokkosGraph_Distance2Color_impl.hpp | 4 ++-- graph/src/KokkosGraph_Distance1ColorHandle.hpp | 10 +++++----- graph/src/KokkosGraph_Distance2ColorHandle.hpp | 8 ++++---- graph/src/KokkosGraph_Triangle.hpp | 14 +++++++------- .../do-not-use/KokkosBatched_Test_Trsm_Cuda.cpp | 6 +++--- .../do-not-use/KokkosBatched_Test_Trsm_Host.hpp | 6 +++--- perf_test/sparse/KokkosSparse_sptrsv.cpp | 2 ++ sparse/impl/KokkosSparse_spgemm_impl_memaccess.hpp | 4 ++-- 9 files changed, 31 insertions(+), 29 deletions(-) diff --git a/graph/impl/KokkosGraph_Distance1Color_impl.hpp b/graph/impl/KokkosGraph_Distance1Color_impl.hpp index b767a095af..0f449a05a3 100644 --- a/graph/impl/KokkosGraph_Distance1Color_impl.hpp +++ b/graph/impl/KokkosGraph_Distance1Color_impl.hpp @@ -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_, @@ -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_, diff --git a/graph/impl/KokkosGraph_Distance2Color_impl.hpp b/graph/impl/KokkosGraph_Distance2Color_impl.hpp index 2c2f83f957..c620834591 100644 --- a/graph/impl/KokkosGraph_Distance2Color_impl.hpp +++ b/graph/impl/KokkosGraph_Distance2Color_impl.hpp @@ -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; diff --git a/graph/src/KokkosGraph_Distance1ColorHandle.hpp b/graph/src/KokkosGraph_Distance1ColorHandle.hpp index 0f5d60591f..81a90dfa58 100644 --- a/graph/src/KokkosGraph_Distance1ColorHandle.hpp +++ b/graph/src/KokkosGraph_Distance1ColorHandle.hpp @@ -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; diff --git a/graph/src/KokkosGraph_Distance2ColorHandle.hpp b/graph/src/KokkosGraph_Distance2ColorHandle.hpp index 766ae6c36a..5c7da7ffcd 100644 --- a/graph/src/KokkosGraph_Distance2ColorHandle.hpp +++ b/graph/src/KokkosGraph_Distance2ColorHandle.hpp @@ -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; diff --git a/graph/src/KokkosGraph_Triangle.hpp b/graph/src/KokkosGraph_Triangle.hpp index b9780a23c6..88f3fd5832 100644 --- a/graph/src/KokkosGraph_Triangle.hpp +++ b/graph/src/KokkosGraph_Triangle.hpp @@ -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_, @@ -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. @@ -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; } @@ -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< diff --git a/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Cuda.cpp b/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Cuda.cpp index 6000bc7c9d..188fe53982 100644 --- a/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Cuda.cpp +++ b/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Cuda.cpp @@ -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); diff --git a/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Host.hpp b/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Host.hpp index 0770055cb0..362a0814ed 100644 --- a/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Host.hpp +++ b/perf_test/batched/dense/do-not-use/KokkosBatched_Test_Trsm_Host.hpp @@ -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); diff --git a/perf_test/sparse/KokkosSparse_sptrsv.cpp b/perf_test/sparse/KokkosSparse_sptrsv.cpp index a27ed3f6d2..1dbfc490aa 100644 --- a/perf_test/sparse/KokkosSparse_sptrsv.cpp +++ b/perf_test/sparse/KokkosSparse_sptrsv.cpp @@ -307,6 +307,7 @@ int test_sptrsv_perf(std::vector 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, @@ -709,6 +710,7 @@ int test_sptrsv_perf(std::vector 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, diff --git a/sparse/impl/KokkosSparse_spgemm_impl_memaccess.hpp b/sparse/impl/KokkosSparse_spgemm_impl_memaccess.hpp index 29a9b5b870..4e99cc853b 100644 --- a/sparse/impl/KokkosSparse_spgemm_impl_memaccess.hpp +++ b/sparse/impl/KokkosSparse_spgemm_impl_memaccess.hpp @@ -691,7 +691,7 @@ void KokkosSPGEMM= num_multi_colors)