← Back to Pull requests

Use the VI scalars #192

Open
unknown opened this pull request with 263 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 30, 2026 13:57 UTC
Author

OK this is a very rough attempt to see how much the VI Scalar can buy us. The short story is we cut the number of forced synchronizations a lot at the cost of more kernel launches (for things like -α). One option to fix that would be to add some VI functions for sub(!!).

I also added some allocating spots to avoid synchronization for every single iteration of (re)orthogonalize.

Here's a summary of how this branch affects the sync counts and kernel launch counts:

eigsolve on CuArray linear operators, profiled with CUPTI (CUDA.@profile).

  • Operators: dense CuMatrix (n = 1024, 4096) and a matrix-free stencil (n = 10⁴, 10⁵, 10⁶).

  • Element types: Float32, Float64, ComplexF64.

  • Settings: krylovdim = 30, howmany = 4, maxiter = 4, tol = 1e-14. Lanczos targets :SR, Arnoldi :LR.

  • Columns: each row sums 15 cases (5 sizes × 3 types).

  • - "Copies to host" is the number of cuMemcpyDtoH calls. It is the reliable metric.
    - "Syncs" counts cuCtx/Stream/EventSynchronize calls. It varies slightly between runs because CUDA.jl sometimes waits on the same event twice.
    - "Kernels" is the number of device kernel launches.

    | Solver | Orth | Syncs main → branch | Copies to host main → branch | Change | Kernels main → branch |
    |---|---|---|---|---|---|
    | Lanczos | MGS2 | 24,324 → 2,189 | 22,230 → 1,995 | 11.1× fewer | 97,140 → 120,390 (+24%) |
    | Lanczos | CGS2 | 24,591 → 23,217 | 22,230 → 22,185 | ≈ same | 97,140 → 100,200 (+3%) |
    | Lanczos | CGSIR | 14,683 → 14,354 | 12,911 → 13,886 | +7.6% | 68,712 → 73,704 (+7%) |
    | Arnoldi | MGS2 | 47,893 → 3,647 | 41,741 → 2,994 | 13.9× fewer | 154,535 → 235,991 (+53%) |
    | Arnoldi | CGS2 | 45,069 → 44,256 | 41,741 → 41,696 | ≈ same | 154,535 → 154,655 (+0%) |
    | Arnoldi | CGSIR | 27,646 → 24,893 | 24,306 → 23,323 | 4% fewer | 100,235 → 101,367 (+1%) |

    We don't see much change for the CGS methods because I haven't addressed project!! yet. Will try that next. The changes in https://github.com/Jutho/KrylovKit.jl/pull/180 should also help a lot with project!!.

    Diff: 263 lines (+197 / -66) across 3 files Reviewer: kshyatt Review duration: 2043m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 263 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.334
    Real PR Conversation Timeline
    1 comments
    "Review active on #192"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.3% (MEDIUM) · Higher = larger blast radius
    39.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.9% · Safe to merge
    20.9%