Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/autoclose-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ permissions:

on:
pull_request_target:
branches: [never-run]
types:
- labeled

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/blis-macos-arm64-reproducer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: BLIS macOS arm64 reproducer

permissions:
contents: read

on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
numpy-reproducer:
runs-on: macos-15
strategy:
fail-fast: false
matrix:
blas_impl: [blis, openblas, newaccelerate]
steps:
- uses: actions/checkout@v6

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v2
with:
micromamba-version: "latest"
init-shell: bash

- name: Run numpy-only reproducer
shell: bash -el {0}
run: |
./build_tools/github/blis_reproducer/run_numpy_blas_reproducer.sh "${{ matrix.blas_impl }}"

c-reproducer:
runs-on: macos-15
needs: [numpy-reproducer]
steps:
- uses: actions/checkout@v6

- name: Build BLIS from source and run C reproducer
run: |
./build_tools/github/blis_reproducer/build_and_run_c_blis_reproducer.sh
1 change: 1 addition & 0 deletions .github/workflows/check-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ permissions:
# To bypass this check, label the PR with "No Changelog Needed".
on:
pull_request:
branches: [never-run]
types: [opened, synchronize, labeled, unlabeled]

jobs:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "CodeQL"

on:
push:
branches: [ "main", "*.X" ]
branches: [ "never-run" ]
pull_request:
branches: [ "main", "*.X" ]
branches: [ "never-run" ]
schedule:
- cron: '0 6 * * 1'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ name: Codespell

on:
push:
branches: [main]
branches: [never-run]
pull_request:
branches: [main]
branches: [never-run]

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cuda-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ permissions:
# 'CUDA CI' label.
on:
pull_request:
branches: [never-run]
types:
- labeled

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cuda-label-remover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ name: Remove "CUDA CI" Label
# trigger which has an API token with write access.
on:
pull_request_target:
branches: [never-run]
types:
- labeled

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ on:
- cron: "42 3 */1 * *"
push:
branches:
- main
# Release branches
- "[0-9]+.[0-9]+.X"
- never-run
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.X"
- never-run
# Manual run
workflow_dispatch:

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/labeler-module.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: "Pull Request Labeler"
on:
pull_request_target:
branches: [never-run]
types: [opened]

# Restrict the permissions granted to the use of secrets.GITHUB_TOKEN in this
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/labeler-title-regex.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Pull Request Regex Title Labeler
on:
pull_request_target:
branches: [never-run]
types: [opened, edited]

# Restrict the permissions granted to the use of secrets.GITHUB_TOKEN in this
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ permissions:
contents: read

on:
- pull_request
pull_request:
branches: [never-run]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ permissions:

on:
push:
branches: [never-run]
pull_request:
branches: [never-run]
schedule:
# Nightly build at 02:30 UTC
- cron: "30 2 * * *"
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ on:
- cron: "42 3 */1 * *"
push:
branches:
- main
# Release branches
- "[0-9]+.[0-9]+.X"
- never-run
pull_request:
branches:
- main
- "[0-9]+.[0-9]+.X"
- never-run
# Manual run
workflow_dispatch:

Expand Down
22 changes: 22 additions & 0 deletions build_tools/github/blis_reproducer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# BLIS macOS arm64 reproducers

This folder contains two independent reproducers for the macOS arm64 BLAS regressions:

- `numpy_blis_reproducer.py`: numpy-only reproducer that compares a GEMM-based pairwise distance computation against a pure numpy reference implementation and verifies the requested BLAS backend is actually used.
- `blis_gemm_reproducer.c`: pure C reproducer that calls `cblas_dgemm` and validates results against a scalar long-double reference loop.

## Run the numpy reproducer in dedicated BLAS envs

```bash
./build_tools/github/blis_reproducer/run_numpy_blas_reproducer.sh blis
./build_tools/github/blis_reproducer/run_numpy_blas_reproducer.sh openblas
./build_tools/github/blis_reproducer/run_numpy_blas_reproducer.sh newaccelerate
```

## Run the pure C reproducer with locally built BLIS

```bash
./build_tools/github/blis_reproducer/build_and_run_c_blis_reproducer.sh
```

The CI workflow `.github/workflows/blis-macos-arm64-reproducer.yml` runs both reproducers on macOS arm64.
105 changes: 105 additions & 0 deletions build_tools/github/blis_reproducer/blis_gemm_reproducer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>

enum CBLAS_ORDER { CblasRowMajor = 101, CblasColMajor = 102 };
enum CBLAS_TRANSPOSE { CblasNoTrans = 111, CblasTrans = 112, CblasConjTrans = 113 };

extern void cblas_dgemm(
enum CBLAS_ORDER order,
enum CBLAS_TRANSPOSE transa,
enum CBLAS_TRANSPOSE transb,
int m,
int n,
int k,
double alpha,
const double *a,
int lda,
const double *b,
int ldb,
double beta,
double *c,
int ldc
);

static double deterministic_value(int i, int j) {
return sin((double)(i + 1) * 0.173) + cos((double)(j + 1) * 0.113);
}

int main(void) {
const int m = 192;
const int n = 160;
const int k = 128;
const double alpha = 1.0;
const double beta = 0.0;
const double atol = 1e-11;
const double rtol = 1e-11;

double *a = calloc((size_t)m * (size_t)k, sizeof(double));
double *b = calloc((size_t)k * (size_t)n, sizeof(double));
double *c = calloc((size_t)m * (size_t)n, sizeof(double));
long double *c_ref = calloc((size_t)m * (size_t)n, sizeof(long double));

if (!a || !b || !c || !c_ref) {
fprintf(stderr, "allocation failure\n");
free(a);
free(b);
free(c);
free(c_ref);
return 2;
}

for (int i = 0; i < m; i++) {
for (int p = 0; p < k; p++) {
a[(size_t)i * (size_t)k + (size_t)p] = deterministic_value(i, p);
}
}
for (int p = 0; p < k; p++) {
for (int j = 0; j < n; j++) {
b[(size_t)p * (size_t)n + (size_t)j] = deterministic_value(p + 7, j + 11);
}
}

cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, a, k, b, n, beta, c, n);

long double max_abs_err = 0.0L;
long double max_rel_err = 0.0L;
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
long double acc = 0.0L;
for (int p = 0; p < k; p++) {
acc += (long double)a[(size_t)i * (size_t)k + (size_t)p] *
(long double)b[(size_t)p * (size_t)n + (size_t)j];
}
c_ref[(size_t)i * (size_t)n + (size_t)j] = acc;
long double diff = fabsl((long double)c[(size_t)i * (size_t)n + (size_t)j] - acc);
if (diff > max_abs_err) {
max_abs_err = diff;
}
long double denom = fabsl(acc);
if (denom < 1e-15L) {
denom = 1e-15L;
}
long double rel = diff / denom;
if (rel > max_rel_err) {
max_rel_err = rel;
}
}
}

printf("max_abs_err=%.6Le\n", max_abs_err);
printf("max_rel_err=%.6Le\n", max_rel_err);

free(a);
free(b);
free(c);
free(c_ref);

if (max_abs_err > atol && max_rel_err > rtol) {
fprintf(stderr, "FAIL: BLIS GEMM mismatch above tolerance\n");
return 1;
}

printf("PASS\n");
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
workdir="${RUNNER_TEMP:-/tmp}/blis-c-repro"
rm -rf "$workdir"
mkdir -p "$workdir"
cd "$workdir"

curl -L -o blis.tar.gz https://github.com/flame/blis/archive/refs/tags/1.1.tar.gz
tar -xzf blis.tar.gz
cd blis-1.1

./configure --enable-cblas auto
if command -v nproc >/dev/null 2>&1; then
n_jobs="$(nproc)"
else
n_jobs="$(sysctl -n hw.ncpu)"
fi
make -j"${n_jobs}"

lib_dir="$(find "$workdir/blis-1.1/lib" -mindepth 1 -maxdepth 1 -type d | head -n 1)"
if [[ -z "${lib_dir}" ]]; then
echo "Unable to locate BLIS library directory" >&2
exit 1
fi

arch_name="$(basename "$lib_dir")"
include_dir="$workdir/blis-1.1/include/$arch_name"
if [[ ! -d "$include_dir" ]]; then
include_dir="$workdir/blis-1.1/include"
fi

cblas_include="$workdir/blis-1.1/build"

cc \
-I"$cblas_include" \
-I"$include_dir" \
-I"$include_dir/blis" \
-I"$workdir/blis-1.1/include" \
-I"$workdir/blis-1.1" \
"${script_dir}/blis_gemm_reproducer.c" \
-L"$lib_dir" \
-lblis -lm \
-Wl,-rpath,"$lib_dir" \
-o "$workdir/blis_gemm_reproducer"

export BLIS_NUM_THREADS=8
"$workdir/blis_gemm_reproducer"
Loading
Loading