NVTX 原理分析
1. 与 Runtime 交互
参考代码位置:
- C/C++ 头文件:
c/include/nvtx3 - 示例注入:
tools/sample-injection
flowchart TD
A[应用程序<br>调用 NVTX API] --> B[NVTX 分发层<br>Header-only]
B -->|首次调用| C{找到注入库?}
C -- 否 --> D[函数指针为空<br>直接返回<br>≈零开销]
C -- 是 --> E[初始化回调表<br>填充函数指针]
E --> F[后续 API<br>直接经指针跳转]
F --> G[工具实现层<br>记录/统计/转发]
应用程序调用 nvtxRangePushA("foo")
↓
NVTX 运行时检查是否有注入库
↓
首次调用时加载注入库,调用 InitializeInjectionNvtx2()
↓
注入库填充回调表
↓
后续调用直接路由到注入库的 impl::RangePushA()
相关页面
- Cprof C++ Profiling 核心技术 — C++ 侧 profiling 与 instrumentation
- Python AI Profiling — Python 侧 profiling 思路
- Critical Path of AI Trace — NVTX 产出 trace 的下游分析
- GPU Trace 时间分解与重叠分析 — Trace 分析算法
← 被以下页面引用(4)
- Cprof C++ Profiling 核心技术ai-systems · concept
- Critical Path of AI Traceai-systems · concept
- Python AI Profilingai-systems · concept
- Agentic Infra:LLM 推理性能优化与 GPU 利用率提升ai-systems · source-summary
修改历史
修改历史5 次提交
- fix(wiki): clean all lint errors to enable strict CI (PR-3)xiaocheng··
75375ef - refactor: reorganize documentation structure and update Navbar componentxiaocheng··
2fb8f42 - chore(project): clean up obsolete configuration and build artifactsxiaocheng··
3574bd3 - feat: add profiling docs for AI tracing and critical pathsxiaocheng··
fd52202