[Mlir-commits] [mlir] [mlir] Init the `TransformsInterfaces` for configuring transformations (PR #99566)

Matthias Springer llvmlistbot at llvm.org
Sun Jul 21 12:50:47 PDT 2024


================
@@ -409,3 +415,38 @@ void mlir::populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter,
                                    "__nv_tanh");
   populateOpPatterns<math::TanOp>(converter, patterns, "__nv_tanf", "__nv_tan");
 }
+
+//===----------------------------------------------------------------------===//
+// NVVMTargetAttr conversion patterns attr interface
+//===----------------------------------------------------------------------===//
+
+namespace {
+struct NVVMTargetPatternsAttrInterface
+    : public ConversionPatternsAttrInterface::ExternalModel<
+          NVVMTargetPatternsAttrInterface, NVVM::NVVMTargetAttr> {
+  /// Configure GPU to NVVM.
+  void populateConversionPatterns(Attribute attr,
+                                  ConversionPatternAttrOptions &options,
+                                  RewritePatternSet &patterns) const;
+};
+} // namespace
+
+void NVVMTargetPatternsAttrInterface::populateConversionPatterns(
----------------
matthias-springer wrote:

This implementation does not use `attr`. What's the benefit of this attr interface over the existing `ConvertToLLVMPatternInterface` dialect interface, which seems to do almost the same thing? Do you have a use kind in mind that cannot be solved with `ConvertToLLVMPatternInterface`?


https://github.com/llvm/llvm-project/pull/99566


More information about the Mlir-commits mailing list