| 191 | } |
| 192 | |
| 193 | static void BM_FloatToBFloat16(int iters) { |
| 194 | testing::StopTiming(); |
| 195 | static const int N = 32 << 20; |
| 196 | const int64 tot = static_cast<int64>(iters) * N; |
| 197 | testing::ItemsProcessed(tot); |
| 198 | testing::BytesProcessed(tot * (sizeof(float) + sizeof(bfloat16))); |
| 199 | |
| 200 | float* inp = new float[N]; |
| 201 | bfloat16* out = new bfloat16[N]; |
| 202 | |
| 203 | testing::StartTiming(); |
| 204 | while (iters--) { |
| 205 | FloatToBFloat16(inp, out, N); |
| 206 | } |
| 207 | delete[] inp; |
| 208 | delete[] out; |
| 209 | } |
| 210 | BENCHMARK(BM_FloatToBFloat16); |
| 211 | |
| 212 | void RoundFloatToBFloat16(const float* src, bfloat16* dst, int64 size) { |
nothing calls this directly
no test coverage detected