Conversation
guosran
commented
Jan 30, 2026
guosran
commented
Jan 30, 2026
Contributor
There was a problem hiding this comment.
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.
guosran
commented
Jan 30, 2026
test/multi-cgra/taskflow/dependency-analysis/dependency-analysis.mlir
Outdated
Show resolved
Hide resolved
ShangkunLi
reviewed
Jan 30, 2026
test/multi-cgra/taskflow/dependency-analysis/dependency-analysis.mlir
Outdated
Show resolved
Hide resolved
c657850 to
58700e7
Compare
guosran
commented
Jan 31, 2026
ShangkunLi
reviewed
Feb 1, 2026
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
tancheng
reviewed
Feb 3, 2026
ShangkunLi
reviewed
Feb 4, 2026
ShangkunLi
reviewed
Feb 4, 2026
- 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
ShangkunLi
reviewed
Feb 5, 2026
…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
ShangkunLi
approved these changes
Feb 6, 2026
Collaborator
|
@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). |
Merged
guosran
added a commit
that referenced
this pull request
Feb 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: