Kotlin-MP:用于并行性的DSL和IR变压器
Kotlin-MP: DSL and IR Transformer for Parallelism
AI总结:
针对Kotlin缺乏低开销、基于指令的真正硬件并行构造问题,提出Kotlin-MP,它是一种原生Kotlin DSL与自定义IR变压器结合的编译器插件,DSL提供直观语法,IR变压器在编译时重写代码以优化并行任务。
摘要:
虽然Kotlin为异步并发提供了出色抽象,但缺乏用于真正硬件并行性的低开销、基于指令的构造。开发人员使用标准任务并行库并行化计算密集型数学循环时会遇到运行时开销等问题。为此提出Kotlin-MP,它是一种原生Kotlin DSL与自定义IR变压器结合的编译器插件,DSL提供类似OpenMP的语法,IR变压器在编译时重写代码以优化并行任务。
英文摘要:
While Kotlin provides exceptional abstractions for asynchronous concurrency (like Coroutines for I/O), it lacks low-overhead, directive-based constructs for true hardware parallelism. When developers attempt to parallelize compute-bound mathematical loops using standard task-parallel libraries, they encounter significant runtime overhead such as lambda allocations and state-machine generation due to the abstraction layers, and face difficulties in ensuring readability, reliability and maintainability in implementing them. To address this, this project proposes Kotlin-MP, a native Kotlin Domain-Specific Language (DSL) paired with a custom Intermediate Representation (IR) transformer as a Kotlin compiler plugin. The DSL provides an intuitive, OpenMP-like syntax for developers to denote parallel regions, schedules, and critical sections. Instead of acting as a standard runtime wrapper, the IR transformer intercepts this DSL at compile-time and structurally rewrites the code. It lowers the parallelized sections directly into optimized \textit{java.util.concurrent.ForkJoinPool} tasks, automatically managing loop chunking, performing thread scheduling, and injecting hardware synchronization and mutual exclusion.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。