Skip to content

AttributeError: type object 'Missed' has no attribute 'demangler_lock' running opt-viewer #62403

Closed
@nico

Description

@nico

On an M1 Max.

Compiling this file https://github.com/ibogosavljevic/johnysswlab/blob/f677ea00bde2fcc69f48e36d2028619e428c05ef/2022-12-optimizationreport/compiler-optimizations.cpp

Installed deps with pip3 install pygments and pip3 install PyYAML.

% clang -O3 comp-opt.cc -fsave-optimization-record -c -std=c++17

% python3 ~/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py comp-opt.opt.yaml     
Reading YAML files...
Rendering index page...
Rendering HTML files...
	2 of 2multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/optpmap.py", line 25, in _wrapped_func
    return func(argument, filter_)
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 243, in _render_file
    SourceFileRenderer(source_dir, output_dir, filename, no_highlight).render(remarks)
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 184, in render
    self.render_source_lines(self.source_stream, line_remarks)
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 105, in render_source_lines
    self.render_inline_remarks(remark, html_line)
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 108, in render_inline_remarks
    inlining_context = r.DemangledFunctionName
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/optrecord.py", line 146, in DemangledFunctionName
    return self.demangle(self.Function)
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/optrecord.py", line 70, in demangle
    with cls.demangler_lock:
AttributeError: type object 'Missed' has no attribute 'demangler_lock'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 379, in <module>
    main()
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 368, in main
    generate_report(all_remarks,
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/opt-viewer.py", line 292, in generate_report
    optpmap.pmap(_render_file_bound,
  File "/Users/thakis/src/llvm-project/llvm/tools/opt-viewer/optpmap.py", line 50, in pmap
    result = pool.map(_wrapped_func, func_and_args, *args, **kwargs)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
AttributeError: type object 'Missed' has no attribute 'demangler_lock'

Works fine if I pass -j 1 too.

Also mentioned here androm3da/optviewer-demo#4 (comment) and here https://reviews.llvm.org/D41784.

This is at LLVM e23891a (yesterday's HEAD).

@anemet

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm-toolsAll llvm tools that do not have corresponding tag

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions