/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ |* *| |* Interface Declarations *| |* *| |* Automatically generated file, do not edit! *| |* *| \*===----------------------------------------------------------------------===*/ namespace mlir { /// A view-like operation "views" a buffer in a potentially different way. It /// takes in a (view of) buffer (and potentially some other operands) and returns /// another view of buffer. class ViewLikeOpInterface; } // namespace mlir namespace mlir { /// Common interface for ops that allow specifying mixed dynamic and static /// offsets, sizes and strides variadic operands. /// Ops that implement this interface need to expose the following methods: /// 1. `getArrayAttrMaxRanks` to specify the length of static integer /// attributes. /// 2. `offsets`, `sizes` and `strides` variadic operands. /// 3. `static_offsets`, resp. `static_sizes` and `static_strides` integer /// array attributes. /// 4. `getOffsetSizeAndStrideStartOperandIndex` method that specifies the /// starting index of the OffsetSizeAndStrideOpInterface operands /// /// The invariants of this interface are: /// 1. `static_offsets`, `static_sizes` and `static_strides` have length /// exactly `getArrayAttrMaxRanks()`[0] (resp. [1], [2]). /// 2. `offsets`, `sizes` and `strides` have each length at most /// `getArrayAttrMaxRanks()`[0] (resp. [1], [2]). /// 3. if an entry of `static_offsets` (resp. `static_sizes`, /// `static_strides`) is equal to a special sentinel value, namely /// `ShapedType::kDynamic`, then the corresponding entry is a dynamic /// offset (resp. size, stride). /// 4. a variadic `offset` (resp. `sizes`, `strides`) operand must be present /// for each dynamic offset (resp. size, stride). /// 5. `offsets`, `sizes` and `strides` operands are specified in this order /// at operand index starting at `getOffsetSizeAndStrideStartOperandIndex`. /// 6. `offsets` and `sizes` operands are non-negative. /// /// This interface is useful to factor out common behavior and provide support /// for carrying or injecting static behavior through the use of the static /// attributes. class OffsetSizeAndStrideOpInterface; } // namespace mlir namespace mlir { /// A view-like operation "views" a buffer in a potentially different way. It /// takes in a (view of) buffer (and potentially some other operands) and returns /// another view of buffer. namespace detail { struct ViewLikeOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. ::mlir::Value (*getViewSource)(const Concept *impl, ::mlir::Operation *); ::mlir::Value (*getViewDest)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::ViewLikeOpInterface; Model() : Concept{getViewSource, getViewDest} {} static inline ::mlir::Value getViewSource(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::Value getViewDest(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::ViewLikeOpInterface; FallbackModel() : Concept{getViewSource, getViewDest} {} static inline ::mlir::Value getViewSource(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::Value getViewDest(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; ::mlir::Value getViewDest(::mlir::Operation *tablegen_opaque_val) const; }; }; template struct ViewLikeOpInterfaceTrait; } // namespace detail class ViewLikeOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::ViewLikeOpInterfaceTrait {}; /// Returns the source buffer from which the view is created. ::mlir::Value getViewSource(); /// Returns the buffer which the view created. ::mlir::Value getViewDest(); }; } // namespace mlir namespace mlir { /// Common interface for ops that allow specifying mixed dynamic and static /// offsets, sizes and strides variadic operands. /// Ops that implement this interface need to expose the following methods: /// 1. `getArrayAttrMaxRanks` to specify the length of static integer /// attributes. /// 2. `offsets`, `sizes` and `strides` variadic operands. /// 3. `static_offsets`, resp. `static_sizes` and `static_strides` integer /// array attributes. /// 4. `getOffsetSizeAndStrideStartOperandIndex` method that specifies the /// starting index of the OffsetSizeAndStrideOpInterface operands /// /// The invariants of this interface are: /// 1. `static_offsets`, `static_sizes` and `static_strides` have length /// exactly `getArrayAttrMaxRanks()`[0] (resp. [1], [2]). /// 2. `offsets`, `sizes` and `strides` have each length at most /// `getArrayAttrMaxRanks()`[0] (resp. [1], [2]). /// 3. if an entry of `static_offsets` (resp. `static_sizes`, /// `static_strides`) is equal to a special sentinel value, namely /// `ShapedType::kDynamic`, then the corresponding entry is a dynamic /// offset (resp. size, stride). /// 4. a variadic `offset` (resp. `sizes`, `strides`) operand must be present /// for each dynamic offset (resp. size, stride). /// 5. `offsets`, `sizes` and `strides` operands are specified in this order /// at operand index starting at `getOffsetSizeAndStrideStartOperandIndex`. /// 6. `offsets` and `sizes` operands are non-negative. /// /// This interface is useful to factor out common behavior and provide support /// for carrying or injecting static behavior through the use of the static /// attributes. namespace detail { struct OffsetSizeAndStrideOpInterfaceInterfaceTraits { struct Concept { /// The methods defined by the interface. unsigned (*getOffsetSizeAndStrideStartOperandIndex)(); std::array (*getArrayAttrMaxRanks)(const Concept *impl, ::mlir::Operation *); ::mlir::OperandRange (*getOffsets)(const Concept *impl, ::mlir::Operation *); ::mlir::OperandRange (*getSizes)(const Concept *impl, ::mlir::Operation *); ::mlir::OperandRange (*getStrides)(const Concept *impl, ::mlir::Operation *); ::llvm::ArrayRef (*getStaticOffsets)(const Concept *impl, ::mlir::Operation *); ::llvm::ArrayRef (*getStaticSizes)(const Concept *impl, ::mlir::Operation *); ::llvm::ArrayRef (*getStaticStrides)(const Concept *impl, ::mlir::Operation *); ::llvm::SmallVector<::mlir::OpFoldResult> (*getMixedOffsets)(const Concept *impl, ::mlir::Operation *); ::llvm::SmallVector<::mlir::OpFoldResult> (*getMixedSizes)(const Concept *impl, ::mlir::Operation *); ::llvm::SmallVector<::mlir::OpFoldResult> (*getMixedStrides)(const Concept *impl, ::mlir::Operation *); bool (*isDynamicOffset)(const Concept *impl, ::mlir::Operation *, unsigned); bool (*isDynamicSize)(const Concept *impl, ::mlir::Operation *, unsigned); bool (*isDynamicStride)(const Concept *impl, ::mlir::Operation *, unsigned); int64_t (*getStaticOffset)(const Concept *impl, ::mlir::Operation *, unsigned); int64_t (*getStaticSize)(const Concept *impl, ::mlir::Operation *, unsigned); int64_t (*getStaticStride)(const Concept *impl, ::mlir::Operation *, unsigned); unsigned (*getIndexOfDynamicOffset)(const Concept *impl, ::mlir::Operation *, unsigned); unsigned (*getIndexOfDynamicSize)(const Concept *impl, ::mlir::Operation *, unsigned); unsigned (*getIndexOfDynamicStride)(const Concept *impl, ::mlir::Operation *, unsigned); ::mlir::Value (*getDynamicOffset)(const Concept *impl, ::mlir::Operation *, unsigned); ::mlir::Value (*getDynamicSize)(const Concept *impl, ::mlir::Operation *, unsigned); ::mlir::Value (*getDynamicStride)(const Concept *impl, ::mlir::Operation *, unsigned); bool (*isSameAs)(const Concept *impl, ::mlir::Operation *, ::mlir::OffsetSizeAndStrideOpInterface, ::llvm::function_ref); bool (*hasUnitStride)(const Concept *impl, ::mlir::Operation *); bool (*hasZeroOffset)(const Concept *impl, ::mlir::Operation *); }; template class Model : public Concept { public: using Interface = ::mlir::OffsetSizeAndStrideOpInterface; Model() : Concept{getOffsetSizeAndStrideStartOperandIndex, getArrayAttrMaxRanks, getOffsets, getSizes, getStrides, getStaticOffsets, getStaticSizes, getStaticStrides, getMixedOffsets, getMixedSizes, getMixedStrides, isDynamicOffset, isDynamicSize, isDynamicStride, getStaticOffset, getStaticSize, getStaticStride, getIndexOfDynamicOffset, getIndexOfDynamicSize, getIndexOfDynamicStride, getDynamicOffset, getDynamicSize, getDynamicStride, isSameAs, hasUnitStride, hasZeroOffset} {} static inline unsigned getOffsetSizeAndStrideStartOperandIndex(); static inline std::array getArrayAttrMaxRanks(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::OperandRange getOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::OperandRange getSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::OperandRange getStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::ArrayRef getStaticOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::ArrayRef getStaticSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::ArrayRef getStaticStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::SmallVector<::mlir::OpFoldResult> getMixedOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::SmallVector<::mlir::OpFoldResult> getMixedSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::SmallVector<::mlir::OpFoldResult> getMixedStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline bool isDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline bool isDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline int64_t getStaticOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline int64_t getStaticSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline int64_t getStaticStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline unsigned getIndexOfDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline unsigned getIndexOfDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline unsigned getIndexOfDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline ::mlir::Value getDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline ::mlir::Value getDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline ::mlir::Value getDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline bool isSameAs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp); static inline bool hasUnitStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool hasZeroOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class FallbackModel : public Concept { public: using Interface = ::mlir::OffsetSizeAndStrideOpInterface; FallbackModel() : Concept{getOffsetSizeAndStrideStartOperandIndex, getArrayAttrMaxRanks, getOffsets, getSizes, getStrides, getStaticOffsets, getStaticSizes, getStaticStrides, getMixedOffsets, getMixedSizes, getMixedStrides, isDynamicOffset, isDynamicSize, isDynamicStride, getStaticOffset, getStaticSize, getStaticStride, getIndexOfDynamicOffset, getIndexOfDynamicSize, getIndexOfDynamicStride, getDynamicOffset, getDynamicSize, getDynamicStride, isSameAs, hasUnitStride, hasZeroOffset} {} static inline unsigned getOffsetSizeAndStrideStartOperandIndex(); static inline std::array getArrayAttrMaxRanks(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::OperandRange getOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::OperandRange getSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::mlir::OperandRange getStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::ArrayRef getStaticOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::ArrayRef getStaticSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::ArrayRef getStaticStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::SmallVector<::mlir::OpFoldResult> getMixedOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::SmallVector<::mlir::OpFoldResult> getMixedSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline ::llvm::SmallVector<::mlir::OpFoldResult> getMixedStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool isDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline bool isDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline bool isDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline int64_t getStaticOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline int64_t getStaticSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline int64_t getStaticStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline unsigned getIndexOfDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline unsigned getIndexOfDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline unsigned getIndexOfDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline ::mlir::Value getDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline ::mlir::Value getDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline ::mlir::Value getDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx); static inline bool isSameAs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp); static inline bool hasUnitStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); static inline bool hasZeroOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); }; template class ExternalModel : public FallbackModel { public: using ConcreteEntity = ConcreteOp; ::mlir::OperandRange getOffsets(::mlir::Operation *tablegen_opaque_val) const; ::mlir::OperandRange getSizes(::mlir::Operation *tablegen_opaque_val) const; ::mlir::OperandRange getStrides(::mlir::Operation *tablegen_opaque_val) const; ::llvm::ArrayRef getStaticOffsets(::mlir::Operation *tablegen_opaque_val) const; ::llvm::ArrayRef getStaticSizes(::mlir::Operation *tablegen_opaque_val) const; ::llvm::ArrayRef getStaticStrides(::mlir::Operation *tablegen_opaque_val) const; ::llvm::SmallVector<::mlir::OpFoldResult> getMixedOffsets(::mlir::Operation *tablegen_opaque_val) const; ::llvm::SmallVector<::mlir::OpFoldResult> getMixedSizes(::mlir::Operation *tablegen_opaque_val) const; ::llvm::SmallVector<::mlir::OpFoldResult> getMixedStrides(::mlir::Operation *tablegen_opaque_val) const; bool isDynamicOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; bool isDynamicSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; bool isDynamicStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; int64_t getStaticOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; int64_t getStaticSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; int64_t getStaticStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; unsigned getIndexOfDynamicOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; unsigned getIndexOfDynamicSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; unsigned getIndexOfDynamicStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; ::mlir::Value getDynamicOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; ::mlir::Value getDynamicSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; ::mlir::Value getDynamicStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const; bool isSameAs(::mlir::Operation *tablegen_opaque_val, ::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp) const; bool hasUnitStride(::mlir::Operation *tablegen_opaque_val) const; bool hasZeroOffset(::mlir::Operation *tablegen_opaque_val) const; }; }; template struct OffsetSizeAndStrideOpInterfaceTrait; } // namespace detail class OffsetSizeAndStrideOpInterface : public ::mlir::OpInterface { public: using ::mlir::OpInterface::OpInterface; template struct Trait : public detail::OffsetSizeAndStrideOpInterfaceTrait {}; /// Return the number of leading operands before the `offsets`, `sizes` and /// and `strides` operands. unsigned getOffsetSizeAndStrideStartOperandIndex(); /// Return the expected rank of each of the`static_offsets`, `static_sizes` /// and `static_strides` attributes. std::array getArrayAttrMaxRanks(); /// Return the dynamic offset operands. ::mlir::OperandRange getOffsets(); /// Return the dynamic size operands. ::mlir::OperandRange getSizes(); /// Return the dynamic stride operands. ::mlir::OperandRange getStrides(); /// Return the static offset attributes. ::llvm::ArrayRef getStaticOffsets(); /// Return the static size attributes. ::llvm::ArrayRef getStaticSizes(); /// Return the dynamic stride attributes. ::llvm::ArrayRef getStaticStrides(); /// Return a vector of all the static or dynamic offsets of the op. ::llvm::SmallVector<::mlir::OpFoldResult> getMixedOffsets(); /// Return a vector of all the static or dynamic sizes of the op. ::llvm::SmallVector<::mlir::OpFoldResult> getMixedSizes(); /// Return a vector of all the static or dynamic strides of the op. ::llvm::SmallVector<::mlir::OpFoldResult> getMixedStrides(); /// Return true if the offset `idx` is dynamic. bool isDynamicOffset(unsigned idx); /// Return true if the size `idx` is dynamic. bool isDynamicSize(unsigned idx); /// Return true if the stride `idx` is dynamic. bool isDynamicStride(unsigned idx); /// Assert the offset `idx` is a static constant and return its value. int64_t getStaticOffset(unsigned idx); /// Assert the size `idx` is a static constant and return its value. int64_t getStaticSize(unsigned idx); /// Assert the stride `idx` is a static constant and return its value. int64_t getStaticStride(unsigned idx); /// Assert the offset `idx` is dynamic and return the position of the /// corresponding operand. unsigned getIndexOfDynamicOffset(unsigned idx); /// Assert the size `idx` is dynamic and return the position of the /// corresponding operand. unsigned getIndexOfDynamicSize(unsigned idx); /// Assert the stride `idx` is dynamic and return the position of the /// corresponding operand. unsigned getIndexOfDynamicStride(unsigned idx); /// Assert the offset `idx` is dynamic and return its value. ::mlir::Value getDynamicOffset(unsigned idx); /// Assert the size `idx` is dynamic and return its value. ::mlir::Value getDynamicSize(unsigned idx); /// Assert the stride `idx` is dynamic and return its value. ::mlir::Value getDynamicStride(unsigned idx); /// Return true if all `other`'s offsets, sizes and strides are the same. /// Takes a custom `cmp` comparison function on OpFoldResult to avoid taking /// a dialect dependence. bool isSameAs(::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp); /// Return true if all strides are guaranteed to be 1. bool hasUnitStride(); /// Return true if all offsets are guaranteed to be 0. bool hasZeroOffset(); }; } // namespace mlir namespace mlir::detail { template struct ViewLikeOpInterfaceTrait : public ::mlir::OpInterface::Trait { /// Returns the buffer which the view created. ::mlir::Value getViewDest() { return (*static_cast(this))->getResult(0); } }; } // namespace mlir::detail namespace mlir::detail { template struct OffsetSizeAndStrideOpInterfaceTrait : public ::mlir::OpInterface::Trait { /// Return the dynamic offset operands. ::mlir::OperandRange getOffsets() { return (*static_cast(this)).getOffsets(); } /// Return the dynamic size operands. ::mlir::OperandRange getSizes() { return (*static_cast(this)).getSizes(); } /// Return the dynamic stride operands. ::mlir::OperandRange getStrides() { return (*static_cast(this)).getStrides(); } /// Return the static offset attributes. ::llvm::ArrayRef getStaticOffsets() { return (*static_cast(this)).getStaticOffsets(); } /// Return the static size attributes. ::llvm::ArrayRef getStaticSizes() { return (*static_cast(this)).getStaticSizes(); } /// Return the dynamic stride attributes. ::llvm::ArrayRef getStaticStrides() { return (*static_cast(this)).getStaticStrides(); } /// Return a vector of all the static or dynamic offsets of the op. ::llvm::SmallVector<::mlir::OpFoldResult> getMixedOffsets() { Builder b((*static_cast(this))->getContext()); return ::mlir::getMixedValues((*static_cast(this)).getStaticOffsets(), (*static_cast(this)).getOffsets(), b); } /// Return a vector of all the static or dynamic sizes of the op. ::llvm::SmallVector<::mlir::OpFoldResult> getMixedSizes() { Builder b((*static_cast(this))->getContext()); return ::mlir::getMixedValues((*static_cast(this)).getStaticSizes(), (*static_cast(this)).getSizes(), b); } /// Return a vector of all the static or dynamic strides of the op. ::llvm::SmallVector<::mlir::OpFoldResult> getMixedStrides() { Builder b((*static_cast(this))->getContext()); return ::mlir::getMixedValues((*static_cast(this)).getStaticStrides(), (*static_cast(this)).getStrides(), b); } /// Return true if the offset `idx` is dynamic. bool isDynamicOffset(unsigned idx) { return ::mlir::ShapedType::isDynamic(getStaticOffsets()[idx]); } /// Return true if the size `idx` is dynamic. bool isDynamicSize(unsigned idx) { return ::mlir::ShapedType::isDynamic(getStaticSizes()[idx]); } /// Return true if the stride `idx` is dynamic. bool isDynamicStride(unsigned idx) { return ::mlir::ShapedType::isDynamic(getStaticStrides()[idx]); } /// Assert the offset `idx` is a static constant and return its value. int64_t getStaticOffset(unsigned idx) { assert(!(*static_cast(this)).isDynamicOffset(idx) && "expected static offset"); return getStaticOffsets()[idx]; } /// Assert the size `idx` is a static constant and return its value. int64_t getStaticSize(unsigned idx) { assert(!(*static_cast(this)).isDynamicSize(idx) && "expected static size"); return getStaticSizes()[idx]; } /// Assert the stride `idx` is a static constant and return its value. int64_t getStaticStride(unsigned idx) { assert(!(*static_cast(this)).isDynamicStride(idx) && "expected static stride"); return getStaticStrides()[idx]; } /// Assert the offset `idx` is dynamic and return the position of the /// corresponding operand. unsigned getIndexOfDynamicOffset(unsigned idx) { assert((*static_cast(this)).isDynamicOffset(idx) && "expected dynamic offset"); auto numDynamic = ::mlir::detail::getNumDynamicEntriesUpToIdx( getStaticOffsets(), idx); return (*static_cast(this)).getOffsetSizeAndStrideStartOperandIndex() + numDynamic; } /// Assert the size `idx` is dynamic and return the position of the /// corresponding operand. unsigned getIndexOfDynamicSize(unsigned idx) { assert((*static_cast(this)).isDynamicSize(idx) && "expected dynamic size"); auto numDynamic = ::mlir::detail::getNumDynamicEntriesUpToIdx( getStaticSizes(), idx); return (*static_cast(this)).getOffsetSizeAndStrideStartOperandIndex() + getOffsets().size() + numDynamic; } /// Assert the stride `idx` is dynamic and return the position of the /// corresponding operand. unsigned getIndexOfDynamicStride(unsigned idx) { assert((*static_cast(this)).isDynamicStride(idx) && "expected dynamic stride"); auto numDynamic = ::mlir::detail::getNumDynamicEntriesUpToIdx( getStaticStrides(), idx); return (*static_cast(this)).getOffsetSizeAndStrideStartOperandIndex() + getOffsets().size() + getSizes().size() + numDynamic; } /// Assert the offset `idx` is dynamic and return its value. ::mlir::Value getDynamicOffset(unsigned idx) { return (*static_cast(this)).getOperand(getIndexOfDynamicOffset(idx)); } /// Assert the size `idx` is dynamic and return its value. ::mlir::Value getDynamicSize(unsigned idx) { return (*static_cast(this)).getOperand(getIndexOfDynamicSize(idx)); } /// Assert the stride `idx` is dynamic and return its value. ::mlir::Value getDynamicStride(unsigned idx) { return (*static_cast(this)).getOperand(getIndexOfDynamicStride(idx)); } /// Return true if all `other`'s offsets, sizes and strides are the same. /// Takes a custom `cmp` comparison function on OpFoldResult to avoid taking /// a dialect dependence. bool isSameAs(::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp) { return ::mlir::detail::sameOffsetsSizesAndStrides( ::mlir::cast<::mlir::OffsetSizeAndStrideOpInterface>( (*static_cast(this)).getOperation()), other, cmp); } /// Return true if all strides are guaranteed to be 1. bool hasUnitStride() { return ::llvm::all_of(getMixedStrides(), [](::mlir::OpFoldResult ofr) { return ::mlir::getConstantIntValue(ofr) == static_cast(1); }); } /// Return true if all offsets are guaranteed to be 0. bool hasZeroOffset() { return ::llvm::all_of(getMixedOffsets(), [](::mlir::OpFoldResult ofr) { return ::mlir::getConstantIntValue(ofr) == static_cast(0); }); } static ::llvm::LogicalResult verifyTrait(::mlir::Operation *op) { return ::mlir::detail::verifyOffsetSizeAndStrideOp( ::mlir::cast<::mlir::OffsetSizeAndStrideOpInterface>(op)); } }; } // namespace mlir::detail namespace mlir { template ::mlir::Value detail::ViewLikeOpInterfaceInterfaceTraits::Model::getViewSource(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getViewSource(); } template ::mlir::Value detail::ViewLikeOpInterfaceInterfaceTraits::Model::getViewDest(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getViewDest(); } template ::mlir::Value detail::ViewLikeOpInterfaceInterfaceTraits::FallbackModel::getViewSource(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getViewSource(tablegen_opaque_val); } template ::mlir::Value detail::ViewLikeOpInterfaceInterfaceTraits::FallbackModel::getViewDest(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getViewDest(tablegen_opaque_val); } template ::mlir::Value detail::ViewLikeOpInterfaceInterfaceTraits::ExternalModel::getViewDest(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val))->getResult(0); } } // namespace mlir namespace mlir { template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getOffsetSizeAndStrideStartOperandIndex() { return ConcreteOp::getOffsetSizeAndStrideStartOperandIndex(); } template std::array detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getArrayAttrMaxRanks(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getArrayAttrMaxRanks(); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getOffsets(); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getSizes(); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getStrides(); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStaticOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getStaticOffsets(); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStaticSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getStaticSizes(); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStaticStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getStaticStrides(); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getMixedOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getMixedOffsets(); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getMixedSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getMixedSizes(); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getMixedStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).getMixedStrides(); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::isDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).isDynamicOffset(idx); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::isDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).isDynamicSize(idx); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::isDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).isDynamicStride(idx); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStaticOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getStaticOffset(idx); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStaticSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getStaticSize(idx); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getStaticStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getStaticStride(idx); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getIndexOfDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getIndexOfDynamicOffset(idx); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getIndexOfDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getIndexOfDynamicSize(idx); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getIndexOfDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getIndexOfDynamicStride(idx); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getDynamicOffset(idx); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getDynamicSize(idx); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::getDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return (llvm::cast(tablegen_opaque_val)).getDynamicStride(idx); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::isSameAs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp) { return (llvm::cast(tablegen_opaque_val)).isSameAs(other, cmp); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::hasUnitStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).hasUnitStride(); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::Model::hasZeroOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return (llvm::cast(tablegen_opaque_val)).hasZeroOffset(); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getOffsetSizeAndStrideStartOperandIndex() { return ConcreteOp::getOffsetSizeAndStrideStartOperandIndex(); } template std::array detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getArrayAttrMaxRanks(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getArrayAttrMaxRanks(tablegen_opaque_val); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getOffsets(tablegen_opaque_val); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getSizes(tablegen_opaque_val); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getStrides(tablegen_opaque_val); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStaticOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getStaticOffsets(tablegen_opaque_val); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStaticSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getStaticSizes(tablegen_opaque_val); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStaticStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getStaticStrides(tablegen_opaque_val); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getMixedOffsets(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getMixedOffsets(tablegen_opaque_val); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getMixedSizes(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getMixedSizes(tablegen_opaque_val); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getMixedStrides(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->getMixedStrides(tablegen_opaque_val); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::isDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->isDynamicOffset(tablegen_opaque_val, idx); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::isDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->isDynamicSize(tablegen_opaque_val, idx); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::isDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->isDynamicStride(tablegen_opaque_val, idx); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStaticOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getStaticOffset(tablegen_opaque_val, idx); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStaticSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getStaticSize(tablegen_opaque_val, idx); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getStaticStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getStaticStride(tablegen_opaque_val, idx); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getIndexOfDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getIndexOfDynamicOffset(tablegen_opaque_val, idx); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getIndexOfDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getIndexOfDynamicSize(tablegen_opaque_val, idx); } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getIndexOfDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getIndexOfDynamicStride(tablegen_opaque_val, idx); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getDynamicOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getDynamicOffset(tablegen_opaque_val, idx); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getDynamicSize(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getDynamicSize(tablegen_opaque_val, idx); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::getDynamicStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, unsigned idx) { return static_cast(impl)->getDynamicStride(tablegen_opaque_val, idx); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::isSameAs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp) { return static_cast(impl)->isSameAs(tablegen_opaque_val, other, cmp); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::hasUnitStride(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->hasUnitStride(tablegen_opaque_val); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::FallbackModel::hasZeroOffset(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { return static_cast(impl)->hasZeroOffset(tablegen_opaque_val); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getOffsets(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getOffsets(); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getSizes(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getSizes(); } template ::mlir::OperandRange detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStrides(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getStrides(); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStaticOffsets(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getStaticOffsets(); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStaticSizes(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getStaticSizes(); } template ::llvm::ArrayRef detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStaticStrides(::mlir::Operation *tablegen_opaque_val) const { return (llvm::cast(tablegen_opaque_val)).getStaticStrides(); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getMixedOffsets(::mlir::Operation *tablegen_opaque_val) const { Builder b((llvm::cast(tablegen_opaque_val))->getContext()); return ::mlir::getMixedValues((llvm::cast(tablegen_opaque_val)).getStaticOffsets(), (llvm::cast(tablegen_opaque_val)).getOffsets(), b); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getMixedSizes(::mlir::Operation *tablegen_opaque_val) const { Builder b((llvm::cast(tablegen_opaque_val))->getContext()); return ::mlir::getMixedValues((llvm::cast(tablegen_opaque_val)).getStaticSizes(), (llvm::cast(tablegen_opaque_val)).getSizes(), b); } template ::llvm::SmallVector<::mlir::OpFoldResult> detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getMixedStrides(::mlir::Operation *tablegen_opaque_val) const { Builder b((llvm::cast(tablegen_opaque_val))->getContext()); return ::mlir::getMixedValues((llvm::cast(tablegen_opaque_val)).getStaticStrides(), (llvm::cast(tablegen_opaque_val)).getStrides(), b); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::isDynamicOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { return ::mlir::ShapedType::isDynamic(getStaticOffsets()[idx]); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::isDynamicSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { return ::mlir::ShapedType::isDynamic(getStaticSizes()[idx]); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::isDynamicStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { return ::mlir::ShapedType::isDynamic(getStaticStrides()[idx]); } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStaticOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { assert(!(llvm::cast(tablegen_opaque_val)).isDynamicOffset(idx) && "expected static offset"); return getStaticOffsets()[idx]; } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStaticSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { assert(!(llvm::cast(tablegen_opaque_val)).isDynamicSize(idx) && "expected static size"); return getStaticSizes()[idx]; } template int64_t detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getStaticStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { assert(!(llvm::cast(tablegen_opaque_val)).isDynamicStride(idx) && "expected static stride"); return getStaticStrides()[idx]; } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getIndexOfDynamicOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { assert((llvm::cast(tablegen_opaque_val)).isDynamicOffset(idx) && "expected dynamic offset"); auto numDynamic = ::mlir::detail::getNumDynamicEntriesUpToIdx( getStaticOffsets(), idx); return (llvm::cast(tablegen_opaque_val)).getOffsetSizeAndStrideStartOperandIndex() + numDynamic; } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getIndexOfDynamicSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { assert((llvm::cast(tablegen_opaque_val)).isDynamicSize(idx) && "expected dynamic size"); auto numDynamic = ::mlir::detail::getNumDynamicEntriesUpToIdx( getStaticSizes(), idx); return (llvm::cast(tablegen_opaque_val)).getOffsetSizeAndStrideStartOperandIndex() + getOffsets().size() + numDynamic; } template unsigned detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getIndexOfDynamicStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { assert((llvm::cast(tablegen_opaque_val)).isDynamicStride(idx) && "expected dynamic stride"); auto numDynamic = ::mlir::detail::getNumDynamicEntriesUpToIdx( getStaticStrides(), idx); return (llvm::cast(tablegen_opaque_val)).getOffsetSizeAndStrideStartOperandIndex() + getOffsets().size() + getSizes().size() + numDynamic; } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getDynamicOffset(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { return (llvm::cast(tablegen_opaque_val)).getOperand(getIndexOfDynamicOffset(idx)); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getDynamicSize(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { return (llvm::cast(tablegen_opaque_val)).getOperand(getIndexOfDynamicSize(idx)); } template ::mlir::Value detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::getDynamicStride(::mlir::Operation *tablegen_opaque_val, unsigned idx) const { return (llvm::cast(tablegen_opaque_val)).getOperand(getIndexOfDynamicStride(idx)); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::isSameAs(::mlir::Operation *tablegen_opaque_val, ::mlir::OffsetSizeAndStrideOpInterface other, ::llvm::function_ref cmp) const { return ::mlir::detail::sameOffsetsSizesAndStrides( ::mlir::cast<::mlir::OffsetSizeAndStrideOpInterface>( (llvm::cast(tablegen_opaque_val)).getOperation()), other, cmp); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::hasUnitStride(::mlir::Operation *tablegen_opaque_val) const { return ::llvm::all_of(getMixedStrides(), [](::mlir::OpFoldResult ofr) { return ::mlir::getConstantIntValue(ofr) == static_cast(1); }); } template bool detail::OffsetSizeAndStrideOpInterfaceInterfaceTraits::ExternalModel::hasZeroOffset(::mlir::Operation *tablegen_opaque_val) const { return ::llvm::all_of(getMixedOffsets(), [](::mlir::OpFoldResult ofr) { return ::mlir::getConstantIntValue(ofr) == static_cast(0); }); } } // namespace mlir