Tasking Compiler [PREMIUM • SOLUTION]

| System | Language | Key Tasking Feature | |--------|----------|----------------------| | | C++/SYCL | Compiles single source for CPU, GPU, FPGA; automatic task mapping and data movement. | | Rust (with async/await) | Rust | Compiler transforms async functions into state machines; tasks are "futures" that can be polled. The borrow checker enables race-free tasking. | | OpenMP 5.0+ | C/C++/Fortran | #pragma omp task with dependence clauses; compiler builds task dependence graph at compile time where possible. | | Swift Concurrency | Swift | async/let and actors; compiler enforces task isolation and schedules onto cooperative thread pool. | | Halide | Halide DSL | Specialized tasking compiler for image processing: separates algorithm from schedule; compiler explores parallel, vectorized, and tiled schedules. | | TAPIR (LLVM) | Any (via IR) | LLVM's "Task Parallel Intermediate Representation" – adds spawn and sync as first-class IR instructions. |

1. Introduction: The Silent Orchestrator In the early days of computing, a compiler had a relatively simple, albeit complex, job: take the linear, step-by-step instructions written by a human in a high-level language (like Fortran or C) and translate them into the linear, step-by-step machine code that a single CPU core could execute. The mental model was a factory assembly line—one instruction after another, predictable and sequential. tasking compiler

// Original: too fine-grained #pragma omp parallel for for(i=0; i<1000000; i++) a[i] = sqrt(b[i]); // Compiler transforms to: #pragma omp parallel for schedule(static, 10000) for(i=0; i<1000000; i+=10000) task for(j=i; j<i+10000; j++) a[j] = sqrt(b[j]); The single biggest cost in parallel computing is moving data —between caches, between cores, between CPU and GPU, across a network. A tasking compiler performs data affinity analysis : it tracks which tasks access which data and attempts to schedule tasks on the core/GPU where the data already resides. | System | Language | Key Tasking Feature

The tasking compiler uses (modeling task execution time) and profile-guided optimization (PGO) to automatically split or merge tasks. For example: | | OpenMP 5