Skip to content

[WIP]Feature/warp tracing - #7

Open
frlai wants to merge 61 commits into
developfrom
feature/warp_tracing
Open

[WIP]Feature/warp tracing#7
frlai wants to merge 61 commits into
developfrom
feature/warp_tracing

Conversation

@frlai

@frlai frlai commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds experimental NVIDIA Warp tracing/export support to LEAPP, including explicit annotate.warp_op(...) regions, automatic Warp segment detection, APIC capture replay, and ONNX/ExportedProgram export support through a leapp::warp_runner custom operator.

Details

  • Adds Warp tracing datatypes, session state, boundary detection, and two-pass discovery/capture flow.
  • Registers leapp::warp_runner and lowers it to com.nvidia.warp::WrpRunner for ONNX exports.
  • Adds WRPB bundle packing and C++ runtime support for ONNX Runtime and Torch/LibTorch adapters.
  • Adds Warp tracing docs, setup guidance, ONNX custom-op build instructions, and InferenceManager smoke-test guidance.
  • Expands functional/unit coverage for Warp tracing, export validation, runtime behavior, dtype handling, and compatibility paths.

Notes

  • Warp tracing is currently Linux/CUDA-only.
  • Warp ONNX inference requires onnxruntime-gpu, CUDA EP availability, and LEAPP_WARP_ONNX_CUSTOM_OP_LIBRARY pointing at a custom op built against the same ONNX Runtime version in the environment.
  • Boundary dtypes are currently limited to primitive scalar types; vector, quaternion, matrix, and transform dtypes are not supported at Warp region boundaries.

@frlai
frlai force-pushed the feature/warp_tracing branch from 67d95f1 to b83ce24 Compare June 26, 2026 17:56
@frlai
frlai force-pushed the feature/warp_tracing branch from ffbc2a2 to 17f8bc8 Compare July 8, 2026 15:35
@frlai
frlai force-pushed the feature/warp_tracing branch from 5537959 to cb014d7 Compare July 20, 2026 23:58
frlai added 27 commits July 26, 2026 00:56
…matic i/o detection for node based operators
…be registered as part of onnx and torchscript via the script path, export to onnx seems to work
…doesn't support jit-trace, onnx-torchscript or jit-script.
updated input signature to use Tensor[] inputs, str runtime_metadata, Tensor bundle.
all metadata will be stored inside runtime_metadata. this includes the mask and i/o configs

todo:
need to prune runtime_metadata for uneeded fields.
Squashed from two_pass_apic_capture:
- implements two pass tracing
- force ptx sm 75
- updated to use single pass, refactored code ownership
…on and broadened support for automatic reentry validation
…stricter hierarchy, fixed bug with seg fault on reentry because loss of buffer creation ownership

 still need to fix bug with incorrect number of i/o at the boundry
…orch reuse cuda memory so torch memory creation functions sill trip the cupti oracle
frlai added 30 commits July 26, 2026 21:51
…dry run, derrived values when node is not tracing are no longer promoted
… we now never demote and update a port in in the traced_data instead to track tagged tensors
…s itself across node boundries and survives most copy attempts
A Warp view of a Torch buffer created before tracing began had no
conversion to intercept, so the runner writing it had no consumers and
pruning deleted it while eager returned the mutated buffer.

- input_tensors indexes each declared input by layout and adopts an
  existing identical-layout alias, so two names over one buffer collapse
  to one port instead of founding two roots
- re-declaring a live carrier of this node rebinds that object in place
  rather than wrapping it, which keeps a promoted wp.array on the current
  pass's root across the Warp discovery and capture passes
- the declared-input/output alias check runs after build_graph_module and
  only faults on an input that survived pruning, since trimming an unused
  declaration is ordinary
- WarpSegment.knows_array replaces two disagreeing rules for whether a
  segment already holds an array
An adapter holding a persistent Torch/Warp pair reads its own attribute
after a kernel writes the buffer, with no conversion for the tracer to
intercept. Wrapping left that object plain, so everything downstream of
the segment was untraced and output_tensors rejected it. TracedTensor
already subclasses torch.Tensor and _promote_plain_tensor already served
the copy_ and __setitem__ destination paths, so declaration now routes
there and such code traces unchanged. NumPy stays wrapped, since a raw
ndarray cannot be class-swapped.

- restore __hash__ on TracedTensor: the elementwise __eq__ nulls the
  inherited hash, which breaks every identity set a carrier reaches,
  nn.Module member traversal included once a registered buffer is
  promoted
- exempt a placeholder-rooted carrier from the cross-node "not a
  registered output" error, because one external tensor declared on two
  nodes now arrives at the second still carrying the first's placeholder
- the dry-run carriers test asserted the wrapping contract and now
  asserts the in-place one
…ctor reframes patching as a simulated function dispatcher and the uses similar traced_data semantics as torch and numpy
Allow traceable function replacements while centralizing atomic patch installation and restoration across all backends.
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