@@ -36,7 +36,10 @@ static void BM_fht2ids(benchmark::State &state, IsRecursive is_recursive) {
3636 int64_t (height * width * sizeof (float )));
3737}
3838
39- static void BM_fht2ds (benchmark::State &state, IsRecursive is_recursive) {
39+ enum class DAlgorithm { DS, DT };
40+
41+ static void BM_fht2d (benchmark::State &state, DAlgorithm algorithm,
42+ IsRecursive is_recursive) {
4043 int const height = state.range (0 );
4144 int const width = height;
4245 std::unique_ptr<float []> src_data{new float [height * width]};
@@ -60,13 +63,25 @@ static void BM_fht2ds(benchmark::State &state, IsRecursive is_recursive) {
6063
6164 auto const d_core = adrt::d<float >::create (src.as <float >());
6265
63- if (is_recursive == IsRecursive::No) {
64- for (auto _ : state) {
65- d_core.ds_non_recursive (dst.as <float >(), src.as <float >(), sign);
66+ if (algorithm == DAlgorithm::DS) {
67+ if (is_recursive == IsRecursive::No) {
68+ for (auto _ : state) {
69+ d_core.ds_non_recursive (dst.as <float >(), src.as <float >(), sign);
70+ }
71+ } else {
72+ for (auto _ : state) {
73+ d_core.ds_recursive (dst.as <float >(), src.as <float >(), sign);
74+ }
6675 }
6776 } else {
68- for (auto _ : state) {
69- d_core.ds_recursive (dst.as <float >(), src.as <float >(), sign);
77+ if (is_recursive == IsRecursive::No) {
78+ for (auto _ : state) {
79+ d_core.dt_non_recursive (dst.as <float >(), src.as <float >(), sign);
80+ }
81+ } else {
82+ for (auto _ : state) {
83+ d_core.dt_recursive (dst.as <float >(), src.as <float >(), sign);
84+ }
7085 }
7186 }
7287
@@ -103,7 +118,7 @@ static void BM_fht2idt(benchmark::State &state, IsRecursive is_recursive) {
103118 int64_t (height * width * sizeof (float )));
104119}
105120
106- #define TEST_ARG ->DenseRange (16 , 4096 , 16 )
121+ #define TEST_ARG ->DenseRange (1 , 4096 , 1 )
107122
108123// Register the function as a benchmark
109124BENCHMARK_CAPTURE(BM_fht2ids, recursive, IsRecursive::Yes) TEST_ARG;
@@ -114,8 +129,16 @@ BENCHMARK_CAPTURE(BM_fht2idt, recursive, IsRecursive::Yes) TEST_ARG;
114129
115130BENCHMARK_CAPTURE (BM_fht2idt, non_recursive, IsRecursive::No) TEST_ARG;
116131
117- BENCHMARK_CAPTURE (BM_fht2ds, recursive, IsRecursive::Yes) TEST_ARG;
132+ BENCHMARK_CAPTURE (BM_fht2d, ds_recursive, DAlgorithm::DS, IsRecursive::Yes)
133+ TEST_ARG;
134+
135+ BENCHMARK_CAPTURE (BM_fht2d, ds_non_recursive, DAlgorithm::DS, IsRecursive::No)
136+ TEST_ARG;
137+
138+ BENCHMARK_CAPTURE (BM_fht2d, dt_recursive, DAlgorithm::DT, IsRecursive::Yes)
139+ TEST_ARG;
118140
119- BENCHMARK_CAPTURE (BM_fht2ds, non_recursive, IsRecursive::No) TEST_ARG;
141+ BENCHMARK_CAPTURE (BM_fht2d, dt_non_recursive, DAlgorithm::DT, IsRecursive::No)
142+ TEST_ARG;
120143
121144BENCHMARK_MAIN ();
0 commit comments