mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Added benchmarks for type casting of float16
This commit is contained in:
parent
002824e32d
commit
93485d86bc
@ -48,12 +48,12 @@ template <typename Device, typename T> class BenchmarkSuite {
|
|||||||
Eigen::array<TensorIndex, 2> sizes;
|
Eigen::array<TensorIndex, 2> sizes;
|
||||||
sizes[0] = m_;
|
sizes[0] = m_;
|
||||||
sizes[1] = k_;
|
sizes[1] = k_;
|
||||||
const TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> A(a_, sizes);
|
const TensorMap<Tensor<int, 2, 0, TensorIndex>, Eigen::Aligned> A((int*)a_, sizes);
|
||||||
TensorMap<Tensor<int, 2, 0, TensorIndex>, Eigen::Aligned> B((int*)b_, sizes);
|
TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, sizes);
|
||||||
|
|
||||||
StartBenchmarkTiming();
|
StartBenchmarkTiming();
|
||||||
for (int iter = 0; iter < num_iters; ++iter) {
|
for (int iter = 0; iter < num_iters; ++iter) {
|
||||||
B.device(device_) = A.template cast<int>();
|
B.device(device_) = A.template cast<T>();
|
||||||
}
|
}
|
||||||
// Record the number of values copied per second
|
// Record the number of values copied per second
|
||||||
finalizeBenchmark(static_cast<int64_t>(m_) * k_ * num_iters);
|
finalizeBenchmark(static_cast<int64_t>(m_) * k_ * num_iters);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
BENCHMARK_RANGE(BM_##FUNC, 10, 5000);
|
BENCHMARK_RANGE(BM_##FUNC, 10, 5000);
|
||||||
|
|
||||||
BM_FuncGPU(memcpy);
|
BM_FuncGPU(memcpy);
|
||||||
//BM_FuncGPU(typeCasting);
|
BM_FuncGPU(typeCasting);
|
||||||
//BM_FuncGPU(random);
|
//BM_FuncGPU(random);
|
||||||
BM_FuncGPU(slicing);
|
BM_FuncGPU(slicing);
|
||||||
BM_FuncGPU(rowChip);
|
BM_FuncGPU(rowChip);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user