Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions test/samples/Sync/test_tmov_col_major_16x1_align_a5.pto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module {
// A5 repro case: TMOV on a 16x1 f32 col_major view.
// Layout stride is [1, 16], i.e. RowStride=1.
// On A5 TMOV_V2V this tends to hit unaligned vector accesses at i>0.
func.func @test_tmov_col_major_16x1_align_a5() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1, v_row=16, v_col=1, blayout=col_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1, v_row=16, v_col=1, blayout=col_major, slayout=none_box, fractal=512, pad=0>
pto.tmov ins(%src : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1, v_row=16, v_col=1, blayout=col_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=16, cols=1, v_row=16, v_col=1, blayout=col_major, slayout=none_box, fractal=512, pad=0>)
return
}
}
6 changes: 6 additions & 0 deletions test/samples/Sync/test_tmov_col_major_16x1_align_a5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3
from pathlib import Path


if __name__ == "__main__":
print(Path(__file__).with_suffix(".pto").read_text(encoding="utf-8"))
11 changes: 11 additions & 0 deletions test/samples/Sync/test_tmov_row_major_1x16_control_a5.pto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module {
// Control case: TMOV on a 1x16 f32 row_major view.
// Layout stride is [16, 1], and validRow=1.
func.func @test_tmov_row_major_1x16_control_a5() {
%src = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>
%dst = pto.alloc_tile : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>
pto.tmov ins(%src : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
outs(%dst : !pto.tile_buf<loc=vec, dtype=f32, rows=1, cols=16, v_row=1, v_col=16, blayout=row_major, slayout=none_box, fractal=512, pad=0>)
return
}
}
6 changes: 6 additions & 0 deletions test/samples/Sync/test_tmov_row_major_1x16_control_a5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env python3
from pathlib import Path


if __name__ == "__main__":
print(Path(__file__).with_suffix(".pto").read_text(encoding="utf-8"))
38 changes: 37 additions & 1 deletion test/samples/runop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ process_one_dir() {
fi
done
fi
local target_arch_lc
target_arch_lc="$(printf '%s' "$target_arch" | tr '[:upper:]' '[:lower:]')"
local expected_vec_barrier="pipe_barrier(PIPE_V)"
local skip_vec_barrier=0
if [[ "$(printf '%s' "$target_arch" | tr '[:upper:]' '[:lower:]')" == "a5" ]]; then
if [[ "${target_arch_lc}" == "a5" ]]; then
skip_vec_barrier=1
fi

Expand Down Expand Up @@ -269,6 +271,12 @@ process_one_dir() {
echo -e "${A}(${base}.py)\tSKIP\trequires --pto-arch=a3"
continue
fi
if [[ ( "$base" == "test_tmov_col_major_16x1_align_a5" || \
"$base" == "test_tmov_row_major_1x16_control_a5" ) && \
"${target_arch_lc}" != "a5" ]]; then
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The variable target_arch_lc is not defined in this script. This will cause the condition to always evaluate to true (as an undefined variable expands to an empty string), resulting in these tests being skipped even when the target architecture is correctly set to a5. You should use the inline transformation consistent with the rest of the file to check the architecture.

Suggested change
"${target_arch_lc}" != "a5" ]]; then
"$(printf '%s' "$target_arch" | tr '[:upper:]' '[:lower:]')" != "a5" ]]; then

echo -e "${A}(${base}.py)\tSKIP\trequires --pto-arch=a5"
continue
fi

# Some samples are expected to fail depending on the selected ptoas flags.
#
Expand Down Expand Up @@ -627,6 +635,34 @@ process_one_dir() {
fi
fi

# A5 TMOV alignment repro/control samples:
# - col_major 16x1 should preserve TMOV + ColMajor tile shape in emitted C++
# - row_major 1x16 control should preserve TMOV + RowMajor tile shape
if [[ "$base" == "test_tmov_col_major_16x1_align_a5" ]]; then
if ! grep -Eq "\\bTMOV\\(" "$cpp"; then
echo -e "${A}(${base}.py)\tFAIL\tmissing TMOV() in col_major repro sample"
overall=1
continue
fi
if ! grep -Fq "Tile<TileType::Vec, float, 16, 1, BLayout::ColMajor" "$cpp"; then
echo -e "${A}(${base}.py)\tFAIL\tmissing 16x1 ColMajor tile in col_major repro sample"
overall=1
continue
fi
fi
if [[ "$base" == "test_tmov_row_major_1x16_control_a5" ]]; then
if ! grep -Eq "\\bTMOV\\(" "$cpp"; then
echo -e "${A}(${base}.py)\tFAIL\tmissing TMOV() in row_major control sample"
overall=1
continue
fi
if ! grep -Fq "Tile<TileType::Vec, float, 1, 16, BLayout::RowMajor" "$cpp"; then
echo -e "${A}(${base}.py)\tFAIL\tmissing 1x16 RowMajor tile in row_major control sample"
overall=1
continue
fi
fi

# Regression guard for issue #185: barrier_sync must support op types
# beyond TMATMUL/TVEC and lower to the expected per-pipe barrier.
if [[ "$base" == "test_barrier_sync" ]]; then
Expand Down
Loading