Toolchain: Remove OpenBLAS-based architecture detection - #7971
Conversation
|
Toolchain Quick Test failed because cmake.org is down. |
There was a problem hiding this comment.
🟡 Changes recommended
Preserve the existing MKL i386/ia32 mapping and clarify or restore the changed OpenBLAS fallback behavior.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Replaces OpenBLAS-based architecture probing with normalized uname -m detection and simplifies toolchain architecture handling.
Changes:
- Adds
SYSTEM_ARCHnormalization across toolchain installers. - Updates OpenBLAS target and fallback behavior.
- Removes obsolete OpenBLAS variables and probe script.
File summaries
| File | Summary |
|---|---|
toolchain/scripts/stage3/install_elpa.sh |
Uses normalized architecture for CPU feature detection. |
toolchain/scripts/stage2/install_openblas.sh |
Updates target selection and fallback behavior; fallback policy requires clarification. |
toolchain/scripts/stage2/install_mkl.sh |
Uses SYSTEM_ARCH; currently rejects i386 before the prior ia32 mapping. |
toolchain/scripts/stage1/install_openmpi.sh |
Uses normalized architecture for compatibility flags. |
toolchain/scripts/stage0/setup_buildtools.sh |
Removes the OpenBLAS architecture probe. |
toolchain/scripts/stage0/install_cmake.sh |
Selects CMake artifacts by system architecture. |
toolchain/scripts/package_versions.sh |
Removes OpenBLAS-dependent checksum selection. |
toolchain/scripts/get_openblas_arch.sh |
Removes the obsolete probe script. |
toolchain/scripts/common_vars.sh |
Defines normalized host architecture detection. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
40564f4 to
bbb1972
Compare
Additional runtime/benchmark evidenceUsing a reviewer-side validation copy that preserves this PR’s strategy but changes OpenBLAS to “build first, then install separately”:
evox3 DGEMM comparison:
SAI corrected dynamic results:
These results support keeping the new Follow-up on the pushed head |
bbb1972 to
a9309e9
Compare
There was a problem hiding this comment.
STALE / SUPERSEDED: this review targeted the earlier head. The current active review is 5325119623, which approves the pushed head after its build/install fixes.
Summary: Request changes
Supersedes my earlier review. Submitted PR reviews cannot be edited or dismissed by their author, so the obsolete Chinese summary remains visible. Please treat this English review as the active review; the corresponding Chinese inline comments have already been deleted.
I am not opposed to the direction here. Replacing OpenBLAS-derived architecture probing with uname -m, letting OpenBLAS auto-detect the CPU for native builds, and using DYNAMIC_ARCH=1 for non-native builds is a reasonable simplification. After fixing the build/install ordering, my validation shows that the new strategy works on AMD Zen5 and Intel Sapphire Rapids and selects sensible runtime kernels.
However, the current implementation is not mergeable: the native path builds OpenBLAS but never installs it, and the clean non-native path combines the first build and install in one make invocation, which fails with OpenBLAS 0.3.33. This is a core toolchain deliverable issue, not a style preference.
Runtime validation of the current patch
| Host | Run | Result |
|---|---|---|
| Local AMD Ryzen 9 3950X / Zen2 | native |
OpenBLAS build and tests pass, but there is no make install; install/openblas-0.3.33 is absent and the toolchain fails at install_successful |
| evox3 AMD Ryzen AI MAX+ 395 / Zen5 | native |
Same failure: build products remain in the source tree; libopenblas_cooperlakep-r0.3.33.so exists, but the install directory does not |
| SAI Intel Xeon w9-3575X / Sapphire Rapids | native |
Same failure |
| SAI Intel Xeon w9-3575X / Sapphire Rapids | generic |
Dynamic branch fails in about five seconds: Makefile.install:49: *** OpenBLAS: Please run "make" firstly. |
Reviewer-side two-stage build/install validation
For validation only, I changed OpenBLAS to run make first and then run make ... install separately. This is not a request to copy that exact diff.
With that temporary change:
- the full GNU toolchain succeeds locally;
- native OpenBLAS reports
core=ZEN; - ABACUS builds successfully;
- the Si2 PW SCF smoke test converges at
FINAL_ETOT_IS -215.5056984233572 eV; lddconfirms ABACUS links to the toolchain-installed OpenBLAS;- corrected
DYNAMIC_ARCHsucceeds on evox3 and selectsCooperlake; - corrected
DYNAMIC_ARCHsucceeds on SAI and selectsSapphireRapids.
So the strategy is worth preserving, but the implementation must be fixed first.
Blocking findings
- The native branch runs
makebut never runsmake ... install. - The non-native branch runs
make ... installfrom a clean tree; OpenBLAS must be built first and installed separately. - Before falling back from native to dynamic, the OpenBLAS source tree must be removed/re-extracted or otherwise reliably cleaned; native-generated metadata and objects can pollute the dynamic build.
- The PR description says the existing
DYNAMIC_ARCHfallback is preserved. That is inaccurate: the old fallback usedTARGET=NEHALEM, notDYNAMIC_ARCH. The non-native semantics are also changing from fixed targets to dynamic dispatch and must be stated explicitly. - Installation success should not be inferred solely from a
makereturn code. Check${pkg_install_dir}/lib/libopenblas*and${pkg_install_dir}/include/openblas_config.hbefore writinginstall_successful.
Minor / documentation
- The
--target-cpuhelp/docs need updating: every value other thannativenow usesDYNAMIC_ARCH; mappings such asbroadwell/skylake -> HASWELLhave been replaced. - If 32-bit MKL support remains intended,
uname -mcommonly reportsi686on 32-bit x86 Linux, noti386; normalizei?86 -> i386or explicitly document dropping 32-bit support. - A small clean-room CI/local check would be valuable: fresh native, fresh generic, artifact checks,
openblas_get_corename(), ABACUS build, and one minimal SCF.
Merge checklist
- fresh native build + install succeeds;
- fresh generic /
DYNAMIC_ARCHbuild + install succeeds; - native-to-dynamic fallback rebuilds from clean sources;
- installed tree contains shared library, headers, pkgconfig, and
install_successful; - ScaLAPACK/ELPA link against the installed OpenBLAS;
- ABACUS links the toolchain OpenBLAS and passes a minimal SCF;
- PR description says that the old NEHALEM fallback and fixed target mapping are replaced;
-
--target-cpudocumentation is updated.
80edf6b to
f1aedb9
Compare
There was a problem hiding this comment.
Follow-up review of f1aedb9
This review supersedes my two earlier
CHANGES_REQUESTEDreviews on the previous head. I cannot dismiss my own submitted reviews, so those stale review bodies remain visible; this current-head review is the active review.
Thanks for the update. The two build/install blockers from my earlier review are fixed: OpenBLAS now builds before running make install in both the native and dynamic paths, and the native-to-dynamic fallback runs make clean before the dynamic build.
I re-ran the current OpenBLAS installer from a clean tree on local AMD Zen2:
| Run | Result |
|---|---|
native |
Build + install succeeded in about 3 minutes; shared library, headers, and install_successful were present; openblas_get_corename() reported ZEN |
generic / DYNAMIC_ARCH=1 |
Build + install succeeded in about 9 minutes; shared library, headers, and install_successful were present; runtime reported Zen |
Together with the earlier multi-host benchmark results in my follow-up comment, this supports the new uname -m + OpenBLAS native/DYNAMIC_ARCH strategy.
Remaining items are non-blocking:
- The PR description still says the existing
DYNAMIC_ARCHfallback is preserved. That is inaccurate: the old fallback wasTARGET=NEHALEM, notDYNAMIC_ARCH. Please state that this PR changes non-native behavior from fixed target mapping to dynamic dispatch. --target-cpuhelp/docs should say that every value other thannativenow uses dynamic dispatch.- See the two inline non-blocking robustness suggestions: explicit OpenBLAS artifact checks and a non-empty CMake checksum guard.
|
All checks are green now. LGTM |
f1aedb9 to
006a413
Compare
Replace
OPENBLAS_ARCHwith a lightweight host architecture detection based onuname -m, normalizing only known equivalent names such asx86_64/amd64andaarch64/arm64.Also remove
OPENBLAS_LIBCOREandget_openblas_arch.sh. For native builds, OpenBLAS already performs its own CPU/core detection whenTARGETis not specified, while the existingDYNAMIC_ARCHfallback is preserved.This removes an unnecessary OpenBLAS download/probe from the early toolchain stages and simplifies the architecture handling.
See also cp2k/cp2k#6023.