[GSoC 2026] Improving lit

Description of the project: LLVM’s main test running tool, lit (LLVM’s integrated tester), is a key part of LLVM’s testing practices for end-to-end testing of the compiler and related tools. lit is a tool that can parse and execute RUN: commands added in source file comments. Chiefly, these commands are shell commands that invoke tools that are being tested—like clang or lld—and whose output can be programmatically checked in conjunction with other tooling, like LLVM’s FileCheck utility.

Over the last couple years, we’ve worked towards improving lit’s internal shell enough, so that it could be the default mode for running LLVM tests (see [RFC] Enabling the Lit Internal Shell by Default). Today, lit already uses the internal shell by default in LLVM’s CI, which has improved test performance and increased consistency across platforms. However, there are still many aspects of the current implementation that could be improved, though.

Modernize the lit Python implementation: Today, lit’s current implementation is, to a large extent, a direct translation of the old Python 2.7 implementation to Python 3. There are numerous language improvements that would allow us to simplify the code and follow best practices. This would require an audit of the current implementation and subsequent refactoring. Note that we’re not advocating a complete rewrite, but targeted well scoped changes to bring the current implementation into line with more modern Python standards.

Reduced process overhead: Using asyncio for subprocess handling is likely a significant improvement in terms of performance, since lit spawns many subprocesses and waits for their results when it could frequently take care of unrelated work. Further, some of the out-of-process builtins should be moved back so that they can run in-process (see [RFC] Reducing process creation overhead in LLVM regression tests).

Improve shell utilities: A few of the internal shell replacements for common programs have some issues with common usage. For instance, the built-in env has some problems with pipelines (see #115578), and the ergonomics around readfile and environment variables in some compiler-rt tests are problematic.

Performance tuning: lit and the various pieces of its internal shell implementation have never been properly profiled and optimized. For instance, commands like echo and cat, while functional, employ suboptimal algorithms and data structures. There is a big opportunity here to leverage profiling information, specifically via Scalene, to pinpoint inefficiencies, such as contention on the Global Interpreter Lock (GIL), excessive memory usage, and redundant data copies.

Expected result: The goal of this project is to improve lit’s performance, usability, and maintainability. Successful proposals should provide a detailed plan for improving lit’s implementation. Applicants are encouraged to look more deeply into these areas, and provide concrete plans for what they propose to change, over only vague descriptions of improvements.

Skills: Python

Project size: Either medium or large

Difficulty: Medium

Confirmed Mentor: @boomanaiden154-1, @ilovepi, @petrhosek

12 Likes

I am a Master’s student at IIT Bombay with prior GSoC experience and have a good systems programming background. I plan to submit a proposal for improving lit.

That’s great to hear. I’d encourage you to share your proposal with the mentors and get feedback from us earlier rather than later. From past years, the applicants that discussed their ideas with the community first usually fared better in project selection than those that did not engage with us. Best of luck.

2 Likes

Hi
I am Dhruv , a Btech student I am interested in this project if you could suggest me some issues that i can solve so that i can get familiar with this then that would be of a great help
Regards

Lit is mostly documented for users (e.g. to guide llvm developers writing tests), but its implementation is mostly only documented in the source (and that may also be lacking). I’d suggest skimming through the implementation and thinking about how what you see corresponds to the project idea and highlights. That’s probably the most useful thing you can do to prepare a good proposal: get familiar with the project and think about the design trade offs and how you’ll want to approach the general problems we outlined.

Another thing you could look at is how hat there may still be some bugs in the issue tracker related to llvm-lit, and f you’re lucky at least one of them will be tagged “good first bug”.

Hey, just FYI, this discourse is not hyperlinked in the official ideas page.

Hi, I’m Aaron. I’m a CS graduate student at the University of Washington, originally from Taiwan. This will be my first GSoC, and I’m very interested in the “Improving lit” idea. I have open-source experience (I’ve had multiple PRs merged in Apache Airflow), and I’ll have plenty of time this summer.

I’ve already set up the LLVM dev environment and opened a starter PR, any feedback would be greatly appreciated. Next, I plan to study the lit codebase, tackle a few more issues, and draft an initial proposal in the next few weeks. If you have suggestions, I’d love to hear them :slight_smile:

Thanks, and I hope we all have a meaningful summer!

1 Like

Hi, a quick question: for the “modernize the lit python implementation” part, what python baseline should we assume? From CMakeLists.txt, it looks like 3.8. Is that the right baseline?

Yes, that is the correct baseline.

1 Like

Hi, how can i submit a draft proposal for this project?

In the past, applicants have reached out to me and @petrhosek through email, or in private messages in discourse and shared their draft. Generally a google doc or something easy to collaborate/comment on. I’ve also seen folks post the pdf here on discourse and ask for feedback. Ultimately, I think it’s up to you about how you’d like to work.

Hi, I am preparing a GSoC 2026 proposal for the lit improvement project. I am planning to focus on asyncio subprocess handling, Python 3 modernization, and Scalene-based profiling. One question before I finalize my approach: for the asyncio integration, is the goal to replace the existing subprocess calls in the test runner loop specifically, or does it extend to the internal shell builtins as well? I want to make sure I scope this correctly.

The design is up to you, and what you think you can achieve. If you think you have a strategy to make things work well with the builtins, then I think that’s great. It’s hard to say without seeing any portion of the design if that’s viable or not

I’d encourage you to provide sufficient details in your proposal so that anyone in the LLVM community can follow your design and rationale.