Lines Matching defs:dim

82 ValueBoundsConstraintSet::Variable::Variable(Value shapedValue, int64_t dim)
83 : Variable(static_cast<OpFoldResult>(shapedValue), std::optional(dim)) {}
86 std::optional<int64_t> dim) {
89 assert(!dim && "expected no dim for index-typed values");
96 if (dim) {
104 mapOperands.emplace_back(value, dim);
164 static void assertValidValueDim(Value value, std::optional<int64_t> dim) {
166 assert(!dim.has_value() && "invalid dim value");
168 assert(*dim >= 0 && "invalid dim value");
170 assert(*dim < shapedType.getRank() && "invalid dim value");
201 std::optional<int64_t> dim) {
203 assertValidValueDim(value, dim);
206 // Check if the value/dim is statically known. In that case, an affine
213 if (shapedType.hasRank() && !shapedType.isDynamicDim(*dim))
214 constSize = shapedType.getDimSize(*dim);
219 // If the value/dim is already mapped, return the corresponding expression
221 ValueDim valueDim = std::make_pair(value, dim.value_or(kIndexValue));
228 return getPosExpr(getPos(value, dim));
232 // Constant index value/dim: add column to the constraint set, add EQ bound
235 (void)insert(value, dim, /*isSymbol=*/true, /*addToWorklist=*/false);
237 bound(value)[*dim] == *constSize;
243 // Dynamic value/dim: insert column to the constraint set and put it on the
246 return getPosExpr(insert(value, dim, /*isSymbol=*/true));
251 return getExpr(value, /*dim=*/std::nullopt);
262 std::optional<int64_t> dim,
265 assertValidValueDim(value, dim);
268 ValueDim valueDim = std::make_pair(value, dim.value_or(kIndexValue));
274 << " (dim: " << dim.value_or(kIndexValue)
285 << " (dim: " << dim.value_or(kIndexValue) << ")\n");
332 std::optional<int64_t> dim) const {
334 assertValidValueDim(value, dim);
340 << " (dim: " << dim.value_or(kIndexValue)
344 valueDimToPosition.find(std::make_pair(value, dim.value_or(kIndexValue)));
357 std::optional<int64_t> dim) const {
359 valueDimToPosition.find(std::make_pair(value, dim.value_or(kIndexValue)));
372 int64_t dim = valueDim.second;
374 // Check for static dim size.
375 if (dim != kIndexValue) {
377 if (shapedType.hasRank() && !shapedType.isDynamicDim(dim)) {
378 bound(value)[dim] == getExpr(shapedType.getDimSize(dim));
384 auto maybeDim = dim == kIndexValue ? std::nullopt : std::make_optional(dim);
387 << " (dim: " << maybeDim << ")\n");
399 if (dim == kIndexValue) {
402 valueBoundsOp.populateBoundsForShapedValueDim(value, dim, *this);
412 if (!dstOp || dim == kIndexValue)
415 bound(value)[dim] == getExpr(tiedOperand, dim);
547 // Not used: Remove dim/symbol from the result.
566 int64_t dim = valueDim.second;
567 if (dim == ValueBoundsConstraintSet::kIndexValue) {
575 assert(cast<ShapedType>(value.getType()).isDynamicDim(dim) &&
576 "expected dynamic dim");
577 mapOperands.push_back(std::make_pair(value, dim));
636 auto defaultStopCondition = [&](Value v, std::optional<int64_t> dim,
654 std::optional<int64_t> dim) {
656 assertValidValueDim(value, dim);
659 // `getExpr` pushes the value/dim onto the worklist (unless it was already
661 (void)getExpr(value, dim);
751 auto stopCondition = [&](Value v, std::optional<int64_t> dim,
913 ValueBoundsConstraintSet::BoundBuilder::operator[](int64_t dim) {
914 assert(!this->dim.has_value() && "dim was already set");
915 this->dim = dim;
917 assertValidValueDim(value, this->dim);
924 assertValidValueDim(value, this->dim);
926 cstr.addBound(BoundType::UB, cstr.getPos(value, this->dim), expr);
939 assertValidValueDim(value, this->dim);
941 cstr.addBound(BoundType::LB, cstr.getPos(value, this->dim), expr);
946 assertValidValueDim(value, this->dim);
948 cstr.addBound(BoundType::EQ, cstr.getPos(value, this->dim), expr);