Skip to content

Commit

Permalink
change some error
Browse files Browse the repository at this point in the history
  • Loading branch information
guodongliang committed Oct 29, 2024
1 parent ed17a38 commit 83010df
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/Native/test/benchmark_test/benchmark_ntt_gather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ void benchmark_ntt_gather_pack1d_dim0_contiguous() {
auto t1 = NttTest::get_cpu_cycle();
for (size_t i = 0; i < run_size; i++) {
ntt::gather<0>(pa, tb, pc);
asm volatile("" ::"g"(pc));
}
auto t2 = NttTest::get_cpu_cycle();
asm volatile("" ::"g"(pc));

constexpr size_t size = pc.elements().size();
std::cout << __FUNCTION__ << " took " << std::setprecision(1) << std::fixed
Expand Down Expand Up @@ -106,9 +106,9 @@ void benchmark_ntt_gather_pack1d_dim0_no_contiguous() {
auto t1 = NttTest::get_cpu_cycle();
for (size_t i = 0; i < run_size; i++) {
ntt::gather<0>(pa, tb, pc);
asm volatile("" ::"g"(pc));
}
auto t2 = NttTest::get_cpu_cycle();
asm volatile("" ::"g"(pc));

constexpr size_t size = pc.elements().size();
std::cout << __FUNCTION__ << " took " << std::setprecision(1) << std::fixed
Expand All @@ -131,7 +131,8 @@ void benchmark_ntt_gather_pack1d_dim1_contiguous() {
constexpr size_t N = 64;
constexpr size_t Period = 1;
using tensor_a_type = ntt::tensor<float, ntt::fixed_shape<M, N>>;
using tensor_b_type = ntt::tensor<size_t, ntt::fixed_shape<1, M / Period>>;
using tensor_b_type =
ntt::tensor<size_t, ntt::fixed_shape<1, M / P / Period>>;
using tensor_pa_type =
ntt::tensor<ntt::vector<float, P>, ntt::fixed_shape<M, N / P>>;
using tensor_pc_type = ntt::tensor<ntt::vector<float, P>,
Expand All @@ -154,9 +155,9 @@ void benchmark_ntt_gather_pack1d_dim1_contiguous() {
auto t1 = NttTest::get_cpu_cycle();
for (size_t i = 0; i < run_size; i++) {
ntt::gather<1>(pa, tb, pc);
asm volatile("" ::"g"(pc));
}
auto t2 = NttTest::get_cpu_cycle();
asm volatile("" ::"g"(pc));

constexpr size_t size = pc.elements().size();
std::cout << __FUNCTION__ << " took " << std::setprecision(1) << std::fixed
Expand All @@ -179,7 +180,8 @@ void benchmark_ntt_gather_pack1d_dim1_no_contiguous() {
constexpr size_t N = 64;
constexpr size_t Period = 2;
using tensor_a_type = ntt::tensor<float, ntt::fixed_shape<M, N>>;
using tensor_b_type = ntt::tensor<size_t, ntt::fixed_shape<1, M / Period>>;
using tensor_b_type =
ntt::tensor<size_t, ntt::fixed_shape<1, M / P / Period>>;
using tensor_pa_type =
ntt::tensor<ntt::vector<float, P>, ntt::fixed_shape<M, N / P>>;
using tensor_pc_type = ntt::tensor<ntt::vector<float, P>,
Expand All @@ -202,9 +204,9 @@ void benchmark_ntt_gather_pack1d_dim1_no_contiguous() {
auto t1 = NttTest::get_cpu_cycle();
for (size_t i = 0; i < run_size; i++) {
ntt::gather<1>(pa, tb, pc);
asm volatile("" ::"g"(pc));
}
auto t2 = NttTest::get_cpu_cycle();
asm volatile("" ::"g"(pc));

constexpr size_t size = pc.elements().size();
std::cout << __FUNCTION__ << " took " << std::setprecision(1) << std::fixed
Expand Down Expand Up @@ -248,9 +250,9 @@ void benchmark_ntt_gather_pack2d_dim0_contiguous() {
auto t1 = NttTest::get_cpu_cycle();
for (size_t i = 0; i < run_size; i++) {
ntt::gather<0>(pa, tb, pc);
asm volatile("" ::"g"(pc));
}
auto t2 = NttTest::get_cpu_cycle();
asm volatile("" ::"g"(pc));

constexpr size_t size = pc.elements().size() * P;
std::cout << __FUNCTION__ << " took " << std::setprecision(1) << std::fixed
Expand Down Expand Up @@ -294,9 +296,9 @@ void benchmark_ntt_gather_pack2d_dim1_contiguous() {
auto t1 = NttTest::get_cpu_cycle();
for (size_t i = 0; i < run_size; i++) {
ntt::gather<1>(pa, tb, pc);
asm volatile("" ::"g"(pc));
}
auto t2 = NttTest::get_cpu_cycle();
asm volatile("" ::"g"(pc));

constexpr size_t size = pc.elements().size() * P;
std::cout << __FUNCTION__ << " took " << std::setprecision(1) << std::fixed
Expand Down

0 comments on commit 83010df

Please sign in to comment.