COMP: Remove dead vendored netlib LAPACK; cherry-pick lsame into blas#6471
Conversation
No VNL class calls any LAPACK routine: vnl uses the older linpack (SVD/QR/ Cholesky) and eispack (eigensystems) paths, not LAPACK. The only LAPACK symbol reached from retained code is lsame_, called ~99x by BLAS; cherry-pick lsame.c/.h into blas/ and delete the rest of v3p/netlib/lapack (82 driver routines + ieeeck/ilaenv/izmax1). Drop the lone consumer test_qsvd (exercised sggsvd_, a generalized SVD no vnl class exposes). Prune the LAPACK entries from the mangle/unmangle/prototypes headers and the slartg/dlartg per-routine init calls. Build links and all 23 vnl_algo tests pass.
|
| Filename | Overview |
|---|---|
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/blas/lsame.c | New file: correct f2c translation of lsame_, but the 3-line provenance comment violates the 1-line/100-char in-source cap and contains a forbidden "deleted behavior" reference. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/blas/lsame.h | New file: prototype matches old lapack/util/lsame.h correctly, but the 2-line comment violates the in-source prose cap and references deleted behavior. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/CMakeLists.txt | Removes V3P_NETLIB_lapack_SOURCES group and its reference; adds lsame.c/lsame.h to V3P_NETLIB_blas_SOURCES. Mechanically correct. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h | Removes 82 LAPACK symbol defines; correctly retains lsame_ → v3p_netlib_lsame_ mapping. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_unmangle.h | Symmetric removal of 82 LAPACK #undef entries; retains lsame_ unmangle correctly. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_prototypes.h | Swaps lapack includes for blas/lsame.h; insertion at the top of the blas block is correct. |
| Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_init.c | Drops slartg/dlartg init calls that belonged to removed LAPACK sources; remaining slamch/dlamch inits are unaffected. |
| Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/CMakeLists.txt | Removes test_qsvd.cxx source and its add_test entry; consistent with dropping the sggsvd_ caller. |
| Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_driver.cxx | Removes DECLARE/REGISTER for test_qsvd; remaining registration list is consistent. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before
B_BLAS[blas/]
B_LAPACK[lapack/double + single + util/]
B_LAPACK_LSAME[lapack/util/lsame.c]
B_TEST[test_qsvd → sggsvd_]
B_LAPACK --> B_LAPACK_LSAME
B_BLAS -->|calls lsame_| B_LAPACK_LSAME
B_TEST -->|calls sggsvd_| B_LAPACK
end
subgraph After
A_BLAS[blas/]
A_BLAS_LSAME[blas/lsame.c cherry-picked]
A_BLAS -->|calls lsame_| A_BLAS_LSAME
end
B_LAPACK -->|82 drivers + 3 util removed| X[deleted]
B_TEST -->|test dropped| X
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
subgraph Before
B_BLAS[blas/]
B_LAPACK[lapack/double + single + util/]
B_LAPACK_LSAME[lapack/util/lsame.c]
B_TEST[test_qsvd → sggsvd_]
B_LAPACK --> B_LAPACK_LSAME
B_BLAS -->|calls lsame_| B_LAPACK_LSAME
B_TEST -->|calls sggsvd_| B_LAPACK
end
subgraph After
A_BLAS[blas/]
A_BLAS_LSAME[blas/lsame.c cherry-picked]
A_BLAS -->|calls lsame_| A_BLAS_LSAME
end
B_LAPACK -->|82 drivers + 3 util removed| X[deleted]
B_TEST -->|test dropped| X
Reviews (1): Last reviewed commit: "COMP: Remove dead vendored netlib LAPACK..." | Re-trigger Greptile
Removes the vendored netlib LAPACK tree from VNL (~248 files, −56k LOC). No VNL class calls any LAPACK routine — vnl uses the older linpack (SVD/QR/Cholesky) and eispack (eigensystems) paths. The single LAPACK symbol reached from retained code,
lsame_, is cherry-picked intoblas/. Advances the VNL pruning direction (#6403).What
lsameprovides for BLAS (why it's kept)lsame_(ca, cb)is a case-insensitive single-character equality test — the helper BLAS level-2/3 routines use to parse their option flags (TRANS∈{N,T,C},UPLO∈{U,L},DIAG,SIDE), so a caller may pass either case.blas/dgemm.c,dgemv.c,dtrmm.c,dtrsv.c, … call it ~99×. It is portable across character encodings (ASCII / EBCDIC / CDC), which is why it's ~120 lines rather than a one-liner. It has no dependencies of its own. Reference-LAPACK shipslsameas part of the BLAS reference, so relocating it intoblas/is the natural home; it merely lived underlapack/util/in netlib's f2c packaging.Why the rest of LAPACK is dead (verification)
core/vnl/**(the one apparent hit,vnl_real_eigensystem, only mentionsdgeevin a comment; it calls eispackrg_).blas/linpack/opt/eispack/sparse/linalg) calls any of the 82 LAPACK driver routines; onlylsame_is reached (by BLAS).test_qsvd(sggsvd_, a generalized SVD that no VNL class exposes) — dropped.ieeeck/ilaenv/izmax1(LAPACK util) had zero retained callers — removed.vnl_algotests pass without the removed files — the linker is the proof the drivers were dead.Change scope
git mv lapack/util/lsame.{c,h}→blas/(provenance comment added to both).v3p/netlib/lapack/(82 drivers + 3 util + headers).CMakeLists.txt: dropV3P_NETLIB_lapack_SOURCESgroup + reference; addlsametoV3P_NETLIB_blas_SOURCES.v3p_netlib_prototypes.h: drop the LAPACK include block; addblas/lsame.h.v3p_netlib_mangle.h/unmangle.h: prune 82 LAPACK symbol entries (keeplsame_).v3p_netlib_init.c: dropslartg/dlartgper-routine init calls.test_qsvd(source + driverDECLARE/REGISTER+add_test).