13 #ifndef DIALECT_TOSA_UTILS_COVERSION_UTILS_H_
14 #define DIALECT_TOSA_UTILS_COVERSION_UTILS_H_
26 SmallVector<utils::IteratorType>
30 SmallVector<Value>
condenseValues(
const SmallVector<Value> &values);
47 template <
typename Op>
48 std::optional<SmallVector<Value>>
53 for (
const Value ¶m : params) {
54 auto paramTy = cast<ShapedType>(param.getType());
55 if (!paramTy.hasStaticShape())
56 dynTypes.push_back(paramTy);
62 for (
const ShapedType &dynTy : dynTypes) {
63 if (llvm::any_of(dynTy.getShape().drop_front(), ShapedType::isDynamic)) {
65 op,
"input can only be dynamic for batch size");
70 dynamicDims.push_back(
71 rewriter.
create<tensor::DimOp>(op->getLoc(), params[0], 0));
static Value max(ImplicitLocOpBuilder &builder, Value value, Value bound)
static Value min(ImplicitLocOpBuilder &builder, Value value, Value bound)
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
Operation * create(const OperationState &state)
Creates an operation given the fields represented as an OperationState.
This provides public APIs that all operations should have.
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
std::enable_if_t<!std::is_convertible< CallbackT, Twine >::value, LogicalResult > notifyMatchFailure(Location loc, CallbackT &&reasonCallback)
Used to notify the rewriter that the IR failed to be rewritten because of a match failure,...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Value clampFloatHelper(Location loc, Value arg, Value min, Value max, OpBuilder &rewriter)
std::optional< SmallVector< Value > > checkHasDynamicBatchDims(PatternRewriter &rewriter, Op op, ArrayRef< Value > params)
SmallVector< utils::IteratorType > getNParallelLoopsAttrs(unsigned nParallelLoops)
SmallVector< Value > condenseValues(const SmallVector< Value > &values)
LogicalResult EqualizeRanks(PatternRewriter &rewriter, Location loc, Value &input1, Value &input2)
Common code to create the reshape op where necessary to make the rank of two values equal.
Value clampIntHelper(Location loc, Value arg, Value min, Value max, OpBuilder &rewriter)
bool validIntegerRange(IntegerType ty, int64_t value)
Include the generated interface declarations.
This class represents an efficient way to signal success or failure.