Skip to content

Commit 3bb754b

Browse files
committed
addresses feedback on API use
1 parent 77fdcc1 commit 3bb754b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

mlir/lib/Dialect/XeGPU/Transforms/XeGPUBlocking.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ void XeGPUBlockingPass::runOnOperation() {
302302
Attribute encoding = tdescTy.getEncoding();
303303
// If the encoding is a ScatterTensorDescAttr, we need to
304304
// potentially adjust the chunk size based on the inst_data.
305-
if (encoding && mlir::isa<xegpu::ScatterTensorDescAttr>(encoding)) {
306-
auto scatterAttr =
307-
mlir::dyn_cast<xegpu::ScatterTensorDescAttr>(encoding);
305+
if (tdescTy.isScattered()) {
306+
auto scatterAttr = tdescTy.getEncodingAsScatterTensorDescAttr();
307+
// mlir::dyn_cast<xegpu::ScatterTensorDescAttr>(encoding);
308308
int64_t chunkSize = scatterAttr.getChunkSize().getInt();
309309

310310
if (chunkSize > 1) {

mlir/test/lib/Dialect/XeGPU/TestXeGPUTransforms.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,12 @@ struct TestXeGPUUnrollingPatterns
102102
// attribute
103103
if (auto tdescTy = dyn_cast<xegpu::TensorDescType>(type)) {
104104
Attribute encoding = tdescTy.getEncoding();
105-
auto layout = llvm::dyn_cast_if_present<xegpu::LayoutAttr>(
106-
tdescTy.getLayout());
105+
auto layout = tdescTy.getLayoutAttr();
107106

108107
// If the encoding is a ScatterTensorDescAttr, we need to
109108
// potentially adjust the chunk size based on the inst_data.
110-
if (encoding && mlir::isa<xegpu::ScatterTensorDescAttr>(encoding)) {
111-
auto scatterAttr =
112-
mlir::dyn_cast<xegpu::ScatterTensorDescAttr>(encoding);
109+
if (tdescTy.isScattered()) {
110+
auto scatterAttr = tdescTy.getEncodingAsScatterTensorDescAttr();
113111
int64_t chunkSize = scatterAttr.getChunkSize().getInt();
114112

115113
if (chunkSize > 1) {

0 commit comments

Comments
 (0)