Generated banner for Warp Compile Time Optimizer
Generated logo for Warp Compile Time Optimizer

Warp Compile Time Optimizer

NVIDIAOfficialCreated by Warp TeamDistributed by NVIDIA

  • Skill
  • Workflow
  • Software development
  • Apache-2.0
  • Medium risk
  • Has scripts

From the author

Use when compile time or startup time is the problem in code that uses Warp: a request to improve, optimize, or cut compile times; an app that is slow to start or stalls at the first wp.launch; seconds of compiling before real work begins; JIT modules recompiling on every run or every CI job. Only applies when the code being optimized uses Warp kernels. Not for steady-state kernel runtime, memory, correctness, building Warp itself from source, or nvcc/C++ build times.
— the description by Warp Team

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to identifying and resolving excessive compile times or startup delays in Warp-based applications. It focuses on isolating compilation bottlenecks, detecting redundant module builds, and optimizing module configuration to ensure efficient kernel generation. The process relies on a dedicated probe script to measure cold-start performance and identify specific mechanisms causing compilation churn, such as identity changes, redundant module options, or inefficient module boundaries.

What it does

  • Measures cold and warm compilation times using an isolated probe script.
  • Identifies redundant module builds caused by identity churn or configuration changes.
  • Provides guidance on aligning module lifecycles and options to prevent unnecessary recompilation.
  • Helps distinguish between structural compilation issues and runtime performance bottlenecks.
  • Offers a protocol for verifying optimizations through comparative analysis of launch topology and timing.
  • Supplies a framework for reporting measured improvements and trade-offs.

When to use it

  • When an application experiences significant delays before the first kernel launch.
  • When Warp modules are observed to recompile repeatedly across runs or CI jobs.
  • When optimizing startup latency for production environments.
  • When investigating why specific kernels or modules trigger unexpected build activity.

Advantages

  • Provides objective, data-driven insights into compilation costs.
  • Minimizes noise by isolating cache directories during measurement.
  • Offers clear, mechanism-based diagnostics to target specific build inefficiencies.
  • Ensures that optimizations preserve existing workload behavior and numerical accuracy.

Usage examples

“My application stalls for several seconds at the first wp.launch. How can I find out why?”
The agent will guide you to use the warp_compile_probe.py script to measure your command, identify which modules are recompiling, and check for identity churn or configuration issues.
“I suspect my Warp kernels are recompiling every time I run my tests. How do I fix this?”
The agent will help you analyze the probe output to determine if the cache is being reused correctly or if module options are being set after the module has already loaded.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/warp-compile-time-optimizer/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip warp-compile-time-optimizer.zip -d .agents/skills

Documentation by Warp Team

Warp cold-start compile time

Start with a runnable command

The probe runs the target in a subprocess, writes only to temporary directories, and needs no network, external tool servers, or Warp checkout.

ScriptPurposeArguments
scripts/warp_compile_probe.pyMeasure isolated cold/warm compilation and launches.measure [OPTIONS] -- COMMAND...; use --help.

Use run_script("scripts/warp_compile_probe.py", args=[...]) when supported; otherwise use the Python command below. The target must run to completion.

Compilation model

Warp compiles modules, not individual kernels. A module's identity is:

(live kernel & function set) x (module options) x (CUDA block_dim) x (generic instances)

Each identity requires code generation and native compilation for the full module.

Cold-start cost is roughly:

number of distinct module identities you touch  x  size of each module

Reduce it in two ways:

  1. Stop identity churn. A module that changes after loading compiles again.

  2. Stop source duplication. A module used at three block dimensions compiles every kernel three times.

Deleting one kernel from a module that still builds saves only part of one build. Removing an unnecessary module identity saves the full build.

When neither applies, overlap independent CUDA builds (CS-13). This changes when work happens, not how much is compiled, so judge it on elapsed time.

When a module's options are fixed

Options have two deadlines:

  1. Module creation (Python import). The module copies enable_backward, max_unroll, lineinfo, deterministic, deterministic_max_records, and compile_time_trace from warp.config. Setting a global later is silently ignored by that module. default_grid_stride is the exception.

  2. First load. Before compilation, change the existing module with wp.set_module_options() or wp.get_module(name).options. Changing an option after load creates a new identity and rebuilds the module (CS-3).

Missed deadlineSymptomCost
wp.config.* set after importhash unchanged, option silently absentthe entire benefit, invisibly
module options set after loada second hash, module builds twiceone extra build, visible in the trace

After changing an option, confirm the hash moved for every target module. An unchanged hash means the option never arrived.

Preserve behavior

Change how Warp compiles the code, not the workload.

Do not delete or merge kernels to claim a gain. Apparently redundant stages may preserve ownership, aliasing, retained outputs, numerical boundaries, or API behavior. Fix duplication at the module level.

Preserve every launch and its order, dimensions, dtypes, devices, block dimensions, gradients, numerical modes, dynamic/plugin behavior, and public API signatures. Keep kernel names when moving definitions to module scope because logs, cache artifacts, and external tools expose them.

Instructions

1. Find the real cost, and confirm it is compilation

Ask what command the user actually waits on, then measure it cold:

python scripts/warp_compile_probe.py measure --samples 3 \
    --json baseline.json -- <the user's command>

The probe gives each sample private WARP_CACHE_PATH, WARP_CACHE_ROOT, and CUDA_CACHE_PATH directories, enables module timers, and records launches. It creates those directories under the system temporary directory and removes them itself, so isolating a sample never requires writing a cache into the project or deleting anything to re-measure. Isolate a hand-rolled sample the same way. Never clear a live cache with wp.clear_kernel_cache() or wp.clear_lto_cache(); clearing is not isolated and can disrupt other processes.

Read the probe output before source. If compilation is a small part of wall time, report the real bottleneck and stop. For libraries and tests, use the smallest command that compiles the workload's modules.

Modules that each compiled once, with no repeated hashes, block-dimension variants, or LTO, have no structural churn. This rules out redundant builds, not oversized builds; still check cache reuse (CS-2), backward codegen (CS-10), unrolling (CS-11), the precompiled header (CS-12), and overlap when several CUDA modules remain (CS-13).

Every sample also re-runs the command against the cache it just populated. If warm module work is not near zero, diagnose cache reuse (CS-2) before changing module structure.

2. Ask about runtime tradeoffs when needed

Apply ordering fixes, lifecycle grouping, and option hoists without asking. Ask before changing fast_math, max_unroll, or a MathDx/tile implementation:

Some of these knobs cut compile time but can make the compiled kernels slower or change numerics. Are you optimizing a fast edit-run loop (where slower kernels are usually fine), or production startup (where they usually are not)?

If the user is unavailable:

  • Leave numerics-changing options and implementation swaps alone.

  • Before removing a capability such as backward codegen, test whether it is used; report what is removed, the measured benefit, and how to revert.

  • Set global wp.config.* options at application entry points, not in library code.

Record declined options and their measured benefits in the step 6 ledger.

Match the scope of the change to the scope of the evidence

A profile supports a change to the measured application, not every consumer of a shared library. Repository searches also miss out-of-tree and future callers. For example, a forward-only application does not justify disabling gradients inside a solver library that another application differentiates through.

Scope the option to the measured process, before importing the library:

import warp as wp

wp.config.enable_backward = False   # must precede the library import

import the_library

This also reaches every module the application loads. CS-10 covers the silent import-order trap. If only a library change works, send its maintainers the measurement and let them decide the contract.

3. Diagnose from the measurement, not from reading the source

The probe prints every compiled module identity with its name, hash, device, and block dimension, then names which modules built more than once. Match what you see:

What the probe showsWhat it meansWhere to look
One module name, several hashesIdentity churn: its kernel set, options, or generic instances changed after it first loadedCS-1, CS-3, CS-6
One module name, several block_dim valuesThe whole module is recompiled per block dimension (CUDA)CS-5
Many one-kernel modules in one featureFixed per-module cost repeatedCS-4
A hash-named module per kernelmodule="unique" used on stable kernelsCS-9
Big gap between module time and native compile time, plus .lto artifactsMathDx/LTO setupCS-7
(compiled) on a run that should have been warmCache is not being reusedCS-2
Modules load, then "Failed to find module"Concurrent CPU JIT first-use raceCS-8
Large generated source, no rebuild problemUnroll budgetCS-11
Adjoint code in a module nothing differentiatesBackward codegenCS-10
Compiles slow across the board, or a few small modules on CUDA below toolkit 13The precompiled header is turned off, or is not paying for itselfCS-12
Several independent modules, each built once, overlap_factor near 1.0Builds are running one at a time; parallel loading is off by defaultCS-13
An option you set changed nothing, and that module's hash is unchangedIt was assigned after the module was created, so it never arrived"When a module's options are fixed"
No row above firesNothing is being built redundantly; the cost is the size of the builds themselvesStep 6

references/mechanisms.md has one section per mechanism: how to confirm it, the fix, its limits, and its failure mode. Read only the sections selected by the measurement.

4. Choose module boundaries deliberately

Group kernels in one module only when they share:

  • lifecycle: they are defined, loaded, and invalidated together;

  • option set: they need the same fast_math, enable_backward, max_unroll, and MathDx settings;

  • stable block dimension on CUDA.

Kernels with the same lifecycle but different stable block dimensions should not share a module because each would compile twice. Separate kernels with independent lifecycles too.

Kernels whose block dimension varies at runtime (chosen from input size, say) have no stable mapping, so keep them in their own module rather than dragging a whole shared module into an extra variant.

Prefer the least invasive change that removes a build. Ordering fixes and option hoists are cheaper and safer than re-architecting module layout; regroup only when fixed per-module cost or block-dimension duplication dominates.

wp.set_module_options() targets its calling Python module, not kernels with an explicit module="pkg.name". Either use a real Python module or update the named module before it loads:

wp.set_module_options({"enable_backward": False})  # at module scope

wp.get_module("pkg.name").options.update({"enable_backward": False})

Do not pass wp.get_module() to wp.set_module_options(module=...), or use @wp.kernel(module_options={...}) without module="unique". Per-kernel enable_backward=False has a tile-module exception covered by CS-10. Confirm the module hash after every option change.

5. Verify
python scripts/warp_compile_probe.py measure --samples 3 \
    --json candidate.json -- <the same command>
python scripts/warp_compile_probe.py compare baseline.json candidate.json

compare rejects changed launch topology and treats a result inside max(1% of baseline, 2 x baseline MAD) as inconclusive.

For BUILDS OVERLAPPED, judge scheduling changes on compile elapsed rather than summed module timers. The required warm pass supplies that clock. See references/measurement.md.

Then check what the probe cannot see:

  • Diff numeric output and run the project's tests or entry points.

  • After changing enable_backward or boundaries, verify a gradient path.

  • After changing fast_math, max_unroll, MathDx, or an implementation, benchmark steady-state runtime.

  • Exercise uncovered dynamic kernels, dtypes, profiles, and modes.

6. Report results

Read "Reporting results" in references/measurement.md. Report:

Describe every optimization in plain language: name the behavior, the evidence, and the effect. For example, write "moved module options before the first load to avoid a redundant rebuild," not "applied CS-3." Treat CS-* labels as internal navigation aids, not user-facing explanations.

OptionMeasuredWhy not takenTo take it
enable_backward=False on pkg.solver−38% colda live tape traverses these kernelsset at the entry point, then re-check adjoints
max_unroll=4−2%, inside noisechanges generated code for no measured gain—
  • before/after medians and sample counts;

  • the reduction and residual cost, sized against the original complaint;

  • mechanisms fixed, ruled out, measured and declined, or not reached;

  • tradeoffs and behavior not verified;

  • the ledger above for declined or incompletely verified options;

  • the measured value of relaxing any constraint that blocked a fix.

State only what the evidence supports. "No structural churn" does not mean "optimal" or "irreducible." Measure declined levers when practical; label any estimate untested. Before reporting no available fix, check CS-13. For a possible module split, first measure a one-kernel module with the same options to establish the repeated fixed cost.

Troubleshooting

Run the target command directly before debugging the probe. See references/measurement.md for cache/noise issues and references/mechanisms.md for mechanism-specific failures.

Limitations

Two rules override any gain:

  • Isolate both Warp and CUDA caches for every cold sample.

  • Keep max_workers <= 1 when a load can target CPU, including device=None and mixed device lists. Concurrent CPU first loads can lose kernels; retries do not make them safe. CUDA-only loading is unaffected.

Measurements are environment-specific: cold times move with CPU, GPU, driver, toolchain, and Warp version. Mechanisms transfer; numbers do not. Read the known unknowns in references/mechanisms.md before making broad claims.

Reference files

  • references/mechanisms.md: the thirteen compile-time mechanisms, each with its confirming signal, fix, applicability limits, and failure mode. Read the sections your measurement points to.

  • references/measurement.md: measurement protocol, what each metric does and does not mean, reporting guidance, log examples, and manual measurement.

Files

references/measurement.md

Measuring Warp cold compilation

Read this when the probe does not fit the application, when you need to explain a number, or when a result looks too good.

What the probe does

scripts/warp_compile_probe.py measure runs a command in a subprocess with:

  • fresh directories for WARP_CACHE_PATH, WARP_CACHE_ROOT, and CUDA_CACHE_PATH;

  • warp.config.verbose = True for module and compiler timers;

  • a wrapped warp.launch that records each kernel, module, dim, device, dtypes, block dimension, and adjoint flag.

Instrumentation is injected as a sitecustomize module on PYTHONPATH, so it works with python -m pkg, python script.py, uv run, and test runners. It chains to any existing sitecustomize without writing into the project.

Each sample then re-runs the command against the cache it just populated. That warm pass is not optional, because two things depend on it: distinguishing expensive cold compilation from compilation repeated on every run, and supplying the warm wall term that compile elapsed is derived from. --warm is still accepted so older commands keep working, but it does nothing.

compare diffs two reports: launch topology first, then cold module work against a noise band, then structural counts.

What each metric means

Cold module work: the sum of Warp's per-module timers for events marked (compiled). It excludes process startup, imports, and data loading. This is the primary number for a change to what gets built, and the wrong number for a change to when it gets built — see "Two clocks" below.

Compile elapsed: cold wall clock minus warm wall clock. The warm pass runs the same command against a populated cache, so startup, imports, and the workload appear in both and cancel, leaving the elapsed time attributable to compilation. Unlike the sum of per-module timers, it cannot double-count builds that overlapped, so it is the number a user actually waits on.

Native compile time: the sum of Warp's Compile x86 / Compile CUDA timer lines. The share of cold module work spent inside the native toolchain.

The remainder (cold module work minus native compile time) is not "code generation time." It includes source and metadata I/O, cache installation, binary loading, and LTO work. Module hashing happens before the timer starts and is not in either number. A large remainder alongside .lto artifacts is the MathDx signature (CS-7); a large remainder otherwise is not self-explaining.

Module identities: distinct (module, device, block_dim) triples that compiled. Unlike timing, this count does not vary with machine load.

Generated source bytes: total .cpp and .cu bytes in the cache. Use this to corroborate timing inside the noise band.

LTO artifact count: .lto files left in the cache. This discrete count shows whether a tile-workload change reached the linker, often moving from 3 to 1 or 1 to 0.

Warm module work: the same command re-run against the populated cache. Near zero means compilation is a cold-start-only cost.

Launches: the ordered topology used to verify that the workload did not change.

Two clocks, and when each one lies

Warp reports one duration per module. Summing them measures work and is stable against machine load, which is why it is the default. But a sum assumes the builds did not run at the same time. When they overlap, each module's timer absorbs the others' contention, so the sum grows while the elapsed time falls.

The result is that a change which compiles the same code concurrently instead of serially looks like a large regression on cold module work and a large improvement on the clock. Both numbers are correctly measured; they answer different questions.

The probe reports BUILDS OVERLAPPED when summed module time exceeds compile elapsed by more than 15%, and compare refuses to call a slowdown a regression when the launches, module identities, and generated source bytes are all unchanged — identical artifacts mean nothing extra was built, so the extra time is contention, not work. In that state it judges the change on compile elapsed.

Which to report:

Your change altersHeadlineWhy
what gets compiled (kernel set, options, boundaries)cold module workwork really changed; stable against load
when or how builds are scheduled (preloading, concurrency)compile elapsedthe sum double-counts overlap

When you report elapsed, carry the structural counts with it — identical identities, hashes, and generated source bytes are what prove no work was added.

Two diagnoses the probe reports directly

CACHE NOT REUSED: the warm pass still costs most of the cold pass. The application is discarding its own compiled kernels between runs, and no amount of module restructuring will help. See CS-2.

LINK-DOMINATED BUILD: most module time is outside the native compiler and .lto artifacts are present. The build is bounded by device-code linking for tile operations. See CS-7, and check enable_backward first (CS-10) because adjoint tile operations need their own links.

Reading the module log directly

Warp prints, with warp.config.verbose = True:

Module <name> <hash> load on device '<device>' (block_dim=<n>) took <ms> ms (compiled|cached|error)
Compile CUDA (<details>) took <ms> ms

The hash is the useful field. Two events with the same name and different hashes mean the module's kernel set, options, or generic instances changed after its first load. Same hash at different block_dim values means CUDA per-block-dimension duplication.

Three common shapes, shown as time, device, block dimension, hash, and name:

# Identity churn: one name and block dimension, several hashes (CS-1/3/6).
312.44  cuda:0  256  6eb476a  app.filters
289.10  cuda:0  256  17e6601  app.filters

# Block-dimension duplication: one name and hash, several dimensions (CS-5).
361.16  cuda:0  128  9004220  app.stages
357.95  cuda:0  256  9004220  app.stages

# Nothing structural: one identity, no variants or LTO.
1772.27  cpu    1    b1faa06  __main__

The first two can cost the same number of builds but require different fixes. The third rules out redundant builds, not oversized generated code.

Protocol

  • Use a fresh cache for each cold sample. Reused artifacts invalidate the measurement.

  • Isolate both cache layers on CUDA. Setting WARP_CACHE_PATH alone leaves the driver cache at ~/.nv/ComputeCache donating PTX-to-SASS results, which can hide a difference. Set CUDA_CACHE_PATH too.

  • At least three cold samples; five if you are reporting a small effect.

  • Same machine, same device, same Warp version for every arm.

  • Report median and MAD because build times have outliers.

  • Interleave baseline and candidate runs. Block ordering on a busy machine can turn drift into an apparent effect.

  • Never carry an absolute millisecond figure from one machine to another.

The noise band

band = max(0.01 * baseline_median, 2 * baseline_MAD)

A change smaller than the band is inconclusive.

At small magnitudes, a percentage band is meaningless. One percent of a 1.5 ms warm measurement is 15 microseconds, far below host jitter, so such a band can flag noise as a regression. Below a few milliseconds, prefer compiled event counts, module identities, or LTO artifacts.

Verifying the workload, in order

  1. Launch topology. compare does this automatically and is the fastest check. Order, count, dim, dtypes, device, and block dimension must all match. It keys on structure rather than kernel name, because moving a kernel from a closure to module scope may rename it. Keep the original name for external tooling.

  2. Numeric output. Run the project's own tests or entry points and diff against the baseline output.

  3. Gradients. If you touched enable_backward or moved kernels between modules, exercise a wp.Tape path and check the adjoints. A broken adjoint is silent. Note that a function returning a NumPy array can still have recorded launches on a tape.

  4. Steady-state runtime. Required if you touched fast_math, max_unroll, MathDx, or swapped an implementation. Cold-compile measurement is blind to a kernel you made slower.

  5. Uncovered paths. Re-run modes, dtypes, profiles, and dynamic paths your measured command did not exercise.

Measure the thing you changed

Two common measurement mistakes:

Timing a wrapper instead of a kernel. A function that allocates device arrays and returns NumPy can spend several times the kernel's own cost on transfers. One measured case had a 2.9x kernel slowdown that was nearly invisible end to end. Time the launch, or make the wrapper's overhead small relative to the work, before concluding a swap was free.

Reading source instead of build output. On a tile module, @wp.kernel(enable_backward=False) removes adjoint source while leaving the adjoint device-code links in place. The generated .cu looks identical to the module-option version, so check LTO artifacts or build time instead (CS-10).

Verify at the layer your change affects. Compilation structure appears in module events; caching appears in the warm pass; generated device code appears in artifacts and runtime.

When a result looks too good

For a large reduction, check:

  • Did the launch topology change? A dropped launch is the usual cause.

  • Did the caches actually stay isolated between arms, both layers?

  • Did the run exit non-zero, or fewer modules compile because something failed early?

  • Did work move into a prewarm step or an unmeasured first request?

  • Did a fallback silently replace a required implementation?

A verified 5% is worth more than an unverified 80%.

When cold time does not improve

A cache fix shows no cold-time improvement because cold work is unchanged. The improvement is that compilation now happens once instead of every invocation, and it appears in the warm pass and in end-to-end time across repeated runs. Report that measure instead of the cold comparison.

Similarly, on CPU a large fixed toolchain cost dominates every run, so a real structural fix can show a small percentage. Removing three of four module builds can be an 8% improvement if the toolchain accounts for the remaining 92%.

Reporting results

Report before/after medians, sample counts, fixed and declined mechanisms, tradeoffs, and behavior you did not verify. Call results inside the noise band inconclusive. Give both the reduction and residual cost; a verified 3% reduction does not resolve a startup the user described as painful.

"I did not find a further reduction" describes the search. "This compiles as fast as possible" makes an unsupported claim about the code. No repeated hashes, block-dimension variants, or LTO establish "no structural churn," but do not prove each build has a minimal kernel set, adjoint footprint, or unroll budget. Report what you checked, the signal that ruled each mechanism out, and what you did not reach. Include the per-module breakdown so others need not remeasure.

Do not invent a small change to avoid a negative result. Also do not stop after the work-removal mechanisms: check CS-13, which can overlap required CUDA builds without a library patch.

Measure declined levers

Measure options you decline or cannot ship when practical. Compilation cost is hard to predict because launching one kernel from a large module still compiles the module's entire live kernel set. If measurement is impossible, label the number an untested estimate and explain why.

Before splitting a dominant module, compile a throwaway one-kernel module with the same options. This estimates the fixed cost repeated by every new module and bounds the possible benefit. In one measured case, a 167 ms fixed floor inside a 467 ms module capped a three-way split at about 20%.

Keep a ledger:

OptionMeasuredWhy not takenTo take it
enable_backward=False on pkg.solver-38% colda live tape traverses these kernelsset at the entry point, then re-check adjoints
max_unroll=4-2%, inside noisechanges generated code for no measured gainno action

Include applied options in the same table when verification did not reach the layer they affect. For example, a runtime knob checked only against compile time remains an open question.

Price blocking constraints

If a pinned dependency, required capability, or lack of persistent storage blocks every fix, measure what relaxing each constraint would buy and present the values side by side. A rule against persistent state may still permit a read-only prewarmed artifact. If no constraint is worth reopening, say what would need to change for another result.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools, Needs Python

The author says: Requires Python 3.10+ and an installed warp-lang package. A CUDA device is needed to diagnose CUDA-specific mechanisms.

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs
  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Warp Team
Publisher
NVIDIA (Official)
Distributed by
NVIDIA
Source
NVIDIA/skills · skills/warp-compile-time-optimizer · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Warp Team or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download warp-compile-time-optimizer.zip