Skip to content

[MLIR][XeGPU] Extend SGMapAttr and Add ConvertLayoutOp #132425

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 24 commits into from
Apr 9, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refine isEvenDistributed
  • Loading branch information
chencha3 committed Apr 1, 2025
commit 784ab38e3a0dc4fd6288375eccba66c9b8db58b4
13 changes: 8 additions & 5 deletions mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ isArgShapesValid(TensorDescType tdescTy, VectorType valueTy,

static bool isEvenDistributed(llvm::ArrayRef<int64_t> shape,
xegpu::LayoutAttr attr) {
assert(attr && "workgroup map attribute is missing.");
assert(attr && "Layout attribute is missing.");
llvm::SmallVector<int32_t> defaults(shape.size(), 1);
llvm::ArrayRef<int32_t> layout, data;
if (attr.getSgLayout()) {
data = attr.getSgData().asArrayRef();
layout = attr.getSgLayout().asArrayRef();
if (auto sg_layout = attr.getSgLayout()) {
layout = sg_layout.asArrayRef();
auto sg_data = attr.getSgData();
data = sg_data? sg_data.asArrayRef(): defaults;
} else {
data = attr.getLaneData().asArrayRef();
layout = attr.getLaneLayout().asArrayRef();
auto lane_data = attr.getLaneData();
data = lane_data? lane_data.asArrayRef(): defaults;
}
for (auto [s, d, l] : llvm::zip_equal(shape, data, layout)) {
// check s % (d * l) != 0
Expand Down
Loading