Skip to content

Add LM precompile workload#32

Merged
sChoiKr merged 2 commits into
mainfrom
precompile
Jul 4, 2026
Merged

Add LM precompile workload#32
sChoiKr merged 2 commits into
mainfrom
precompile

Conversation

@sChoiKr

@sChoiKr sChoiKr commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a TensorKitchen-side precompile workload for the LM frontend so the first cpd(...; solver = :lm) and nncpd(...; solver = :lm) call no longer pays the large operator-path JIT cost at runtime.

What changed

  • add PrecompileTools as a dependency
  • load precompile.jl from src/TensorKitchen.jl
  • add a dedicated src/precompile.jl workload covering:
    • direct LM solve on canonical CP models
    • cpd(...; solver = :lm) with random init
    • cpd(...; solver = :lm, init = :alswarm)
    • nncpd(...; solver = :lm) with random init and ALS warm start
  • update CPD/NNCPD pipeline docs to mention :lm in the shared manifold-solver dispatch list
  • keep the public default solver on the RGD path

Why

The LM implementation itself was not spending most of its time in TensorKitchen callbacks. The main issue was first-call latency from JIT compilation along the Manopt nonlinear least-squares/operator path. This PR moves that cost into package precompilation so end users do not see a 40-50 second pause on the first LM call.

Validation

Fresh Julia process timings after precompile:

  • direct canonical LM solve on a (6,5,4) CP model: about 43s -> 0.15s
  • cpd(...; solver = :lm, init = :alswarm) on a (6,5,4) CP example: about 43s -> 0.18s
  • nncpd(...; solver = :lm, init = :alswarm) first call: about 0.28s

I did not rerun the full repository test suite in this PR flow.

@sChoiKr sChoiKr closed this Jul 4, 2026
@sChoiKr sChoiKr changed the title [codex] Add LM precompile workload Add LM precompile workload Jul 4, 2026
@sChoiKr sChoiKr reopened this Jul 4, 2026
@sChoiKr
sChoiKr marked this pull request as ready for review July 4, 2026 04:27
@sChoiKr
sChoiKr merged commit 1ec3450 into main Jul 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant