[Mlir-commits] [mlir] [mlir][amdgpu] Lower make_gather_dma_descriptor. (PR #172083)
Krzysztof Drewniak
llvmlistbot at llvm.org
Mon Dec 15 08:35:00 PST 2025
================
@@ -2896,8 +2931,81 @@ struct AMDGPUMakeDmaDescriptorLowering
return dgroup2;
}
+ Value getGatherIndices(DescriptorOp op, OpAdaptor adaptor,
+ ConversionPatternRewriter &rewriter, Location loc,
+ ArrayRef<Value> consts, bool firstHalf) const {
+ IntegerType i32 = rewriter.getI32Type();
+ Type v4i32 = this->typeConverter->convertType(VectorType::get(4, i32));
+ assert(v4i32 && "expected type conversion to succeed.");
+
+ if (!op.getIndices())
+ return LLVM::PoisonOp::create(rewriter, loc, v4i32);
+
+ Value indices = adaptor.getIndices();
+ auto vectorType = cast<VectorType>(indices.getType());
+ unsigned length = vectorType.getShape().back();
+ Type elementType = vectorType.getElementType();
+ unsigned maxLength = elementType == i32 ? 4 : 8;
+ int32_t offset = firstHalf ? 0 : maxLength;
+ unsigned discountedLength =
+ std::max(static_cast<int32_t>(length - offset), 0);
+
+ unsigned targetSize = std::min(maxLength, discountedLength);
+
+ SmallVector<Value> indicesVector;
+ for (unsigned i = offset; i < targetSize + offset; i++) {
----------------
krzysz00 wrote:
Nit `++i`
https://github.com/llvm/llvm-project/pull/172083
More information about the Mlir-commits
mailing list