This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 1648 - Slow Tensor gemv vs Matrix
Summary: Slow Tensor gemv vs Matrix
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Tensor (show other bugs)
Version: 3.5 (future version)
Hardware: x86 - 64-bit Linux
: Normal Optimization
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-18 02:25 UTC by william.tambellini
Modified: 2019-12-04 18:17 UTC (History)
4 users (show)



Attachments
bench_matrix_vs_tensor.cpp (dec 17) (8.52 KB, text/x-c++src)
2018-12-18 02:25 UTC, william.tambellini
no flags Details

Description william.tambellini 2018-12-18 02:25:36 UTC
Created attachment 909 [details]
bench_matrix_vs_tensor.cpp (dec 17)

Unless I did something unfair for Tensors, Tensor gemv is significantly slower than Vector-Matrix gemv:

Example:
$ ./buildrun.sh 
Bench Eigen Matrix vs Tensor
Usage: program numberOfEigenThreads (default to 1)
GCC: 6.1.0
Eigen version: 3.3.90
Simd: SSE, SSE2
Eigen::nbThreads: 1
EIGEN_NO_DEBUG
EIGEN_VECTORIZE
EIGEN_HAS_OPENMP: 201511
omp_get_num_threads: 1

Gemv:
Repeat: 200
               N         EMatrix         ETensor
             256      0.00156261      0.00443656
             512      0.00572028       0.0179982
            1024        0.035893       0.0818175
            2048        0.329064        0.455825
            4096        0.906102         1.96649

That seems to be confirmed by TensorFlow which is today casting tensors to Matrix/VectorMap in order to do faster gemv : 
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/kernels/batch_matmul_op_impl.h
Comment 1 Nobody 2019-12-04 18:17:57 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1648.

Note You need to log in before you can comment on or make changes to this bug.