/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::gpu { /// Interface for GPU target attributes. Attributes implementing this interface /// compile GPU modules into binary objects, providing an opaque interface to /// hide implementation details. class TargetAttrInterface; } // namespace mlir::gpu namespace mlir::gpu { /// Interface for GPU target attributes that verify the target attribute /// of a given GPU module. class TargetAttrVerifyInterface; } // namespace mlir::gpu namespace mlir::gpu { /// Interface for GPU offloading LLVM translation attributes. Attributes /// implementing this interface manage the interaction between GPU offloading /// operations and host IR. class OffloadingLLVMTranslationAttrInterface; } // namespace mlir::gpu namespace mlir::gpu { /// Interface for GPU target attributes. Attributes implementing this interface /// compile GPU modules into binary objects, providing an opaque interface to /// hide implementation details. namespace detail { struct TargetAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. std::optional (*serializeToObject)(const Concept *impl, ::mlir::Attribute , ::mlir::Operation*, const ::mlir::gpu::TargetOptions&); ::mlir::Attribute (*createObject)(const Concept *impl, ::mlir::Attribute , ::mlir::Operation *, const ::mlir::gpu::SerializedObject &, const ::mlir::gpu::TargetOptions &); }; template class Model : public Concept { public: using Interface = ::mlir::gpu::TargetAttrInterface; Model() : Concept{serializeToObject, createObject} {} static inline std::optional serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* module, const ::mlir::gpu::TargetOptions& options); static inline ::mlir::Attribute createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module, const ::mlir::gpu::SerializedObject & object, const ::mlir::gpu::TargetOptions & options); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::gpu::TargetAttrInterface; FallbackModel() : Concept{serializeToObject, createObject} {} static inline std::optional serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* module, const ::mlir::gpu::TargetOptions& options); static inline ::mlir::Attribute createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module, const ::mlir::gpu::SerializedObject & object, const ::mlir::gpu::TargetOptions & options); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct TargetAttrInterfaceTrait; } // namespace detail class TargetAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::TargetAttrInterfaceTrait {}; /// Serializes a GPU module to a string containing a representation of the /// module. /// /// If serialization fails then the method should return `std::nullopt`. /// /// The `module` parameter must be a GPU Module Op. The `options` parameter /// is meant to be used for passing additional options that are not in the /// attribute. std::optional serializeToObject(::mlir::Operation* module, const ::mlir::gpu::TargetOptions& options) const; /// Creates a GPU object attribute from a binary string. /// /// The `module` parameter must be a `GPUModuleOp` and can be used to /// retrieve additional information like the list of kernels in the binary. /// The `object` parameter is a binary string. The `options` parameter is /// meant to be used for passing additional options that are not in the /// attribute. ::mlir::Attribute createObject(::mlir::Operation * module, const ::mlir::gpu::SerializedObject & object, const ::mlir::gpu::TargetOptions & options) const; }; } // namespace mlir::gpu namespace mlir::gpu { /// Interface for GPU target attributes that verify the target attribute /// of a given GPU module. namespace detail { struct TargetAttrVerifyInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::LogicalResult (*verifyTarget)(const Concept *impl, ::mlir::Attribute , ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::gpu::TargetAttrVerifyInterface; Model() : Concept{verifyTarget} {} static inline ::mlir::LogicalResult verifyTarget(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::gpu::TargetAttrVerifyInterface; FallbackModel() : Concept{verifyTarget} {} static inline ::mlir::LogicalResult verifyTarget(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct TargetAttrVerifyInterfaceTrait; } // namespace detail class TargetAttrVerifyInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::TargetAttrVerifyInterfaceTrait {}; /// Verifies that the target attribute is valid for the given GPU module. ::mlir::LogicalResult verifyTarget(::mlir::Operation * module) const; }; } // namespace mlir::gpu namespace mlir::gpu { /// Interface for GPU offloading LLVM translation attributes. Attributes /// implementing this interface manage the interaction between GPU offloading /// operations and host IR. namespace detail { struct OffloadingLLVMTranslationAttrInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::llvm::LogicalResult (*embedBinary)(const Concept *impl, ::mlir::Attribute , ::mlir::Operation*, ::llvm::IRBuilderBase&, ::mlir::LLVM::ModuleTranslation&); ::llvm::LogicalResult (*launchKernel)(const Concept *impl, ::mlir::Attribute , ::mlir::Operation*, ::mlir::Operation*, ::llvm::IRBuilderBase&, ::mlir::LLVM::ModuleTranslation&); }; template class Model : public Concept { public: using Interface = ::mlir::gpu::OffloadingLLVMTranslationAttrInterface; Model() : Concept{embedBinary, launchKernel} {} static inline ::llvm::LogicalResult embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation); static inline ::llvm::LogicalResult launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* launchFunc, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::gpu::OffloadingLLVMTranslationAttrInterface; FallbackModel() : Concept{embedBinary, launchKernel} {} static inline ::llvm::LogicalResult embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation); static inline ::llvm::LogicalResult launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* launchFunc, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteAttr; }; }; template struct OffloadingLLVMTranslationAttrInterfaceTrait; } // namespace detail class OffloadingLLVMTranslationAttrInterface : public ::mlir::AttributeInterface { public: using ::mlir::AttributeInterface::AttributeInterface; template struct Trait : public detail::OffloadingLLVMTranslationAttrInterfaceTrait {}; /// Translates a `gpu.binary` Op into a sequence of LLVM IR target-specific /// instructions, embedding the binary into a host LLVM module. /// /// The LLVM translation mechanism invokes this function when translating a /// `gpu.binary`. /// /// The first argument has to be a GPU binary operation. /// If the function fails at any point, it must return `failure`. ::llvm::LogicalResult embedBinary(::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation) const; /// Translates a `gpu.launch_func` op into a sequence of LLVM IR /// target-specific instructions, resulting in a kernel launch on host IR. /// /// The LLVM translation mechanism invokes this function when translating a /// `gpu.launch_func` operation; it searches the appropriate binary and uses /// its offloading handler. /// /// The first two arguments must be GPU launch and binary operations, /// respectively. If the function fails at any point, it must return /// `failure`. ::llvm::LogicalResult launchKernel(::mlir::Operation* launchFunc, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation) const; }; } // namespace mlir::gpu namespace mlir::gpu::detail { template struct TargetAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::gpu::detail namespace mlir::gpu::detail { template struct TargetAttrVerifyInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::gpu::detail namespace mlir::gpu::detail { template struct OffloadingLLVMTranslationAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { }; } // namespace mlir::gpu::detail namespace mlir::gpu { template std::optional detail::TargetAttrInterfaceInterfaceTraits::Model::serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* module, const ::mlir::gpu::TargetOptions& options) { return (::llvm::cast(tablegen_opaque_val)).serializeToObject(module, options); } template ::mlir::Attribute detail::TargetAttrInterfaceInterfaceTraits::Model::createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module, const ::mlir::gpu::SerializedObject & object, const ::mlir::gpu::TargetOptions & options) { return (::llvm::cast(tablegen_opaque_val)).createObject(module, object, options); } template std::optional detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::serializeToObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* module, const ::mlir::gpu::TargetOptions& options) { return static_cast(impl)->serializeToObject(tablegen_opaque_val, module, options); } template ::mlir::Attribute detail::TargetAttrInterfaceInterfaceTraits::FallbackModel::createObject(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module, const ::mlir::gpu::SerializedObject & object, const ::mlir::gpu::TargetOptions & options) { return static_cast(impl)->createObject(tablegen_opaque_val, module, object, options); } } // namespace mlir::gpu namespace mlir::gpu { template ::mlir::LogicalResult detail::TargetAttrVerifyInterfaceInterfaceTraits::Model::verifyTarget(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module) { return (::llvm::cast(tablegen_opaque_val)).verifyTarget(module); } template ::mlir::LogicalResult detail::TargetAttrVerifyInterfaceInterfaceTraits::FallbackModel::verifyTarget(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation * module) { return static_cast(impl)->verifyTarget(tablegen_opaque_val, module); } } // namespace mlir::gpu namespace mlir::gpu { template ::llvm::LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::Model::embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation) { return (::llvm::cast(tablegen_opaque_val)).embedBinary(binaryOp, hostBuilder, hostModuleTranslation); } template ::llvm::LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::Model::launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* launchFunc, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation) { return (::llvm::cast(tablegen_opaque_val)).launchKernel(launchFunc, binaryOp, hostBuilder, hostModuleTranslation); } template ::llvm::LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::FallbackModel::embedBinary(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation) { return static_cast(impl)->embedBinary(tablegen_opaque_val, binaryOp, hostBuilder, hostModuleTranslation); } template ::llvm::LogicalResult detail::OffloadingLLVMTranslationAttrInterfaceInterfaceTraits::FallbackModel::launchKernel(const Concept *impl, ::mlir::Attribute tablegen_opaque_val, ::mlir::Operation* launchFunc, ::mlir::Operation* binaryOp, ::llvm::IRBuilderBase& hostBuilder, ::mlir::LLVM::ModuleTranslation& hostModuleTranslation) { return static_cast(impl)->launchKernel(tablegen_opaque_val, launchFunc, binaryOp, hostBuilder, hostModuleTranslation); } } // namespace mlir::gpu