tensor_benchmarks_sycl.cc
Go to the documentation of this file.
1 #ifdef EIGEN_USE_SYCL
2 
3 #include <CL/sycl.hpp>
4 #include <iostream>
5 
6 #include "tensor_benchmarks.h"
7 
8 cl::sycl::gpu_selector selector;
9 Eigen::QueueInterface queue(selector);
10 #define BM_FuncWithInput2DimsGPU(FUNC, D1, D2) \
11  static void BM_##FUNC##_##D1##x##D2(int iters, int N) { \
12  StopBenchmarkTiming(); \
13  Eigen::SyclDevice device(&queue); \
14  BenchmarkSuite<Eigen::SyclDevice, float> suite(device, D1, D2); \
15  suite.FUNC(iters); \
16  } \
17  BENCHMARK_RANGE(BM_##FUNC##_##D1##x##D2, 10, 10);
18 
19 BM_FuncWithInput2DimsGPU(rowReduction, 256, 100352);
20 BM_FuncWithInput2DimsGPU(rowReduction, 64, 100352);
21 BM_FuncWithInput2DimsGPU(rowReduction, 512, 25088);
22 BM_FuncWithInput2DimsGPU(rowReduction, 128, 25088);
23 BM_FuncWithInput2DimsGPU(rowReduction, 102, 6272);
24 BM_FuncWithInput2DimsGPU(rowReduction, 256, 6272);
25 BM_FuncWithInput2DimsGPU(rowReduction, 204, 1568);
26 BM_FuncWithInput2DimsGPU(rowReduction, 512, 1568);
27 BM_FuncWithInput2DimsGPU(rowReduction, 1024, 1568);
28 BM_FuncWithInput2DimsGPU(rowReduction, 2048, 1568);
29 
30 BM_FuncWithInput2DimsGPU(colReduction, 100352, 256);
31 BM_FuncWithInput2DimsGPU(colReduction, 100352, 64);
32 BM_FuncWithInput2DimsGPU(colReduction, 25088, 512);
33 BM_FuncWithInput2DimsGPU(colReduction, 6272, 102);
34 BM_FuncWithInput2DimsGPU(colReduction, 25088, 128);
35 BM_FuncWithInput2DimsGPU(colReduction, 6272, 256);
36 BM_FuncWithInput2DimsGPU(colReduction, 1568, 204);
37 BM_FuncWithInput2DimsGPU(colReduction, 1568, 512);
38 BM_FuncWithInput2DimsGPU(colReduction, 1568, 1024);
39 BM_FuncWithInput2DimsGPU(colReduction, 1568, 2048);
40 BM_FuncWithInput2DimsGPU(fullReduction, 1001, 1);
41 BM_FuncWithInput2DimsGPU(fullReduction, 2050048, 1);
42 BM_FuncWithInput2DimsGPU(fullReduction, 2097152, 1);
43 BM_FuncWithInput2DimsGPU(fullReduction, 2048, 1);
44 BM_FuncWithInput2DimsGPU(fullReduction, 262144, 1);
45 BM_FuncWithInput2DimsGPU(fullReduction, 256, 1);
46 BM_FuncWithInput2DimsGPU(fullReduction, 589824, 1);
47 BM_FuncWithInput2DimsGPU(fullReduction, 1024, 1);
48 BM_FuncWithInput2DimsGPU(fullReduction, 524288, 1);
49 BM_FuncWithInput2DimsGPU(fullReduction, 512, 1);
50 BM_FuncWithInput2DimsGPU(fullReduction, 2359296, 1);
51 BM_FuncWithInput2DimsGPU(fullReduction, 1048576, 1);
52 BM_FuncWithInput2DimsGPU(fullReduction, 131072, 1);
53 BM_FuncWithInput2DimsGPU(fullReduction, 16384, 1);
54 BM_FuncWithInput2DimsGPU(fullReduction, 9408, 1);
55 BM_FuncWithInput2DimsGPU(fullReduction, 64, 1);
56 BM_FuncWithInput2DimsGPU(fullReduction, 4096, 1);
57 BM_FuncWithInput2DimsGPU(fullReduction, 36864, 1);
58 BM_FuncWithInput2DimsGPU(fullReduction, 32768, 1);
59 BM_FuncWithInput2DimsGPU(fullReduction, 128, 1);
60 BM_FuncWithInput2DimsGPU(fullReduction, 147456, 1);
61 BM_FuncWithInput2DimsGPU(fullReduction, 65536, 1);
62 #define BM_FuncGPU(FUNC) \
63  static void BM_##FUNC(int iters, int N) { \
64  StopBenchmarkTiming(); \
65  Eigen::SyclDevice device(&queue); \
66  BenchmarkSuite<Eigen::SyclDevice, float> suite(device, N); \
67  suite.FUNC(iters); \
68  } \
69  BENCHMARK_RANGE(BM_##FUNC, 10, 5000);
70 
71 BM_FuncGPU(rowReduction);
72 BM_FuncGPU(colReduction);
73 BM_FuncGPU(fullReduction);
74 
75 BM_FuncGPU(memcpy);
76 BM_FuncGPU(typeCasting);
77 BM_FuncGPU(random);
78 BM_FuncGPU(slicing);
79 BM_FuncGPU(rowChip);
80 BM_FuncGPU(colChip);
81 BM_FuncGPU(shuffling);
82 BM_FuncGPU(padding);
83 BM_FuncGPU(striding);
84 BM_FuncGPU(broadcasting);
85 BM_FuncGPU(coeffWiseOp);
86 BM_FuncGPU(algebraicFunc);
87 BM_FuncGPU(transcendentalFunc);
88 // Contractions
89 #define BM_FuncWithInputDimsGPU(FUNC, D1, D2, D3) \
90  static void BM_##FUNC##_##D1##x##D2##x##D3(int iters, int N) { \
91  StopBenchmarkTiming(); \
92  Eigen::SyclDevice device(&queue); \
93  BenchmarkSuite<Eigen::SyclDevice, float> suite(device, D1, D2, D3); \
94  suite.FUNC(iters); \
95  } \
96  BENCHMARK_RANGE(BM_##FUNC##_##D1##x##D2##x##D3, 10, 5000);
97 
98 BM_FuncWithInputDimsGPU(contraction, N, N, N);
99 BM_FuncWithInputDimsGPU(contraction, 64, N, N);
100 BM_FuncWithInputDimsGPU(contraction, N, 64, N);
101 BM_FuncWithInputDimsGPU(contraction, N, N, 64);
102 
103 BM_FuncWithInputDimsGPU(contractionRowMajor, N, N, N);
104 BM_FuncWithInputDimsGPU(contractionRowMajor, 64, N, N);
105 BM_FuncWithInputDimsGPU(contractionRowMajor, N, 64, N);
106 BM_FuncWithInputDimsGPU(contractionRowMajor, N, N, 64);
107 
108 BM_FuncWithInputDimsGPU(contractionRowMajorAT, N, N, N);
109 BM_FuncWithInputDimsGPU(contractionRowMajorAT, 64, N, N);
110 BM_FuncWithInputDimsGPU(contractionRowMajorAT, N, 64, N);
111 BM_FuncWithInputDimsGPU(contractionRowMajorAT, N, N, 64);
112 
113 BM_FuncWithInputDimsGPU(contractionRowMajorBT, N, N, N);
114 BM_FuncWithInputDimsGPU(contractionRowMajorBT, 64, N, N);
115 BM_FuncWithInputDimsGPU(contractionRowMajorBT, N, 64, N);
116 BM_FuncWithInputDimsGPU(contractionRowMajorBT, N, N, 64);
117 
118 
119 BM_FuncWithInputDimsGPU(contractionRowMajorABT, N, N, N);
120 BM_FuncWithInputDimsGPU(contractionRowMajorABT, 64, N, N);
121 BM_FuncWithInputDimsGPU(contractionRowMajorABT, N, 64, N);
122 BM_FuncWithInputDimsGPU(contractionRowMajorABT, N, N, 64);
123 
124 // Convolutions
125 #define BM_FuncWithKernelDimsGPU(FUNC, DIM1, DIM2) \
126  static void BM_##FUNC##_##DIM1##x##DIM2(int iters, int N) { \
127  StopBenchmarkTiming(); \
128  Eigen::SyclDevice device(&queue); \
129  BenchmarkSuite<Eigen::SyclDevice, float> suite(device, N); \
130  suite.FUNC(iters, DIM1, DIM2); \
131  } \
132  BENCHMARK_RANGE(BM_##FUNC##_##DIM1##x##DIM2, 128, 5000);
133 
134 BM_FuncWithKernelDimsGPU(convolution, 7, 1);
135 BM_FuncWithKernelDimsGPU(convolution, 1, 7);
136 BM_FuncWithKernelDimsGPU(convolution, 7, 4);
137 BM_FuncWithKernelDimsGPU(convolution, 4, 7);
138 BM_FuncWithKernelDimsGPU(convolution, 7, 64);
139 BM_FuncWithKernelDimsGPU(convolution, 64, 7);
140 #endif
contractionRowMajor
void contractionRowMajor(const Device &device_, TensorIndex num_iters, TensorIndex m_, TensorIndex k_, TensorIndex n_)
Definition: tensor_contract_sycl_bench.cc:103
tensor_benchmarks.h
contraction
void contraction(const Device &device_, TensorIndex num_iters, TensorIndex m_, TensorIndex k_, TensorIndex n_)
Definition: tensor_contract_sycl_bench.cc:49
N
#define N
Definition: igam.h:9


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:05:25