<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2026-08-26T09:44:34+00:00</updated><id>/feed.xml</id><title type="html">Compiler Research</title><subtitle>Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
</subtitle><entry><title type="html">Enabling Differentiable Rendering via AD of Parallel C++ STL Primitives in Clad</title><link href="/blogs/gsoc26_abdelrhman_elrawy_introduction_blog" rel="alternate" type="text/html" title="Enabling Differentiable Rendering via AD of Parallel C++ STL Primitives in Clad" /><published>2026-06-17T00:00:00+00:00</published><updated>2026-06-17T00:00:00+00:00</updated><id>/blogs/enabling-differentiable-rendering-via-AD-in-clad</id><content type="html" xml:base="/blogs/gsoc26_abdelrhman_elrawy_introduction_blog"><![CDATA[<h2 id="about-me">About Me</h2>

<p>Hi! I’m Abdelrhman Elrawy, a graduate student in Applied Computing specializing in Machine Learning and Parallel Programming. After successfully adding Thrust API support to Clad during GSoC 2025, I’m back this summer to work on <strong>Enabling Differentiable Rendering via AD of Parallel C++ STL Primitives in Clad</strong>.</p>

<h2 id="project-description">Project Description</h2>

<p><a href="https://github.com/vgvassilev/clad">Clad</a> is a Clang-based automatic differentiation (AD) tool. This project proposes to enhance Clad by leveraging its liveness analysis to automatically generate lock-free backward passes for highly parallel differentiable rendering pipelines. Specifically, the project targets the atomic bottleneck inherent in 3D Gaussian Splatting (3DGS) rasterization.</p>

<p>Modern GPU-based differentiable renderers suffer from heavy use of atomic operations (e.g., <code class="language-plaintext highlighter-rouge">atomicAdd</code>) during the backward pass because many threads attempt to update the same pixel and gradient buffers simultaneously. This contention overwhelms L2 cache atomic units, stalling execution and causing the gradient computation to consume a significant portion of training time.</p>

<h2 id="technical-approach">Technical Approach</h2>

<p>My approach is twofold:</p>

<ol>
  <li>
    <p><strong>Redesign the Rendering Pipeline</strong>: I will avoid write conflicts by construction using deterministic sorting, tile-based memory ownership, and local accumulation before a single global write. Crucially, I plan to build this new architecture on top of my previous GSoC work that integrated the Thrust API into Clad. By utilizing Thrust’s highly optimized parallel primitives (such as <code class="language-plaintext highlighter-rouge">thrust::sort_by_key</code> and <code class="language-plaintext highlighter-rouge">thrust::reduce</code>) for the sorting and tile-based operations, we can provide a clean, high-level C++ structure to the compiler.</p>
  </li>
  <li>
    <p><strong>Generate the Backward Pass</strong>: I will utilize Clad to automatically generate the backward pass. By relying on Clad’s liveness analysis, the compiler will prove exclusive memory ownership and automatically eliminate the need for <code class="language-plaintext highlighter-rouge">atomicAdd</code> calls. To isolate the compiler complexity from the graphics complexity, the project will use a differentiable geometry path tracer as the foundational stepping stone.</p>
  </li>
</ol>

<h2 id="expected-outcomes">Expected Outcomes</h2>

<p>Beyond differentiable rendering, this work establishes a foundation for compiler-driven automatic differentiation of parallel C++ programs, enabling efficient gradient computation in a wide range of high-performance computing applications.</p>

<h2 id="related-links">Related Links</h2>

<ul>
  <li><a href="https://github.com/vgvassilev/clad">Clad GitHub</a></li>
  <li><a href="/assets/docs/Abdelrhman_Elrawy_Proposal_GSoC_2026.pdf">Project Proposal</a></li>
  <li><a href="https://github.com/a-elrawy">My GitHub</a></li>
</ul>]]></content><author><name>Abdelrhman Elrawy</name></author><category term="gsoc" /><category term="llvm" /><category term="clang" /><category term="automatic-differentiation" /><category term="gpu" /><category term="cuda" /><category term="thrust" /><category term="rendering" /><category term="3dgs" /><summary type="html"><![CDATA[This summer, I am working on enhancing Clad to automatically generate lock-free backward passes for highly parallel differentiable rendering pipelines. This project targets the atomic bottleneck inherent in 3D Gaussian Splatting (3DGS) rasterization.]]></summary></entry><entry><title type="html">Final report for creating teaching materials with xeus-cpp</title><link href="/blogs/xeus-cpp_Hristiyan_Shterev_blog_final/" rel="alternate" type="text/html" title="Final report for creating teaching materials with xeus-cpp" /><published>2026-06-10T00:00:00+00:00</published><updated>2026-06-10T00:00:00+00:00</updated><id>/blogs/creating-teaching-materials-xeus-cpp-final</id><content type="html" xml:base="/blogs/xeus-cpp_Hristiyan_Shterev_blog_final/"><![CDATA[<div class="custom-banner-wrapper" role="img" aria-label="">
  <div class="custom-banner-flex">
    <div class="banner-logo">
      <img src="/images/mg-pld-logo.png" alt="Left Logo" />
    </div>

    <div class="banner-separator" aria-hidden="true">
      @
    </div>

    <div class="banner-logo logo-right-bg">
      <img src="/images/cr-logo_old.png" alt="Right Logo" />
    </div>
  </div>

  
  <div class="banner-caption" role="heading" aria-level="2">
    
  </div>
  
</div>

<style>
  .custom-banner-wrapper {
    --b-height: 20vh;
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
    padding: 1.5rem 0;
  }

  .custom-banner-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
  }

  .banner-logo img {
    height: calc(var(--b-height) * 0.85);
    width: auto;
    max-width: 30vw;
    min-height: 50px;
    object-fit: contain;
  }

  /* Keep the white background for the right logo badge if needed */
  .logo-right-bg img {
    padding: 8px;
    background: #fff;
    border-radius: 4px;
  }

  .banner-separator {
    font-size: calc(var(--b-height) * 0.5);
    font-weight: 700;
    color: #000;
  }

  .banner-caption {
    text-align: center;
    margin-top: 1rem;
    font-family: Georgia, serif;
    font-size: calc(var(--b-height) * 0.25);
    color: #111;
  }

  @media (max-width: 768px) {
    .custom-banner-wrapper { --b-height: 15vh; }
    .custom-banner-flex { gap: 1.5rem; }
  }

  @media (max-width: 480px) {
    .custom-banner-flex { flex-direction: column; gap: 1rem; }
  }
</style>

<h2 id="main-goals-of-this-project">Main goals of this project</h2>

<p>The main goal of this project was to create interactable examples for the for the CUDA and OpenMP programming models, targeting beginners who want hands-on experience with parallel computing on both the GPU and CPU.</p>

<p>Each notebook builds on the previous one, introducing new concepts gradually through working code examples.</p>

<p>Together the 16 notebooks cover the full beginner to intermediate journey - from launching a first thread to understanding memory hierarchies, synchronisation primitives, and performance optimization on both CPU and GPU.</p>

<h2 id="the-cuda-notebooks">The CUDA notebooks</h2>

<p>The CUDA notebooks include 8 different examples that add to one another. Here is what each one explains:</p>

<ul>
  <li>The first notebook is a basic introduction to CUDA with simple examples like the <strong>global</strong> kernel usage and calling it.</li>
  <li>Next we introduce some more fundamental concepts.</li>
  <li>The third notebook shows how using parallel programming can speed up if we use the threads the right way.</li>
  <li>After that we show thread cooperation. The threads split the work instead of having one thread per task</li>
  <li>Then we demonstrate The Julia set. A complex mathematical shape.</li>
  <li>The sixth example creates a ripple pattern.</li>
  <li>Next we demonstrate the dot product. A mathematical operation that takes two equal-length vectors and returns a single regular number</li>
  <li>Lastly there is a simple ray tracing example.</li>
</ul>

<h3 id="cuda-benchmark-vs-the-cpu">CUDA benchmark vs the CPU</h3>

<p>This benchmark adds two vectors with 10 million elements each into a third one. This is done 3 times using different methods.</p>

<ul>
  <li>The first one is a basic CPU only demonstration. The time is around 21 ms.</li>
  <li>The second example is using the GPU but with only 1 thread per block. We can see that this is slower compared to the first one. This is a very unoptimized way to use the device.</li>
  <li>The third method is now a lot faster than the other 2. We make each block use 256 threads which speeds up the time by a lot - around 2 milliseconds.</li>
</ul>

<p><img src="/images/blog/cuda-vs-cpu-benchmark.png" alt="Benchmarked comparison of CUDA vs the CPU" style="max-width: 70%; height: auto; display: block; margin: 0 auto;" /></p>

<h2 id="the-openmp-notebooks">The OpenMP notebooks</h2>

<p>The OpenMP notebooks also include 8 different examples that add to one another. Here is what each one explains:</p>

<ul>
  <li>The first notebook is a basic introduction to OpenMP with simple examples like the #pragma omp parallel directive and thread creation.</li>
  <li>Next we introduce the fork-join model and how threads are spawned and joined back together.</li>
  <li>Then we demonstrate the Pi integral. A mathematical problem solved by splitting the work across multiple threads.</li>
  <li>The fourth notebook calculates the area of the Mandelbrot set. A complex mathematical shape rendered in parallel by assigning different regions to different threads.</li>
  <li>After that we show linked list traversal. How pointer-based data structures interact with parallel execution.</li>
  <li>The sixth example demonstrates race conditions. What happens when threads write to the same memory without protection and how to fix it.</li>
  <li>Next we demonstrate false sharing. How threads can slow each other down even when touching different variables due to CPU cache line behaviour.</li>
  <li>Lastly there is Conway’s Game of Life. A grid simulation where threads compute the next generation in parallel using double buffering to avoid race conditions by design.</li>
</ul>

<h2 id="related-links">Related links</h2>

<ul>
  <li><a href="https://github.com/compiler-research/xeus-cpp">Xeus-cpp repository</a></li>
  <li><a href="https://github.com/HrisShterev">My github account</a></li>
  <li><a href="https://github.com/compiler-research/live-cpp-tutorials/">Notebooks repository</a></li>
</ul>]]></content><author><name>Hristiyan Shterev</name></author><category term="c++" /><category term="xeus-cpp" /><category term="jupyter" /><category term="internship" /><category term="systems-programming" /><category term="high-school" /><category term="cuda" /><summary type="html"><![CDATA[A Final report of my project about creating notebooks for CUDA and OpenMP with xeus-cpp]]></summary></entry><entry><title type="html">Clad as a First-Class Gradient Engine in LibTorch</title><link href="/blogs/gsoc26_kacent_introduction_blog/" rel="alternate" type="text/html" title="Clad as a First-Class Gradient Engine in LibTorch" /><published>2026-06-03T00:00:00+00:00</published><updated>2026-06-03T00:00:00+00:00</updated><id>/blogs/clad-as-first-class-gradient-engine-in-libtorch</id><content type="html" xml:base="/blogs/gsoc26_kacent_introduction_blog/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>My name is Kacent Huang, and I am a second-year Computer Science undergraduate student at Nanjing University. During Google Summer of Code 2026, I will be working with the Compiler Research group on <strong>“Clad as a First-Class Gradient Engine in LibTorch”</strong>.</p>

<p>The project explores whether compiler-generated gradients from <a href="https://github.com/vgvassilev/clad">Clad</a> can be used as a practical backend for selected <a href="https://pytorch.org/cppdocs/">LibTorch</a> workloads. The goal is not to replace the full PyTorch autograd system. Instead, I want to build a focused C++ prototype that shows where source-transformed derivatives are correct, maintainable, and competitive.</p>

<p><strong>Mentors</strong>: Aaron Jomy, David Lange, Vassil Vassilev</p>

<h3 id="background">Background</h3>

<p>LibTorch is the C++ API of PyTorch. It lets C++ applications define tensors, run models, and execute training or inference workflows without moving the main application logic into Python. This is useful for ROOT and HEP workflows where data processing, simulation, and analysis are already deeply rooted in C++.</p>

<p>Clad is a Clang-based automatic differentiation tool. Rather than building a dynamic computation graph at runtime, Clad works through compiler source transformation: it analyzes C++ code and emits derivative code. Recent Compiler Research work has shown that this approach can be promising for machine-learning workloads, especially when the workload is CPU-bound and the differentiated code is carefully scoped.</p>

<p>This project sits at the boundary between these two systems. LibTorch provides the tensor runtime and the user-facing ML framework, while Clad provides a compiler-driven path for generating backward code for selected parts of a workload.</p>

<h3 id="project-scope">Project Scope</h3>

<p>The first version of the project will be intentionally narrow. LibTorch supports a very large operator ecosystem, dynamic tensor dispatch, and framework-managed autograd. Trying to replace all of that in one GSoC project would be unrealistic and would not produce a useful engineering result.</p>

<p>Instead, the project will focus on a limited proof of concept:</p>

<ul>
  <li>CPU execution first.</li>
  <li>Contiguous floating-point tensors first.</li>
  <li>A small supported operator or graph subset first.</li>
  <li>Correctness checks against native LibTorch autograd and, where appropriate, finite differences.</li>
  <li>Clear documentation of what is supported and what remains out of scope.</li>
</ul>

<p>My proposal starts from <code class="language-plaintext highlighter-rouge">torch::autograd::Function</code> because it is the smallest official LibTorch extension boundary for custom forward and backward code. The forward path can call a reference C++ kernel or component, while the backward path can call Clad-generated derivative code.</p>

<p>In the initial presentation, I also described a longer-term “torch.compile-like” direction for LibTorch C++. In eager LibTorch code, a user function such as:</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">auto</span> <span class="nf">my_graph</span><span class="p">(</span><span class="n">torch</span><span class="o">::</span><span class="n">Tensor</span> <span class="n">x</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">torch</span><span class="o">::</span><span class="n">Tensor</span> <span class="p">{</span>
  <span class="k">return</span> <span class="p">(</span><span class="n">x</span> <span class="o">*</span> <span class="n">x</span><span class="p">).</span><span class="n">sum</span><span class="p">();</span>
<span class="p">}</span>
</code></pre></div></div>

<p>produces an observed graph instance at runtime. A future version of this idea could specialize that observed graph by operator sequence, tensor shape, dtype, and layout assumptions, then lower the supported subset into Clad-friendly C++ code. That is a broader research direction; the GSoC deliverable remains a small, measurable prototype.</p>

<h3 id="implementation-plan">Implementation Plan</h3>

<p>The implementation will proceed in stages.</p>

<p>First, I will select a reference workload that is small enough to test rigorously. Candidate workloads include a compact dense layer, an activation-plus-loss path, or a toy training component that can be expressed with source-visible C++ logic and simple tensor access patterns.</p>

<p>Second, I will generate and validate gradients with Clad outside LibTorch. This separates the core AD question from the framework-integration question: before using the generated code inside LibTorch, the derivative itself should be checked against expected results.</p>

<p>Third, I will build the LibTorch integration layer. The main path is a custom <code class="language-plaintext highlighter-rouge">torch::autograd::Function</code> whose <code class="language-plaintext highlighter-rouge">forward</code> method runs the selected C++ workload and whose <code class="language-plaintext highlighter-rouge">backward</code> method calls the Clad-generated derivative. The interface should keep saved tensors and metadata minimal so the data flow stays easy to inspect.</p>

<p>Fourth, I will compare the Clad-backed path with native LibTorch autograd on the same workload. Correctness comes first. Performance measurements and engineering tradeoffs will follow once the end-to-end path is stable.</p>

<p>If the primary path is stable early enough, I will evaluate whether a PyTorch custom-operator route gives a cleaner API or lower overhead. I will treat that as a stretch goal, not a prerequisite for the core project.</p>

<h3 id="expected-deliverables">Expected Deliverables</h3>

<p>By the end of the project, I aim to deliver:</p>

<ul>
  <li>A minimal LibTorch C++ example that uses Clad-generated derivative code through <code class="language-plaintext highlighter-rouge">torch::autograd::Function</code>.</li>
  <li>A documented CPU reference workload chosen to match Clad’s strengths.</li>
  <li>Correctness tests against native LibTorch autograd and finite-difference checks where they are useful.</li>
  <li>Benchmark notes explaining runtime behavior, integration overhead, and workload limitations.</li>
  <li>Developer-facing documentation describing the supported scope and possible extension points.</li>
</ul>

<p>The result should give the Compiler Research and HSF communities a concrete baseline for future work. If the prototype works well, it can motivate broader operator coverage, a cleaner user-facing API, ROOT-facing examples, or GPU support. If some parts do not work well, the project should still document the boundary clearly enough to guide the next attempt.</p>

<h3 id="looking-forward">Looking Forward</h3>

<p>I am interested in this project because it combines compilers, C++, machine-learning systems, and scientific software. The most important outcome is not only a working demo, but also a clear understanding of where compiler-generated derivatives fit naturally into a mature ML framework.</p>

<p>For users, the ideal experience should still feel like LibTorch C++. Clad should act as a compiler backend for supported pieces of the computation, with LibTorch remaining responsible for tensors, execution, and the surrounding training workflow.</p>

<h3 id="related-links">Related Links</h3>

<ul>
  <li><a href="https://hepsoftwarefoundation.org/gsoc/2026/proposal_Clad-Libtorch.html">Project Description</a></li>
  <li><a href="https://github.com/vgvassilev/clad">Clad Repository</a></li>
  <li><a href="https://pytorch.org/cppdocs/">PyTorch C++ Documentation</a></li>
  <li><a href="/assets/docs/Kacent_Proposal_GSOC2026.pdf">GSoC Project Proposal</a></li>
  <li><a href="/assets/presentations/Kacent_Clad_As_Torch_Engine.pdf">Initial Presentation</a></li>
  <li><a href="https://github.com/fogsong233">My GitHub Profile</a></li>
</ul>]]></content><author><name>Kacent Huang</name></author><category term="gsoc" /><category term="c++" /><category term="clang" /><category term="clad" /><category term="libtorch" /><category term="pytorch" /><category term="machine-learning" /><summary type="html"><![CDATA[A GSoC 2026 project exploring whether Clad-generated gradients can become a practical backend for selected LibTorch C++ workloads.]]></summary></entry><entry><title type="html">Final report for Port C and C++ Course to xeus-cpp</title><link href="/blogs/xeus_cpp_G_Runtolev_blog_final/" rel="alternate" type="text/html" title="Final report for Port C and C++ Course to xeus-cpp" /><published>2026-06-02T00:00:00+00:00</published><updated>2026-06-02T00:00:00+00:00</updated><id>/blogs/port-c-and-c++-course-to-xeus-cpp</id><content type="html" xml:base="/blogs/xeus_cpp_G_Runtolev_blog_final/"><![CDATA[<div class="custom-banner-wrapper" role="img" aria-label="">
  <div class="custom-banner-flex">
    <div class="banner-logo">
      <img src="/images/mg-pld-logo.png" alt="Left Logo" />
    </div>

    <div class="banner-separator" aria-hidden="true">
      @
    </div>

    <div class="banner-logo logo-right-bg">
      <img src="/images/cr-logo_old.png" alt="Right Logo" />
    </div>
  </div>

  
  <div class="banner-caption" role="heading" aria-level="2">
    
  </div>
  
</div>

<style>
  .custom-banner-wrapper {
    --b-height: 20vh;
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
    padding: 1.5rem 0;
  }

  .custom-banner-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
  }

  .banner-logo img {
    height: calc(var(--b-height) * 0.85);
    width: auto;
    max-width: 30vw;
    min-height: 50px;
    object-fit: contain;
  }

  /* Keep the white background for the right logo badge if needed */
  .logo-right-bg img {
    padding: 8px;
    background: #fff;
    border-radius: 4px;
  }

  .banner-separator {
    font-size: calc(var(--b-height) * 0.5);
    font-weight: 700;
    color: #000;
  }

  .banner-caption {
    text-align: center;
    margin-top: 1rem;
    font-family: Georgia, serif;
    font-size: calc(var(--b-height) * 0.25);
    color: #111;
  }

  @media (max-width: 768px) {
    .custom-banner-wrapper { --b-height: 15vh; }
    .custom-banner-flex { gap: 1.5rem; }
  }

  @media (max-width: 480px) {
    .custom-banner-flex { flex-direction: column; gap: 1rem; }
  }
</style>

<h3 id="project-overview"><strong>Project Overview</strong></h3>
<p>The goal of this project was to modernize C and C++ education by porting a traditional curriculum into an interactive Jupyter Notebook environment using the <strong>xeus-cpp</strong> kernel. 
Unlike standard compilers that require a full write-build-run cycle, xeus-cpp uses a JIT interpreter to execute code cell by cell. 
This allows students to experiment with code incrementally while the program state, such as variables and functions, persists throughout the session.</p>

<h3 id="why-this-project-was-important"><strong>Why This Project Was Important</strong></h3>
<p>Traditional C++ learning often has a high barrier to entry due to complex compiler setups and the rigid nature of static builds. This project was vital because:</p>
<ul>
  <li>Students can start coding immediately in a browser without configuring local toolchains.</li>
  <li>Provides instant feedback - errors are caught per cell, allowing students to fix bugs in real-time rather than waiting for a full program to compile.</li>
  <li>The stateful nature of notebooks makes it easier to demonstrate how pointers and memory allocation evolve during execution.</li>
</ul>

<h3 id="results"><strong>Results</strong></h3>
<p>The project resulted in a comprehensive curriculum, spanning from C fundamentals to advanced C++20 features. Key deliverables included:</p>
<ul>
  <li><strong>Interactive Notebooks:</strong> 12 fully functional modules with theory and live code sandboxes.</li>
  <li><strong>Safe Coding Patterns:</strong> A documented set of techniques, such as using <code class="language-plaintext highlighter-rouge">#ifndef</code> macro guards and namespace versioning to prevent redefinition errors when re-running cells.</li>
</ul>

<h3 id="what-worked-well-and-key-challenges"><strong>What Worked Well and Key Challenges</strong></h3>
<ul>
  <li><strong>Successes:</strong> The modular design of the notebooks proved highly effective. Breaking concepts into small, isolated cells made complex topics like OOP much more approachable.</li>
  <li><strong>Challenges:</strong> The biggest hurdle was the fundamental difference in execution models. For instance, the traditional <code class="language-plaintext highlighter-rouge">int main()</code> function actually causes conflicts in a REPL environment. Additionally, managing the global state required strict discipline to avoid “pollution” where variables from previous cells unintentionally affected new ones.</li>
</ul>]]></content><author><name>Georgi Runtolev</name></author><category term="c++" /><category term="xeus-cpp" /><category term="jupyter" /><category term="internship" /><category term="systems-programming" /><summary type="html"><![CDATA[A summary for my project to implement an educational course, explaining C and C++ features in a notebook environment]]></summary></entry><entry><title type="html">Improving Clang Error Recovery for Interactive Workflows: Early Findings</title><link href="/blogs/cppalliance26_sahil_patidar_intro_blog/" rel="alternate" type="text/html" title="Improving Clang Error Recovery for Interactive Workflows: Early Findings" /><published>2026-06-01T00:00:00+00:00</published><updated>2026-06-01T00:00:00+00:00</updated><id>/blogs/consistent-error-recovery-infrastructure</id><content type="html" xml:base="/blogs/cppalliance26_sahil_patidar_intro_blog/"><![CDATA[<div class="custom-banner-wrapper" role="img" aria-label="">
  <div class="custom-banner-flex">
    <div class="banner-logo">
      <img src="/images/cppalliance-logo.svg" alt="Left Logo" />
    </div>

    <div class="banner-separator" aria-hidden="true">
      @
    </div>

    <div class="banner-logo logo-right-bg">
      <img src="/images/cr-logo_old.png" alt="Right Logo" />
    </div>
  </div>

  
  <div class="banner-caption" role="heading" aria-level="2">
    
  </div>
  
</div>

<style>
  .custom-banner-wrapper {
    --b-height: 20vh;
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
    padding: 1.5rem 0;
  }

  .custom-banner-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
  }

  .banner-logo img {
    height: calc(var(--b-height) * 0.85);
    width: auto;
    max-width: 30vw;
    min-height: 50px;
    object-fit: contain;
  }

  /* Keep the white background for the right logo badge if needed */
  .logo-right-bg img {
    padding: 8px;
    background: #fff;
    border-radius: 4px;
  }

  .banner-separator {
    font-size: calc(var(--b-height) * 0.5);
    font-weight: 700;
    color: #000;
  }

  .banner-caption {
    text-align: center;
    margin-top: 1rem;
    font-family: Georgia, serif;
    font-size: calc(var(--b-height) * 0.25);
    color: #111;
  }

  @media (max-width: 768px) {
    .custom-banner-wrapper { --b-height: 15vh; }
    .custom-banner-flex { gap: 1.5rem; }
  }

  @media (max-width: 480px) {
    .custom-banner-flex { flex-direction: column; gap: 1rem; }
  }
</style>

<h2 id="introduction">Introduction</h2>

<p>I am Sahil Patidar. As part of the <strong>CppAlliance Fellowship 2026</strong>, I am working on the <strong>Consistent Error Recovery Infrastructure</strong> project.</p>

<p>In this project, I have been exploring how Clang handles errors in interactive environments such as Clang-Repl. During this work, We came across several issues related to rollback, error recovery, and compiler state management. This post shares some of those findings and the challenges involved in improving error recovery for interactive compilation.</p>

<p>Mentors: Vassil Vassilev, Aaron Jomy</p>

<hr />

<h2 id="project-description">Project Description</h2>
<p>This project aims to improve Clang’s error recovery infrastructure for interactive systems such as Clang-Repl and other tools built on top of Clang’s frontend.</p>

<p>Clang is primarily designed for traditional batch compilation, where a translation unit is compiled once from start to finish. Interactive systems work differently: they accept multiple inputs over time, and a failed input should not affect future inputs. Users expect the compiler to remain stable and continue working correctly after an error.</p>

<p>While Clang already provides robust error recovery for normal compilation, some recovery paths do not work well in incremental compilation scenarios. Failed inputs can sometimes leave semantic state behind and influence future analysis, which can affect the reliability of interactive workflows.</p>

<p>The goal of this project is to improve and extend Clang’s error recovery infrastructure so that interactive tools can recover from failed inputs more reliably, avoid polluting compiler state, and remain stable after errors, while preserving Clang’s existing behavior and compiler invariants.</p>

<hr />

<h2 id="why-this-project-matters">Why This Project Matters</h2>

<p>Building an interactive C++ environment is much more challenging than traditional compilation. In a normal compiler workflow, the entire program is compiled once from start to finish. In a REPL (Read-Eval-Print Loop), however, code is entered incrementally, modified frequently, and sometimes rolled back using commands such as %undo.</p>

<p>For users, the expectation is simple: a failed input should not affect future inputs. The compiler should recover cleanly and remain in a consistent state. In practice, achieving this is difficult because the compiler must carefully manage parser state, semantic analysis, and AST structures across multiple independent inputs.</p>

<p>While exploring Clang-Repl, we encountered several issues related to semantic state recovery, and handling of invalid declarations. These examples highlight some of the challenges that motivated this project.</p>

<p>⸻</p>

<h3 id="case-study-1-undo-does-not-fully-remove-template-specializations">Case Study 1: Undo Does Not Fully Remove Template Specializations</h3>

<p>One issue appears when undoing template specializations.</p>

<p>Example</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span> <span class="p">{};</span>
<span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{};</span>
<span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span> <span class="p">};</span>
<span class="c1">// error: redefinition of 'S2&lt;int&gt;'</span>
<span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="o">%</span><span class="n">undo</span>
<span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span> <span class="p">};</span>
<span class="c1">// still gives redefinition error</span>
</code></pre></div></div>
<p>What Happens?</p>

<p>The cleanup logic in <code class="language-plaintext highlighter-rouge">IncrementalParser::CleanUpPTU</code> removes declarations from lookup structures such as DeclContext and IdResolver. However, it does not fully remove all template-related information.</p>

<p>Some important template state is still left behind:</p>

<ul>
  <li>The specialization remains stored in <code class="language-plaintext highlighter-rouge">ClassTemplateDecl::Specializations</code>.</li>
  <li>Its canonical declaration still remains in the AST.</li>
</ul>

<p>Later, when a new specialization with the same definition is written, Sema checks the existing specializations using <code class="language-plaintext highlighter-rouge">findSpecialization</code>.</p>

<p>Since the old specialization is still present in the template’s specialization list, Sema finds it and treats the new declaration as a duplicate. As a result, it reports a redefinition error.</p>

<p>Why It Matters</p>

<p>This behavior causes several problems in interactive workflows:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">%undo</code> does not fully restore the previous state.</li>
  <li>Old declarations continue to affect future inputs.</li>
  <li>Valid code may fail unexpectedly.</li>
</ul>

<p>⸻</p>

<h3 id="case-study-2-parser-recovery-on-incomplete-functions">Case Study 2: Parser Recovery on Incomplete Functions</h3>

<p>Another issue appears when the user enters incomplete code.</p>

<p>Example</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="kt">void</span> <span class="nf">foo</span><span class="p">()</span> <span class="p">{</span>
</code></pre></div></div>
<p>What Happens?</p>

<p>Instead of waiting for additional input, the parser repeatedly reports errors such as:</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nl">error:</span> <span class="n">expected</span> <span class="n">expression</span>
</code></pre></div></div>
<p>Eventually the session ends with:</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">fatal</span> <span class="n">error</span><span class="o">:</span> <span class="n">too</span> <span class="n">many</span> <span class="n">errors</span> <span class="n">emitted</span>
</code></pre></div></div>
<p>The REPL fails to recover from the incomplete input.</p>

<p>Comparison with Cling</p>

<p>Cling handles this situation differently. When a function body is incomplete, it waits for more input instead of immediately producing a stream of parser errors.</p>

<p>Why the Parser Repeats the Same Error?</p>

<p>When the parser encounters <code class="language-plaintext highlighter-rouge">{</code>, it enters the function body and begins parsing statements using the following loop:</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">while</span> <span class="p">(...</span> <span class="n">Tok</span><span class="p">.</span><span class="n">isNot</span><span class="p">(</span><span class="n">tok</span><span class="o">::</span><span class="n">r_brace</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="n">Tok</span><span class="p">.</span><span class="n">isNot</span><span class="p">(</span><span class="n">tok</span><span class="o">::</span><span class="n">eof</span><span class="p">))</span> <span class="p">{</span>
  <span class="p">...</span>
  <span class="n">R</span> <span class="o">=</span> <span class="n">ParseStatementOrDeclaration</span><span class="p">(...);</span>
<span class="p">}</span>
</code></pre></div></div>
<p>After encountering <code class="language-plaintext highlighter-rouge">{</code>, the parser enters the function body and repeatedly calls <code class="language-plaintext highlighter-rouge">ParseStatementOrDeclaration()</code> until it finds a closing <code class="language-plaintext highlighter-rouge">}</code> or reaches the end of the file.</p>

<p>With incomplete input, no valid statements can be parsed and no closing <code class="language-plaintext highlighter-rouge">}</code> is found. Parsing fails, but no tokens are consumed, so the parser remains at the same position.</p>

<p>As a result, the loop keeps running, repeatedly calling <code class="language-plaintext highlighter-rouge">ParseStatementOrDeclaration()</code> on the same token and emitting the same error message.</p>

<p>The root cause is that the loop does not check whether parsing made any progress. When parsing fails without consuming tokens, there is no condition to break out of the loop.</p>

<p>Why It Matters</p>

<p>This leads to:</p>

<ul>
  <li>Repeated and noisy error messages.</li>
  <li>Poor interactive user experience.</li>
  <li>Reduced stability for subsequent inputs.</li>
</ul>

<p>⸻</p>

<h3 id="case-study-3-invalid-template-definitions-affect-future-inputs">Case Study 3: Invalid Template Definitions Affect Future Inputs</h3>

<p>A third issue occurs when a template specialization contains a compilation error.</p>

<p>Example</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span> <span class="p">{};</span>
<span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span><span class="p">;</span> <span class="p">};</span>
<span class="c1">// error: expected expression</span>
<span class="n">Clang</span><span class="o">-</span><span class="n">Repl</span><span class="o">&gt;</span> <span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span> <span class="p">};</span>
<span class="c1">// error: redefinition of 'S2&lt;int&gt;'</span>
</code></pre></div></div>
<p>What Happens?</p>

<p>Although the first specialization is invalid, Clang still records it internally as an existing specialization. When the user later provides a correct definition, it is rejected as a redefinition.</p>

<p>In other words, a failed declaration continues to influence future inputs even though compilation never succeeded.</p>

<p>Comparison with Cling</p>

<p>In normal interactive mode, Cling rolls back the invalid specialization and discards it. As a result, the later valid definition is accepted.</p>

<p>Additional Challenge: Combined Inputs</p>

<p>A related issue appears when multiple statements are processed as a single input transaction. In this scenario, even Cling/ROOT exhibits similar behavior.</p>

<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">root</span> <span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span> <span class="p">{};</span>
<span class="n">root</span> <span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">v</span> <span class="o">=</span> <span class="p">;</span> <span class="p">};</span> \
<span class="n">root</span> <span class="p">(</span><span class="n">cont</span> <span class="n">ed</span><span class="p">,</span> <span class="n">cancel</span> <span class="n">with</span> <span class="p">.</span><span class="err">@</span><span class="p">)</span> <span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">v</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span> <span class="p">};</span>
<span class="nl">ROOT_prompt_1:</span><span class="mi">1</span><span class="o">:</span><span class="mi">38</span><span class="o">:</span> <span class="n">error</span><span class="o">:</span> <span class="n">expected</span> <span class="n">expression</span>
<span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">v</span> <span class="o">=</span> <span class="p">;</span> <span class="p">};</span> \
                                     <span class="o">^</span>
<span class="nl">ROOT_prompt_1:</span><span class="mi">2</span><span class="o">:</span><span class="mi">20</span><span class="o">:</span> <span class="n">error</span><span class="o">:</span> <span class="n">redefinition</span> <span class="n">of</span> <span class="err">'</span><span class="n">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="err">'</span>
<span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">v</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span> <span class="p">};</span>
                   <span class="o">^~~~~~~</span>
<span class="nl">ROOT_prompt_1:</span><span class="mi">1</span><span class="o">:</span><span class="mi">20</span><span class="o">:</span> <span class="n">note</span><span class="o">:</span> <span class="n">previous</span> <span class="n">definition</span> <span class="n">is</span> <span class="n">here</span>
<span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S2</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span> <span class="kt">int</span> <span class="n">v</span> <span class="o">=</span> <span class="p">;</span> <span class="p">};</span> \
</code></pre></div></div>

<p>In this case, both specializations are compiled as part of the same transaction. Since rollback occurs only after compilation of the entire input completes, the invalid specialization remains visible while processing the second definition, resulting in a redefinition error.</p>

<p>Why It Matters</p>

<p>This behavior makes interactive development more difficult because:</p>

<ul>
  <li>Invalid code affects later inputs.</li>
  <li>Users cannot easily correct mistakes incrementally.</li>
  <li>REPL behavior changes depending on how inputs are grouped.</li>
  <li>Recovery from template-related errors becomes unintuitive.</li>
</ul>

<hr />

<h2 id="what-we-learned-during-investigation">What We Learned During Investigation</h2>

<p>While investigating these issues, I found that the observed behavior is actually consistent with Clang’s current design, even though it is not ideal for an interactive environment such as Clang-Repl.</p>

<p>Consider the following example:</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">template</span> <span class="o">&lt;</span><span class="k">class</span> <span class="nc">T</span><span class="p">&gt;</span> <span class="k">struct</span> <span class="nc">S1</span> <span class="p">{};</span>
<span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span>
<span class="k">struct</span> <span class="nc">S1</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span>
  <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span><span class="p">;</span>
<span class="p">};</span>
<span class="k">template</span> <span class="o">&lt;</span><span class="p">&gt;</span>
<span class="k">struct</span> <span class="nc">S1</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="p">{</span>
  <span class="kt">int</span> <span class="n">val</span> <span class="o">=</span> <span class="mi">32</span><span class="p">;</span>
<span class="p">};</span>
</code></pre></div></div>
<p>This produces:</p>
<div class="language-cpp highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nl">error:</span> <span class="n">redefinition</span> <span class="n">of</span> <span class="err">'</span><span class="n">S1</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span><span class="err">'</span>
</code></pre></div></div>
<p>At first, this looked like an error recovery problem. However, after tracing the implementation, it became clear that Clang is behaving as expected according to its normal compilation model.</p>

<p>The specialization declaration is created successfully and added to Clang’s semantic state before the initializer error is diagnosed. Later, when the second specialization is encountered, Clang naturally treats it as a redefinition.</p>

<p>While following the code path, I also noticed that the specialization begins to be treated as a definition through <code class="language-plaintext highlighter-rouge">Specialization-&gt;startDefinition()</code> before the entire class body has been processed. If parsing fails later, some definition-related state may already have been recorded and can influence future declarations.</p>

<p>This led to an important realization: the problem is not simply that an invalid declaration exists. The bigger issue is that a failed incremental submission can continue to participate in future semantic analysis.</p>

<p>For normal compilation, this behavior is reasonable because Clang is designed around a semantic state that continuously grows throughout compilation. In a REPL, however, users usually expect a failed input not to affect future attempts.</p>

<p>Another important constraint is that any solution must preserve Clang’s existing behavior. The redefinition diagnostic above is correct according to Clang’s current rules and should continue to behave the same way during normal compilation.</p>

<p><strong>Looking at Possible Directions</strong></p>

<p>During the investigation, I also looked at Cling’s declaration unloading mechanism. Cling handles similar problems by updating lookup structures and semantic state after failures. While this works well for Cling, it relies on modifying data structures that Clang generally expects to remain stable, making the same approach difficult to apply directly.</p>

<p>One possible direction is to control whether declarations from failed submissions participate in lookup, redeclaration checks, and other semantic operations, instead of removing them completely. This could allow interactive environments to treat failed inputs differently without modifying the AST itself.</p>

<p>However, lookup is only part of the problem. By the time an error is diagnosed, information may already have been recorded in redeclaration chains, specialization sets, or definition state. Because of this, filtering declarations from lookup alone may not be enough.</p>

<p>Filtering vs Rollback</p>

<p>“Removing” a declaration does not mean removing it from memory. Clang mostly uses bump allocation, so AST nodes typically remain allocated for the lifetime of the compilation. In practice, removal usually means preventing a declaration from participating in semantic operations such as lookup and redeclaration checks.</p>

<p>At this stage, it is still unclear whether rollback, filtering, delayed registration, or some combination of these approaches is the right solution.</p>

<p>What became clear during this investigation is that the larger challenge is deciding how failed incremental submissions should interact with Clang’s semantic state while preserving the behavior and invariants that Clang already relies on.</p>

<p>This leads to the central question for the project:</p>

<p>When should declarations from a failed interactive submission become visible to future semantic analysis, and how can that be controlled without breaking Clang’s existing behavior?</p>

<hr />

<h2 id="where-this-leads">Where This Leads</h2>

<p>What started as a simple redefinition error turned out to be a much deeper question about how Clang manages semantic state.</p>

<p>The investigation showed that the behavior is not really a bug in Clang’s normal compilation model. Instead, it exposes a mismatch between the expectations of interactive environments and the assumptions built into a traditional compiler.</p>

<p>The next step is to understand where that gap should be addressed. Whether the answer involves rollback, filtering, delayed registration, or something else entirely is still an open question, but the investigation has already provided a clearer picture of the problem space.</p>

<hr />

<h2 id="related-links">Related Links</h2>

<ul>
  <li><a href="https://github.com/llvm/llvm-project">LLVM Repository</a></li>
  <li><a href="https://compiler-research.org/open_projects#consistent-error-recovery-infrastructure">Project Description</a></li>
  <li><a href="https://github.com/SahilPatidar">My GitHub Profile</a></li>
</ul>

<hr />]]></content><author><name>Sahil Patidar</name></author><category term="cppalliance" /><category term="clang" /><category term="error-recovery" /><category term="clang-repl" /><category term="interactive-compilation" /><summary type="html"><![CDATA[As part of the CppAlliance Fellowship 2026, this project explores improvements to Clang’s error recovery infrastructure for interactive environments such as Clang-Repl, with the goal of providing more reliable recovery and better compiler state consistency after failed inputs.]]></summary></entry><entry><title type="html">Enhance and Develop GeneROOT Infrastructure</title><link href="/blogs/generoot_jeffrey_zhang_blog/" rel="alternate" type="text/html" title="Enhance and Develop GeneROOT Infrastructure" /><published>2026-05-27T00:00:00+00:00</published><updated>2026-05-27T00:00:00+00:00</updated><id>/blogs/enhance-and-develop-generoot-infrastructure</id><content type="html" xml:base="/blogs/generoot_jeffrey_zhang_blog/"><![CDATA[<h2 id="introduction">Introduction</h2>

<p>My name is Jeffrey Zhang, and I’m a third-year B.S. undergraduate student studying Physics at Nagoya
University, Japan. I’ll be working on extending the GeneROOT infrastructure, building directly on the foundation
laid by Aditya Pandey during his GSoC 2025 work on using ROOT in genome
sequencing.</p>

<p><strong>Mentors</strong>: Martin Vassilev, Vassil Vassilev, Aaron Jomy</p>

<h2 id="overview">Overview</h2>

<p>Large-scale biological data, such as a fully sequenced human genome, typically occupies $\sim$500 GB. Analyzing such datasets for research involves data volumes that exceed petabytes. Handling data at this scale requires a highly robust underlying software infrastructure. To meet this challenge, the GeneROOT project draws on CERN’s extensive expertise in managing massive physics datasets through its columnar-based ROOT software framework. The GeneROOT project aims to adapt this framework specifically for processing biological data.</p>

<p>During the <a href="https://compiler-research.org/blogs/GSoC25_aditya_pandey_final_blog/">2025 GeneROOT GSoC</a> project, Aditya Pandey established the RNTuple data model for genome sequences. It currently supports region queries, conversion from SAM to RNTuple, and a benchmark comparison against the industry-standard CRAM format on a single test sample <code class="language-plaintext highlighter-rouge">HG00154</code> from the 1000 Genomes Project.</p>

<p>However, the results reveal several limitations. The benchmark suite relies on a single low-coverage sample with hard-coded file paths, which is insufficient for a credible comparison with tools such as SAMtools and CRAM. In terms of performance, RNTuple’s index lookup itself performs a linear scan that does not scale to production-sized datasets. In terms of functionality, RAMtools cannot currently export records back to SAM, has no merge operation to complement the chromosome splitter, no sort, and no statistics tools. These gaps leave RAMtools as a proof of concept rather than a usable pipeline component.</p>

<p>My project builds on that foundation by expanding benchmark suite, optimizing indexing, evaluating compression algorithms, and bringing more SAMtools features to RAMtools.</p>

<h2 id="technical-implementation">Technical Implementation</h2>

<p>The work breaks into five tasks:</p>

<ol>
  <li>
    <p><strong>Benchmark on heavy bioinformatics datasets.</strong> Refactor the benchmark
suite, replace hard-coded paths with a <code class="language-plaintext highlighter-rouge">benchmark_config.h</code> and
CLI-driven dataset selection, run against well-known reference samples
(<code class="language-plaintext highlighter-rouge">HG001</code>–<code class="language-plaintext highlighter-rouge">HG007</code>), and capture more metrics such as memory usage in addition to
timing metrics.</p>
  </li>
  <li>
    <p><strong>Cross-format comparison.</strong> Extend the <code class="language-plaintext highlighter-rouge">system()</code>-call approach already
used in <code class="language-plaintext highlighter-rouge">chromosome_split_benchmark.cxx</code> so all benchmark scripts measure
SAM, BAM, and CRAM against RAMtools/RNTuple on the same datasets.</p>
  </li>
  <li>
    <p><strong>Genomic compression algorithms.</strong> Evaluate modern quality-score
compression schemes (Crumble, QVZ, CALQ, P-block), extend the
<code class="language-plaintext highlighter-rouge">EQualCompressionBits</code> enum in <code class="language-plaintext highlighter-rouge">RAMNTupleRecord.h</code>, and add the most
effective candidates as new quality policies.</p>
  </li>
  <li>
    <p><strong>Indexing and search optimizations.</strong> <code class="language-plaintext highlighter-rouge">GetRowsInRange()</code> currently does
an O(N) linear scan; I’ll replace it with an O(log N) binary search over
a sorted <code class="language-plaintext highlighter-rouge">fIndex</code> (eliminating the redundant <code class="language-plaintext highlighter-rouge">fIndexMap</code>/<code class="language-plaintext highlighter-rouge">RebuildMap</code>
pair), have <code class="language-plaintext highlighter-rouge">kPositionInterval</code> and <code class="language-plaintext highlighter-rouge">kMappedInterval</code> as configurable
parameters, and implement a no-index columnar query fallback in
<code class="language-plaintext highlighter-rouge">RAMNTupleView.cxx</code> similar to legacy TTree <code class="language-plaintext highlighter-rouge">ramview_no_index.cxx</code>.</p>
  </li>
  <li>
    <p><strong>Add common SAMtools features to RAMtools.</strong> Add <code class="language-plaintext highlighter-rouge">ramntuplestats</code>,
<code class="language-plaintext highlighter-rouge">ramntupleidxstat</code>, and <code class="language-plaintext highlighter-rouge">ramntupleflagstat</code>; complete <code class="language-plaintext highlighter-rouge">ramntupleview</code>
with N-record, region-filtering, and selective-column output; and add
<code class="language-plaintext highlighter-rouge">ramntuplesplit</code>, <code class="language-plaintext highlighter-rouge">ramntuplemerge</code>, and <code class="language-plaintext highlighter-rouge">ramntuplesort</code>.</p>
  </li>
</ol>

<h2 id="goals">Goals</h2>

<p>By the end of the coding period I aim to have:</p>

<ul>
  <li>A reproducible benchmark suite that runs against multiple
genomic datasets with custom commands and outputs.</li>
  <li>Quantitative cross-format comparisons against SAM, BAM, and CRAM.</li>
  <li>A measurable storage-efficiency improvement on <code class="language-plaintext highlighter-rouge">QUAL</code> data using modern
compression algorithms.</li>
  <li>Faster region queries that can scale better to production-sized datasets.</li>
  <li>RAMtools at feature parity with some of the commonly used functionalities in SAMtools, such as <code class="language-plaintext highlighter-rouge">Stat</code> and <code class="language-plaintext highlighter-rouge">View</code>.</li>
</ul>

<p>The combined effect should move RAMtools from a working proof of concept
toward a more usable component of a real genomics pipeline.</p>]]></content><author><name>Jeffrey Zhang</name></author><category term="c++" /><category term="genome" /><category term="bioinformatics" /><category term="root" /><category term="rntuple" /><summary type="html"><![CDATA[Continuing the GeneROOT project: expanding benchmark suite, optimizing indexing, evaluating compression algorithms, and bringing more SAMtools features to RAMtools.]]></summary></entry><entry><title type="html">CARTopiaX: Extending a Next-Generation Platform for Computational Cancer Biology</title><link href="/blogs/gsoc26_salvador_introduction_blog/" rel="alternate" type="text/html" title="CARTopiaX: Extending a Next-Generation Platform for Computational Cancer Biology" /><published>2026-05-27T00:00:00+00:00</published><updated>2026-05-27T00:00:00+00:00</updated><id>/blogs/extending-cartopiax</id><content type="html" xml:base="/blogs/gsoc26_salvador_introduction_blog/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>My name is Salvador de la Torre Gonzalez, and I am a Mathematics and Computer Engineering student at the University of Seville and a Google Summer of Code 2026 contributor working on the project <strong>“CARTopiaX: Extending a Next-Generation Platform for Computational Cancer Biology”</strong>.</p>

<p>During GSoC 2025, I was part of the Compiler Research team, where I initiated the CARTopiaX framework. This year, the project focuses on extending the platform to reproduce additional biologically relevant phenomena in CAR T-cell therapy research.</p>

<p><strong>Mentors</strong>: Luciana Melina Luque, Vassil Vassilev, Lukas Breitwieser</p>

<h3 id="briefly-about-car-t-cell-therapy-and-cartopiax">Briefly about CAR-T Cell Therapy and CARTopiaX</h3>

<p>Chimeric Antigen Receptor T-cell (<strong>CAR-T</strong>) therapy is an immunotherapy approach where a patient’s T-cells are engineered to recognize and destroy cancer cells. Although highly successful in blood cancers, CAR-T therapy still faces major challenges in solid tumors due to limited infiltration, immunosuppressive microenvironments, and T-cell exhaustion.</p>

<p><a href="https://github.com/compiler-research/CARTopiaX">CARTopiaX</a> is an advanced agent-based model designed to study CAR T-cell therapy in solid tumors. Built on <a href="https://github.com/BioDynaMo/biodynamo">BioDynaMo</a>, a high-performance open-source platform for large-scale and modular biological simulations, CARTopiaX enables detailed exploration of complex biological interactions, hypothesis testing and data-driven discovery within tumor microenvironments.</p>

<p>The framework implements the mathematical model proposed in the <em>Nature Scientific Reports</em> paper <em>“In silico study of heterogeneous tumour-derived organoid response to CAR T-cell therapy”</em> and successfully reproduces its experimental trends <em>in silico</em>.</p>

<p>The goal of this GSoC project is to expand CARTopiaX so it can replicate new <em>in vitro</em> experimental observations and biological mechanisms, strengthening its role as a flexible framework for computational cancer biology research.</p>

<h3 id="implementation-details-and-plans">Implementation Details and Plans</h3>

<p>The project will focus on extending CARTopiaX with additional biological mechanisms identified through a literature review of recent CAR T-cell studies.</p>

<h4 id="possible-extension-directions">Possible extension directions</h4>

<p><u>1. Agents</u></p>

<ul>
  <li><strong>Additional immune populations (PBMCs, macrophages, MDSCs):</strong> Incorporating alternative immune populations, such as PBMCs (comprising T cells and dendritic cells), macrophages that engulf debris and pathogens, and MDSCs which act as immunosuppressive cells to inhibit T-cell activity.</li>
  <li><strong>Stromal cells (fibroblasts and CAFs) acting as physical barriers:</strong> Including stromal cells like fibroblasts and CAFs (Cancer-Associated Fibroblasts), which contribute to extracellular matrix production and physical immune cell exclusion.</li>
  <li><strong>Tumor heterogeneity, cancer types, and antigen loss/re-expression:</strong> Modeling tumor heterogeneity and variability, which includes differences in antigen expression and the ability of tumor cells to temporarily lose and later regain target antigens to enable immune evasion.</li>
</ul>

<p><u>2. Microenvironment</u></p>

<ul>
  <li><strong>Cytokine signaling and immunosuppressive factors:</strong> Examining cytokine signaling and immunosuppressive factors, which are signaling proteins that regulate immune activity and can suppress immune responses (e.g., TGF-β, IL-10) to promote tumor evasion.</li>
  <li><strong>Hypoxia and nutrient deprivation effects:</strong> Accounting for hypoxia, which consists of low oxygen regions within tumors caused by limited diffusion and high cellular consumption, along with the associated effects of nutrient deprivation.</li>
  <li><strong>Vascularization and nutrient diffusion:</strong> Simulating vascularization and nutrient diffusion through blood vessels that supply oxygen and nutrients while directly influencing spatial gradients within the tumor microenvironment.</li>
  <li><strong>ECM viscosity and hydrogel-based barriers:</strong> Evaluating ECM viscosity and hydrogel-based barriers, where the density and stiffness of the structural extracellular matrix network hinder immune cell movement.</li>
  <li><strong>ECM degradation and heat-induced microenvironment modulation:</strong> Assessing ECM degradation and heat-induced microenvironment modulation as processes that experimentally modify the extracellular matrix to increase permeability and improve immune cell infiltration.</li>
</ul>

<p><u>3. Rules &amp; Dynamics</u></p>

<ul>
  <li><strong>Immune suppression and exhaustion mechanisms:</strong> Integrating immune suppression and exhaustion mechanisms, which are processes where immune cells gradually lose their activity due to prolonged stimulation or inhibitory signals.</li>
  <li><strong>Antigen-dependent recognition and immune evasion:</strong> Analyzing antigen-dependent recognition and immune evasion, whereby CAR T-cells recognize tumor cells based on specific antigens while tumors actively evade this by downregulating or losing antigen expression.</li>
  <li><strong>Chemotaxis and infiltration dynamics:</strong> Modeling chemotaxis and infiltration dynamics to capture the directed movement of immune cells toward specific chemical gradients such as cytokines.</li>
  <li><strong>Macrophage phagocytosis:</strong> Incorporating macrophage phagocytosis as the active process by which macrophages engulf and remove dead or damaged cells.</li>
  <li><strong>ECM permeability evolution:</strong> Tracking ECM permeability evolution to understand how continuous changes in tissue structure affect how easily cells can move through the extracellular matrix.</li>
  <li><strong>Hypoxia-induced necrosis and cell-state transitions:</strong> Simulating hypoxia-induced necrosis and cell-state transitions, which involve cell death caused by oxygen deprivation and the subsequent transitions between different cellular states under stress conditions.</li>
</ul>

<hr />

<p>The project is organized into four main phases:</p>

<p><u>Phase 1: Literature Review &amp; Data Acquisition</u></p>

<ul>
  <li>Select a high-impact experimental study from the literature that provides relevant biological and computational insights for model extension.</li>
  <li>Obtain usable wet-lab datasets associated with the selected study, ensuring they are suitable for computational analysis.</li>
  <li>Extract quantitative metrics from experimental data to enable model calibration and evaluation.</li>
</ul>

<p><u>Phase 2: Model Expansion</u></p>

<ul>
  <li>Add new biological agents, microenvironment components and required to represent the selected CAR T-cell phenomenon.</li>
  <li>Implement biologically grounded rules and interactions that govern cell behavior and system new dynamics.</li>
  <li>Adapt and extend the existing CARTopiaX model structure to accurately reproduce the chosen biological setting.</li>
</ul>

<p><u>Phase 3: Model Calibration &amp; Optimization</u></p>

<ul>
  <li>Define fitness functions using error metrics (e.g., MSE/RMSE) for model fitting, measuring the discrepancy between simulated outputs and experimental observations.</li>
  <li>Implement and apply efficient optimization methods for high computational cost scenarios, such as Bayesian optimization and evolutionary algorithms, to explore the parameter space effectively.</li>
  <li>Reduce computational cost via early stopping, simplified simulations, and staged calibration strategies that progressively refine parameter estimates.</li>
  <li>Perform parameter estimation to identify the set of model parameters that best reproduce the experimental data.</li>
</ul>

<p><u>Phase 4: Validation &amp; Delivery</u></p>

<ul>
  <li>Validate the model using multiple stochastic simulations to ensure robustness and consistency of results.</li>
  <li>Perform sensitivity analysis and robustness checks to understand parameter influence and model stability.</li>
  <li>Summarize findings in a structured scientific report oriented towards a future research publication.</li>
</ul>

<hr />

<h3 id="conclusion">Conclusion</h3>

<p>This project aims to demonstrate how CARTopiaX can evolve into a flexible and extensible framework capable of reproducing increasingly complex biological phenomena in CAR T-cell therapy research.</p>

<p>By combining real experimental data with large-scale agent-based simulations, the project seeks to support hypothesis-driven exploration in computational oncology while strengthening the connection between <em>in vitro</em> experimentation and predictive <em>in silico</em> modeling.</p>

<p>As both the original author of CARTopiaX and a student working at the intersection of mathematics, computer engineering and computational biology, I am excited to continue expanding the project during GSoC 2026.</p>

<h3 id="related-links">Related Links</h3>

<ul>
  <li><a href="https://github.com/compiler-research/CARTopiaX">CARTopiaX</a></li>
  <li><a href="https://hepsoftwarefoundation.org/gsoc/2026/proposal_BioDynamo_CartopiaX.html">Project Description</a></li>
  <li>Luque, L.M., Carlevaro, C.M., Rodriguez-Lomba, E. et al. <em>In silico study of heterogeneous tumour-derived organoid response to CAR T-cell therapy.</em> Sci Rep 14, 12307 (2024). <a href="https://doi.org/10.1038/s41598-024-63125-5">DOI</a></li>
  <li>Breitwieser, L., Hesam, A., de Montigny, J. et al. <em>BioDynaMo: a modular platform for high-performance agent-based simulation.</em> Bioinformatics 38(2), 453–460 (2022). <a href="https://doi.org/10.1093/bioinformatics/btab649">DOI</a></li>
  <li>Breitwieser, L., Hesam, A., Rademakers, F., Gómez Luna, J., and Mutlu, O. <em>High-Performance and Scalable Agent-Based Simulation with BioDynaMo.</em> In Proceedings of the 28th ACM SIGPLAN Annual Symposium on Principles and Practice of Parallel Programming (PPoPP ‘23), 174–188 (2023). <a href="https://doi.org/10.1145/3572848.3577480">DOI</a></li>
  <li><a href="https://github.com/BioDynaMo/biodynamo">BioDynaMo Repository</a></li>
  <li><a href="https://github.com/salva24">My GitHub Profile</a></li>
</ul>]]></content><author><name>Salvador de la Torre Gonzalez</name></author><category term="gsoc" /><category term="BioDynaMo" /><category term="c++" /><summary type="html"><![CDATA[Extending CARTopiaX within BioDynaMo to reproduce new biologically relevant CAR T-cell phenomena using real wet-lab experimental data.]]></summary></entry><entry><title type="html">Consolidate and advance the GPU infrastructure in Clad</title><link href="/blogs/gsoc26_vedant_introduction_blog/" rel="alternate" type="text/html" title="Consolidate and advance the GPU infrastructure in Clad" /><published>2026-05-24T00:00:00+00:00</published><updated>2026-05-24T00:00:00+00:00</updated><id>/blogs/consolidate-and-advance-the-gpu-infrastructure-in-Clad</id><content type="html" xml:base="/blogs/gsoc26_vedant_introduction_blog/"><![CDATA[<h3 id="introduction">Introduction</h3>

<p>I am Vedant Goyal, a pre-final year B.E. undergraduate student studying Electrical and Computer Engineering at Thapar Institute of Engineering and Technology. During Google Summer of Code 2026, I will be working on “Consolidating and advancing the GPU infrastructure in Clad” project with Compiler Research group.</p>

<p><strong>Mentors:</strong> Aaron Jomy, David Lange, Vassil Vassilev</p>

<h3 id="about-automatic-differentiation-and-clad">About Automatic Differentiation and Clad</h3>

<p>Automatic Differentiation(AD) is a set of techniques to evaluate the derivative of functions specified by a computer program. Automatic Differentiation is different from symbolic differentiation and numerical differentiation. Symbolic differentiation is computationally expensive whereas Numerical differentiation suffers from round off errors. AD solves all these problems by applying chain rule systematically to compute gradients.</p>

<p>Clad is a Clang-based automatic differentiation tool that transforms C++ source code to compute derivatives. Unlike other AD tools which compute derivatives at runtime by operator overloading, Clad computes derivatives at compile time, by leveraging Clang’s compiler infrastructure. It supports multiple differentiation modes like forward mode, reverse mode and hessian mode, making it suitable for a wide range of applications.</p>

<h3 id="overview-of-the-project">Overview of the project</h3>

<p>In recent years, Clad has gained promising support for GPU-based differentiation, including CUDA kernel differentiation, partial Thrust support, and integrations with several GPU-oriented applications. However, much of this work remains fragmented across older branches and forks, with limited testing, benchmarking, and upstream integration.</p>

<p>The primary goal of this project is to consolidate and strengthen Clad’s GPU infrastructure. The work will begin with auditing and reproducing contributions made by previous contributors to identify what has already been already merged in master, what remains incomplete, and which areas require additional testing or refinement.</p>

<p>The project will further focus on improving correctness, expanding GPU feature support, integrating representative GPU workloads, and establishing reproducible benchmarks and testing infrastructure for GPU-based automatic differentiation in Clad.</p>

<h3 id="implementation-plan">Implementation Plan</h3>

<p>The first phase of the project will focus on incorporating the support for the modern Unified Memory APIs and complete host-device boundary tracking. Ex:- Clad does not have support for the <code class="language-plaintext highlighter-rouge">cudaMallocManaged</code> yet. I’ll also be resolving the isolated compiler edge cases identified in previous work.</p>

<p>Once the core GPU work is in place the next step would be to address the concurrency challenges specifically regarding memory spaces. Prior efforts had already provided basic support for the memory qualifiers like <code class="language-plaintext highlighter-rouge">__shared__</code>, <code class="language-plaintext highlighter-rouge">__managed__</code> etc. but generating the correct gradients still requires deep architectural changes. Strategies like block level sync and synchronization primitives like <code class="language-plaintext highlighter-rouge">cudaDeviceSynchronize()</code> needs to be implemented in order to prevent race condition without over relying on the expensive atomic operations.</p>

<p>After all that have been done I will be focusing on integrating the full scale HPC (High Performance Computing) applications like LULESH and RSBench to the current Clad infrastructure. Also to ensure long term maintainability the I will design and implement a CI pipeline that executes GPU-specific tests on capable runners, ensuring future commits do not break CUDA functionality.</p>

<p>As stretch goals, I plan to further integrate XSBench and LBM HPC applications in the clad infrastructure and also establishing a reproducible benchmarking suite that evaluates Clad’s performance on HPC applications directly against Enzyme. The final stages will focus on extensive testing, documentation, and contributing the changes back to the main repository.</p>

<h3 id="looking-forward">Looking Forward</h3>

<p>By the end of summer, I hope to deliver a more consolidated, reliable, and better-tested GPU infrastructure for Clad, along with improved benchmarking, workload support, and developer experience for GPU-based automatic differentiation workflows. I’m very excited for this opportunity to contribute to the scientific computing community.</p>

<hr />

<h3 id="related-links">Related Links</h3>

<p>-<a href="https://hepsoftwarefoundation.org/gsoc/2026/proposal_Clad-GPU.html">Project Description</a>
-<a href="https://github.com/vgvassilev/clad">Clad Repository</a>
-<a href="/assets/docs/Vedant_Goyal_Proposal_2026.pdf">GSoC Project Proposal</a>
-<a href="https://github.com/Vedant2005goyal">My Github Profile</a></p>]]></content><author><name>Vedant Goyal</name></author><category term="gsoc" /><category term="clad" /><category term="clang" /><category term="cuda" /><category term="c++" /><summary type="html"><![CDATA[A GSoC 2026 project aimed at consolidating the fragmented GPU work and advancing the GPU infrastructure]]></summary></entry><entry><title type="html">Enhance Clang Diagnostics: Making the Compiler Work Harder for You</title><link href="/blogs/cppalliance26_aditya_medhane_intro_blog/" rel="alternate" type="text/html" title="Enhance Clang Diagnostics: Making the Compiler Work Harder for You" /><published>2026-05-23T00:00:00+00:00</published><updated>2026-05-23T00:00:00+00:00</updated><id>/blogs/enhance-clang-diagnostics-intro</id><content type="html" xml:base="/blogs/cppalliance26_aditya_medhane_intro_blog/"><![CDATA[<div class="custom-banner-wrapper" role="img" aria-label="">
  <div class="custom-banner-flex">
    <div class="banner-logo">
      <img src="/images/cppalliance-logo.svg" alt="Left Logo" />
    </div>

    <div class="banner-separator" aria-hidden="true">
      @
    </div>

    <div class="banner-logo logo-right-bg">
      <img src="/images/cr-logo_old.png" alt="Right Logo" />
    </div>
  </div>

  
  <div class="banner-caption" role="heading" aria-level="2">
    
  </div>
  
</div>

<style>
  .custom-banner-wrapper {
    --b-height: 20vh;
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
    padding: 1.5rem 0;
  }

  .custom-banner-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
  }

  .banner-logo img {
    height: calc(var(--b-height) * 0.85);
    width: auto;
    max-width: 30vw;
    min-height: 50px;
    object-fit: contain;
  }

  /* Keep the white background for the right logo badge if needed */
  .logo-right-bg img {
    padding: 8px;
    background: #fff;
    border-radius: 4px;
  }

  .banner-separator {
    font-size: calc(var(--b-height) * 0.5);
    font-weight: 700;
    color: #000;
  }

  .banner-caption {
    text-align: center;
    margin-top: 1rem;
    font-family: Georgia, serif;
    font-size: calc(var(--b-height) * 0.25);
    color: #111;
  }

  @media (max-width: 768px) {
    .custom-banner-wrapper { --b-height: 15vh; }
    .custom-banner-flex { gap: 1.5rem; }
  }

  @media (max-width: 480px) {
    .custom-banner-flex { flex-direction: column; gap: 1rem; }
  }
</style>

<h3 id="introduction">Introduction</h3>

<p>Hello everyone! I’m Aditya Medhane, a Computer Science undergrad at IIIT Gwalior, India. I’m working with the Compiler Research group as part of the <strong>CppAlliance Fellowship 2026</strong> on the project “Enhance Clang Diagnostics.”</p>

<p>Compilers have always fascinated me. Not just what they produce, but how they work inside. There’s something genuinely interesting about a piece of software that understands other software. The more I dig into it, the more there is to learn, and I think that’s what I love most about working in this space. Contributing to a compiler like Clang means working on a tool that millions of developers depend on every day, and even a small improvement in the diagnostics can save someone hours of debugging.</p>

<p><strong>Mentors</strong>: Vassil Vassilev, Aaron Jomy</p>

<hr />

<h3 id="why-diagnostics">Why Diagnostics?</h3>

<p>Compilers communicate with us. When something goes wrong in our code, they tell us what happened and where through errors, warnings, notes, and remarks. But there are a surprising number of cases where Clang just stays silent, and that silence causes real bugs that are hard to track down.</p>

<p>Think about this: you write a generic lambda that compares a string to some pointer. It works fine when your vector holds <code class="language-plaintext highlighter-rouge">std::string</code> objects. Swap the vector to hold <code class="language-plaintext highlighter-rouge">const char*</code> and that same lambda silently switches from comparing string contents to comparing raw memory addresses. Same code, same lambda, completely different behavior. No warning. No error. Nothing.</p>

<p>These silent failures are exactly what this project aims to fix.</p>

<hr />

<h3 id="overview">Overview</h3>

<p>The project targets five categories of diagnostic gaps:</p>

<ol>
  <li><strong>C2y standard papers</strong> that Clang either hasn’t implemented or only partially implemented</li>
  <li><strong>Silent semantic changes</strong> where valid code silently does something unintended</li>
  <li><strong>Clang-tidy checks</strong> worth pulling into Clang proper so everyone benefits without opt-in</li>
  <li><strong>Diagnostic rewording and fix-it hints</strong> where the current message is confusing or missing a suggestion</li>
  <li><strong>Missing warnings</strong> for patterns other compilers already catch</li>
</ol>

<p>Each category has concrete, well-scoped tasks tied to open GitHub issues or gaps in Clang’s C status page, so the work is measurable from the start.</p>

<p>Each of these categories deserves a detailed post of its own, and that’s exactly the plan. As patches land, I’ll write deeper dives into the specific problems, the implementation decisions, and what the review process looked like. Stay tuned for those.</p>

<hr />

<h3 id="what-the-work-looks-like">What the Work Looks Like</h3>

<h4 id="c2y-standards-patches">C2y Standards Patches</h4>

<p>C2y is the upcoming C standard, and Clang’s C status page tracks which proposals are implemented. Two papers are marked incomplete. <a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3418.pdf">N3418</a> makes creating unicode character names through token pasting a constraint violation, where Clang is currently silent while GCC already diagnoses it. <a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3244.pdf">N3244</a> has two remaining items around <code class="language-plaintext highlighter-rouge">extern inline</code> functions and alignment specifier mismatches on redeclarations where Clang’s behavior is either missing or incorrect. Fixing these closes two papers and makes Clang more conformant.</p>

<h4 id="silent-semantic-change-detection">Silent Semantic Change Detection</h4>

<p>This is the flagship deliverable. You can see the problem live on <a href="https://godbolt.org/z/E9Me1djP6">Godbolt</a>. A generic lambda comparing two values behaves correctly when the container holds <code class="language-plaintext highlighter-rouge">std::string</code>, and silently does the wrong thing when the container holds <code class="language-plaintext highlighter-rouge">const char*</code>. The comparison flips from a proper string comparison to a raw pointer address comparison, and no compiler in the world warns about it today. The goal is to make Clang the first one that does.</p>

<h4 id="clang-tidy-upstreaming">Clang-Tidy Upstreaming</h4>

<p>Clang-tidy has useful checks that most people never see because they have to opt in. Two of those checks are good candidates to live in Clang proper, where they’d run for everyone. One catches macros that expand to multiple statements used as a bare <code class="language-plaintext highlighter-rouge">if</code> body, where only the first statement is actually conditional. The other catches raw memory functions like <code class="language-plaintext highlighter-rouge">memset</code> or <code class="language-plaintext highlighter-rouge">realloc</code> being called on non-trivial C++ types, which silently bypasses constructors and destructors.</p>

<h4 id="diagnostic-rewording-and-missing-warnings">Diagnostic Rewording and Missing Warnings</h4>

<p>Several open issues are clean and self-contained. One of the most user-facing is a fix-it hint for implicit function declarations. When you call <code class="language-plaintext highlighter-rouge">printf</code> without including <code class="language-plaintext highlighter-rouge">&lt;stdio.h&gt;</code>, Clang already knows which header you need. It just doesn’t tell you. Another category is patterns that GCC already warns about, like self-initialization (<code class="language-plaintext highlighter-rouge">int x = x;</code>), where Clang has been silent for over a decade.</p>

<hr />

<h3 id="goals">Goals</h3>

<p>By the end of the fellowship, the aim is to have:</p>

<ul>
  <li>N3418 and N3244 resolved in Clang’s C status page</li>
  <li>A new warning for silent <code class="language-plaintext highlighter-rouge">const char*</code> pointer comparisons</li>
  <li>Two clang-tidy checks upstreamed into Clang proper</li>
  <li>Several open diagnostic issues closed with rewording or fix-it hints</li>
  <li>Missing warnings added for patterns that other compilers already catch</li>
</ul>

<p>Every patch will come with regression tests, negative tests to prevent false positives, and compile-time measurements for anything that runs during a normal build.</p>

<hr />

<h3 id="related-links">Related Links</h3>

<ul>
  <li><a href="https://compiler-research.org/open_projects#enhance-clang-diagnostics">Project Listing</a></li>
  <li><a href="https://github.com/llvm/llvm-project/blob/main/clang/www/c_status.html">Clang C Status (<code class="language-plaintext highlighter-rouge">c_status.html</code>)</a></li>
  <li><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3418.pdf">N3418</a></li>
  <li><a href="https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3244.pdf">N3244</a></li>
  <li><a href="https://github.com/flash1729">My GitHub Profile</a></li>
</ul>]]></content><author><name>Aditya Medhane</name></author><category term="cppalliance" /><category term="clang" /><category term="diagnostics" /><category term="c2y" /><category term="llvm" /><category term="compiler-engineering" /><summary type="html"><![CDATA[A CppAlliance Fellowship 2026 project to close diagnostic gaps in Clang: C2y standard papers, silent semantic changes, clang-tidy upstreaming, and missing warnings that other compilers already catch.]]></summary></entry><entry><title type="html">Systematic Triage of clang-tidy &amp;amp; Clang Static Analyzer</title><link href="/blogs/systematic_triage_clang_tidy_Peiqi_Li_blog/" rel="alternate" type="text/html" title="Systematic Triage of clang-tidy &amp;amp; Clang Static Analyzer" /><published>2026-05-22T00:00:00+00:00</published><updated>2026-05-22T00:00:00+00:00</updated><id>/blogs/systematic-triage-of-clang-tidy-and-csa</id><content type="html" xml:base="/blogs/systematic_triage_clang_tidy_Peiqi_Li_blog/"><![CDATA[<div class="custom-banner-wrapper" role="img" aria-label="">
  <div class="custom-banner-flex">
    <div class="banner-logo">
      <img src="/images/cppalliance-logo.svg" alt="Left Logo" />
    </div>

    <div class="banner-separator" aria-hidden="true">
      @
    </div>

    <div class="banner-logo logo-right-bg">
      <img src="/images/cr-logo.png" alt="Right Logo" />
    </div>
  </div>

  
  <div class="banner-caption" role="heading" aria-level="2">
    
  </div>
  
</div>

<style>
  .custom-banner-wrapper {
    --b-height: 20vh;
    width: 100%;
    max-width: 95%;
    margin: 0 auto;
    padding: 1.5rem 0;
  }

  .custom-banner-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
  }

  .banner-logo img {
    height: calc(var(--b-height) * 0.85);
    width: auto;
    max-width: 30vw;
    min-height: 50px;
    object-fit: contain;
  }

  /* Keep the white background for the right logo badge if needed */
  .logo-right-bg img {
    padding: 8px;
    background: #fff;
    border-radius: 4px;
  }

  .banner-separator {
    font-size: calc(var(--b-height) * 0.5);
    font-weight: 700;
    color: #000;
  }

  .banner-caption {
    text-align: center;
    margin-top: 1rem;
    font-family: Georgia, serif;
    font-size: calc(var(--b-height) * 0.25);
    color: #111;
  }

  @media (max-width: 768px) {
    .custom-banner-wrapper { --b-height: 15vh; }
    .custom-banner-flex { gap: 1.5rem; }
  }

  @media (max-width: 480px) {
    .custom-banner-flex { flex-direction: column; gap: 1rem; }
  }
</style>

<h2 id="introduction">Introduction</h2>

<p>Hello everyone! I am thrilled to join the Compiler Research team as a CppAlliance Fellow for the 2026 cycle. Over the next six months, I will be working closely with my mentors to systematically process and resolve the highest-impact open requests in <code class="language-plaintext highlighter-rouge">clang-tidy</code> and the Clang Static Analyzer (CSA). The ultimate goal is to reduce diagnostic noise—such as high-frequency false positives and unsafe fix-it hints—in modern C++ codebases.</p>

<p><strong>Mentors</strong>: Vassil Vassilev, Aaron Ballman, Martin Vassilev</p>

<h2 id="overview">Overview</h2>

<p>Static analysis tools are a developer’s best friend, but even a small false-positive rate can lead to <code class="language-plaintext highlighter-rouge">NOLINT</code> fatigue, often causing engineering teams to disable incredibly useful checks altogether.</p>

<p>Currently, the issue trackers for <code class="language-plaintext highlighter-rouge">clang-tidy</code> and CSA hold a massive backlog of reports covering false positives, invalid fix-it hints, and performance regressions. Many of these issues are well-motivated and severely affect real-world adoption, but remain unresolved due to limited maintainer bandwidth rather than technical difficulty. This project targets these exact high-friction points to restore trust in automated C++ diagnostics and refactoring.</p>

<h2 id="technical-implementation">Technical Implementation</h2>

<p>To guarantee that fixes are conservative and well-tested, the project will rely on a strict standard operating procedure:</p>

<ol>
  <li><strong>Minimal Reproducer Extraction</strong>: Isolating reported bugs into standalone C++ snippets devoid of external library dependencies to bypass environment-specific variables.</li>
  <li><strong>Narrowest-Layer Application</strong>: Applying fixes at the narrowest possible layer (e.g., AST matcher refinement vs. check-level logic vs. analyzer state transition) to prevent unintended cross-check regressions.</li>
  <li><strong>Fix-it Safety Contracts</strong>: Downgrading or completely removing <code class="language-plaintext highlighter-rouge">fix-it</code> hints if they cannot be guaranteed 100% safe (for instance, during complex macro expansions).</li>
  <li><strong>Targeted Regression Testing</strong>: Backing every patch with <code class="language-plaintext highlighter-rouge">llvm-lit</code> and <code class="language-plaintext highlighter-rouge">FileCheck</code> tests, explicitly including negative tests to prove the absence of new false positives.</li>
</ol>

<h2 id="goals">Goals</h2>

<p>In the coming months, my primary aim is to decrease diagnostic noise and increase the perceived reliability of Clang-based tooling. The roadmap to achieve this includes:</p>

<ol>
  <li>Setting up a fully working local LLVM build with <code class="language-plaintext highlighter-rouge">clang-tools-extra</code>.</li>
  <li>Systematically triaging the issue backlog to extract a prioritized matrix of high-impact targets.</li>
  <li>Resolving AST blind spots related to modern C++ constructs (e.g., templates, perfect forwarding, and implicit conversions) using refined AST matchers.</li>
  <li>Selectively addressing CSA issues where the root cause heavily overlaps with front-end semantics.</li>
  <li>Providing comprehensive documentation and upstream issue follow-ups for any remaining edge cases.</li>
</ol>]]></content><author><name>Peiqi Li</name></author><category term="clang-tidy" /><category term="static-analyzer" /><category term="clang" /><category term="llvm" /><category term="cppalliance" /><summary type="html"><![CDATA[Systematically processing and resolving high-impact open requests in clang-tidy and the Clang Static Analyzer to reduce diagnostic noise.]]></summary></entry></feed>