MLIR  20.0.0git
Public Types | Public Member Functions | List of all members
mlir::OwningMemRef< T, Rank > Class Template Reference

Owning MemRef type that abstracts over the runtime type for ranked strided memref. More...

#include "mlir/ExecutionEngine/MemRefUtils.h"

Public Types

using DescriptorType = StridedMemRefType< T, Rank >
 
using FreeFunType = std::function< void(DescriptorType)>
 

Public Member Functions

 OwningMemRef (ArrayRef< int64_t > shape, ArrayRef< int64_t > shapeAlloc={}, ElementWiseVisitor< T > init={}, std::optional< uint64_t > alignment=std::optional< uint64_t >(), AllocFunType allocFun=&::malloc, std::function< void(StridedMemRefType< T, Rank >)> freeFun=[](StridedMemRefType< T, Rank > descriptor) { ::free(descriptor.data);})
 Allocate a new dense StridedMemrefRef with a given shape. More...
 
 OwningMemRef (DescriptorType descriptor, FreeFunType freeFunc)
 Take ownership of an existing descriptor with a custom deleter. More...
 
 ~OwningMemRef ()
 
 OwningMemRef (const OwningMemRef &)=delete
 
OwningMemRefoperator= (const OwningMemRef &)=delete
 
OwningMemRefoperator= (const OwningMemRef &&other)
 
 OwningMemRef (OwningMemRef &&other)
 
DescriptorTypeoperator* ()
 
DescriptorTypeoperator-> ()
 
T & operator[] (std::initializer_list< int64_t > indices)
 

Detailed Description

template<typename T, unsigned Rank>
class mlir::OwningMemRef< T, Rank >

Owning MemRef type that abstracts over the runtime type for ranked strided memref.

Definition at line 135 of file MemRefUtils.h.

Member Typedef Documentation

◆ DescriptorType

template<typename T , unsigned Rank>
using mlir::OwningMemRef< T, Rank >::DescriptorType = StridedMemRefType<T, Rank>

Definition at line 137 of file MemRefUtils.h.

◆ FreeFunType

template<typename T , unsigned Rank>
using mlir::OwningMemRef< T, Rank >::FreeFunType = std::function<void(DescriptorType)>

Definition at line 138 of file MemRefUtils.h.

Constructor & Destructor Documentation

◆ OwningMemRef() [1/4]

template<typename T , unsigned Rank>
mlir::OwningMemRef< T, Rank >::OwningMemRef ( ArrayRef< int64_t >  shape,
ArrayRef< int64_t >  shapeAlloc = {},
ElementWiseVisitor< T >  init = {},
std::optional< uint64_t >  alignment = std::optional<uint64_t>(),
AllocFunType  allocFun = &::malloc,
std::function< void(StridedMemRefType< T, Rank >)>  freeFun = [](StridedMemRefType<T, Rank> descriptor) { ::free(descriptor.data); } 
)
inline

Allocate a new dense StridedMemrefRef with a given shape.

An optional shapeAlloc array can be supplied to "pad" every dimension individually. If an ElementWiseVisitor is provided, it will be used to initialize the data, else the memory will be zero-initialized. The alloc and free method used to manage the data allocation can be optionally provided, and default to malloc/free.

Definition at line 146 of file MemRefUtils.h.

◆ OwningMemRef() [2/4]

template<typename T , unsigned Rank>
mlir::OwningMemRef< T, Rank >::OwningMemRef ( DescriptorType  descriptor,
FreeFunType  freeFunc 
)
inline

Take ownership of an existing descriptor with a custom deleter.

Definition at line 182 of file MemRefUtils.h.

◆ ~OwningMemRef()

template<typename T , unsigned Rank>
mlir::OwningMemRef< T, Rank >::~OwningMemRef ( )
inline

Definition at line 184 of file MemRefUtils.h.

◆ OwningMemRef() [3/4]

template<typename T , unsigned Rank>
mlir::OwningMemRef< T, Rank >::OwningMemRef ( const OwningMemRef< T, Rank > &  )
delete

◆ OwningMemRef() [4/4]

template<typename T , unsigned Rank>
mlir::OwningMemRef< T, Rank >::OwningMemRef ( OwningMemRef< T, Rank > &&  other)
inline

Definition at line 196 of file MemRefUtils.h.

Member Function Documentation

◆ operator*()

template<typename T , unsigned Rank>
DescriptorType& mlir::OwningMemRef< T, Rank >::operator* ( )
inline

Definition at line 198 of file MemRefUtils.h.

◆ operator->()

template<typename T , unsigned Rank>
DescriptorType* mlir::OwningMemRef< T, Rank >::operator-> ( )
inline

Definition at line 199 of file MemRefUtils.h.

◆ operator=() [1/2]

template<typename T , unsigned Rank>
OwningMemRef& mlir::OwningMemRef< T, Rank >::operator= ( const OwningMemRef< T, Rank > &&  other)
inline

Definition at line 190 of file MemRefUtils.h.

◆ operator=() [2/2]

template<typename T , unsigned Rank>
OwningMemRef& mlir::OwningMemRef< T, Rank >::operator= ( const OwningMemRef< T, Rank > &  )
delete

◆ operator[]()

template<typename T , unsigned Rank>
T& mlir::OwningMemRef< T, Rank >::operator[] ( std::initializer_list< int64_t >  indices)
inline

Definition at line 200 of file MemRefUtils.h.


The documentation for this class was generated from the following file: