Skip to content
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

CascadeFlowOp and ConfigureCascadeOp #974

Merged
merged 63 commits into from
Feb 19, 2024
Merged

CascadeFlowOp and ConfigureCascadeOp #974

merged 63 commits into from
Feb 19, 2024

Conversation

AndraBisca
Copy link
Collaborator

@AndraBisca AndraBisca commented Feb 2, 2024

This PR adds two new operations to the AIE dialect, CascadeFlowOp and ConfigureCascadeOp.

CascadeFlowOp represents a cascade stream flow between the two input tiles. The op is used like in the example below:

module @test {
  aie.device(xcve2802) {
    %t13 = aie.tile(1, 3)
    %t23 = aie.tile(2, 3)
    aie.cascade_flow(%t13, %t23)
  }
}

Each CascadeFlowOp is lowered into a ConfigureCascadeOp which takes as input a tile, an input cascade direction and an output cascade direction. The input and output directions of the cascade for that tile are based on the relative positions of the tiles in the CascadeFlowOp. Unless specified otherwise, the default input and output directions for the cascade are North and South respectively. The lowering is implemented in AIELowerCascadeFlows.cpp and is called using aie-opt --aie-lower-cascade-flows <path to mlir code>. As an example, the code above lowers to:

module @test {
  aie.device(xcve2802) {
    %tile_1_3 = aie.tile(1, 3)
    %tile_2_3 = aie.tile(2, 3)
    aie.configure_cascade(%tile_1_3, North, East)
    aie.configure_cascade(%tile_2_3, West, South)
  }
}

Additionally, this PR adds a new configuration function, mlir_aie_configure_cascade, to AIETargetXAIEV2.cpp that generates libXAIE calls to XAie_CoreConfigAccumulatorControl for each ConfigureCascadeOp. This new target should be called from the host code at the beginning of execution to properly setup the registers for each tile. Similar configuration functions have been added to AIETargetCDODirect.cpp and AIETargetAirbin.cpp.

…dd tests. Add mlir_aie_configure_cascade target to AIE2 that generates libXAIE calls from ConfigureCascadeOps.
lib/Dialect/AIE/IR/AIEDialect.cpp Outdated Show resolved Hide resolved
lib/Dialect/AIE/IR/AIEDialect.cpp Outdated Show resolved Hide resolved
AndraBisca and others added 2 commits February 2, 2024 15:48
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@AndraBisca
Copy link
Collaborator Author

AndraBisca commented Feb 2, 2024

Related to #517.

Copy link
Contributor

github-actions bot commented Feb 2, 2024

Coverage Report

Created: 2024-02-19 15:45

Click here for information about interpreting this report.

FilenameFunction CoverageLine CoverageRegion CoverageBranch Coverage
include/aie/Dialect/AIE/Transforms/AIEPasses.h 50.00% 50.00% 50.00% -
lib/Dialect/AIE/IR/AIEDialect.cpp 90.91% 82.31% 84.83% 74.62%
lib/Dialect/AIE/Transforms/AIECoreToStandard.cpp 93.10% 77.52% 76.52% 61.96%
lib/Dialect/AIE/Transforms/AIELowerCascadeFlows.cpp 100.00% 93.55% 95.83% 93.75%
Totals 91.03% 81.62% 83.96% 73.51%
Generated by llvm-cov -- llvm version 14.0.0

@makslevental
Copy link
Contributor

Is this not supported on IPU? Ie shouldn't CDODirect also be extended to support?

@AndraBisca
Copy link
Collaborator Author

Is this not supported on IPU? Ie shouldn't CDODirect also be extended to support?

Yes, it is. I'm working on modifying CDODirect.

AndraBisca and others added 2 commits February 5, 2024 15:39
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
lib/Targets/AIETargetCDODirect.cpp Outdated Show resolved Hide resolved
include/aie/Dialect/AIE/IR/AIEAttrs.td Outdated Show resolved Hide resolved
lib/Targets/AIETargetAirbin.cpp Outdated Show resolved Hide resolved
lib/Targets/AIETargetCDODirect.cpp Outdated Show resolved Hide resolved
AndraBisca and others added 2 commits February 6, 2024 10:41
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@keryell
Copy link
Member

keryell commented Feb 6, 2024

Would it be possible to make clearer in the operation what is the input and what is the output. Perhaps if runing an LSP server knowing the dialect the IDE could display it as when the mouse is above it, but that does not seem super clear in other context, such as reading slides or random code samples. :-)

@makslevental
Copy link
Contributor

Perhaps if runing an LSP server knowing the dialect

We don't have such functionality.

@AndraBisca AndraBisca changed the title [WIP] CascadeFlowOp and CascadeSwitchboxOp CascadeFlowOp and CascadeSwitchboxOp Feb 14, 2024
@AndraBisca AndraBisca marked this pull request as ready for review February 14, 2024 17:03
@AndraBisca AndraBisca changed the title CascadeFlowOp and CascadeSwitchboxOp CascadeFlowOp and ConfigureCascadeOp Feb 15, 2024
@AndraBisca AndraBisca marked this pull request as ready for review February 15, 2024 13:53
@AndraBisca AndraBisca requested a review from jgmelber February 15, 2024 15:28
Copy link
Collaborator

@denolf denolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

@AndraBisca AndraBisca merged commit 7f6650a into main Feb 19, 2024
52 checks passed
@AndraBisca AndraBisca deleted the cascade-config branch February 19, 2024 17:24
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.

6 participants