[Mlir-commits] [mlir] [mlir][interfaces] Add the `TargetInfo` attribute interface (PR #78073)

Mehdi Amini llvmlistbot at llvm.org
Sun Apr 20 05:42:18 PDT 2025


================
@@ -66,13 +68,24 @@ class NVVMTargetAttrImpl
                          const SmallVector<char, 0> &object,
                          const gpu::TargetOptions &options) const;
 };
+
+// Implementation of the `::mlir::TargetAttrInterface` model.
+class NVVMTargetInfoAttrImpl
+    : public mlir::TargetAttrInterface::FallbackModel<NVVMTargetInfoAttrImpl> {
+public:
+  StringRef getTargetTriple(Attribute attribute) const;
+  StringRef getTargetChip(Attribute attribute) const;
+  std::string getTargetFeatures(Attribute attribute) const;
+  LogicalResult setTargetSpec(Attribute attribute, TargetSpec &spec) const;
+};
 } // namespace
 
 // Register the NVVM dialect, the NVVM translation & the target interface.
 void mlir::NVVM::registerNVVMTargetInterfaceExternalModels(
     DialectRegistry &registry) {
   registry.addExtension(+[](MLIRContext *ctx, NVVM::NVVMDialect *dialect) {
     NVVMTargetAttr::attachInterface<NVVMTargetAttrImpl>(*ctx);
+    NVVMTargetAttr::attachInterface<NVVMTargetInfoAttrImpl>(*ctx);
----------------
joker-eph wrote:

There needs a promise on the attribute I believe.

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


More information about the Mlir-commits mailing list