OpenMathLib / OpenMathLib/OpenBLAS
Splitting gotoblas_t into parameters and kernels to re-use kernels between dynamic targets
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 7.6k
- Forks
- 1.7k
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 42
Description
This would greatly help with the competing demand of re-using our kernels between different cores with different parameters whilst not overly bloating the dynamic binary.
Looking at gotoblas_t (https://github.com/OpenMathLib/OpenBLAS/blob/develop/common_param.h#L1211), there are two parts, parameters such as:
int sgemm_p, sgemm_q, sgemm_r;
int sgemm_unroll_m, sgemm_unroll_n, sgemm_unroll_mn;
And function pointers, such as:
int (*sgemm_kernel )(BLASLONG, BLASLONG, BLASLONG, float, float *, float *, float *, BLASLONG);
int (*sgemm_beta )(BLASLONG, BLASLONG, BLASLONG, float, float *, BLASLONG, float *, BLASLONG, float *, BLASLONG);
The parameters take up far less space than all of the compiled kernels, so I'm proposing splitting gotoblas_t into openblas_kernels and openblas_params data structures. That would allow our dynamic logic to do something like this:
case NEOVERSEV1:
openblas_kernels = openblas_kernels_ARMV8SVE;
openblas_params = openblas_params_NEOVERSEV1;
This allows sensible defaults (such as the minimum cache size for a particular core should it not be queriable dynamically) without duplicating the kernels multiple times.
We can mark these with DYNAMIC_KERNELS and DYNAMIC_PARAMS in the Makefile, DYNAMIC_LIST would build both for all and DYNAMIC_ARCH would be our current favourites.
@martin-frbg, what do you think?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in common_param.h at gotoblas_t and trace the dynamic-target logic that selects kernels and parameters. Then inspect the Makefile definitions for DYNAMIC_KERNELS, DYNAMIC_PARAMS, DYNAMIC_LIST, and DYNAMIC_ARCH. Done means parameters and function pointers are separate structures, dynamic targets can combine shared kernels with target-specific parameters, and the existing build modes remain supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100