Skip to content

Bugs in MemoryProfiler.timeline due to mix of Key and TensorKey types returned #142371

@robert-hardwick

Description

@robert-hardwick

🐛 Describe the bug

We have a bug on Aarch64

"errorStackTrace" : "Traceback (most recent call last):
 File \"/var/lib/jenkins/workspace/test/profiler/test_memory_profiler.py\", line 1488, in test_memory_timeline\u000a    lines = [  File \"/var/lib/jenkins/workspace/test/profiler/test_memory_profiler.py\", line 1490, in <listcomp>
   f\"{id_for_testing(key):>3}(v{version}) {format_size(size):>15}\"

  File \"/var/lib/jenkins/workspace/test/profiler/test_memory_profiler.py\", line 1486, in id_for_testing
  return id_map.setdefault(key.storage.allocation_id, len(id_map))
AttributeError: 'Key' object has no attribute 'storage'\u000a\u000aTo execute this test, run the following from the base repo dir

    python test/profiler/test_memory_profiler.py TestMemoryProfilerE2E.test_memory_timeline
This message can be suppressed by setting PYTORCH_PRINT_REPRO_ON_FAILURE=0"

Upon investigation I can see that MemoryProfiler.timeline is returning a mixture of Key and TensorKey for the keys. ( Key does not have storage attribute! ). The typing suggest that the return type should be KeyAndID, however we are getting lots of TensorAndID, furthermore the failing test test_memory_timeline is expecting TensorAndID.

def timeline(self) -> Tuple[Tuple[int, Action, KeyAndID, int], ...]:

Unsure whether the correct fix is to let the test handle mixture of key types and change the typing annotations or whether we should only be returning TensorAndID from the timeline method.

Tagging authors from git blame @aaronenyeshi @ezyang

Versions

Collecting environment information...
PyTorch version: 2.6.0a0+git35c676d
Is debug build: True
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.5 LTS (aarch64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.30.5
Libc version: glibc-2.35

Python version: 3.10.15 | packaged by conda-forge | (main, Oct 16 2024, 01:19:28) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.8.0-1019-aws-aarch64-with-glibc2.35
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 48
On-line CPU(s) list: 0-47
Vendor ID: ARM
Model: 1
Thread(s) per core: 1
Core(s) per cluster: 48
Socket(s): -
Cluster(s): 1
Stepping: r1p1
BogoMIPS: 2100.00
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs paca pacg dcpodp svei8mm svebf16 i8mm bf16 dgh rng
L1d cache: 3 MiB (48 instances)
L1i cache: 3 MiB (48 instances)
L2 cache: 48 MiB (48 instances)
L3 cache: 32 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-47
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; __user pointer sanitization
Vulnerability Spectre v2: Mitigation; CSV2, BHB
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected

Versions of relevant libraries:
[pip3] mypy==1.11.2
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.22.4
[pip3] onnx==1.17.0
[pip3] onnxscript==0.1.0.dev20240817
[pip3] optree==0.13.0
[pip3] torch==2.6.0a0+git35c676d
[conda] No relevant packages

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    OSS contribution wantedPR from open source contributors welcome to solve this issue.oncall: profilerprofiler-related issues (cpu, gpu, kineto)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions