Skip to content

Commit d23020f

Browse files
authored
[AMD] Leverage MLIR error report infra in more places (triton-lang#5719)
This is a minor change, when implementing PR triton-lang#5549 I used: ```rewriter.notifyMatchFailure``` in place of ```return failure();``` as per suggestions to leverage MLIR infra for errors. We should probably be consistent throughout the file and use the MLIR infra for the other buffer ops.
1 parent 1c28e08 commit d23020f

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

third_party/amd/lib/TritonAMDGPUToLLVM/LoadStoreOpToLLVM.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,17 @@ struct BufferAtomicRMWOpConversion
581581
switch (memScope) {
582582
// System scope is not supported yet
583583
case MemSyncScope::SYSTEM:
584-
return failure();
584+
return rewriter.notifyMatchFailure(
585+
op, "System memory scope is not supported for Buffer Atomic RMW");
585586
case MemSyncScope::GPU:
586587
scopeStr = "agent";
587588
break;
588589
case MemSyncScope::CTA:
589590
scopeStr = "workgroup";
590591
break;
591592
default:
592-
return failure();
593+
return rewriter.notifyMatchFailure(
594+
op, "Unsupported memory scope for Buffer Atomic RMW");
593595
}
594596

595597
StringAttr scope = mlir::StringAttr::get(loc.getContext(), scopeStr);
@@ -815,7 +817,7 @@ struct AtomicCASOpConversion
815817
auto scope = op.getScope();
816818
auto scopeStr = getAMDGPUMemScopeStr(scope);
817819
if (!scopeStr)
818-
return failure();
820+
return rewriter.notifyMatchFailure(op, "Unknown AMDGPU memory scope");
819821

820822
// deal with tensor or scalar
821823
auto valueTy = op.getResult().getType();
@@ -1143,7 +1145,7 @@ struct AtomicRMWOpConversion
11431145

11441146
auto scopeStr = getAMDGPUMemScopeStr(scope);
11451147
if (!scopeStr)
1146-
return failure();
1148+
return rewriter.notifyMatchFailure(op, "Unknown AMDGPU memory scope");
11471149

11481150
auto vecTy = vec_ty(valueElemTy, vec);
11491151
auto retType = vec == 1 ? valueElemTy : vecTy;

third_party/amd/lib/TritonAMDGPUTransforms/ConvertToBufferOps.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,9 @@ struct ConvertTritonLoadToBufferLoad
422422
rewriter.replaceOp(op, bufferLoadOp);
423423
return success();
424424
}
425+
425426
LDBG("Failed to convert: " << op);
426-
return failure();
427+
return rewriter.notifyMatchFailure(op, "Failed to convert LoadOp");
427428
}
428429

429430
private:
@@ -462,7 +463,7 @@ struct ConvertTritonStoreToBufferStore
462463
return success();
463464
}
464465
LDBG("Failed to convert: " << op);
465-
return failure();
466+
return rewriter.notifyMatchFailure(op, "Failed to convert StoreOp");
466467
}
467468

468469
private:

0 commit comments

Comments
 (0)