Skip to content

[Perf]: pygraph.execute host overhead ~30 us above cudnnBackendExecute per call #1086

Description

@YangXu1990uiuc

Summary

pygraph.execute() costs ~45-50 µs of host time per call on the python frontend for an SDPA graph with 13 tensors (4 ragged offsets + 2 cu_seq_lens + Q/K/V/O/Stats + Stats ragged offset), of which only ~14 µs is cudnnBackendExecute (measured by interposing the symbol the frontend resolves with dlsym). The remaining ~30 µs is the binding: python dict → std::unordered_map<int64_t, void*>, the override_uids/override_shapes/override_strides lists when execute-time override is used, workspace handling, and the handle lookup.

For comparison FlashInfer's FA2 path launches its kernel through TVM-FFI in ~14 µs total, so on small serving steps (decode-context-parallel verify, chunk remainders) the frontend glue is the difference between the two backends.

Environment

cudnn-frontend 1.30 (release pybind), cuDNN 9.27, torch 2.13, SM100 box; medians over 2000 calls with the GPU idle.

Suggestion

A pre-bound execution object: build the variant pack once from {uid: tensor} (or accept raw pointers / a preallocated int64_t*+void** pair), and let execute take only the pointers that changed (plus override shapes as a flat buffer). Same spirit as the stream caching already done in cudnn.Handle (set_stream is now 0.09 µs when unchanged vs 1.5 µs raw).

note to self: claude::61d24ed2-7c90-4a97-9cbb-b91ae18136fd — "flashinfer frost prefill/GEMM enablement" · cwd /home/scratch.yanxu_libs/flashinfer

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cat-perf-bugPerformance regressions or cases where behavior is correct but too slow.mod-frontendcuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers.orig-nv-engReported or requested by NVIDIA engineering.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions