28 #ifndef MLIR_DIALECT_SPARSETENSOR_IR_ENUMS_H
29 #define MLIR_DIALECT_SPARSETENSOR_IR_ENUMS_H
39 namespace sparse_tensor {
62 #define MLIR_SPARSETENSOR_FOREVERY_FIXED_O(DO) \
70 #define MLIR_SPARSETENSOR_FOREVERY_O(DO) \
71 MLIR_SPARSETENSOR_FOREVERY_FIXED_O(DO) \
95 #define MLIR_SPARSETENSOR_FOREVERY_V(DO) \
180 return "compressed-nu";
182 return "compressed-no";
184 return "compressed-nu-no";
188 return "singleton-nu";
190 return "singleton-no";
192 return "singleton-nu-no";
199 const uint8_t formatBits =
static_cast<uint8_t
>(dlt) >> 2;
200 const uint8_t propertyBits =
static_cast<uint8_t
>(dlt) & 3;
203 return (formatBits <= 1) ? (propertyBits == 0)
204 : (formatBits == 2 || formatBits == 4);
223 return (
static_cast<uint8_t
>(dlt) & ~3) ==
229 return (
static_cast<uint8_t
>(dlt) & ~3) ==
235 return !(
static_cast<uint8_t
>(dlt) & 2);
240 return !(
static_cast<uint8_t
>(dlt) & 1);
248 return static_cast<LevelFormat>(
static_cast<uint8_t
>(dlt) & ~3);
256 constexpr std::optional<DimLevelType>
258 auto dlt =
static_cast<DimLevelType>(
static_cast<uint8_t
>(lf) |
259 (ordered ? 0 : 2) | (unique ? 0 : 1));
260 return isValidDLT(dlt) ? std::optional(dlt) : std::nullopt;
275 "getLevelFormat conversion is broken");
298 "getDimLevelType conversion is broken");
311 "isValidDLT definition is broken");
322 "isCompressedDLT definition is broken");
333 "isSingletonDLT definition is broken");
344 "isOrderedDLT definition is broken");
355 "isUniqueDLT definition is broken");
std::complex< double > complex64
constexpr std::optional< LevelFormat > getLevelFormat(DimLevelType dlt)
Convert a DimLevelType to its corresponding LevelFormat.
LevelFormat
This enum defines all the storage formats supported by the sparse compiler, without the level propert...
OverheadType
Encoding of overhead types (both pointer overhead and indices overhead), for "overloading" @newSparse...
constexpr bool isValidDLT(DimLevelType dlt)
Check that the DimLevelType contains a valid (possibly undefined) value.
std::string toMLIRString(DimLevelType dlt)
Returns string representation of the given dimension level type.
Action
The actions performed by @newSparseTensor.
constexpr bool isSingletonDLT(DimLevelType dlt)
Check if the DimLevelType is singleton (regardless of properties).
constexpr bool isUniqueDLT(DimLevelType dlt)
Check if the DimLevelType is unique (regardless of storage format).
constexpr bool isIntegralPrimaryType(PrimaryType valTy)
constexpr bool isDenseDLT(DimLevelType dlt)
Check if the DimLevelType is dense.
PrimaryType
Encoding of the elemental type, for "overloading" @newSparseTensor.
std::complex< float > complex32
constexpr bool isUndefDLT(DimLevelType dlt)
Check if the DimLevelType is the special undefined value.
constexpr std::optional< DimLevelType > getDimLevelType(LevelFormat lf, bool ordered, bool unique)
Convert a LevelFormat to its corresponding DimLevelType with the given properties.
constexpr bool isRealPrimaryType(PrimaryType valTy)
uint64_t index_type
This type is used in the public API at all places where MLIR expects values with the built-in type "i...
DimLevelType
This enum defines all the sparse representations supportable by the SparseTensor dialect.
constexpr bool isComplexPrimaryType(PrimaryType valTy)
constexpr bool isCompressedDLT(DimLevelType dlt)
Check if the DimLevelType is compressed (regardless of properties).
constexpr bool isFloatingPrimaryType(PrimaryType valTy)
constexpr bool isOrderedDLT(DimLevelType dlt)
Check if the DimLevelType is ordered (regardless of storage format).
Include the generated interface declarations.