From ea02bfc382f7ad4d263f0f61d5875036a7694187 Mon Sep 17 00:00:00 2001 From: Benjamin Chetioui <3920784+bchetioui@users.noreply.github.com> Date: Tue, 2 May 2023 21:08:27 +0200 Subject: [PATCH] [OPTIMIZER] Fix crash in loop pipelining. (#1602) Fixes issue #1601. --- lib/Dialect/TritonGPU/Transforms/Pipeline.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp b/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp index 238c00ddbe23..1f3a75352c6d 100644 --- a/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp +++ b/lib/Dialect/TritonGPU/Transforms/Pipeline.cpp @@ -579,7 +579,12 @@ scf::ForOp LoopPipeliner::createNewForOp() { // we replace the use new load use with a convert layout size_t i = std::distance(loads.begin(), it); auto cvtDstTy = op.getResult(0).getType().cast(); - auto cvtDstEnc = cvtDstTy.getEncoding().cast(); + auto cvtDstEnc = + cvtDstTy.getEncoding().dyn_cast(); + if (!cvtDstEnc) { + builder.clone(op, mapping); + continue; + } auto newDstTy = RankedTensorType::get( cvtDstTy.getShape(), cvtDstTy.getElementType(), ttg::DotOperandEncodingAttr::get(