9#ifndef MLIR_DIALECT_SPARSETENSOR_IR_SPARSETENSOR_H_ 
   10#define MLIR_DIALECT_SPARSETENSOR_IR_SPARSETENSOR_H_ 
   25#include "llvm/ADT/bit.h" 
   81  operator uint64_t()
 const { 
return storage; }
 
   85    storage |= 
static_cast<uint64_t
>(0x01u) << i;
 
 
   90    storage |= 
static_cast<uint64_t
>(
lhs);
 
 
   95    storage = storage << offset;
 
 
  108    if (prev >= 
max() - 1)
 
  111    uint64_t 
b = storage >> (prev + 
static_cast<int64_t>(1));
 
  114    return llvm::countr_zero(
b) + prev + 
static_cast<int64_t>(1);
 
 
  119    return (storage & (
static_cast<int64_t>(1) << i)) != 0;
 
 
  122    unsigned m = llvm::countr_zero(storage);
 
  123    return m == 64 ? -1 : m;
 
 
  125  unsigned max()
 const { 
return llvm::bit_width(storage); }
 
  126  unsigned count()
 const { 
return llvm::popcount(storage); }
 
  127  bool empty()
 const { 
return storage == 0; }
 
 
  137#define GET_ATTRDEF_CLASSES 
  138#include "mlir/Dialect/SparseTensor/IR/SparseTensorAttrEnums.h.inc" 
  140#define GET_ATTRDEF_CLASSES 
  141#include "mlir/Dialect/SparseTensor/IR/SparseTensorAttrDefs.h.inc" 
  143#define GET_TYPEDEF_CLASSES 
  144#include "mlir/Dialect/SparseTensor/IR/SparseTensorTypes.h.inc" 
  146#define GET_OP_CLASSES 
  147#include "mlir/Dialect/SparseTensor/IR/SparseTensorOps.h.inc" 
  149#include "mlir/Dialect/SparseTensor/IR/SparseTensorOpsDialect.h.inc" 
  156namespace sparse_tensor {
 
  161  assert(
static_cast<bool>(t) && 
"getRankedTensorType got null argument");
 
  162  return dyn_cast<RankedTensorType>(std::forward<T>(t).
getType());
 
 
  168  assert(
static_cast<bool>(t) && 
"getMemRefType got null argument");
 
  169  return cast<MemRefType>(std::forward<T>(t).
getType());
 
 
  178  return llvm::any_of(types, [](
Type type) {
 
 
A multi-dimensional affine map Affine map's are immutable like Type's, and they are uniqued.
 
MLIRContext is the top-level object for a collection of MLIR operations.
 
type_range getTypes() const
 
Operation is the basic unit of execution within MLIR.
 
operand_range getOperands()
Returns an iterator on the underlying Value's.
 
result_range getResults()
 
type_range getTypes() const
 
This class provides an abstraction over the various different ranges of value types.
 
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
 
I64BitSet & lshift(unsigned offset)
 
iterator_range< const_set_bits_iterator > bits() const
 
bool isSubSetOf(const I64BitSet p) const
 
I64BitSet & set(unsigned i)
 
const_set_bits_iterator begin() const
 
int find_next(unsigned prev) const
 
I64BitSet & operator|=(I64BitSet lhs)
 
bool operator[](unsigned i) const
 
const_set_bits_iterator end() const
 
llvm::const_set_bits_iterator_impl< I64BitSet > const_set_bits_iterator
 
bool hasAnySparseOperandOrResult(Operation *op)
Returns true iff MLIR operand has any sparse operand or result.
 
uint64_t Dimension
The type of dimension identifiers and dimension-ranks.
 
Dimension toDim(SparseTensorEncodingAttr enc, Level l)
Convenience method to translate the given level to the corresponding dimension.
 
RankedTensorType getRankedTensorType(T &&t)
Convenience method to abbreviate casting getType().
 
uint64_t Level
The type of level identifiers and level-ranks.
 
AffineMap inferLvlToDim(AffineMap dimToLvl, MLIRContext *context)
Given the dimToLvl map, infers the lvlToDim map, or returns empty Affine map when inference fails.
 
SparseTensorEncodingAttr getSparseTensorEncoding(Type type)
Convenience method to get a sparse encoding attribute from a type.
 
MemRefType getMemRefType(T &&t)
Convenience method to abbreviate casting getType().
 
bool hasAnySparseType(TypeRange types)
Returns true iff the type range has any sparse tensor type.
 
Level toLvl(SparseTensorEncodingAttr enc, Dimension d)
Convenience method to translate the given dimension to the corresponding level.
 
bool isBlockSparsity(AffineMap dimToLvl)
Given the dimToLvl map, returns if it's block sparsity.
 
int64_t Size
The type for individual components of a compile-time shape, including the value ShapedType::kDynamic ...
 
bool hasAnyNonIdentityOperandsOrResults(Operation *op)
Returns true iff MLIR operation has any sparse tensor with non-identity dim2lvl maps.
 
bool hasAnySparseResult(Operation *op)
Returns true iff MLIR operand has any sparse result.
 
bool hasAnySparseOperand(Operation *op)
Returns true iff MLIR operand has any sparse operand.
 
SmallVector< unsigned > getBlockSize(AffineMap dimToLvl)
Given the dimToLvl map, returns the block sizes in a vector.
 
AffineMap inverseBlockSparsity(AffineMap dimToLvl, MLIRContext *context)
Returns the lvlToDim map for the given dimToLvl map specific to the block sparse cases.
 
Include the generated interface declarations.
 
Type getType(OpFoldResult ofr)
Returns the int type of the integer in ofr.
 
A simple structure that encodes a range of levels in the sparse tensors that forms a COO segment.
 
bool inSegment(Level l) const
 
bool isSegmentStart(Level l) const
 
std::pair< Level, Level > lvlRange