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
refactor: keep the GPU warm-start path out of host-only translation units
populate_from_data_model_view() inlined both the GPU and CPU warm-start directions
in one if/else. The GPU direction is only reachable when handle != nullptr, but the
compiler instantiated both branches into every translation unit that included the
header -- dragging convert_to_gpu_warmstart, convert_to_cpu_warmstart and
pdlp_warm_start_data_t(view, stream) along with them.
Split into three pieces:
apply_warmstart_gpu_target() declared here, defined in libcuopt
apply_warmstart_cpu_target_with_device() declared here, defined in libcuopt
apply_warmstart_cpu_target() host-only, inline
selected by a kHostOnly template parameter dispatched with `if constexpr`. The
compile-time dispatch is the point: a host-only caller never *instantiates* the GPU
branch, so it emits no reference to it. A runtime `if` would still instantiate both
and leave the undefined symbols behind.
Note the two CPU-target variants. A kHostOnly caller has no device, so it cannot be
holding device-resident warm start and the host-only helper suffices. A normal caller
passing handle == nullptr *does* have a device (cython_solve.cu:181 does exactly
this), so its warm start may be device-resident and needs the D2H
convert_to_cpu_warmstart that the with_device variant performs. Collapsing these two
into one host-only helper silently drops the caller's warm start.
Also moves the trivial warm-start accessors -- which only hand back a reference and
allocate nothing -- into solver_settings_accessors.cpp so host-only consumers can
resolve them without pulling in the CUDA translation unit.
Deliberately NOT included: making solver settings constructible without CUDA. That
needs pdlp_warm_start_data_t to stop being a by-value member, and every mechanism for
that either breaks the deep-copy semantics settings rely on (they are copied per-solver
in run_concurrent and per-batch in batch mode) or requires hand-enumerating every
scalar field in a copy constructor. It belongs with the header-separation work, which
is already restructuring these types.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
0 commit comments