llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-mlir-gpu Author: Mehdi Amini (joker-eph) <details> <summary>Changes</summary> Generate a key-value prop-dict printer that dispatches each field to its ODS printer while retaining attribute conversion for non-compositional default parsers. Keep operation-specific property printer hooks ahead of the generated implementation and preserve legacy input compatibility. See #<!-- -->155475 Assisted-by: Codex --- Patch is 45.08 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/217589.diff 20 Files Affected: - (modified) mlir/docs/DefiningDialects/Operations.md (+4-1) - (modified) mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td (+2) - (modified) mlir/include/mlir/Dialect/XeGPU/IR/XeGPUOps.td (+2) - (modified) mlir/include/mlir/IR/OpBase.td (+5) - (modified) mlir/include/mlir/IR/OpDefinition.h (+19-3) - (modified) mlir/include/mlir/TableGen/Operator.h (+3) - (modified) mlir/lib/TableGen/Operator.cpp (+4) - (modified) mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-copy.mlir (+4-4) - (modified) mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-dealloc.mlir (+8-8) - (modified) mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-load-store.mlir (+4-4) - (modified) mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-copy.mlir (+1-1) - (modified) mlir/test/Conversion/MemRefToEmitC/memref-with-custom-types.mlir (+1-2) - (modified) mlir/test/Dialect/EmitC/member_call_opaque.mlir (+2-2) - (modified) mlir/test/IR/enum-attr-roundtrip.mlir (+4-4) - (modified) mlir/test/IR/properties.mlir (+23-15) - (modified) mlir/test/Target/LLVMIR/Import/intrinsic.ll (+1-1) - (modified) mlir/test/lib/Dialect/Test/TestOps.td (+28) - (added) mlir/test/mlir-tblgen/op-format-custom-properties-printer.td (+23) - (modified) mlir/test/mlir-tblgen/op-format.mlir (+6-6) - (modified) mlir/tools/mlir-tblgen/OpFormatGen.cpp (+134-4) ``````````diff diff --git a/mlir/docs/DefiningDialects/Operations.md b/mlir/docs/DefiningDialects/Operations.md index 419041a52b0da..a6e119727c906 100644 --- a/mlir/docs/DefiningDialects/Operations.md +++ b/mlir/docs/DefiningDialects/Operations.md @@ -768,7 +768,10 @@ The available directives are as follows: `FieldParser` specialization is available or when the selected specialization declares `isKeyValueCompositional = false`. - The legacy `<{key = attribute, ...}>` dictionary spelling is also - accepted when parsing and is used by the generated printer. + accepted when parsing. The generated printer uses the key-value + spelling and the same custom-printer or attribute-conversion choice. + Operations that provide a custom `printProperties` hook should set + `hasCustomPropertiesPrinter` to suppress the shadowed generated helper. - Any property or inherent attribute that is not used elsewhere in the format is parsed and printed as part of this list. - If present, the `attr-dict` will not contain any inherent attributes. diff --git a/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td index c52a1c0c94402..f9c80235aa1ca 100644 --- a/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td +++ b/mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td @@ -48,6 +48,8 @@ class XeVM_Attr<string attrName, string attrMnemonic, list<Trait> traits = []> class XeVM_Op<string mnemonic, list<Trait> traits = []> : LLVM_OpBase<XeVM_Dialect, mnemonic, traits> { + let hasCustomPropertiesPrinter = 1; + code extraBaseClassDeclaration = [{ void printProperties(::mlir::MLIRContext *ctx, ::mlir::OpAsmPrinter &p, const Properties &prop, diff --git a/mlir/include/mlir/Dialect/XeGPU/IR/XeGPUOps.td b/mlir/include/mlir/Dialect/XeGPU/IR/XeGPUOps.td index 49b98922cee4c..b6b60b252eec8 100644 --- a/mlir/include/mlir/Dialect/XeGPU/IR/XeGPUOps.td +++ b/mlir/include/mlir/Dialect/XeGPU/IR/XeGPUOps.td @@ -26,6 +26,8 @@ include "mlir/Interfaces/ViewLikeInterface.td" class XeGPU_Op<string mnemonic, list<Trait> traits = []>: Op<XeGPU_Dialect, mnemonic, traits> { + let hasCustomPropertiesPrinter = 1; + code extraBaseClassDeclaration = [{ void printProperties(::mlir::MLIRContext *ctx, ::mlir::OpAsmPrinter &p, const Properties &prop, diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td index 0d0669e90c3f7..a130d5847a1c7 100644 --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -408,6 +408,11 @@ class Op<Dialect dialect, string mnemonic, list<Trait> props = []> { /// * void print(OpAsmPrinter &p) bit hasCustomAssemblyFormat = 0; + /// This field indicates that the operation provides a custom + /// `printProperties` hook. Setting it avoids generating the default + /// per-field `prop-dict` printer that the hook would shadow. + bit hasCustomPropertiesPrinter = 0; + // A bit indicating if the operation has additional invariants that need to // verified (aside from those verified by other ODS constructs). If set to `1`, // an additional `LogicalResult verify()` declaration will be generated on the diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h index 075d39194ed97..d92a93746bf54 100644 --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -1864,6 +1864,18 @@ class Op : public OpState, public Traits<ConcreteType>... { using detect_has_print_properties = llvm::is_detected<has_print_properties, T>; + /// Trait to check if T provides a generated printer for the key-value + /// spelling of `prop-dict`. + template <typename T, typename... Args> + using has_print_properties_as_key_value_list = + decltype(T::_odsPrintPropertiesAsKeyValueList( + std::declval<MLIRContext *>(), std::declval<OpAsmPrinter &>(), + std::declval<const typename PropertiesSelector<T>::type &>(), + std::declval<ArrayRef<StringRef>>())); + template <typename T> + using detect_has_print_properties_as_key_value_list = + llvm::is_detected<has_print_properties_as_key_value_list, T>; + /// Trait to check if parseProperties(OpAsmParser, T) exist template <typename T, typename... Args> using has_parse_properties = decltype(parseProperties( @@ -2036,15 +2048,19 @@ class Op : public OpState, public Traits<ConcreteType>... { InferredProperties<T> &properties) {} /// Print the operation properties with names not included within - /// 'elidedProps'. Unless overridden, this method will try to dispatch to a - /// `printProperties` free-function if it exists, and otherwise by converting - /// the properties to an Attribute. + /// 'elidedProps'. Unless overridden, this method first tries to dispatch to a + /// `printProperties` free-function, then to the generated per-field printer, + /// and finally converts the properties to an Attribute. template <typename T> static void printProperties(MLIRContext *ctx, OpAsmPrinter &p, const T &properties, ArrayRef<StringRef> elidedProps = {}) { if constexpr (detect_has_print_properties<T>::value) return printProperties(p, properties, elidedProps); + if constexpr (detect_has_print_properties_as_key_value_list< + ConcreteType>::value) + return ConcreteType::_odsPrintPropertiesAsKeyValueList(ctx, p, properties, + elidedProps); genericPrintProperties( p, ConcreteType::getPropertiesAsAttr(ctx, properties), elidedProps); } diff --git a/mlir/include/mlir/TableGen/Operator.h b/mlir/include/mlir/TableGen/Operator.h index f0514d8e61748..4c0ba2a1db9ec 100644 --- a/mlir/include/mlir/TableGen/Operator.h +++ b/mlir/include/mlir/TableGen/Operator.h @@ -143,6 +143,9 @@ class Operator { /// Returns true if default builders should not be generated. bool skipDefaultBuilders() const; + /// Returns true if the operation provides a custom properties printer. + bool hasCustomPropertiesPrinter() const; + /// Op result iterators. const_value_iterator result_begin() const; const_value_iterator result_end() const; diff --git a/mlir/lib/TableGen/Operator.cpp b/mlir/lib/TableGen/Operator.cpp index 82dfbcbfa4d4f..148c3408b707d 100644 --- a/mlir/lib/TableGen/Operator.cpp +++ b/mlir/lib/TableGen/Operator.cpp @@ -186,6 +186,10 @@ bool Operator::skipDefaultBuilders() const { return def.getValueAsBit("skipDefaultBuilders"); } +bool Operator::hasCustomPropertiesPrinter() const { + return def.getValueAsBit("hasCustomPropertiesPrinter"); +} + auto Operator::result_begin() const -> const_value_iterator { return results.begin(); } diff --git a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-copy.mlir b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-copy.mlir index be0b9baf502bc..8f5b93bffe27e 100644 --- a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-copy.mlir +++ b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-copy.mlir @@ -18,7 +18,7 @@ func.func @alloc_copy(%arg0: memref<999xi32>) { // CHECK-LABEL: func.func @alloc_copy( // CHECK-SAME: %[[ARG0:.*]]: memref<999xi32>) { // CHECK: %[[UNREALIZED_CONVERSION_CAST_0:.*]] = builtin.unrealized_conversion_cast %[[ARG0]] : memref<999xi32> to !emitc.array<999xi32> -// CHECK: %[[CALL_OPAQUE_0:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CHECK: %[[CALL_OPAQUE_0:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CHECK: %[[VAL_0:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // CHECK: %[[MUL_0:.*]] = emitc.mul %[[CALL_OPAQUE_0]], %[[VAL_0]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: %[[CALL_OPAQUE_1:.*]] = emitc.call_opaque "malloc"(%[[MUL_0]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -30,11 +30,11 @@ func.func @alloc_copy(%arg0: memref<999xi32>) { // CHECK: %[[VAL_2:.*]] = "emitc.constant"() <{value = 0 : index}> : () -> index // CHECK: %[[SUBSCRIPT_1:.*]] = emitc.subscript %[[UNREALIZED_CONVERSION_CAST_1]]{{\[}}%[[VAL_2]]] : (!emitc.array<999xi32>, index) -> !emitc.lvalue<i32> // CHECK: %[[ADDRESS_OF_1:.*]] = emitc.address_of %[[SUBSCRIPT_1]] : !emitc.lvalue<i32> -// CHECK: %[[CALL_OPAQUE_2:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CHECK: %[[CALL_OPAQUE_2:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CHECK: %[[VAL_3:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // CHECK: %[[MUL_1:.*]] = emitc.mul %[[CALL_OPAQUE_2]], %[[VAL_3]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: emitc.call_opaque "memcpy"(%[[ADDRESS_OF_1]], %[[ADDRESS_OF_0]], %[[MUL_1]]) : (!emitc.ptr<i32>, !emitc.ptr<i32>, !emitc.size_t) -> () -// CHECK: %[[CALL_OPAQUE_3:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CHECK: %[[CALL_OPAQUE_3:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CHECK: %[[VAL_4:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // CHECK: %[[MUL_2:.*]] = emitc.mul %[[CALL_OPAQUE_3]], %[[VAL_4]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: %[[CALL_OPAQUE_4:.*]] = emitc.call_opaque "malloc"(%[[MUL_2]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -46,7 +46,7 @@ func.func @alloc_copy(%arg0: memref<999xi32>) { // CHECK: %[[VAL_6:.*]] = "emitc.constant"() <{value = 0 : index}> : () -> index // CHECK: %[[SUBSCRIPT_3:.*]] = emitc.subscript %[[UNREALIZED_CONVERSION_CAST_2]]{{\[}}%[[VAL_6]]] : (!emitc.array<999xi32>, index) -> !emitc.lvalue<i32> // CHECK: %[[ADDRESS_OF_3:.*]] = emitc.address_of %[[SUBSCRIPT_3]] : !emitc.lvalue<i32> -// CHECK: %[[CALL_OPAQUE_5:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CHECK: %[[CALL_OPAQUE_5:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CHECK: %[[VAL_7:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // CHECK: %[[MUL_3:.*]] = emitc.mul %[[CALL_OPAQUE_5]], %[[VAL_7]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: emitc.call_opaque "memcpy"(%[[ADDRESS_OF_3]], %[[ADDRESS_OF_2]], %[[MUL_3]]) : (!emitc.ptr<i32>, !emitc.ptr<i32>, !emitc.size_t) -> () diff --git a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-dealloc.mlir b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-dealloc.mlir index 3194a40c16eeb..ad2329b922c81 100644 --- a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-dealloc.mlir +++ b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-dealloc.mlir @@ -15,7 +15,7 @@ func.func @alloc_and_dealloc() { // CPP: module { // CPP-NEXT: emitc.include <"cstdlib"> // CPP-LABEL: alloc_and_dealloc() -// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // CPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // CPP-NEXT: %[[ALLOC_PTR:.*]] = emitc.call_opaque "malloc"(%[[ALLOC_TOTAL_SIZE]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -27,7 +27,7 @@ func.func @alloc_and_dealloc() { // NOCPP: module { // NOCPP-NEXT: emitc.include <"stdlib.h"> // NOCPP-LABEL: alloc_and_dealloc() -// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // NOCPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_PTR:.*]] = emitc.call_opaque "malloc"(%[[ALLOC_TOTAL_SIZE]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -43,7 +43,7 @@ func.func @alloc_and_dealloc_aligned() { } // CPP-LABEL: alloc_and_dealloc_aligned -// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [f32]}> : () -> !emitc.size_t +// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [f32]> : () -> !emitc.size_t // CPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // CPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // CPP-NEXT: %[[ALIGNMENT:.*]] = "emitc.constant"() <{value = 64 : index}> : () -> !emitc.size_t @@ -54,7 +54,7 @@ func.func @alloc_and_dealloc_aligned() { // CPP-NEXT: return // NOCPP-LABEL: alloc_and_dealloc_aligned -// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [f32]}> : () -> !emitc.size_t +// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [f32]> : () -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 999 : index}> : () -> index // NOCPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // NOCPP-NEXT: %[[ALIGNMENT:.*]] = "emitc.constant"() <{value = 64 : index}> : () -> !emitc.size_t @@ -71,7 +71,7 @@ func.func @allocating_and_deallocating_multi() { } // CPP-LABEL: allocating_and_deallocating_multi -// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 6993 : index}> : () -> index // CPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // CPP-NEXT: %[[ALLOC_PTR:.*]] = emitc.call_opaque "malloc"(%[[ALLOC_TOTAL_SIZE]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void"> @@ -81,7 +81,7 @@ func.func @allocating_and_deallocating_multi() { // CPP-NEXT: return // NOCPP-LABEL: allocating_and_deallocating_multi -// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 6993 : index}> : () -> index // NOCPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_PTR:.*]] = emitc.call_opaque "malloc"(%[[ALLOC_TOTAL_SIZE]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -97,7 +97,7 @@ func.func @alloc_and_dealloc_rank0() { } // CPP-LABEL: alloc_and_dealloc_rank0 -// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// CPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 1 : index}> : () -> index // CPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // CPP-NEXT: %[[ALLOC_PTR:.*]] = emitc.call_opaque "malloc"(%[[ALLOC_TOTAL_SIZE]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -107,7 +107,7 @@ func.func @alloc_and_dealloc_rank0() { // CPP-NEXT: return // NOCPP-LABEL: alloc_and_dealloc_rank0 -// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t +// NOCPP-NEXT: %[[ALLOC:.*]] = emitc.call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_SIZE:.*]] = "emitc.constant"() <{value = 1 : index}> : () -> index // NOCPP-NEXT: %[[ALLOC_TOTAL_SIZE:.*]] = emitc.mul %[[ALLOC]], %[[ALLOC_SIZE]] : (!emitc.size_t, index) -> !emitc.size_t // NOCPP-NEXT: %[[ALLOC_PTR:.*]] = emitc.call_opaque "malloc"(%[[ALLOC_TOTAL_SIZE]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> diff --git a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-load-store.mlir b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-load-store.mlir index 653220470bb5a..43c5733baccb3 100644 --- a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-load-store.mlir +++ b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-alloc-load-store.mlir @@ -21,7 +21,7 @@ // CHECK-SAME: %[[ARG_J:.*]]: !emitc.size_t) func.func private @memref_alloc_store(%v : f32, %i: index, %j: index) { /// Allocation size computation - // CHECK: %[[SIZEOF_F32:.*]] = call_opaque "sizeof"() <{args = [f32]}> : () -> !emitc.size_t + // CHECK: %[[SIZEOF_F32:.*]] = call_opaque "sizeof"() <args = [f32]> : () -> !emitc.size_t // CHECK: %[[NUM_ELEMS:.*]] = "emitc.constant"() <{value = 32 : index}> : () -> index // CHECK: %[[TOTAL_BYTES:.*]] = mul %[[SIZEOF_F32]], %[[NUM_ELEMS]] : (!emitc.size_t, index) -> !emitc.size_t /// Alloc @@ -42,7 +42,7 @@ func.func private @memref_alloc_store(%v : f32, %i: index, %j: index) { // CHECK-SAME: %[[ARG_I:.*]]: !emitc.size_t, // CHECK-SAME: %[[ARG_J:.*]]: !emitc.size_t) -> f32 func.func private @memref_alloc_load(%i: index, %j: index) -> f32 { - // CHECK: %[[SIZEOF_F32:.*]] = call_opaque "sizeof"() <{args = [f32]}> : () -> !emitc.size_t + // CHECK: %[[SIZEOF_F32:.*]] = call_opaque "sizeof"() <args = [f32]> : () -> !emitc.size_t // CHECK: %[[NUM_ELEMS:.*]] = "emitc.constant"() <{value = 32 : index}> : () -> index // CHECK: %[[TOTAL_BYTES:.*]] = mul %[[SIZEOF_F32]], %[[NUM_ELEMS]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: %[[MALLOC_PTR:.*]] = call_opaque "malloc"(%[[TOTAL_BYTES]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -77,7 +77,7 @@ func.func @memref_load_store(%buff0: memref<2xf32>, // CHECK-LABEL: emitc.func private @memref_alloc_store_rank0( // CHECK-SAME: %[[VAL:.*]]: i32) func.func private @memref_alloc_store_rank0(%v : i32) { - // CHECK: %[[SIZEOF_I32:.*]] = call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t + // CHECK: %[[SIZEOF_I32:.*]] = call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CHECK: %[[NUM_ELEMS:.*]] = "emitc.constant"() <{value = 1 : index}> : () -> index // CHECK: %[[TOTAL_BYTES:.*]] = mul %[[SIZEOF_I32]], %[[NUM_ELEMS]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: %[[MALLOC_PTR:.*]] = call_opaque "malloc"(%[[TOTAL_BYTES]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> @@ -92,7 +92,7 @@ func.func private @memref_alloc_store_rank0(%v : i32) { // CHECK-LABEL: emitc.func private @memref_alloc_load_rank0() -> i32 func.func private @memref_alloc_load_rank0() -> i32 { - // CHECK: %[[SIZEOF_I32:.*]] = call_opaque "sizeof"() <{args = [i32]}> : () -> !emitc.size_t + // CHECK: %[[SIZEOF_I32:.*]] = call_opaque "sizeof"() <args = [i32]> : () -> !emitc.size_t // CHECK: %[[NUM_ELEMS:.*]] = "emitc.constant"() <{value = 1 : index}> : () -> index // CHECK: %[[TOTAL_BYTES:.*]] = mul %[[SIZEOF_I32]], %[[NUM_ELEMS]] : (!emitc.size_t, index) -> !emitc.size_t // CHECK: %[[MALLOC_PTR:.*]] = call_opaque "malloc"(%[[TOTAL_BYTES]]) : (!emitc.size_t) -> !emitc.ptr<!emitc.opaque<"void">> diff --git a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-copy.mlir b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-copy.mlir index 6105521d9326d..828aa68ea9f1c 100644 --- a/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-copy.mlir +++ b/mlir/test/Conversion/MemRefToEmitC/memref-to-emitc-copy.mlir @@ -21,7 +21,7 @@ func.func @copying(%arg0 : memref<9x4x5x7xf32>, %arg1 : memref<9x4x5x7xf32>) { // CHECK: %[[VAL_1:.*]] = "emitc.constant"() <{value = 0 : index}> : () -> index // CHECK: %[[SUBSCRIPT_1:.*]] = emitc.subscript %[[UNREALIZED_CONVERSION_CAST_0]]{{\[}}%[[VAL_1]], %[[VAL_1]], %[[VAL_1]], %[[VAL_1]]] : (!emitc.array<9x4x5x7xf32>, index, index, index, index) -> !emitc.lvalue<f32> // CHECK: %[[ADDRESS_OF_1:.*]] = emitc.address_of ... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/217589 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
