1 #ifndef THIRD_PARTY_EIGEN3_TENSOR_BENCHMARKS_H_
2 #define THIRD_PARTY_EIGEN3_TENSOR_BENCHMARKS_H_
5 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int
7 #include "unsupported/Eigen/CXX11/Tensor"
10 #define BENCHMARK_RANGE(bench, lo, hi) \
11 BENCHMARK(bench)->Range(lo, hi)
43 #ifdef EIGEN_USE_SYCL // warmup for sycl
59 if (
sizeof(
T) >=
sizeof(
int)) {
63 sizes[0] =
m_ *
sizeof(
T) /
sizeof(
int);
64 sizes[1] =
k_ *
sizeof(
T) /
sizeof(
int);
68 #ifdef EIGEN_USE_SYCL // warmup for sycl
87 #ifdef EIGEN_USE_SYCL // warmup for sycl
114 #ifdef EIGEN_USE_SYCL // warmup for sycl
116 C.slice(first_quadrant, quarter_sizes).device(
device_) =
117 A.slice(first_quadrant, quarter_sizes);
118 C.slice(second_quadrant, quarter_sizes).device(
device_) =
119 B.slice(second_quadrant, quarter_sizes);
120 C.slice(third_quadrant, quarter_sizes).device(
device_) =
121 A.slice(third_quadrant, quarter_sizes);
122 C.slice(fourth_quadrant, quarter_sizes).device(
device_) =
123 B.slice(fourth_quadrant, quarter_sizes);
128 C.slice(first_quadrant, quarter_sizes).device(
device_) =
129 A.slice(first_quadrant, quarter_sizes);
130 C.slice(second_quadrant, quarter_sizes).device(
device_) =
131 B.slice(second_quadrant, quarter_sizes);
132 C.slice(third_quadrant, quarter_sizes).device(
device_) =
133 A.slice(third_quadrant, quarter_sizes);
134 C.slice(fourth_quadrant, quarter_sizes).device(
device_) =
135 B.slice(fourth_quadrant, quarter_sizes);
150 #ifdef EIGEN_USE_SYCL // warmup for sycl
171 #ifdef EIGEN_USE_SYCL // warmup for sycl
198 #ifdef EIGEN_USE_SYCL // warmup for sycl
222 #if defined(EIGEN_HAS_INDEX_LIST)
223 Eigen::IndexPairList<Eigen::type2indexpair<0, 0>,
224 Eigen::type2indexpair<2, 1> > paddings;
230 #ifdef EIGEN_USE_SYCL // warmup for sycl
254 #ifndef EIGEN_HAS_INDEX_LIST
261 Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> >
strides;
264 #ifdef EIGEN_USE_SYCL // warmup for sycl
288 #ifndef EIGEN_HAS_INDEX_LIST
295 Eigen::IndexList<Eigen::type2index<1>,
int>
broadcast;
299 #ifdef EIGEN_USE_SYCL // warmup for sycl
320 #ifdef EIGEN_USE_SYCL // warmup for sycl
322 C.device(
device_) =
A *
A.constant(
static_cast<T>(3.14)) +
B *
B.constant(
static_cast<T>(2.7));
327 C.device(
device_) =
A *
A.constant(
static_cast<T>(3.14)) +
B *
B.constant(
static_cast<T>(2.7));
343 #ifdef EIGEN_USE_SYCL // warmup for sycl
345 C.device(
device_) =
A.rsqrt() +
B.sqrt() *
B.square();
350 C.device(
device_) =
A.rsqrt() +
B.sqrt() *
B.square();
365 #ifdef EIGEN_USE_SYCL // warmup for sycl
389 #ifndef EIGEN_HAS_INDEX_LIST
391 sum_along_dim[0] = 0;
395 Eigen::IndexList<Eigen::type2index<0>> sum_along_dim;
397 #ifdef EIGEN_USE_SYCL // warmup for sycl
399 C.device(
device_) =
B.sum(sum_along_dim);
404 C.device(
device_) =
B.sum(sum_along_dim);
423 #ifndef EIGEN_HAS_INDEX_LIST
425 sum_along_dim[0] = 1;
429 Eigen::IndexList<Eigen::type2index<1>> sum_along_dim;
431 #ifdef EIGEN_USE_SYCL // warmup for sycl
433 A.device(
device_) =
B.sum(sum_along_dim);
438 A.device(
device_) =
B.sum(sum_along_dim);
455 #ifdef EIGEN_USE_SYCL // warmup for sycl
473 contraction<static_cast<int>(
Eigen::ColMajor)>(num_iters,
false,
false);
477 contraction<static_cast<int>(
Eigen::RowMajor)>(num_iters,
false,
false);
481 contraction<static_cast<int>(
Eigen::RowMajor)>(num_iters,
true,
false);
485 contraction<static_cast<int>(
Eigen::RowMajor)>(num_iters,
false,
true);
498 kernel_sizes[0] = kernel_x;
499 kernel_sizes[1] = kernel_y;
502 result_sizes[0] =
m_ - kernel_x + 1;
503 result_sizes[1] =
n_ - kernel_y + 1;
508 #ifdef EIGEN_USE_SYCL // warmup for sycl
520 (
m_ - kernel_x + 1) * (
n_ - kernel_y + 1) * kernel_x * kernel_y * num_iters);
528 sizeA[0] = (trans_a ?
k_:
m_);
529 sizeA[1] = (trans_a ?
m_:
k_);
531 sizeB[0] = (trans_b ?
n_:
k_);
532 sizeB[1] = (trans_b ?
k_:
n_);
545 dims[0] =
DimPair(a_contract_dim, b_contract_dim);
546 #ifdef EIGEN_USE_SYCL // warmup for sycl
574 #if defined(EIGEN_USE_GPU) && defined(__CUDACC__)
578 #elif defined(EIGEN_USE_SYCL)
597 #endif // THIRD_PARTY_EIGEN3_TENSOR_BENCHMARKS_H_