-
Notifications
You must be signed in to change notification settings - Fork 70
fix: align MAT fill and expand sync pipes #930
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
Open
HecreReed
wants to merge
1
commit into
hw-native-sys:main
Choose a base branch
from
HecreReed:codex/fix-mat-pipe-sync
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright (c) 2026 Huawei Technologies Co., Ltd. | ||
| // This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| // CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| // Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| // INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| // See LICENSE in the root of the software repository for the full text of the License. | ||
|
|
||
| // RUN: ptoas --pto-arch a5 --enable-insert-sync %s | FileCheck %s | ||
| // RUN: ptoas --pto-arch a5 --enable-graph-sync-solver --graph-sync-solver-event-id-max=64 %s | FileCheck %s | ||
|
|
||
| module attributes {"pto.target_arch" = "a5"} { | ||
| // MAT TEXPANDS runs on MTE2. The following MAT->RIGHT TMOV runs on MTE1, | ||
| // so sync insertion must order TEXPANDS before TMOV across those pipes. | ||
| func.func @texpands_mat_sync(%scalar: f16) | ||
| attributes {pto.kernel_kind = #pto.kernel_kind<cube>} { | ||
| %src = pto.alloc_tile | ||
| : !pto.tile_buf<loc=mat, dtype=f16, rows=32, cols=32, v_row=32, v_col=32, | ||
| blayout=col_major, slayout=row_major, fractal=512, pad=0> | ||
| %dst = pto.alloc_tile | ||
| : !pto.tile_buf<loc=right, dtype=f16, rows=32, cols=32, v_row=32, v_col=32, | ||
| blayout=row_major, slayout=col_major, fractal=512, pad=0> | ||
|
|
||
| pto.texpands ins(%scalar : f16) | ||
| outs(%src : !pto.tile_buf<loc=mat, dtype=f16, rows=32, cols=32, v_row=32, v_col=32, | ||
| blayout=col_major, slayout=row_major, fractal=512, pad=0>) | ||
| pto.tmov ins(%src : !pto.tile_buf<loc=mat, dtype=f16, rows=32, cols=32, v_row=32, v_col=32, | ||
| blayout=col_major, slayout=row_major, fractal=512, pad=0>) | ||
| outs(%dst : !pto.tile_buf<loc=right, dtype=f16, rows=32, cols=32, v_row=32, v_col=32, | ||
| blayout=row_major, slayout=col_major, fractal=512, pad=0>) | ||
| return | ||
| } | ||
| } | ||
|
|
||
| // CHECK-LABEL: AICORE void texpands_mat_sync( | ||
| // CHECK: TEXPANDS( | ||
| // CHECK: set_flag(PIPE_MTE2, PIPE_MTE1, EVENT_ID{{[0-9]+}}); | ||
| // CHECK: wait_flag(PIPE_MTE2, PIPE_MTE1, EVENT_ID{{[0-9]+}}); | ||
| // CHECK: TMOV( |
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
Oops, something went wrong.
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.
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.
The helper lambda
getASFromTypecan be simplified to reduce boilerplate and improve readability by extracting the memory space attribute first, and then performing a singledyn_cast_or_nullcheck.