8000 The profiler does not seem to be able to record cuda runtime nodes · Issue #155001 · pytorch/pytorch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
The profiler does not seem to be able to record cuda runtime nodes #155001
Open
@9LLPPLL6

Description

@9LLPPLL6

🐛 Describe the bug

I used torch.profile to collect traces during distributed training. Then I observed the collected traces and found that the profiler seems to have missed some cuda runtime nodes.

I do distributed training with dp=4 on 4XA6000,Below is the script repository I used for repo,You can run run_llama.sh and run_gpt2.sh to replicate this problem, you need to download the wikitext dataset to your local folder on hugging face to start the script.

Regardless of llama or gpt2, the trace with rank0 does not have this problem, while the other ranks will miss some cuda runtime nodes, the expectation should be that each cuda kernel will bind a cuda runtime event.

Missing cuda runtime examples I observed:
The node with External id 17297502 does not have a corresponding cuda runtime node

{
    "ph": "X", "cat": "kernel", "name": "void at::native::(anonymous namespace)::multi_tensor_apply_kernel<at::native::(anonymous namespace)::TensorListScalarListMetadata<float, 3>, at::native::(anonymous namespace)::PointwiseOpScalarListFunctor<float, 3, 3, 0>, std::divides<float> >(at::native::(anonymous namespace)::TensorListScalarListMetadata<float, 3>, at::native::(anonymous namespace)::PointwiseOpScalarListFunctor<float, 3, 3, 0>, std::divides<float>)", "pid": 3, "tid": 7,
    "ts": 5433179088085.773, "dur": 466.342,
    "args": {
      "External id": 17297499,      "queued": 0, "device": 3, "context": 1,      "stream": 7, "correlation": 17297499,      "registers per thread": 35,      "shared memory": 0,      "blocks per SM": 3.809524,      "warps per SM": 60.952381,      "grid": [320, 1, 1],      "block": [512, 1, 1],      "est. achieved occupancy %": 100
    }
  },
  {
    "ph": "f", "id": 17297499, "pid": 3, "tid": 7, "ts": 5433179088085.773,
    "cat": "ac2g", "name": "ac2g", "bp": "e"
  },
  {
    "ph": "X", "cat": "kernel", "name": "void at::native::(anonymous namespace)::multi_tensor_apply_kernel<at::native::(anonymous namespace)::TensorListScalarListMetadata<float, 3>, at::native::(anonymous namespace)::PointwiseOpScalarListFunctor<float, 3, 3, 0>, std::divides<float> >(at::native::(anonymous namespace)::TensorListScalarListMetadata<float, 3>, at::native::(anonymous namespace)::PointwiseOpScalarListFunctor<float, 3, 3, 0>, std::divides<float>)", "pid": 3, "tid": 7,
    "ts": 5433179088552.788, "dur": 237.955,
    "args": {
      "External id": 17297502,      "queued": 0, "device": 3, "context": 1,      "stream": 7, "correlation": 17297502,      "registers per thread": 35,      "shared memory": 0,      "blocks per SM": 1.952381,      "warps per SM": 31.238094,      "grid": [164, 1, 1],      "block": [512, 1, 1],      "est. achieved occupancy %": 65
    }
  },
  {
    "ph": "f", "id": 17297502, "pid": 3, "tid": 7, "ts": 5433179088552.788,
    "cat": "ac2g", "name": "ac2g", "bp": "e"
  },

Normal, expected :

{
    "ph": "X", "cat": "cuda_runtime", "name": "cudaLaunchKernel", "pid": 3563046, "tid": 3563046,
    "ts": 5433179089173.648, "dur": 19.004,
    "args": {
      "External id": 39,      "cbid": 211, "correlation": 17297564
    }
  },
  {
    "ph": "s", "id": 17297564, "pid": 3563046, "tid": 3563046, "ts": 5433179089173.648,
    "cat": "ac2g", "name": "ac2g"
  },
  {
    "ph": "X", "cat": "kernel", "name": "void at::native::(anonymous namespace)::indexSelectLargeIndex<float, long, unsigned int, 2, 2, -2, true>(at::cuda::detail::TensorInfo<float, unsigned int>, at::cuda::detail::TensorInfo<float const, unsigned int>, at::cuda::detail::TensorInfo<long const, unsigned int>, int, int, unsigned int, unsigned int, long)", "pid": 3, "tid": 7,
    "ts": 5433179089388.639, "dur": 15.648,
    "args": {
      "External id": 46,      "queued": 0, "device": 3, "context": 1,      "stream": 7, "correlation": 17297586,      "registers per thread": 32,      "shared memory": 0,      "blocks per SM": 8.000000,      "warps per SM": 32.000000,      "grid": [672, 1, 1],      "block": [128, 1, 1],      "est. achieved occupancy %": 67
    }
  },
  {
    "ph": "f", "id": 17297586, "pid": 3, "tid": 7, "ts": 5433179089388.639,
    "cat": "ac2g", "name": "ac2g", "bp": "e"
  },

Versions

Collecting environment information...
PyTorch version: 2.4.0a0+3bcc3cddb5.nv24.07
Is debug build: False
CUDA used to build PyTorch: 12.5
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.4 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.30.0
Libc version: glibc-2.35

Python version: 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-6.8.0-59-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 12.5.82
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration:
GPU 0: NVIDIA RTX A6000
GPU 1: NVIDIA RTX A6000
GPU 2: NVIDIA RTX A6000
GPU 3: NVIDIA RTX A6000

Nvidia driver version: 550.163.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.2.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.2.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 52 bits physical, 57 bits virtual
Byte Order: Little Endian
CPU(s): 96
On-line CPU(s) list: 0-95
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Gold 6442Y
CPU family: 6
Model: 143
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 2
Stepping: 7
CPU max MHz: 4000.0000
CPU min MHz: 800.0000
BogoMIPS: 5200.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cat_l2 cdp_l3 intel_ppin cdp_l2 ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect user_shstk avx_vnni avx512_bf16 wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req hfi vnmi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq la57 rdpid bus_lock_detect cldemote movdiri movdir64b enqcmd fsrm md_clear serialize tsxldtrk pconfig arch_lbr ibt amx_bf16 avx512_fp16 amx_tile amx_int8 flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 2.3 MiB (48 instances)
L1i cache: 1.5 MiB (48 instances)
L2 cache: 96 MiB (48 instances)
L3 cache: 120 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-23,48-71
NUMA node1 CPU(s): 24-47,72-95
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.26.4
[pip3] nvidia-cudnn-frontend==1.5.1
[pip3] nvtx==0.2.5
[pip3] > [pip3] optree==0.12.1
[pip3] pynvjitlink==0.2.3
[pip3] pytorch-triton==3.0.0+989adb9a2
[pip3] torch==2.4.0a0+3bcc3cddb5.nv24.7
[pip3] torch-tensorrt==2.5.0a0
[pip3] torchvision==0.19.0a0
[conda] Could not collect

cc @robieta @chaekit @guotuofeng @guyang3532 @dzhulgakov @davidberard98 @briancoutinho @sraikund16 @sanrise

Metadata

Metadata

Assignees

Labels

oncall: profilerprofiler-related issues (cpu, gpu, kineto)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0