NVIDIA / NVIDIA/apex

apex.pyprof.prof throwing exception when handling bool datatype

Open
#601 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

While executing:

python -m apex.pyprof.prof -w 100 -c kernel,op,sil,tc,flops,bytes,device,stream,block,grid net.dict

I get this exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/pyprof/prof/__main__.py", line 10, in <module>
    main()
  File "/usr/local/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/pyprof/prof/prof.py", line 224, in main
    bytes = xx.bytes()
  File "/usr/local/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/pyprof/prof/convert.py", line 61, in bytes
    b = self.elems() * (Utility.typeToBytes(self.stype) + Utility.typeToBytes(self.dtype))
  File "/usr/local/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/pyprof/prof/utility.py", line 22, in typeToBytes
    assert False
AssertionError

While digging into the problem a little bit, I found that utility.py:Utility.typeToBytes is being fed a boolean for t.

This is the line in net.dict that causes the failure:

{'kShortName': 'elementwise_kernel', 'kDuration': 2848, 'layer': [], 'trace': [], 'reprMarkers': [], 'marker': ["{'mod': 'Tensor', 'op': 'float', 'args': [{'name': '', 'type': 'tensor', 'shape': (18, 104, 160), 'dtype': 'bool'}]}"], 'seqMarker': ['to, seq = 60471'], 'seqId': [60471], 'subSeqId': 0, 'altSeqId': [], 'dir': 'fprop', 'mod': ['Tensor'], 'op': ['float'], 'tid': 1431533376, 'device': 0, 'stream': 7, 'grid': (585, 1, 1), 'block': (512, 1, 1), 'kLongName': 'void at::native::elementwise_kernel<512, 1, void at::native::gpu_kernel_impl<void at::native::copy_kernel_impl<float, bool>(at::TensorIterator&)::{lambda(bool)#1}>(at::TensorIterator&, void at::native::copy_kernel_impl<float, bool>(at::TensorIterator&)::{lambda(bool)#1} const&)::{lambda(int)#1}>(int, void at::native::gpu_kernel_impl<void at::native::copy_kernel_impl<float, bool>(at::TensorIterator&)::{lambda(bool)#1}>(at::TensorIterator&, void at::native::copy_kernel_impl<float, bool>(at::TensorIterator&)::{lambda(bool)#1} const&)::{lambda(int)#1})'}

Here's that net.dict line pretty-printed because that's a hard line to look at :)

{'altSeqId': [],
 'block': (512, 1, 1),
 'device': 0,
 'dir': 'fprop',
 'grid': (585, 1, 1),
 'kDuration': 2848,
 'kLongName': 'void at::native::elementwise_kernel<512, 1, void '
              'at::native::gpu_kernel_impl<void '
              'at::native::copy_kernel_impl<float, '
              'bool>(at::TensorIterator&)::{lambda(bool)#1}>(at::TensorIterator&, '
              'void at::native::copy_kernel_impl<float, '
              'bool>(at::TensorIterator&)::{lambda(bool)#1} '
              'const&)::{lambda(int)#1}>(int, void '
              'at::native::gpu_kernel_impl<void '
              'at::native::copy_kernel_impl<float, '
              'bool>(at::TensorIterator&)::{lambda(bool)#1}>(at::TensorIterator&, '
              'void at::native::copy_kernel_impl<float, '
              'bool>(at::TensorIterator&)::{lambda(bool)#1} '
              'const&)::{lambda(int)#1})',
 'kShortName': 'elementwise_kernel',
 'layer': [],
 'marker': ["{'mod': 'Tensor', 'op': 'float', 'args': [{'name': '', 'type': "
            "'tensor', 'shape': (18, 104, 160), 'dtype': 'bool'}]}"],
 'mod': ['Tensor'],
 'op': ['float'],
 'reprMarkers': [],
 'seqId': [60471],
 'seqMarker': ['to, seq = 60471'],
 'stream': 7,
 'subSeqId': 0,
 'tid': 1431533376,
 'trace': []}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with utility.py:Utility.typeToBytes and its caller in convert.py:bytes; reproduce the failure using the provided python -m apex.pyprof.prof command and net.dict input. Done means bool dtype handling no longer raises the assertion and profiling completes for this input.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
devtools, performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.