You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LIBINT2_OPT_AM=0 breaks the build: #cmakedefine drops zero-valued LIBINT_*_AM macros #445
Configuring with -DLIBINT2_OPT_AM=0 (scalar), or with a list whose maximum is 0 (e.g. -DLIBINT2_MAX_AM='2;1' -DLIBINT2_OPT_AM='0;0'), configures fine but the compiler fails to build:
src/bin/libint/build_libint.cc:601:34: error: use of undeclared identifier 'LIBINT_OPT_AM'
(line 601 on master, cparams->max_am_opt("default", LIBINT_OPT_AM);).
Cause
include/libint2/config.h.cmake.in declares the value with
#cmakedefine LIBINT_OPT_AM @LIBINT_OPT_AM@
#cmakedefine emits #define only when the CMake variable is true, and CMake treats 0 as false, so a zero value is written as /* #undef LIBINT_OPT_AM */. build_libint.cc then uses LIBINT_OPT_AM unconditionally (it is only #if defined-guarded for the _LIST variant).
The same #cmakedefine pattern is used for every LIBINT_<class>_MAX_AM and LIBINT_<class>_OPT_AM, so a user-specified 0 for any of them is silently dropped and the compiler falls back to the default (for MAX_AM this matters now that cmake/modules/int_am.cmake accepts 0, see #399). For OPT_AM, 0 is a legitimate request ("do not optimize/unroll anything") that currently cannot be expressed.
(with int_am.cmake setting the variable to -1 when it is not applicable), or guard the use in build_libint.cc with #if defined(LIBINT_OPT_AM). The first option also fixes the silent drop for the per-class _MAX_AM/_OPT_AM macros.
Found while verifying #399 with LIBINT2_ENABLE_GENERIC_CODE=ON (which needs a small opt AM to exercise the generic kernels).
Activity
config.h: preserve a value of 0 for the scalar LIBINT_*_MAX_AM/OPT_AM…
Merge origin/master into kshitij/feature/2e_rkb_ints