30167

AnnotationGym: A Generic Framework for Automatic Source Code Annotation

Hafsah Shahzad, Ahmed Sanaullah, Sanjay Arora, Ulrich Drepper, Martin Herbordt
Electrical and Computer Engineering Department, Boston University, 8 Saint Mary’s Street, Boston, MA 02215
IEEE Access, 2025

@article{shahzad2025annotationgym,

   title={AnnotationGym: A Generic Framework for Automatic Source Code Annotation},

   author={Shahzad, Hafsah and Sanaullah, Ahmed and Arora, Sanjay and Drepper, Ulrich and Herbordt, Martin},

   journal={IEEE Access},

   year={2025},

   publisher={IEEE}

}

Download Download (PDF)   View View   Source Source   

228

views

A common approach to code optimization is to insert compiler hints in the source code using annotations. Two major challenges with using annotations effectively are their complexity and lack of portability. This means, first, that significant developer expertise is required, and, second, that the supported annotations, as well as their syntax and use, can vary substantially. Moreover, there is not currently any tool that can output performant annotation-inserted codes for different back-ends. To address these challenges, we present AnnotationGym, an easy-to-use, open-source, generic infrastructure that supplements or replaces the developer in annotating source code. It demonstrates a novel application of AI methods to code annotation. In addition to improving code performance, the flexibility of AnnotationGym enables easy comparisons of performance and optimization strategies among compilers and target architectures and thus provides an extensible platform to facilitate further progress in this field. AnnotationGym automatically extracts structured information about the target code and compiler to generate a list of possible annotations. AI-based optimization algorithms then traverse this space to determine the best set of annotations depending on the developer goals. To demonstrate its effectiveness, we run AnnotationGym on popular, representative workloads from the Polybench suite, and target different compilers (GCC, AMD HLS, Intel HLS), optimization algorithms (Reinforcement Learning, Bayesian Optimization), and architectures (CPU, FPGA).We also test our approach on FPGA codes derived, e.g., from the Rodinia and OpenDwarfs benchmarks and that are hand-optimized using standard best practices. An interesting finding is that the best overall performance obtained by AnnotationGym was generally with unoptimized codes.
No votes yet.
Please wait...

You must be logged in to post a comment.

* * *

* * *

HGPU group © 2010-2025 hgpu.org

All rights belong to the respective authors

Contact us: