-
Notifications
You must be signed in to change notification settings - Fork 15
Spatial Task Placement for Multi-CGRA #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a dependency-analysis pass and a spatial placement pass for Minimized Canonicalized Tasks (MCTs) onto a 2D multi-CGRA grid, plus tests that validate the new placement attributes on several kernels.
Changes:
- Add
AnalyzeMCTDependencyPassto detect SSA and memory (RAW/WAR/WAW) dependencies between MCTs and to identify same-header fusion candidates. - Add
PlaceMCTOnCGRAPassimplementing a critical-path–driven placement heuristic with adjacency-aware scoring and basic memory/SRAM assignment, and register both passes in the Taskflow pass pipeline and build system. - Extend multi-CGRA Taskflow tests (parallel-nested, multi-nested, irregular-loop) with new RUN lines that invoke the placement pass and FileCheck the resulting
taskflow.taskplacement attributes.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/multi-cgra/taskflow/parallel-nested/parallel-nested.mlir | Adds a placement pipeline invocation and PLACEMENT checks for 2 tasks’ CGRA coordinates and counts. |
| test/multi-cgra/taskflow/multi-nested/multi-nested.mlir | Adds placement pipeline and PLACEMENT checks for 5 tasks’ CGRA coordinates and counts in a more complex nested-loop scenario. |
| test/multi-cgra/taskflow/irregular-loop/irregular-loop.mlir | Extends the irregular-loop test with a placement pipeline and PLACEMENT checks for 3 tasks’ CGRA coordinates and counts. |
| lib/TaskflowDialect/Transforms/PlaceMCTOnCGRAPass.cpp | Implements the CGRA placer, including counter-chain extraction, dependency graph construction, ALAP-based task prioritization, heuristic scoring, placement annotation, and memory/SRAM mapping. |
| lib/TaskflowDialect/Transforms/CMakeLists.txt | Registers the new analysis and placement passes with the Taskflow transforms library build. |
| lib/TaskflowDialect/Transforms/AnalyzeMCTDependencyPass.cpp | Implements MCT dependency analysis, printing detailed per-task counter-chain and read/write sets plus a dependency summary. |
| include/TaskflowDialect/TaskflowPasses.td | Declares the analyze-mct-dependency and place-mct-on-cgra passes with documentation used by MLIR’s pass infrastructure. |
| include/TaskflowDialect/TaskflowPasses.h | Declares factory functions for constructing the new Taskflow passes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
test/multi-cgra/taskflow/dependency-analysis/dependency-analysis.mlir
Outdated
Show resolved
Hide resolved
test/multi-cgra/taskflow/dependency-analysis/dependency-analysis.mlir
Outdated
Show resolved
Hide resolved
c657850 to
58700e7
Compare
13d2632 to
a955784
Compare
a955784 to
4ead25c
Compare
…mrefs, iterative 3x3 grid placement, and centroid-based SRAM allocation
…mrefs, iterative 3x3 grid placement, and centroid-based SRAM allocation
- Fix SRAM ID encoding for large grids\n- Add successors to SSA proximity score\n- Remove load balance metric\n- Improve error handling with assert\n- Fix comments and variable naming\n- Ensure SSA dependencies use value inputs only\n- Update tests for new placement logic
…lity and structure
- Rename CGRAPlacer to TaskMapper\n- Rename mapping_info to task_mapping_info\n- Use readable SRAM locations {row, col} in task_mapping_info\n- Provide full task lines in test cases
…mments on mapping info readability and encoding
…ncy terminology to dependency_depth, and improve SRAM mapping readability
…d clean up whitespace
|
@guosran Before merging, plz sync with the main branch, and double-check whether I missed any format checking (e.g., comment ends with a period, comment starts with the description style). |
Summary
The
MapCTOnCGRAArrayPassperforms spatial mapping oftaskflow.taskoperations onto a 2D CGRA grid. It optimizes task placement and SRAM assignment to minimize inter-tile communication and memory access latency.Core Mechanism
Graph-Based Modeling: Constructs a bipartite Task-Memory Graph to track SSA dependencies between tasks and shared memory access.
Iterative Optimization: Employs a Coordinate Descent strategy that alternates between:
Heuristic Scoring: Uses a weighted scoring function considering SSA proximity, memory distance, and grid load balancing.
The result for 'multi_nested_loop` is shown below: