private:
void addRequireStatsOpByName(StringRef opName);
- SolverContext &context;
-
/// Vector of all candidate type constraints, indexed by ordinal.
std::vector<CandidateQuantizedType> candidateTypes;
}
/// Checks if the SSA values associated with `cst''s identifiers are unique.
-static bool areIdsUnique(const FlatAffineConstraints &cst) {
+static bool LLVM_ATTRIBUTE_UNUSED
+areIdsUnique(const FlatAffineConstraints &cst) {
SmallPtrSet<Value *, 8> uniqueIds;
for (auto id : cst.getIds()) {
if (id.hasValue() && !uniqueIds.insert(id.getValue()).second)
return positionAttr(rewriter, values);
};
// Helper function to obtain the ptr of the given `view`.
- auto getViewPtr = [pos, &rewriter, this](ViewType type,
- Value *view) -> Value * {
+ auto getViewPtr = [pos, this](ViewType type, Value *view) -> Value * {
auto elementPtrTy = getPtrToElementType(type, lowering);
return extractvalue(elementPtrTy, view, pos(0));
};
cast<ConstantIndexOp>(v->getDefiningOp()).getValue() == 0;
}
-/// Returns a map that can be used to filter the zero values out of tileSizes.
-/// For example, if tileSizes contains `{v1, 0, v2}`, the returned map is:
-///
-/// ```{.mlir}
-/// (d0, d1, d2) -> (d0, d2)
-/// ```
-static AffineMap nonZeroMap(ArrayRef<Value *> tileSizes) {
- SmallVector<AffineExpr, 4> exprs;
- for (auto en : llvm::enumerate(tileSizes))
- if (!isZero(en.value()))
- exprs.push_back(getAffineDimExpr(en.index(), en.value()->getContext()));
- assert(!exprs.empty() &&
- "unexpected zero-only tile sizes, should have been handled earlier");
- return AffineMap::get(tileSizes.size(), 0, exprs, {});
-}
-
// Creates a number of ranges equal to the number of non-zero in `tileSizes`.
// One for each loop of the LinalgOp that is tiled. The `tileSizes` argument has
// one entry per surrounding loop. It uses zero as the convention that a
using namespace mlir;
using namespace mlir::quantizer;
-TargetConfiguration::TargetConfiguration(SolverContext &context)
- : context(context) {}
+TargetConfiguration::TargetConfiguration(SolverContext &context) {}
void TargetConfiguration::addOpHandlerByName(StringRef name, OpHandlerFn fn) {
opHandlers[name] = fn;
os << "PropagateExplicitScale";
}
void propagate(SolverContext &solverContext,
- const TargetConfiguration &config) {
+ const TargetConfiguration &config) override {
DiscreteScaleZeroPointFact scaleZp;
// Get scale/zp from all parents.
}
void propagate(SolverContext &solverContext,
- const TargetConfiguration &config) {
+ const TargetConfiguration &config) override {
// First determine the required min/max range and type constraints.
Location fusedLoc = UnknownLoc::get(&solverContext.getMlirContext());
llvm::SmallBitVector enabledCandidateTypesMask(
}
switch (anchor->getTypeTransformRule()) {
- default:
- op->emitOpError("unsupported type transform rule");
- break;
case CAGAnchorNode::TypeTransformRule::Direct:
anchor->getOp()->setOperand(anchor->getOperandIdx(), newTypedInputValue);
break;
Value *replacedResultValue = nullptr;
Value *newResultValue = nullptr;
switch (anchor->getTypeTransformRule()) {
- default:
- op->emitOpError("unsupported type transform rule");
- return;
case CAGAnchorNode::TypeTransformRule::Direct:
origResultValue->setType(newType);
replacedResultValue = newResultValue = b.create<DequantizeCastOp>(