Home
last modified time | relevance | path

Searched refs:ShapedType (Results 1 – 25 of 161) sorted by relevance

1234567

/external/llvm-project/mlir/lib/IR/
DTypeUtilities.cpp22 if (auto st = type.dyn_cast<ShapedType>()) in getElementTypeOrSelf()
61 if (!ShapedType::isDynamic(dim1) && !ShapedType::isDynamic(dim2) && in verifyCompatibleShape()
74 auto sType1 = type1.dyn_cast<ShapedType>(); in verifyCompatibleShape()
75 auto sType2 = type2.dyn_cast<ShapedType>(); in verifyCompatibleShape()
95 return value.getType().cast<ShapedType>().getElementType(); in unwrap()
104 return value.getType().cast<ShapedType>().getElementType(); in unwrap()
DBuiltinTypes.cpp193 constexpr int64_t ShapedType::kDynamicSize;
194 constexpr int64_t ShapedType::kDynamicStrideOrOffset;
196 Type ShapedType::getElementType() const { in getElementType()
200 unsigned ShapedType::getElementTypeBitWidth() const { in getElementTypeBitWidth()
204 int64_t ShapedType::getNumElements() const { in getNumElements()
213 int64_t ShapedType::getRank() const { return getShape().size(); } in getRank()
215 bool ShapedType::hasRank() const { in hasRank()
219 int64_t ShapedType::getDimSize(unsigned idx) const { in getDimSize()
224 bool ShapedType::isDynamicDim(unsigned idx) const { in isDynamicDim()
229 unsigned ShapedType::getDynamicDimIndex(unsigned index) const { in getDynamicDimIndex()
[all …]
DBuiltinAttributes.cpp437 ShapedType ElementsAttr::getType() const { in getType()
438 return Attribute::getType().cast<ShapedType>(); in getType()
662 static bool hasSameElementsOrSplat(ShapedType type, const Values &values) { in hasSameElementsOrSplat()
777 DenseElementsAttr DenseElementsAttr::get(ShapedType type, in get()
821 DenseElementsAttr DenseElementsAttr::get(ShapedType type, in get()
833 DenseElementsAttr DenseElementsAttr::get(ShapedType type, in get()
842 DenseElementsAttr DenseElementsAttr::get(ShapedType type, in get()
850 DenseElementsAttr DenseElementsAttr::get(ShapedType type, in get()
865 DenseElementsAttr DenseElementsAttr::get(ShapedType type, in get()
874 DenseElementsAttr::get(ShapedType type, in get()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms/
Doptimize_mhlo.cc62 if (!gather.operand().getType().cast<ShapedType>().hasRank() || in matchAndRewrite()
63 !gather.operand().getType().cast<ShapedType>().hasStaticShape() || in matchAndRewrite()
64 !gather.start_indices().getType().cast<ShapedType>().hasRank() || in matchAndRewrite()
65 !gather.start_indices().getType().cast<ShapedType>().hasStaticShape()) { in matchAndRewrite()
102 gather.operand().getType().cast<ShapedType>().getRank()) { in matchAndRewrite()
107 if (gather.slice_sizes().getType().cast<ShapedType>().getNumElements() < in matchAndRewrite()
123 gather_start_indices.getType().cast<ShapedType>(); in matchAndRewrite()
139 {}, indicesSlice.getType().cast<ShapedType>().getElementType()), in matchAndRewrite()
Dlegalize_to_linalg.cc73 ShapedType GetHloOpResultType(Operation* op) { in GetHloOpResultType()
74 return GetResultValue<isLHLO>(op).getType().template cast<ShapedType>(); in GetHloOpResultType()
88 Value GetInitTensor(OpBuilder& b, Location loc, ShapedType type, in GetInitTensor()
100 if (en.value() != ShapedType::kDynamicSize) continue; in ExtractDynamicSizes()
119 auto type = attr.getType().dyn_cast<ShapedType>(); in GetInitValueAsConst()
152 ShapedType t0 = args[0].getType().template dyn_cast<ShapedType>(); in matchAndRewrite()
156 auto fail = [&](ShapedType t) { in matchAndRewrite()
163 return fail(v.getType().dyn_cast<ShapedType>()); in matchAndRewrite()
166 [&](Type t) { return fail(t.dyn_cast<ShapedType>()); })) in matchAndRewrite()
191 ShapedType result_type = result.getType().template cast<ShapedType>(); in matchAndRewrite()
[all …]
/external/llvm-project/mlir/lib/Dialect/Quant/IR/
DQuantTypes.cpp85 if (candidateExpressedType.isa<ShapedType>()) { in isCompatibleExpressedType()
86 return candidateExpressedType.cast<ShapedType>().getElementType() == in isCompatibleExpressedType()
94 if (primitiveOrContainerType.isa<ShapedType>()) { in getQuantizedElementType()
96 primitiveOrContainerType.cast<ShapedType>().getElementType(); in getQuantizedElementType()
126 } else if (quantizedType.isa<ShapedType>()) { in castToStorageType()
128 ShapedType sType = quantizedType.cast<ShapedType>(); in castToStorageType()
150 } else if (candidateType.isa<ShapedType>()) { in castFromExpressedType()
151 ShapedType candidateShapedType = candidateType.cast<ShapedType>(); in castFromExpressedType()
175 } else if (quantizedType.isa<ShapedType>()) { in castToExpressedType()
177 ShapedType sType = quantizedType.cast<ShapedType>(); in castToExpressedType()
/external/llvm-project/mlir/lib/Interfaces/
DViewLikeInterface.cpp43 op.static_offsets(), ShapedType::isDynamicStrideOrOffset, in verify()
49 op.static_sizes(), ShapedType::isDynamic, op.sizes()))) in verify()
54 op.static_strides(), ShapedType::isDynamicStrideOrOffset, in verify()
88 ShapedType::isDynamicStrideOrOffset); in printOffsetsSizesAndStrides()
91 ShapedType::isDynamic); in printOffsetsSizesAndStrides()
94 ShapedType::isDynamicStrideOrOffset); in printOffsetsSizesAndStrides()
168 ShapedType::kDynamicStrideOrOffset, offsetsInfo) || in parseOffsetsSizesAndStrides()
173 ShapedType::kDynamicSize, sizesInfo) || in parseOffsetsSizesAndStrides()
178 ShapedType::kDynamicStrideOrOffset, stridesInfo)) in parseOffsetsSizesAndStrides()
/external/llvm-project/mlir/test/EDSC/
Dbuilder-api-test.cpp316 MemRefType::get({ShapedType::kDynamicSize, ShapedType::kDynamicSize, in TEST_FUNC()
317 ShapedType::kDynamicSize}, in TEST_FUNC()
541 {ShapedType::kDynamicSize, ShapedType::kDynamicSize}, i32Type, {}, 0); in TEST_FUNC()
616 {ShapedType::kDynamicSize, ShapedType::kDynamicSize}, f32Type, {}, 0); in TEST_FUNC()
723 MemRefType::get({ShapedType::kDynamicSize, ShapedType::kDynamicSize, in TEST_FUNC()
724 ShapedType::kDynamicSize}, in TEST_FUNC()
797 auto memrefType = MemRefType::get({ShapedType::kDynamicSize}, in TEST_FUNC()
868 {ShapedType::kDynamicSize, ShapedType::kDynamicSize}, f32Type, {}, 0); in TEST_FUNC()
921 {ShapedType::kDynamicSize, ShapedType::kDynamicSize}, f32Type, {}, 0); in TEST_FUNC()
958 {ShapedType::kDynamicSize, ShapedType::kDynamicSize}, f32Type, {}, 0); in TEST_FUNC()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/lite/ir/
Dtfl_ops.cc72 ShapedType shaped_type = in VerifyOperandsHaveSameShapesOrBroadcastableShape()
73 op->getOperand(index).getType().dyn_cast<ShapedType>(); in VerifyOperandsHaveSameShapesOrBroadcastableShape()
157 Type element_type = value.getType().cast<ShapedType>().getElementType(); in EqualsZero()
326 if (auto shaped_type = t.dyn_cast_or_null<ShapedType>()) { in IsF32ShapedType()
334 if (auto shaped_type = t.dyn_cast_or_null<ShapedType>()) { in IsBF16ShapedType()
390 .dyn_cast_or_null<ShapedType>(); in ConstFoldBinaryOpDenseDense()
474 auto type = result_type.dyn_cast<ShapedType>(); in ConstFoldBinaryOp()
499 auto result_shape_type = result_type.cast<ShapedType>(); in ConstFoldUnaryOp()
747 const auto shaped_type = value.getType().cast<ShapedType>(); in fold()
781 if (attribute_size != opaque_attr.getType().cast<ShapedType>().getDimSize(0)) in Verify()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/tensorflow/transforms/
Dlegalize_hlo.cc96 conv_op.lhs().getType().cast<ShapedType>().getDimSize( in matchAndRewrite()
145 conv_op.lhs().getType().cast<ShapedType>().getDimSize(dim), in IsSamePadding()
146 conv_op.rhs().getType().cast<ShapedType>().getDimSize(i), in IsSamePadding()
167 auto filter_type = conv_op.rhs().getType().cast<ShapedType>(); in CreateConvOp()
198 if (!conv_op.lhs().getType().cast<ShapedType>().hasStaticShape() || in IsSupportedConvOp()
199 !conv_op.rhs().getType().cast<ShapedType>().hasStaticShape() || in IsSupportedConvOp()
200 !conv_op.getType().cast<ShapedType>().hasStaticShape()) in IsSupportedConvOp()
214 .cast<ShapedType>() in IsSupportedConvOp()
308 ShapedType input_type = op.operand().getType().cast<ShapedType>(); in matchAndRewrite()
313 .cast<ShapedType>() in matchAndRewrite()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/lite/transforms/
Ddense_to_sparse.cc83 const ShapedType& type) { in CalculateRandomSparsity()
104 float CalculateBlockSparsity(const ElementsAttr& attr, const ShapedType& type, in CalculateBlockSparsity()
170 ShapedType type; in InspectWeight()
174 type = cst.getType().cast<ShapedType>(); in InspectWeight()
177 type = cst.getType().cast<ShapedType>(); in InspectWeight()
221 ShapedType type; in BuildSparsityParameterAttribute()
224 type = cst.getType().cast<ShapedType>(); in BuildSparsityParameterAttribute()
227 type = cst.getType().cast<ShapedType>(); in BuildSparsityParameterAttribute()
319 ShapedType type; in runOnFunction()
322 type = dyn_cast<ConstOp>(inst).getType().cast<ShapedType>(); in runOnFunction()
[all …]
Doptimize.cc67 if (sq_op.getType().cast<ShapedType>().getRank() - 1 == in L2NormalizeReduceAxis()
72 if (sq_op.getType().cast<ShapedType>().getRank() != axis.getNumElements()) { in L2NormalizeReduceAxis()
75 auto shape = sq_op.getType().cast<ShapedType>(); in L2NormalizeReduceAxis()
101 expected_output.cast<ShapedType>().getElementType(); in OperandsBroadcastToOutputType()
110 auto tail_type = type1.dyn_cast<ShapedType>(); in IsTailOfShape()
111 auto full_type = type2.dyn_cast<ShapedType>(); in IsTailOfShape()
159 const auto filter_shape = filter.getType().cast<ShapedType>().getShape(); in CanFuseConvOrDepthwiseConv()
252 auto shaped_type = type.dyn_cast<ShapedType>(); in GetShapeStrippedType()
650 ShapedType filter_type = filter_cst.getType(); in matchAndRewrite()
666 ShapedType new_bias_type = in matchAndRewrite()
[all …]
Dlegalize_tf.cc105 auto shaped_type = value.getType().dyn_cast<ShapedType>(); in HasSameStaticShapes()
125 ShapedType new_type = RankedTensorType::get(shape, new_ele_type); in CreateCastToInt32()
175 random_uniform_op.output().getType().dyn_cast_or_null<ShapedType>()) { in matchAndRewrite()
593 if (!lhs.getType().cast<ShapedType>().hasStaticShape() || in matchAndRewrite()
594 !rhs.getType().cast<ShapedType>().hasStaticShape()) { in matchAndRewrite()
598 auto lhs_shape = lhs.getType().cast<ShapedType>().getShape(); in matchAndRewrite()
599 auto rhs_shape = rhs.getType().cast<ShapedType>().getShape(); in matchAndRewrite()
660 if (!lhs.getType().cast<ShapedType>().hasStaticShape() || in matchAndRewrite()
661 !rhs.getType().cast<ShapedType>().hasStaticShape() || in matchAndRewrite()
662 !cond.getType().cast<ShapedType>().hasStaticShape()) { in matchAndRewrite()
[all …]
/external/llvm-project/mlir/include/mlir/IR/
DBuiltinAttributes.h22 class ShapedType; variable
450 ShapedType getType() const;
578 static DenseElementsAttr get(ShapedType type, ArrayRef<Attribute> values);
587 static DenseElementsAttr get(const ShapedType &type, ArrayRef<T> values) {
599 static DenseElementsAttr get(const ShapedType &type, T value) {
611 static DenseElementsAttr get(const ShapedType &type, ArrayRef<T> values) {
619 static DenseElementsAttr get(ShapedType type, ArrayRef<bool> values);
623 static DenseElementsAttr get(ShapedType type, ArrayRef<StringRef> values);
629 static DenseElementsAttr get(ShapedType type, ArrayRef<APInt> values);
635 static DenseElementsAttr get(ShapedType type,
[all …]
DBuiltinTypes.h326 class ShapedType : public Type {
409 : public Type::TypeBase<VectorType, ShapedType, detail::VectorTypeStorage> {
444 class TensorType : public ShapedType {
446 using ShapedType::ShapedType;
519 class BaseMemRefType : public ShapedType {
522 using ShapedType::ShapedType;
622 return ShapedType::kDynamicStrideOrOffset; in getDynamicStrideOrOffset()
722 inline bool ShapedType::classof(Type type) { in classof()
/external/llvm-project/mlir/lib/CAPI/IR/
DBuiltinAttributes.cpp328 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), in mlirDenseElementsAttrGet()
334 return wrap(DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), in mlirDenseElementsAttrSplatGet()
340 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrBoolSplatGet()
345 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrUInt32SplatGet()
350 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrInt32SplatGet()
355 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrUInt64SplatGet()
360 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrInt64SplatGet()
365 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrFloatSplatGet()
370 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), element)); in mlirDenseElementsAttrDoubleSplatGet()
378 DenseElementsAttr::get(unwrap(shapedType).cast<ShapedType>(), values)); in mlirDenseElementsAttrBoolGet()
[all …]
DBuiltinTypes.cpp124 bool mlirTypeIsAShaped(MlirType type) { return unwrap(type).isa<ShapedType>(); } in mlirTypeIsAShaped()
127 return wrap(unwrap(type).cast<ShapedType>().getElementType()); in mlirShapedTypeGetElementType()
131 return unwrap(type).cast<ShapedType>().hasRank(); in mlirShapedTypeHasRank()
135 return unwrap(type).cast<ShapedType>().getRank(); in mlirShapedTypeGetRank()
139 return unwrap(type).cast<ShapedType>().hasStaticShape(); in mlirShapedTypeHasStaticShape()
143 return unwrap(type).cast<ShapedType>().isDynamicDim( in mlirShapedTypeIsDynamicDim()
148 return unwrap(type).cast<ShapedType>().getDimSize(static_cast<unsigned>(dim)); in mlirShapedTypeGetDimSize()
152 return ShapedType::isDynamic(size); in mlirShapedTypeIsDynamicSize()
156 return ShapedType::isDynamicStrideOrOffset(val); in mlirShapedTypeIsDynamicStrideOrOffset()
/external/tensorflow/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/IR/
Dchlo_ops.cc136 ShapedType lhs_type = operands[0].getType().dyn_cast<ShapedType>(); in InferBroadcastBinaryOpReturnTypeComponents()
137 ShapedType rhs_type = operands[1].getType().dyn_cast<ShapedType>(); in InferBroadcastBinaryOpReturnTypeComponents()
198 ShapedType lhs_type = operands[0].getType().dyn_cast<ShapedType>(); in inferReturnTypeComponents()
306 left.getType().cast<ShapedType>(), right.getType().cast<ShapedType>(), \
335 if (op.value().getType() != op.getType().cast<ShapedType>().getElementType()) in Verify()
362 auto op_type = op.operand().getType().cast<ShapedType>(); in matchAndRewrite()
Dhlo_ops.cc289 auto shape = op.getType().cast<ShapedType>(); in Verify()
309 auto result_ty = iota.getType().cast<ShapedType>(); in matchAndRewrite()
338 auto result_ty = getResult().getType().cast<ShapedType>(); in fold()
358 auto result_ty = iota.getType().cast<ShapedType>(); in matchAndRewrite()
375 auto result_ty = iota.getType().cast<ShapedType>(); in matchAndRewrite()
386 iota.output_shape().getType().cast<ShapedType>().getShape(), in matchAndRewrite()
400 iota.output_shape().getType().cast<ShapedType>().getElementType()), in matchAndRewrite()
437 auto idx_tensor = indices.take_front().front().getType().cast<ShapedType>(); in Verify()
442 idx_tensor = idx.getType().cast<ShapedType>(); in Verify()
461 auto operand_ty = (*operands.begin()).getType().cast<ShapedType>(); in inferReturnTypes()
[all …]
/external/llvm-project/mlir/lib/Dialect/Quant/Utils/
DQuantizeUtils.cpp56 ShapedType newDenseType = in convertDenseFPElementsAttr()
59 .dyn_cast_or_null<ShapedType>(); in convertDenseFPElementsAttr()
86 ShapedType newSparseType = in convertSparseElementsAttr()
88 .dyn_cast_or_null<ShapedType>(); in convertSparseElementsAttr()
/external/llvm-project/mlir/test/Bindings/Python/
Dir_attributes.py216 print(ShapedType(a.type).element_type)
231 print(ShapedType(a.type).element_type)
254 print(ShapedType(a.type).element_type)
268 print(ShapedType(type_attr.value).element_type)
/external/llvm-project/mlir/include/mlir/Interfaces/
DViewLikeInterface.td51 `ShapedType::kDynamicStrideOrOffset` (resp. `ShapedType::kDynamicSize`,
52 `ShapedType::kDynamicStrideOrOffset`), then the corresponding entry is
162 return ShapedType::isDynamicStrideOrOffset(v.getSExtValue());
176 return ShapedType::isDynamic(v.getSExtValue());
190 return ShapedType::isDynamicStrideOrOffset(v.getSExtValue());
253 ShapedType::isDynamicStrideOrOffset,
270 static_sizes().template cast<ArrayAttr>(), ShapedType::isDynamic, idx);
287 ShapedType::isDynamicStrideOrOffset,
/external/tensorflow/tensorflow/compiler/mlir/tensorflow/ir/
Dtf_ops_n_z.cc159 int64_t depth_val = ShapedType::kDynamicSize; in InferOneHotOpType()
288 auto arg_ty = tensor.getType().dyn_cast<ShapedType>(); in fold()
436 auto output_type = getType().cast<ShapedType>(); in fold()
596 ShapedType::kDynamicSize); in GetReshapeOutputType()
611 if (size == ShapedType::kDynamicSize) { in GetReshapeOutputType()
722 auto result_ty = getType().dyn_cast<ShapedType>(); in fold()
908 getType().cast<ShapedType>().getElementType().getIntOrFloatBitWidth(); in fold()
1037 ShapedType output_type = getType().cast<ShapedType>(); in fold()
1039 ShapedType input_type = getOperand().getType().cast<ShapedType>(); in fold()
1172 .dyn_cast_or_null<ShapedType>(); in Verify()
[all …]
/external/llvm-project/mlir/lib/Parser/
DAttributeParser.cpp451 DenseElementsAttr getAttr(llvm::SMLoc loc, ShapedType type);
465 DenseElementsAttr getStringAttr(llvm::SMLoc loc, ShapedType type, Type eltTy);
468 DenseElementsAttr getHexAttr(llvm::SMLoc loc, ShapedType type);
518 ShapedType type) { in getAttr()
668 ShapedType type, in getStringAttr()
690 ShapedType type) { in getHexAttr()
887 ShapedType Parser::parseElementsLiteralType(Type type) { in parseElementsLiteralType()
901 auto sType = type.cast<ShapedType>(); in parseElementsLiteralType()
919 ShapedType type = parseElementsLiteralType(attrType); in parseSparseElementsAttr()
925 ShapedType indicesType = in parseSparseElementsAttr()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/tools/kernel_gen/transforms/
Dsame_shape_propagation.cc218 ShapedType type = alloc.getResult().getType().cast<ShapedType>(); in build()
226 ShapedType type = alloc.getResult().getType().cast<ShapedType>(); in build()
243 ShapedType type, in fillShapeFromAllocLike()
248 shape.push_back(ShapedType::isDynamic(extent) in fillShapeFromAllocLike()

1234567