Tracking source locations in the Futhark compiler
9 months ago
- #Profiling
- #Compiler
- #Futhark
- Futhark is a programming language designed for writing fast programs, but sometimes programs are not fast, necessitating profiling.
- Initially, Futhark had limited profiling support, but recent updates have improved it by adding human-readable reports from machine-readable data.
- The profiler initially provided data with compiler-generated names, making it hard for users to relate to their original code.
- To improve usability, the Futhark compiler now tracks provenance (source code origins) throughout compilation, even through aggressive optimizations like fusion and fission.
- Provenance tracking piggybacks on existing certificate infrastructure in the compiler, ensuring accurate propagation of source information.
- The solution focuses on tracking leaf scalar operations rather than higher-level constructs like maps, providing more useful profiling data.
- Recent updates now show detailed source locations in profiling logs, helping users identify slow parts of their code.
- Future improvements could include better machine-readable profiling data, heat maps of code performance, and suggestions for optimization.
- Challenges remain in correlating GPU kernel performance with specific parts of the source code and providing actionable optimization advice.