Regarding Instrumentation of Clang/LLVM for Compile Time

Hello everyone,
I am a college student at my final year, I have a strong interest in compilers and i wish i could help the community.

The “Instrumentation of Clang/LLVM for Compile Time” project seems very interesting and i started reading about instrumentation to get more knowledge.
I have a strong C/C++, algorithms, data structures, operating systems and fimiliar with x86 archeticture.
I am new to open source so i wish you tell me how can i be useful?
And is this project still open?
Thanks

1 Like

https://llvm.org/OpenProjects.html#llvm_instrumentaion_for_compile_time

Maybe @Jamie can clarify the scope of work a bit. Since it’s posted under a “GSoC 2022” header, I hope it’s still open/relevant.

Hi Mohamed,

Yes, this project is open, it is under GSoC 2022.

2017 LLVM Developers’ Meeting: M. Zolotukhin “LLVM Compile-Time: Challenges. Improvements... ” - YouTube is a good presentation which describes how we measure and monitor compile time, some existing challenges, some useful tools and tricks, and etc. It is a great idea to get yourself familiar with running test-suite, and especially CTMark.

Another area to get familiar with is LLVM: llvm::TimePassesHandler Class Reference and LLVM: include/llvm/Support/TimeProfiler.h File Reference.

@Jamie Please feel free to add to this.

Good luck!
Whitney Tsang

1 Like

That’s great. I will start doing my research, in fact this projects is so intresting as it will make me have a good understanding in all compilers area.
I will finish what you suggested and see what i would get and inform you.

Thanks

Hi Mohamed,
Whitney has already pointed out some good starting points for looking at the specific classes that are used in doing time profiling. This project spans the entire compiler, and will have you contributing code to both the clang and llvm projects. There are many useful links for the practical side of things at https://llvm.org/, such as how to download/compile the code, coding standards, and links to documentation on several of the projects. The links to the clang internal manual will give you a high level overview of much of the front end. You will also find links to the developer’s meetings which have tutorials and presentations. The new pass manager, Using the New Pass Manager — LLVM 16.0.0git documentation, is at the heart of the optimization pipeline and an understanding of how it works will help you understand how LLVM does optimization. A friendly word of warning: there are many interesting topics and it can be very easy to become distracted. Filtering and focusing in on the relevant parts is key; the others topics can wait…

Hello, @Jamie!
Thanks for adding more info! As of now I’ve read some docs from the official website and have watched the presentation linked by Whitney, that really helped understanding things, goal of the project and how it is supposed to be achieved. I’m currently learning about the New Pass Manager. With all this completed can you please mention the steps to be taken in order to start working on the project, that’ll be greatly helpful.
Super excited to work on the project.

Thanks!

Whitney and I have received several requests from several interested parties regarding this GSoC project. We thank you for your interest and in the sake of fairness to those who have expressed an interest, we will answer general questions about this project on this thread so that all have access to the information.

Many have asked about suggestions about avenues of exploration and things to consider so here are a couple: There are excellent examples of pull requests for adding a timer: ⚙ D36946 [time-report] Add Template Instantiation Timer and ⚙ D36492 [time-report] Add preprocessor timer. They show how one would add a timer to a section of code. However, these patches were never delivered, which begs the question of why and if there are follow up actions? Part of working within an open-source community such as clang and llvm involves understanding what has worked and also what hasn’t. Communication skills are important so investigating why this wasn’t delivered will help build needed skills. It may also help in determining where timers are appropriate.
As described in the original proposal, much of the work involved with this project will be determining appropriate places for adding timers and analyzing the results. Adding too many timers will both slow the compiler and possibly overwhelm anyone trying to mine information from the output. Therefore, an extremely important part of this project is developing ways to filter and control the amount of information produced by the timers. For example, the timing profiles will likely be vastly different between running the compiler to produce an executable suitable for debugging as opposed to when the compiler is optimizing code. Developing control or filtering mechanisms to appropriately control the timers for such cases, as well as those which you will discover through your investigation, are extremely important. Consider the compilation process as a whole and try to think of, and explore, scenarios that may reveal interesting characteristics of where the compiler spends its time. Also consider new and innovative ways that you may be able to control the information that you generate.

2 Likes

Hi @s-ayush2903,
Thank you for your interest in this project. General information about how the Google Summer of Code projects and candidates are chosen, including next steps, can be found here: https://summerofcode.withgoogle.com/ and more information about this specific project can be found in my previous posts here. Good luck in your research.

1 Like

This presentation is good. Especially, i understand why compile time is increased or decreased through historical data.

Thanks!