Skip to content

[mlir][xegpu] Refine layout assignment in XeGPU SIMT distribution. #142687

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

Merged
merged 60 commits into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ff1012e
add bug fix
charithaintc May 27, 2025
c6eb53f
add test
charithaintc May 28, 2025
3bdb596
add comments
charithaintc May 28, 2025
6d47e3f
Merge branch 'main' into scf_for_bug
charithaintc May 28, 2025
fe3ab99
remove unsused headers
charithaintc May 28, 2025
f91b64c
save work
charithaintc Jun 2, 2025
cc621a1
Merge branch 'main' into scf_for_bug
charithaintc Jun 2, 2025
76f7d98
Merge branch 'scf_for_bug' into fix_layout_assign
charithaintc Jun 2, 2025
5cacace
initial version
charithaintc Jun 2, 2025
7d54194
working version
charithaintc Jun 3, 2025
b289399
working expect for unreal cast
charithaintc Jun 3, 2025
4318343
some fixes
charithaintc Jun 3, 2025
20a6415
branch terminator iface
charithaintc Jun 4, 2025
7bd0be2
save work
charithaintc Jun 4, 2025
00dc2b6
working
charithaintc Jun 4, 2025
35620ec
move out layout prop
charithaintc Jun 5, 2025
92c23f1
fix test
charithaintc Jun 5, 2025
7b69082
fix names
charithaintc Jun 5, 2025
5669616
func op iface support
charithaintc Jun 5, 2025
71902aa
fix test
charithaintc Jun 5, 2025
341daff
fix test
charithaintc Jun 5, 2025
fdacb63
revert merge
charithaintc Jun 5, 2025
57acc9e
add comment
charithaintc Jun 5, 2025
d7eaaa5
fix
charithaintc Jun 5, 2025
a99ee75
refactor
charithaintc Jun 5, 2025
739aad7
refactor
charithaintc Jun 5, 2025
76b7333
refactor
charithaintc Jun 5, 2025
1db0ca5
Merge branch 'main' into fix_layout_assign
charithaintc Jun 9, 2025
cbcfd61
address comments
charithaintc Jun 9, 2025
0f79697
fix bitcast
charithaintc Jun 10, 2025
74bf971
address comments
charithaintc Jun 11, 2025
2695f90
Merge branch 'main' into fix_layout_assign
charithaintc Jun 11, 2025
d6969bc
address comments
charithaintc Jun 11, 2025
d5e4c6c
address comments
charithaintc Jun 12, 2025
94da37e
address comments
charithaintc Jun 12, 2025
d43f0ec
Merge branch 'main' into fix_layout_assign
charithaintc Jun 12, 2025
76671e2
address comments
charithaintc Jun 12, 2025
32f8c79
address comments
charithaintc Jun 12, 2025
9cefe6f
address comments
charithaintc Jun 13, 2025
57824d8
address comments
charithaintc Jun 13, 2025
fd56999
Merge branch 'main' into fix_layout_assign
charithaintc Jun 13, 2025
ab05be9
address comments
charithaintc Jun 13, 2025
559bf74
Merge branch 'main' into fix_layout_assign
charithaintc Jun 13, 2025
c34f401
Merge branch 'main' into fix_layout_assign
charithaintc Jun 16, 2025
c4dd5a5
address comments
charithaintc Jun 16, 2025
2c66eac
address comments
charithaintc Jun 16, 2025
5705d74
address comments
charithaintc Jun 16, 2025
f73f237
Merge branch 'main' into fix_layout_assign
charithaintc Jun 16, 2025
10f9b49
Merge branch 'main' into fix_layout_assign
charithaintc Jun 17, 2025
d842d3a
chnage pass name
charithaintc Jun 17, 2025
f091519
fix line breaks in test
charithaintc Jun 17, 2025
0ac7162
fix comment in region ops
charithaintc Jun 17, 2025
caca184
remove unused headers
charithaintc Jun 17, 2025
e49fc63
Merge branch 'main' into fix_layout_assign
charithaintc Jun 18, 2025
0111b9f
fix conflict
charithaintc Jun 18, 2025
4de7cab
add option to print layout results
charithaintc Jun 18, 2025
10936bc
Merge branch 'main' into fix_layout_assign
charithaintc Jun 20, 2025
3a26509
fix conflict
charithaintc Jun 20, 2025
cc956c6
Merge branch 'main' into fix_layout_assign
charithaintc Jun 20, 2025
65dd453
Merge branch 'main' into fix_layout_assign
charithaintc Jun 20, 2025
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
19 changes: 16 additions & 3 deletions mlir/include/mlir/Dialect/XeGPU/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,23 @@ def XeGPUSubgroupDistribute : Pass<"xegpu-subgroup-distribute"> {
}];
let dependentDialects = ["memref::MemRefDialect", "xegpu::XeGPUDialect",
"vector::VectorDialect"];
}

def XeGPUPropagateLayout : Pass<"xegpu-propagate-layout"> {
let summary = "Propagate and assign XeGPU layout information";
let description = [{
This pass propagates the XeGPU layout information accross ops. Starting
from a set of anchor operations (e.g. `dpas`, `store_nd`), this will
propagate the layouts required for their operands to the producers. With
this propagated layout information, pass will then update op result type
with the layout information.
}];
let dependentDialects = ["memref::MemRefDialect", "xegpu::XeGPUDialect",
"vector::VectorDialect"];
let options = [Option<
"printOnly", "print-analysis-only", "bool",
/*default=*/"false",
"Print the result of the subgroup map propagation analysis and exit.">];
"printOnly", "print-analysis-only", "bool",
/*default=*/"false",
"Print the result of layout propagation analysis and exit.">];
}

def XeGPUWgToSgDistribute : Pass<"xegpu-wg-to-sg-distribute"> {
Expand Down
14 changes: 14 additions & 0 deletions mlir/include/mlir/Dialect/XeGPU/Utils/XeGPUUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ class LayoutAttr;
class TensorDescType;
} // namespace xegpu

namespace xegpu {
/// HW dependent constants.
/// TODO: These constants should be queried from the target information.
namespace targetinfo {
constexpr unsigned subgroupSize = 16; // How many lanes in a subgroup.
/// If DPAS A or B operands have low precision element types they must be packed
/// according to the following sizes.
constexpr unsigned packedSizeInBitsForDefault =
16; // Minimum packing size per register for DPAS A.
constexpr unsigned packedSizeInBitsForDpasB =
32; // Minimum packing size per register for DPAS B.
} // namespace targetinfo
} // namespace xegpu

namespace xegpu {

/// Flatten a set of ValueRange into a single SmallVector<Value>
Expand Down
1 change: 1 addition & 0 deletions mlir/lib/Dialect/XeGPU/Transforms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_mlir_dialect_library(MLIRXeGPUTransforms
XeGPUSubgroupDistribute.cpp
XeGPUUnroll.cpp
XeGPUWgToSgDistribute.cpp
XeGPUPropagateLayout.cpp

ADDITIONAL_HEADER_DIRS
${MLIR_MAIN_INCLUDE_DIR}/mlir/Dialect/XeGPU
Expand Down
Loading
Loading