The Linear-ADMM Halide code can compile and generate baremetal code in Linux and Windows build environments. But the same code fails in MacOS+clang14 environment.
Error report:
[4/6] Generating src/user-problem/ladmm_iter.[ah] with a custom command (wrapped by meson to set env)
FAILED: src/user-problem/ladmm_iter.a src/user-problem/ladmm_iter.h
env LD_LIBRARY_PATH=/Users/runner/work/ProxImaL/ProxImaL/proximal/halide/subprojects/Halide-10.0.0-x86-64-osx/lib /Users/runner/work/ProxImaL/ProxImaL/proximal/halide/build/src/user-problem/solver-generator -o /Users/runner/work/ProxImaL/ProxImaL/proximal/halide/build/src/user-problem -g ladmm_iter -e static_library,h,stmt_html machine_params=12,6291000,40 target=host auto_schedule=true -s Mullapudi2016 -p autoschedule_mullapudi2016 n_iter=1 mu=0.333 lmb=3.0
Assertion failed: (_z.defined() && "FuncTuple z_new is not defined."), function iterate, file linearized-admm.h, line 92.
The assertion that failed:
// src/algorithm/linearlized-admm.h
// Update z_i for i = 0..N .
const FuncTuple<N> Kv2 = K.forward(v_new);
FuncTuple<N> z_new;
{
for (auto&& [_z_new, _Kv2, _u, prox] : zip_view{z_new, Kv2, u, psi_fns}) {
Func Kv_u{"Kv_u"};
const auto vars = (prox.n_dim == 4) ? Vars{x, y, c, k} : Vars{x, y, c};
Kv_u(vars) = _Kv2(vars) + _u(vars);
_z_new = prox(Kv_u, 1.0f / lmb);
assert(_z_new.defined() && "FuncTuple z_new is not defined.");
}
}
Build environment:
C++ compiler for the host machine: c++ (clang 14.0.0 "Apple clang version 14.0.0 (clang-1400.0.29.202)")
C++ linker for the host machine: c++ ld64 820.1
Host machine cpu family: x86_64
Host machine cpu: x86_64
Possible root cause: In gcc and msvc, the variable _z_new is treated as C++ l-value (Func&), but in clang-14, it is treated as r-value Func&&. Thus, the z-update step appears to be immediately discarded, causing the ADMM iteration to fail during the codegen step.
Likely solution: Upgrade from Halide 10.0 to Halide >14.0, so as to match the MacOS+clang14 build environment.
The Linear-ADMM Halide code can compile and generate baremetal code in Linux and Windows build environments. But the same code fails in MacOS+clang14 environment.
Error report:
The assertion that failed:
Build environment:
Possible root cause: In gcc and msvc, the variable
_z_new
is treated as C++ l-value (Func&
), but in clang-14, it is treated as r-valueFunc&&
. Thus, the z-update step appears to be immediately discarded, causing the ADMM iteration to fail during the codegen step.Likely solution: Upgrade from Halide 10.0 to Halide >14.0, so as to match the MacOS+clang14 build environment.