OpenMathLib / OpenMathLib/OpenBLAS

AXPY looks bad especially on MacOS (M4)

Open
#5,230 5 comments 1 reaction 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 am doing some benchmarking on 2d convolution in octave and e.g. for simple benchmark like that:

r = ones (1, 5e4);
tic;  x1 = conv  (r, r);  time_row_conv  = toc

On MacOS (M4) the timing for OpenBLAS is 3.66 s), and for APPLE veclib it is 0.1 s.
On x86_64 linux (Ryzen 3950x) it is also a couple seconds (and pretty much the same as NETLIB).
I will try to get some other Blas on it eventually to compare.

The conv code essentially is:

    const F77_INT len = ma - mb + 1;  // Pre-calculate this value to avoid temporary
    for (F77_INT k = 0; k < na - nb + 1; k++) {
      for (F77_INT j = 0; j < nb; j++) {
        for (F77_INT i = 0; i < mb; i++) {
          double b_val = b[i + j*mb];
          daxpy_(&len, &b_val, &a[mb-i-1 + (k+nb-j-1)*ma], &one, &c[k*len], &one);
        }
      }
    }

and profiler shows that it all dominated by daxpy calls.

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 reproducing the reported 2-D convolution benchmark and profiling the convolution loop shown in the issue, focusing on its daxpy calls. Compare OpenBLAS results with Apple vecLib and the reported x86_64 behavior; done means identifying and resolving the performance problem, with benchmark evidence showing the improvement.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.