[Mlir-commits] [mlir] [MLIR][XeGPU] Add XeGPU scattered ops (PR #86594)
Mehdi Amini
llvmlistbot at llvm.org
Mon Mar 25 16:10:13 PDT 2024
================
@@ -32,6 +32,17 @@ void XeGPUDialect::initialize() {
//===----------------------------------------------------------------------===//
// XeGPU_TensorDescAttr
//===----------------------------------------------------------------------===//
+TensorDescAttr TensorDescAttr::get(mlir::MLIRContext *context,
+ xegpu::MemoryScope memory_scope,
+ int array_length, bool boundary_check,
+ bool scattered) {
+ auto scopeAttr = MemoryScopeAttr::get(context, memory_scope);
+ auto lengthAttr =
+ IntegerAttr::get(IntegerType::get(context, 64), array_length);
+ auto boundaryAttr = BoolAttr::get(context, boundary_check);
+ auto scatteredAttr = BoolAttr::get(context, scattered);
+ return Base::get(context, scopeAttr, lengthAttr, boundaryAttr, scatteredAttr);
+}
----------------
joker-eph wrote:
This kind of builder encourages bad practices IMO: by hiding the attribute creation it incurs compile-time cost.
If instead these are moved to the user, they are more likely to reuse existing attributes across multiple builder call.
(It's something that I see in multiple places though, so feel free to keep it if you want: this is just food for thoughts)
https://github.com/llvm/llvm-project/pull/86594
More information about the Mlir-commits
mailing list