Skip to content

Commit

Permalink
Merge ginkgo-project#1736 Rename half helper
Browse files Browse the repository at this point in the history
This PR renames the half helper to make majority usage shorter.

Related PR: ginkgo-project#1736
  • Loading branch information
yhmtsai authored Dec 4, 2024
2 parents 0adecfb + b4a3a40 commit 1659ae5
Show file tree
Hide file tree
Showing 502 changed files with 2,498 additions and 3,059 deletions.
8 changes: 4 additions & 4 deletions benchmark/utils/formats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ using hybrid = gko::matrix::Hybrid<etype, itype>;
using csr = gko::matrix::Csr<etype, itype>;
using coo = gko::matrix::Coo<etype, itype>;
using ell = gko::matrix::Ell<etype, itype>;
using ell_mixed = gko::matrix::Ell<gko::next_precision<etype>, itype>;
using ell_mixed = gko::matrix::Ell<gko::next_precision_base<etype>, itype>;


/**
Expand Down Expand Up @@ -274,7 +274,7 @@ std::unique_ptr<gko::LinOp> matrix_factory(
check_ell_admissibility(data);
}
if (format == "ell_mixed") {
gko::matrix_data<gko::next_precision<etype>, itype> conv_data;
gko::matrix_data<gko::next_precision_base<etype>, itype> conv_data;
conv_data.size = data.size;
conv_data.nonzeros.resize(data.nonzeros.size());
auto it = conv_data.nonzeros.begin();
Expand All @@ -284,8 +284,8 @@ std::unique_ptr<gko::LinOp> matrix_factory(
it->value = el.value;
++it;
}
gko::as<gko::ReadableFromMatrixData<gko::next_precision<etype>, itype>>(
mat.get())
gko::as<gko::ReadableFromMatrixData<gko::next_precision_base<etype>,
itype>>(mat.get())
->read(conv_data);
} else {
gko::as<gko::ReadableFromMatrixData<etype, itype>>(mat.get())->read(
Expand Down
13 changes: 6 additions & 7 deletions common/cuda_hip/base/batch_multi_vector_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void scale(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(
GKO_DECLARE_BATCH_MULTI_VECTOR_SCALE_KERNEL);


Expand All @@ -81,7 +81,7 @@ void add_scaled(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(
GKO_DECLARE_BATCH_MULTI_VECTOR_ADD_SCALED_KERNEL);


Expand All @@ -101,7 +101,7 @@ void compute_dot(std::shared_ptr<const DefaultExecutor> exec,
x_ub, y_ub, res_ub, [] __device__(auto val) { return val; });
}

GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(
GKO_DECLARE_BATCH_MULTI_VECTOR_COMPUTE_DOT_KERNEL);


Expand All @@ -121,7 +121,7 @@ void compute_conj_dot(std::shared_ptr<const DefaultExecutor> exec,
x_ub, y_ub, res_ub, [] __device__(auto val) { return conj(val); });
}

GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(
GKO_DECLARE_BATCH_MULTI_VECTOR_COMPUTE_CONJ_DOT_KERNEL);


Expand All @@ -139,7 +139,7 @@ void compute_norm2(std::shared_ptr<const DefaultExecutor> exec,
x_ub, res_ub);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(
GKO_DECLARE_BATCH_MULTI_VECTOR_COMPUTE_NORM2_KERNEL);


Expand All @@ -156,8 +156,7 @@ void copy(std::shared_ptr<const DefaultExecutor> exec,
x_ub, result_ub);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE_WITH_HALF(
GKO_DECLARE_BATCH_MULTI_VECTOR_COPY_KERNEL);
GKO_INSTANTIATE_FOR_EACH_VALUE_TYPE(GKO_DECLARE_BATCH_MULTI_VECTOR_COPY_KERNEL);


} // namespace batch_multi_vector
Expand Down
6 changes: 3 additions & 3 deletions common/cuda_hip/base/device_matrix_data_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void remove_zeros(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_DEVICE_MATRIX_DATA_REMOVE_ZEROS_KERNEL);


Expand Down Expand Up @@ -112,7 +112,7 @@ void sum_duplicates(std::shared_ptr<const DefaultExecutor> exec, size_type,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_DEVICE_MATRIX_DATA_SUM_DUPLICATES_KERNEL);


Expand All @@ -127,7 +127,7 @@ void sort_row_major(std::shared_ptr<const DefaultExecutor> exec,
it + data.get_num_stored_elements(), vals);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_DEVICE_MATRIX_DATA_SORT_ROW_MAJOR_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/distributed/assembly_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void count_non_owning_entries(
num_parts, local_part, row_part_ptrs.get_data(), send_count.get_data());
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE_BASE(
GKO_DECLARE_COUNT_NON_OWNING_ENTRIES);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/distributed/matrix_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ void separate_local_nonlocal(
});
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE_BASE(
GKO_DECLARE_SEPARATE_LOCAL_NONLOCAL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/distributed/vector_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void build_local(
range_id.get_data(), local_mtx->get_values(), is_local_row);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_LOCAL_GLOBAL_INDEX_TYPE_BASE(
GKO_DECLARE_DISTRIBUTED_VECTOR_BUILD_LOCAL);


Expand Down
12 changes: 5 additions & 7 deletions common/cuda_hip/factorization/cholesky_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void symbolic_factorize(
postorder, postorder_parent, out_row_ptrs, out_cols);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_CHOLESKY_SYMBOLIC_FACTORIZE);


Expand Down Expand Up @@ -321,7 +321,7 @@ void forest_from_factor(
build_children_from_parents(exec, forest);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_CHOLESKY_FOREST_FROM_FACTOR);


Expand Down Expand Up @@ -355,8 +355,7 @@ void initialize(std::shared_ptr<const DefaultExecutor> exec,
transpose_idxs);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_DECLARE_CHOLESKY_INITIALIZE);
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_CHOLESKY_INITIALIZE);


template <typename ValueType, typename IndexType>
Expand Down Expand Up @@ -391,8 +390,7 @@ void factorize(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_DECLARE_CHOLESKY_FACTORIZE);
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_CHOLESKY_FACTORIZE);


template <typename ValueType, typename IndexType>
Expand Down Expand Up @@ -448,7 +446,7 @@ void symbolic_count(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_CHOLESKY_SYMBOLIC_COUNT);


Expand Down
10 changes: 5 additions & 5 deletions common/cuda_hip/factorization/factorization_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ void add_diagonal_elements(std::shared_ptr<const DefaultExecutor> exec,
mtx_builder.get_col_idx_array() = std::move(new_col_idx_array);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_FACTORIZATION_ADD_DIAGONAL_ELEMENTS_KERNEL);


Expand Down Expand Up @@ -385,7 +385,7 @@ void initialize_row_ptrs_l_u(
components::prefix_sum_nonnegative(exec, u_row_ptrs, num_rows + 1);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_FACTORIZATION_INITIALIZE_ROW_PTRS_L_U_KERNEL);


Expand Down Expand Up @@ -418,7 +418,7 @@ void initialize_l_u(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_FACTORIZATION_INITIALIZE_L_U_KERNEL);


Expand Down Expand Up @@ -446,7 +446,7 @@ void initialize_row_ptrs_l(
components::prefix_sum_nonnegative(exec, l_row_ptrs, num_rows + 1);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_FACTORIZATION_INITIALIZE_ROW_PTRS_L_KERNEL);


Expand Down Expand Up @@ -483,7 +483,7 @@ void initialize_l(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_FACTORIZATION_INITIALIZE_L_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/ic_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void sparselib_ic(std::shared_ptr<const DefaultExecutor> exec,
sparselib::destroy(desc);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_IC_SPARSELIB_IC_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/ilu_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void sparselib_ilu(std::shared_ptr<const DefaultExecutor> exec,
sparselib::destroy(desc);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_ILU_SPARSELIB_ILU_KERNEL);


Expand Down
6 changes: 2 additions & 4 deletions common/cuda_hip/factorization/lu_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ void initialize(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_DECLARE_LU_INITIALIZE);
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_LU_INITIALIZE);


template <typename ValueType, typename IndexType>
Expand Down Expand Up @@ -287,8 +286,7 @@ void factorize(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_DECLARE_LU_FACTORIZE);
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(GKO_DECLARE_LU_FACTORIZE);


template <typename IndexType>
Expand Down
4 changes: 2 additions & 2 deletions common/cuda_hip/factorization/par_ic_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void init_factor(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_IC_INIT_FACTOR_KERNEL);


Expand Down Expand Up @@ -144,7 +144,7 @@ void compute_factor(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_IC_COMPUTE_FACTOR_KERNEL);


Expand Down
4 changes: 2 additions & 2 deletions common/cuda_hip/factorization/par_ict_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ void add_candidates(std::shared_ptr<const DefaultExecutor> exec,
syn::value_list<int>(), syn::type_list<>(), exec, llh, a, l, l_new);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ICT_ADD_CANDIDATES_KERNEL);


Expand All @@ -457,7 +457,7 @@ void compute_factor(std::shared_ptr<const DefaultExecutor> exec,
syn::value_list<int>(), syn::type_list<>(), exec, a, l, l_coo);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ICT_COMPUTE_FACTOR_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/par_ilu_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void compute_l_u_factors(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ILU_COMPUTE_L_U_FACTORS_KERNEL);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void threshold_filter_approx(std::shared_ptr<const DefaultExecutor> exec,
&threshold, m_out, m_out_coo);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ILUT_THRESHOLD_FILTER_APPROX_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/par_ilut_filter_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void threshold_filter(std::shared_ptr<const DefaultExecutor> exec,
m_out_coo, lower);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ILUT_THRESHOLD_FILTER_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/par_ilut_select_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void sampleselect_count(std::shared_ptr<const DefaultExecutor> exec,
unsigned char* oracles, IndexType* partial_counts, \
IndexType* total_counts)

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(DECLARE_SSSS_COUNT);
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(DECLARE_SSSS_COUNT);


template <typename IndexType>
Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/par_ilut_select_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void threshold_select(std::shared_ptr<const DefaultExecutor> exec,
}
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ILUT_THRESHOLD_SELECT_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/par_ilut_spgeam_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void add_candidates(std::shared_ptr<const DefaultExecutor> exec,
u_new);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ILUT_ADD_CANDIDATES_KERNEL);


Expand Down
2 changes: 1 addition & 1 deletion common/cuda_hip/factorization/par_ilut_sweep_kernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void compute_l_u_factors(std::shared_ptr<const DefaultExecutor> exec,
u_csc);
}

GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE_WITH_HALF(
GKO_INSTANTIATE_FOR_EACH_VALUE_AND_INDEX_TYPE(
GKO_DECLARE_PAR_ILUT_COMPUTE_LU_FACTORS_KERNEL);


Expand Down
Loading

0 comments on commit 1659ae5

Please sign in to comment.