Skip to content

Add WAR dependency representation in taskflow dialect#280

Merged
ShangkunLi merged 7 commits intocoredac:mainfrom
ShangkunLi:dependecy-check
Mar 7, 2026
Merged

Add WAR dependency representation in taskflow dialect#280
ShangkunLi merged 7 commits intocoredac:mainfrom
ShangkunLi:dependecy-check

Conversation

@ShangkunLi
Copy link
Collaborator

@ShangkunLi ShangkunLi commented Mar 6, 2026

PR: Add WAR Dependency Tracking & Rename Dependency Operands

Summary

This PR introduces Write-After-Read (WAR) dependency tracking to the Taskflow dialect and renames the dependency-related operands for clarity and consistency.

Previously, TaskflowTaskOp only tracked RAW and WAW dependencies via read_memrefs / write_memrefs inputs and write_outputs results. WAR dependencies were invisible because read memrefs had no SSA output to form a dependency chain. This PR closes that gap.

Changes

1. WAR Dependency Support (dependency_read_out)

  • TaskflowOps.td: Added dependency_read_out result segment to TaskflowTaskOp and read_results operand segment to TaskflowYieldOp, creating SSA passthrough for read memrefs.
  • TaskflowOps.cpp: Updated custom parser to infer dependency_read_out count from dependency_read_in count. Updated printer to emit all result segments.
  • AffineToTaskflowPass.cpp: Populated read_output_types and read_yield_operands during loop-to-task conversion. dependency_read_out results are mapped first; dependency_write_out overwrites them, preserving correct RAW priority.

2. Downstream Pass Compatibility

  • MemoryAccessStreamingFusion.cpp: Updated dependency analysis, fused-task operand building, body fusion, and replaceUsesAndCleanup to handle dependency_read_out. Writer's dependency_read_out results are replaced before erasing.
  • ResourceAwareTaskOptimizationPass.cpp: Updated dependency graph construction, fusion operand merging, and replaceTaskResults to propagate dependency_read_out through fused tasks.

3. Rename

Renamed all dependency-related fields and assembly keywords for consistency:

Old Name New Name
read_memrefs dependency_read_in
write_memrefs dependency_write_in
read_outputs dependency_read_out
write_outputs dependency_write_out

And we also modified the FuseTaskPass.cpp to support the WAR dependency. Could @HobbitQia also help review our modifications on this pass to make sure our modifications are correct?

@ShangkunLi ShangkunLi requested review from guosran and tancheng March 6, 2026 16:22
@ShangkunLi ShangkunLi linked an issue Mar 6, 2026 that may be closed by this pull request
@ShangkunLi ShangkunLi merged commit c99c146 into coredac:main Mar 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P0] Consider the WAR memory access dependency in taskflow

3 participants