optimization remarks update
play

Optimization Remarks Update Francis Visoiu Mistrih Optimization - PowerPoint PPT Presentation

Optimization Remarks Update Francis Visoiu Mistrih Optimization Remarks opt-viewer.py Challenges YAML doesnt scale well Discovering remarks Processing remarks __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB clang /


  1. Optimization Remarks Update Francis Visoiu Mistrih

  2. Optimization Remarks opt-viewer.py

  3. Challenges • YAML doesn’t scale well • Discovering remarks • Processing remarks

  4. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB clang / RelWithDebInfo / macOS

  5. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB • Significant size impact clang / RelWithDebInfo / macOS

  6. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB • Significant size impact • Slow to parse: ~4 minutes for 27 million remarks clang / RelWithDebInfo / macOS

  7. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB • Significant size impact • Slow to parse: ~4 minutes for 27 million remarks • Compile-time impact: 5% slowdown clang / RelWithDebInfo / macOS

  8. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB Remarks (LLVM Bitstream) __DWARF 1.7 GB 8.5 GB • Significant size impact • Slow to parse: ~4 minutes for 27 million remarks • Compile-time impact: 5% slowdown clang / RelWithDebInfo / macOS

  9. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB Remarks (LLVM Bitstream) __DWARF 1.7 GB 8.5 GB • Significant size impact 12x smaller • Slow to parse: ~4 minutes for 27 million remarks • Compile-time impact: 5% slowdown clang / RelWithDebInfo / macOS

  10. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB Remarks (LLVM Bitstream) __DWARF 1.7 GB 8.5 GB • Significant size impact 12x smaller • Slow to parse: ~4 minutes 27 seconds (8x faster) • Compile-time impact: 5% slowdown clang / RelWithDebInfo / macOS

  11. __TEXT 0.1 GB __DWARF Remarks (YAML) 8.5 GB 20.7 GB Remarks (LLVM Bitstream) __DWARF 1.7 GB 8.5 GB • Significant size impact 12x smaller • Slow to parse: ~4 minutes 27 seconds (8x faster) • Compile-time impact: 5% slowdown 2% slowdown clang / RelWithDebInfo / macOS

  12. Extra Benefits • Well-known format in the community • Testing and tooling like llvm-bcanalyzer • Versioning • Flexible metadata

  13. libRemarks #include "llvm-c/Remarks.h" LLVMRemarkParserRef Parser = LLVMRemarkParserCreateYAML(Buf, Size); LLVMRemarkEntryRef Remark = NULL; while ((Remark = LLVMRemarkParserGetNext(Parser))) { // use Remark }

  14. libRemarks #include "llvm-c/Remarks.h" LLVMRemarkParserRef Parser = LLVMRemarkParserCreateBitstream(Buf, Size); Bitstream LLVMRemarkEntryRef Remark = NULL; while ((Remark = LLVMRemarkParserGetNext(Parser))) { // use Remark }

  15. { .o .opt.yaml

  16. { { ? .o .opt.yaml

  17. foo.o foo.opt.bitstream clang ld out bar.o bar.opt.bitstream

  18. foo.o foo.opt.bitstream clang ld out bar.o bar.opt.bitstream

  19. foo.o foo.opt.bitstream bar.o bar.opt.bitstream

  20. foo.o __remarks 52 4d 52 4b 01 08 00 00 17 00 00 00 07 01 b2 40 b4 42 39 d0 43 38 3c 3c c1 28 bc 83 3b d0 43 38 a4 83 3b 94 83 3c 80 41 3a b8 83 39 bc c3 41 80 38 06 08 14 22 1e 9a 61 16 e8 41 1e d2 c1 1d ce 01 0c e8 21 1c c4 81 1d ca 41 71 40 1f 1c a2 14 f0 81 1e ca 41 1e dc 21 1c d8 foo.opt.bitstream

  21. foo.o __remarks 52 4d 52 4b 01 08 00 00 17 00 00 00 07 01 b2 40 b4 42 39 d0 43 38 3c 3c c1 28 bc 83 3b d0 43 38 a4 83 3b 94 83 3c 80 41 3a b8 83 39 bc c3 41 80 38 06 <file path> 08 14 22 1e 9a 61 16 e8 41 1e d2 c1 1d ce 01 0c e8 21 1c c4 81 1d ca 41 71 40 1f 1c a2 14 f0 81 1e ca 41 1e dc 21 1c d8 foo.opt.bitstream

  22. Remarks Section • Only in object files • Not included in the linked binary • Accessible through the Debug Map • clang’s remarks section: 0.27GB

  23. .dSYM

  24. .dSYM ❌ ❌ ❌ .o .o .o

  25. out.dSYM Remarks/out out dsymutil DWARF/out

  26. Get Involved • Python bindings for integration with opt-viewer.py • llvm-remarkutil: convert, merge, extract, etc. • Faster lookup: build an index • Remark classes: verbosity, accuracy, etc. • Tablegen: better remark structure • Per-remark documentation: possible actions, reasons, etc.

  27. Thanks!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend