ARM64: Cortex-A72 DGEMM 6×8 microkernel and blocking - #5970
Open
hugomeiland wants to merge 4 commits into
Open
Conversation
TARGET=CORTEXA72 previously reused the A57 8x4 path. Add a dedicated 6x8 NEON ukernel, contiguous MR=6 panel packers (stock gemm_*copy_6 is 4+2), and UNROLL_M=6-aware TRSM kernels so HPL/dtrsm does not corrupt the heap. DTRMM falls back to generic 2x2 until a matching kernel exists. Co-authored-by: Cursor <cursoragent@cursor.com>
Give CORTEXA72 its own param.h block (UNROLL 6x8, P=120 Q=240, R=4096 shared-L2 / R=768 single-core), add it to DYNAMIC_CORE, and stop aliasing gotoblas_CORTEXA72 to A57 so DYNAMIC_ARCH can select the new kernels on MIDR 0xd08. Co-authored-by: Cursor <cursoragent@cursor.com>
DYNAMIC_ARCH builds CORTEXA72 as a separate kernel and pull dneg_tcopy from generic/neg_tcopy_$(DGEMM_UNROLL_M).c. Width 6 was missing (only 1/2/4/8/16 existed), which broke the arm64 Graviton Cirun and Azure DYNAMIC_ARM64 jobs. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Pushed a fix for the arm64 Graviton Cirun / DYNAMIC_ARCH build break:
Commit: 2b69faf |
Darwin's DYNAMIC_CORE only builds ARMV8/NEOVERSEN1/ARMV9SME/VORTEXM4, so an unconditional extern gotoblas_CORTEXA72 left Apple M builds with an undefined symbol. Mirror the CORTEXA57 Darwin alias. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Follow-up for the Apple M / Darwin DYNAMIC_ARCH linker failure ( Darwin's Commit: after this push on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TARGET=CORTEXA72/ DYNAMIC_ARCH MIDR0xd08currently aliases Cortex-A57 (KERNEL.CORTEXA57→dgemm_kernel_8x4.S, sharedparam.hincluding theNUM_CORES>8“server”DGEMM_Q=512path). That blocking is a poor fit for A72’s ~2 MiB L2 shared by a 4-core cluster (e.g. AWS Graviton1).This PR gives CORTEXA72 a dedicated DGEMM 6×8 path (BLIS-like MR×NR) plus measured panel blocking P=120 / Q=240 / R=4096 (R=768 when
NUM_CORES≤2).Measured HPL (AWS a1.metal, 16×1 MPI, grid 4×4, N=52000)
Residuals PASSED on all HPL runs used for the table.
Explored and not shipped as default:
What changed
kernel/arm64/dgemm_kernel_6x8_cortexa72.S— MR=6 NR=8; C inv8–v31; Av0–v2, Bv3–v6gemm_{t,n}copy_6_panel.c— contiguous MR=6 Goto packs (required; stockgeneric/gemm_*copy_6.cis a 4+2 clone and yields wrong residuals with a 6-wide ukernel)trsm_kernel_*_UNROLLM6.c— stock TRSM assumes power-of-2UNROLL_MviaGEMM_UNROLL_M_SHIFT/ bit masks; with M=6 that overruns packed buffers (free(): invalid next sizein HPL /cblas_dtrsm). Same idea as loongarch64*_UNROLLN6.cKERNEL.CORTEXA72— wire DGEMM/pack/TRSM; DTRMM falls back togeneric/trmmkernel_2x2.c(no 6×8 TRMM yet); NR=8 reusesdgemm_{n,t}copy_8.Sparam.h— CORTEXA72 split out of the A57 shared block;DGEMM_DEFAULT_UNROLL_{M,N}=6,8,P=120,Q=240,R=4096/768Makefile.system/cmake/arch.cmake— addCORTEXA72toDYNAMIC_COREdriver/others/dynamic_arm64.c—extern gotoblas_CORTEXA72instead of#define … gotoblas_CORTEXA57SGEMM/CGEMM/ZGEMM remain on the A57 kernels for now.
Test plan
make TARGET=CORTEXA72 USE_THREAD=0 NO_FORTRAN=1 NO_LAPACK=1 libssmoke build on arm64 (Apple host) — 6×8.S, panel packers, and UNROLLM6 TRSM objects compile and link intolibopenblas_cortexa72-*.aTARGET=CORTEXA72cblas/utest on an A72 hostNotes for reviewers
Tuning context from the arm-benchmarks research tree (private); happy to paste more kernel-cycle / NB sweeps if useful. Prefetch distances kept at the proven A57 values (
A_PRE=2560 B_PRE=448 C_PRE=128); schedule deviations measured on A72 mostly lost.Made with Cursor