Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tensorOps benchmarks #180

Open
corbett5 opened this issue Jul 10, 2020 · 5 comments
Open

Add tensorOps benchmarks #180

corbett5 opened this issue Jul 10, 2020 · 5 comments

Comments

@corbett5
Copy link
Collaborator

Also examine using std::fma.

@rrsettgast
Copy link
Member

What did you have in mind for std::fma for device kernels?

@corbett5
Copy link
Collaborator Author

CUDA has a fma as well, just like cos and whatnot. I'm not sure it would be beneficial but worth checking out.

@rrsettgast
Copy link
Member

I suspect that it may force the compiler to recognize the fma operation, when it might miss it otherwise?? We are getting all sorts of DFMA instructions in our CUDA PTX, but I was pretty careful about checking that we are getting them when we expect.

@corbett5
Copy link
Collaborator Author

Yeah but it could be slower: https://stackoverflow.com/questions/34265982/automatically-generate-fma-instructions-in-msvc
For things like AiBi it is very applicable. But how you'd go about applying it to things like

dstSymMatrix[ 3 ] = matrixA[ 1 ][ 0 ] * symMatrixB[ 0 ] * matrixA[ 2 ][ 0 ] +
                        matrixA[ 1 ][ 0 ] * symMatrixB[ 5 ] * matrixA[ 2 ][ 1 ] +
                        matrixA[ 1 ][ 0 ] * symMatrixB[ 4 ] * matrixA[ 2 ][ 2 ] +
                        matrixA[ 1 ][ 1 ] * symMatrixB[ 5 ] * matrixA[ 2 ][ 0 ] +
                        matrixA[ 1 ][ 1 ] * symMatrixB[ 1 ] * matrixA[ 2 ][ 1 ] +
                        matrixA[ 1 ][ 1 ] * symMatrixB[ 3 ] * matrixA[ 2 ][ 2 ] +
                        matrixA[ 1 ][ 2 ] * symMatrixB[ 4 ] * matrixA[ 2 ][ 0 ] +
                        matrixA[ 1 ][ 2 ] * symMatrixB[ 3 ] * matrixA[ 2 ][ 1 ] +
                        matrixA[ 1 ][ 2 ] * symMatrixB[ 2 ] * matrixA[ 2 ][ 2 ];

might harm performance even if std::fma is fast because it limits the re-arranging the compiler can do.

@rrsettgast
Copy link
Member

without fma I count 27 fp operations.

dstSymMatrix[ 3 ] = matrixA[ 1 ][ 0 ] * ( symMatrixB[ 0 ] * matrixA[ 2 ][ 0 ] +
                                          symMatrixB[ 5 ] * matrixA[ 2 ][ 1 ] +
                                          symMatrixB[ 4 ] * matrixA[ 2 ][ 2 ] ) +
                    matrixA[ 1 ][ 1 ] * ( symMatrixB[ 5 ] * matrixA[ 2 ][ 0 ] +
                                          symMatrixB[ 1 ] * matrixA[ 2 ][ 1 ] +
                                          symMatrixB[ 3 ] * matrixA[ 2 ][ 2 ] ) +
                    matrixA[ 1 ][ 2 ] * ( symMatrixB[ 4 ] * matrixA[ 2 ][ 0 ] +
                                          symMatrixB[ 3 ] * matrixA[ 2 ][ 1 ] +
                                          symMatrixB[ 2 ] * matrixA[ 2 ][ 2 ] );

rearranging and using fma i count 12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants