OpenMathLib / OpenMathLib/OpenBLAS

Element ordering of inner GEMM kernels

Open
#1,528 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
7.6k
Forks
1.7k
Avg merge
1d 3h
Merged PRs (30d)
42

Description

I'm working on optimizing the inner GEMM kernels for RISC-V. I'm confused about the way the arrays are arranged once S/DGEMMKERNEL is called. The array ba[] and bb[] arguments seem to be arranged such that ba[] is row major, and bb[] is column major, turning the matrix-multiply into a series of dot products.

Furthermore, elements of ba[] and bb[] are rearranged, such that a 2x2 (or whatever size) block of elements is arranged contiguously. I guess this is to improve locality?

Is there anyway to write the inner kernel such that it receives A[] and B[] in the same arrangement, (both row major or both column major), without element reordering? The RISC-V vector implementation makes it very simple to perform GEMM if the operands are arranged in this manner, since loads and stores of long arrays stored contiguously are optimized for.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining the inner GEMM kernel interface referenced by S/DGEMMKERNEL and the ba[], bb[], A[], and B[] layouts described in the issue. Compare the existing element reordering with the RISC-V vector implementation, and define whether accepting both operands in the same layout without reordering is feasible; done means a documented design decision or an agreed implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.