Skip to content

Commit

Permalink
Increase K tile size for small matrices. (iree-org#5213)
Browse files Browse the repository at this point in the history
This improves mobileBert by 6%
  • Loading branch information
ThomasRaoux authored Mar 23, 2021
1 parent f5804ec commit cf8180e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ static void getMaliBestMatMulTileSizes(
int64_t dstSize) {
const int64_t smallMatrixSizeThreshold = 512 * 512;
if (elementType.isF16()) {
// When the destination is smaller than the threshold, we prefer smaller
// tiles to increase parallelism.
// For smaller destination size we cannot fill out the GPU with bigger tile
// sizes. Instead we pick smaller tiles along M and N to increase the number
// of workgroups and a larger K tile size since we have lower pressure and
// need extra instructions to hide latency.
// TODO: The threshold needs to be fine tuned by doing exploration based on
// matrix shapes.
if (dstSize <= smallMatrixSizeThreshold) {
tileSizes.push_back(TileWorkgroupSizePair({{16, 32, 8}, {8, 2, 1}}));
tileSizes.push_back(TileWorkgroupSizePair({{16, 32, 16}, {8, 2, 1}}));
} else {
tileSizes.push_back(TileWorkgroupSizePair({{16, 64, 4}, {8, 2, 1}}));
tileSizes.push_back(TileWorkgroupSizePair({{8, 128, 4}, {8, 2, 1}}));
Expand Down

0 comments on commit cf8180e

Please sign in to comment.