/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir::gpu { /// Interface for GPU operations that execute asynchronously on the device. /// /// GPU operations implementing this interface take a list of dependencies /// as `gpu.async.token` arguments and optionally return a `gpu.async.token`. /// /// The op doesn't start executing until all depent ops producing the async /// dependency tokens have finished executing. /// /// If the op returns a token, the op merely schedules the execution on the /// device and returns immediately, without waiting for the execution to /// complete. On the hand, if the op does not return a token, the op will wait /// for the execution to complete. class AsyncOpInterface; } // namespace mlir::gpu namespace mlir::gpu { /// Interface for GPU operations that execute asynchronously on the device. /// /// GPU operations implementing this interface take a list of dependencies /// as `gpu.async.token` arguments and optionally return a `gpu.async.token`. /// /// The op doesn't start executing until all depent ops producing the async /// dependency tokens have finished executing. /// /// If the op returns a token, the op merely schedules the execution on the /// device and returns immediately, without waiting for the execution to /// complete. On the hand, if the op does not return a token, the op will wait /// for the execution to complete. namespace detail { struct AsyncOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. OperandRange (*getAsyncDependencies)(const Concept *impl, ::mlir::Operation *); void (*addAsyncDependency)(const Concept *impl, ::mlir::Operation *, Value); Value (*getAsyncToken)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::gpu::AsyncOpInterface; Model() : Concept{getAsyncDependencies, addAsyncDependency, getAsyncToken} {} static inline OperandRange getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token); static inline Value getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::gpu::AsyncOpInterface; FallbackModel() : Concept{getAsyncDependencies, addAsyncDependency, getAsyncToken} {} static inline OperandRange getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline void addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token); static inline Value getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; OperandRange getAsyncDependencies(::mlir::Operation *tablegen_opaque_val) const; void addAsyncDependency(::mlir::Operation *tablegen_opaque_val, Value token) const; }; }; template struct AsyncOpInterfaceTrait; } // namespace detail class AsyncOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::AsyncOpInterfaceTrait {}; /// Query the operands that represent async dependency tokens. OperandRange getAsyncDependencies(); /// Adds a new token to the list of async dependencies if it is not already there. void addAsyncDependency(Value token); /// Query the result that represents the async token to depend on. Value getAsyncToken(); }; } // namespace mlir::gpu namespace mlir::gpu::detail { template struct AsyncOpInterfaceTrait : public ::mlir::OpInterface::Trait { /// Query the operands that represent async dependency tokens. OperandRange getAsyncDependencies() { ConcreteOp op = cast(this->getOperation()); return op.getAsyncDependencies(); } /// Adds a new token to the list of async dependencies if it is not already there. void addAsyncDependency(Value token) { if (!::llvm::is_contained(this->getAsyncDependencies(), token)) ::mlir::gpu::addAsyncDependency(this->getOperation(), token); } }; } // namespace mlir::gpu::detail namespace mlir::gpu { template OperandRange detail::AsyncOpInterfaceInterfaceTraits::Model::getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getAsyncDependencies(); } template void detail::AsyncOpInterfaceInterfaceTraits::Model::addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token) { return (llvm::cast(tablegen_opaque_val)).addAsyncDependency(token); } template Value detail::AsyncOpInterfaceInterfaceTraits::Model::getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getAsyncToken(); } template OperandRange detail::AsyncOpInterfaceInterfaceTraits::FallbackModel::getAsyncDependencies(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getAsyncDependencies(tablegen_opaque_val); } template void detail::AsyncOpInterfaceInterfaceTraits::FallbackModel::addAsyncDependency(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, Value token) { return static_cast(impl)->addAsyncDependency(tablegen_opaque_val, token); } template Value detail::AsyncOpInterfaceInterfaceTraits::FallbackModel::getAsyncToken(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getAsyncToken(tablegen_opaque_val); } template OperandRange detail::AsyncOpInterfaceInterfaceTraits::ExternalModel::getAsyncDependencies(::mlir::Operation *tablegen_opaque_val) const { ConcreteOp op = cast(this->getOperation()); return op.getAsyncDependencies(); } template void detail::AsyncOpInterfaceInterfaceTraits::ExternalModel::addAsyncDependency(::mlir::Operation *tablegen_opaque_val, Value token) const { if (!::llvm::is_contained(this->getAsyncDependencies(), token)) ::mlir::gpu::addAsyncDependency(this->getOperation(), token); } } // namespace mlir::gpu