Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
28c5c4c
pull changes
charithaintc Aug 21, 2025
ad5d0a8
rename getLayoutAttr util
chencha3 Aug 21, 2025
0e34f36
refine
chencha3 Aug 21, 2025
a84014f
format
chencha3 Aug 21, 2025
f3af2c3
update convert_layout
chencha3 Aug 21, 2025
ee5baca
save work
charithaintc Aug 21, 2025
621122c
save work
charithaintc Aug 21, 2025
35c6489
fix compilation error in clang
chencha3 Aug 22, 2025
b912c21
save work
charithaintc Aug 25, 2025
42a2309
Merge remote-tracking branch 'chencha3/generalize_utils_for_LayoutAtt…
charithaintc Aug 25, 2025
5a683b4
save work
charithaintc Aug 25, 2025
2da2c6d
save work
charithaintc Aug 26, 2025
7eabad4
save work
charithaintc Aug 26, 2025
237637c
Merge branch 'main' into vector_bitcast_distr
charithaintc Aug 26, 2025
635a006
save work
charithaintc Aug 26, 2025
74ab5a3
save work
charithaintc Aug 26, 2025
b36e109
save work
charithaintc Aug 27, 2025
4e871d7
save work
charithaintc Aug 27, 2025
4119eb1
Merge branch 'main' into vector_bitcast_distr
charithaintc Aug 27, 2025
6bf4c68
fix
charithaintc Aug 27, 2025
1a1ef32
fix
charithaintc Aug 27, 2025
34f1703
fix
charithaintc Aug 27, 2025
d7169de
fix
charithaintc Aug 27, 2025
47bcc2e
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 2, 2025
47decaf
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 9, 2025
13a2137
save work
charithaintc Sep 9, 2025
93f07e7
remove restriction
charithaintc Sep 10, 2025
be1c00c
add transpose function
charithaintc Sep 10, 2025
82486fa
Merge branch 'main' into slice_utils
charithaintc Sep 10, 2025
916c75f
add slice attribute utils
charithaintc Sep 10, 2025
77e8a94
fix name
charithaintc Sep 10, 2025
441323c
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 11, 2025
d0de396
Merge branch 'slice_utils' into vector_bitcast_distr
charithaintc Sep 11, 2025
dc3a250
use isTransposeOf
charithaintc Sep 11, 2025
2f83417
cleanup
charithaintc Sep 11, 2025
0819489
cleanup
charithaintc Sep 11, 2025
0c1f71a
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 12, 2025
90b6d8e
address comments
charithaintc Sep 12, 2025
9c2a7ed
address comments
charithaintc Sep 12, 2025
d55bce8
address comments
charithaintc Sep 13, 2025
96a9da2
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 15, 2025
74df1be
remove invalid shape cast tests
charithaintc Sep 15, 2025
c877d93
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 17, 2025
d1ca356
address comments
charithaintc Sep 18, 2025
b1e5ee3
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 18, 2025
80e930f
address comments
charithaintc Sep 18, 2025
b1bb16b
simplify shape cast handling
charithaintc Sep 18, 2025
073686e
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 19, 2025
1376ca2
remove headers
charithaintc Sep 19, 2025
9ec78f9
Merge branch 'main' into vector_bitcast_distr
charithaintc Sep 19, 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
48 changes: 48 additions & 0 deletions mlir/include/mlir/Dialect/XeGPU/IR/XeGPUAttrs.td
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,54 @@ def DistributeLayoutAttr: AttrInterface<"DistributeLayoutAttr"> {
"FailureOr<SmallVector<SmallVector<Value>>>",
"getOffsets",
(ins "OpBuilder &": $builder, "Location":$loc, "Value":$linearId, "ArrayRef<int64_t>":$shape)>,
InterfaceMethod</*desc=*/[{Check if this layout can be achieved by applying a transpose
to some other layout according to given permutation of (0...n-1).}],
/*retTy=*/"bool",
/*methodName=*/"isTransposeOf",
/*args=*/(ins "const xegpu::DistributeLayoutAttr&": $other, "ArrayRef<int64_t>": $perm),
/*methodBody=*/[{
if (!other)
return false;
if ($_self.getRank() != other.getRank() || perm.size() != static_cast<size_t>($_self.getRank()))
return false;
// Check if the permutation is valid
if (!isPermutationVector(perm))
return false;
auto checkTranspose = [](ArrayRef<int64_t> dst, ArrayRef<int64_t> src, ArrayRef<int64_t> perm) {
// If both `dst` and `src` are empty, conservatively return true
// here because some layout fields can be empty.
if (dst.empty() && src.empty())
return true;
for (const auto &ta : llvm::enumerate(perm)) {
if (src[ta.index()] != dst[ta.value()])
return false;
}
return true;
};
// Check sgLayout
if (!checkTranspose($_self.getEffectiveSgLayoutAsInt(), other.getEffectiveSgLayoutAsInt(), perm))
return false;
// Check sgData
if (!checkTranspose($_self.getEffectiveSgDataAsInt(), other.getEffectiveSgDataAsInt(), perm))
return false;
// Check instData
if (!checkTranspose($_self.getEffectiveInstDataAsInt(), other.getEffectiveInstDataAsInt(), perm))
return false;
// Check laneLayout
if (!checkTranspose($_self.getEffectiveLaneLayoutAsInt(), other.getEffectiveLaneLayoutAsInt(), perm))
return false;
// Check laneData
if (!checkTranspose($_self.getEffectiveLaneDataAsInt(), other.getEffectiveLaneDataAsInt(), perm))
return false;
// Check order if both sides have order field.
if ($_self.getOrder() && other.getOrder()) {
auto thisOrderAsInt = llvm::to_vector_of<int64_t>($_self.getOrder().asArrayRef());
auto otherOrderAsInt = llvm::to_vector_of<int64_t>(other.getOrder().asArrayRef());
if (!checkTranspose(thisOrderAsInt, otherOrderAsInt, perm))
return false;
}
return true;
}]>,
InterfaceMethod</*desc=*/[{Check if this layout is a slice of some other layout.}],
/*retTy=*/"bool",
/*methodName=*/"isSliceOf",
Expand Down
Loading
Loading