Split gotoblas dispatch table by group / operation (1/2) - #6087
Open
topolarity wants to merge 4 commits into
Open
topolarity wants to merge 4 commits into
topolarity wants to merge 4 commits into
Conversation
gotoblas dispatch table by group / operation (1/2)
No functional change. With DYNAMIC_ARCH the small-matrix kernel tables in interface/gemm*.c hold FUNC_OFFSET()s, which are offsets into gotoblas_t, and add them to gotoblas. Spell that base FUNC_BASE(func), next to FUNC_OFFSET(func), and reach it through GEMM_SMALL_KERNEL_BASE in the same way as the offsets themselves. This lets the kernels move out of gotoblas_t without interface/gemm*.c knowing where they went. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preparation for numbering the DYNAMIC_ARCH cores; nothing includes the header yet. dyn_cores.h holds one X-macro, OPENBLAS_CORE_LIST(X, arg), which expands to X(CORE, arg) for each core of the build, in sorted order and without duplicates. Makefile.system and cmake/arch.cmake each write it where they finish computing DYNAMIC_CORE. dyn_cores.h is written by the top-level make only - sub-makes inherit OPENBLAS_DYN_CORES - so that parallel sub-makes never rewrite it under a compile. It is emitted through $(HASH) because GNU Make 3.81 reads a literal '#' inside $(shell ...) as a comment. cmake rewrites it only when the list changes, and puts it in the build directory, which the kernel targets now have on their include path. A stale copy left in the source tree by make would shadow cmake's, so cmake refuses to configure with one there, as it already does for config_kernel.h. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
topolarity
force-pushed
the
ct/dispatch-split-prep
branch
from
October 2, 2026 00:55
02bef9d to
61d7286
Compare
Preparation for splitting the kernels out of gotoblas_t; nothing uses the
new macros yet.
* common_param.h numbers the cores of the build, OPENBLAS_CORE_<CORE>,
from OPENBLAS_CORE_LIST() in dyn_cores.h, and every core's gotoblas_t
records its number in the new "core" field.
* OPENBLAS_DISPATCH(group) is the running core's table for a group of
kernels, from the array openblas_<group>_dispatch[], indexed by
gotoblas->core. driver/others/dispatch.c will define those arrays,
with DEFINE_DISPATCH_TABLE(group). OPENBLAS_DISPATCH_OFFSET/_BASE do
for the offset tables of interface/gemm*.c what FUNC_OFFSET/FUNC_BASE
do today.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preparation for splitting the kernels out of gotoblas_t, later in this series. After that split, each core's kernel tables are defined together in setparam_<CORE>.o, and all the per-group arrays together in dispatch.o; a static link would keep all of them as soon as it kept any, and with them every kernel. Separate sections let --gc-sections keep only the groups a program calls. On its own this changes no static link size: every kernel is still reachable from gotoblas_t. Only for compilers known to accept the flags, and not for MSVC-style frontends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
topolarity
force-pushed
the
ct/dispatch-split-prep
branch
from
October 2, 2026 01:35
61d7286 to
f78159e
Compare
This branch has not been deployed
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.
This is a preliminary PR to prepare for splitting the monolithic
gotoblasdispatch table, to allow functions to be GC'd by the linker when linking statically with-Wl,--gc-sections. See #6088 for the motivation (smaller binaries).Changes (by commit) are:
*_KERNEL_BASE#define, to allow for per-kernel dispatch tables.dyn_cores.hto defineOPENBLAS_CORE_LISTmacro to enumerate the enabled cores for the build.dispatch.cand anenumto identify selected cores in each dispatch table.-ffunction-sections -fdata-sectionsto the build flags, so that-Wl,--gc-sectionsis effective once the dispatch table is split.This PR does not yet use the split dispatch table. It is populated and initialized in PR 2 of this stack, which is separated since the changes were largely generated by script.
Claude Opus 5.5 was used to prepare these changes. I have reviewed all code by hand.