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

Would you share the performance data? #2

Open
oscarriddle opened this issue Jun 6, 2019 · 3 comments
Open

Would you share the performance data? #2

oscarriddle opened this issue Jun 6, 2019 · 3 comments

Comments

@oscarriddle
Copy link

I tried to realize the matrix multiplication over batched 2D input matrix A with the same 2D matrix B.

By simply expand the gridDims.z, which seems the same way like you did, I find the computation become quite slow.

@salehjg
Copy link
Owner

salehjg commented Jun 7, 2019

Hi :D

I'm assuming you have [matrix A of batch size b] and [matrix B of batch size b].
how exactly can I help?
For the default matrix sizes, this is the nvvp timeline
batch-matmul-cuda(gtx1070).nvvp.zip

Just consider that this is not the fastest possible kernel for batch tiled-matrix-multiplication.

@salehjg
Copy link
Owner

salehjg commented Jun 7, 2019

btw, it might be the tile size or the block size that hinders fast multiplication.
It should be easier to track down performance issues for a given kernel and input configuration.

@oscarriddle
Copy link
Author

oscarriddle commented Jun 12, 2019

Hi, thanks for your reply.

I'm trying to design a fast batch tiled-mm kernel. In my circumstance, the batch means that multiple matrix A multiply with a single matrix B. Not multi-A multiply correspondingly with multi-B. I will take a deeper look into your idea :)

Thanks,


Here is my idea:

  1. First, complete the tiled MM by high efficient share memory size, then start the kernel with:
gridDim(DIVUP(CC, Tile_size), DIVUP(CH*CW, Tile_size), 1), 
blockDim(Tile_size, Tile_size)
  1. Above method realized a 2D MM with pretty good performance. Then I tried to do the batched As with single B, by utilizing the gridDims.z like below:
gridDim(DIVUP(CC, Tile_size), DIVUP(CH*CW, Tile_size), batch_size), 
blockDim(Tile_size, Tile_size)

The performance becomes not that good, so I wondered whether there exist some good ideas.

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

No branches or pull requests

2 participants