Home
last modified time | relevance | path

Searched refs:rewriter (Results 1 – 25 of 94) sorted by relevance

1234

/external/tensorflow/tensorflow/compiler/mlir/lite/transforms/
Dlower_static_tensor_list.cc90 TensorListPatternRewriter *rewriter);
93 Value CreateI32SplatConst(Location loc, PatternRewriter *rewriter, in CreateI32SplatConst() argument
96 RankedTensorType::get(shape, rewriter->getIntegerType(32)); in CreateI32SplatConst()
98 DenseElementsAttr::get(type, rewriter->getI32IntegerAttr(val)); in CreateI32SplatConst()
99 return rewriter->create<ConstantOp>(loc, type, attr); in CreateI32SplatConst()
102 Value CreateI32SplatTensor(Location loc, PatternRewriter *rewriter, in CreateI32SplatTensor() argument
104 Value scalar_val = CreateI32SplatConst(loc, rewriter, {}, val); in CreateI32SplatTensor()
105 return rewriter->create<TF::FillOp>( in CreateI32SplatTensor()
106 loc, RankedTensorType::get({-1}, rewriter->getIntegerType(32)), in CreateI32SplatTensor()
113 PatternRewriter *rewriter) { in PrependLeadingDimIfRanked() argument
[all …]
Dlegalize_tf.cc98 Operation* op, PatternRewriter& rewriter) const override; \
121 Operation* op, PatternRewriter& rewriter) const { in matchAndRewrite()
132 StringAttr::get("NONE", rewriter.getContext()); in matchAndRewrite()
133 rewriter.replaceOpWithNewOp<TFL::ConcatenationOp>( in matchAndRewrite()
140 Operation* op, PatternRewriter& rewriter) const { in matchAndRewrite()
151 StringAttr::get("NONE", rewriter.getContext()); in matchAndRewrite()
152 rewriter.replaceOpWithNewOp<ConcatenationOp>( in matchAndRewrite()
165 Operation* op, PatternRewriter& rewriter) const { in matchAndRewrite()
172 auto no_input = rewriter.create<ConstantOp>( in matchAndRewrite()
173 op->getLoc(), rewriter.getNoneType(), rewriter.getUnitAttr()); in matchAndRewrite()
[all …]
Dprepare_tf.cc124 PatternRewriter &rewriter) const override { in matchAndRewrite()
149 rewriter.setInsertionPointAfter(tf_op); in matchAndRewrite()
151 rewriter.getI64IntegerAttr(tf_op.num_bits().getSExtValue()); in matchAndRewrite()
152 BoolAttr narrow_range = rewriter.getBoolAttr(tf_op.narrow_range()); in matchAndRewrite()
155 rewriter, res_type, min_value, max_value, quant_dim, num_bits, in matchAndRewrite()
163 auto quantize = rewriter.create<TFL::QuantizeOp>( in matchAndRewrite()
165 auto dequantize = rewriter.create<TFL::DequantizeOp>( in matchAndRewrite()
260 PatternRewriter &rewriter) const override { in rewrite()
279 auto bias_attr = rewriter.getZeroAttr(bias_type); in rewrite()
281 rewriter.create<TF::ConstOp>(op->getLoc(), bias_type, bias_attr); in rewrite()
[all …]
Dunroll_batch_matmul.cc71 PatternRewriter& rewriter) { in createReshapeOp() argument
74 RankedTensorType::get({shape_rank}, rewriter.getIntegerType(64)); in createReshapeOp()
78 rewriter.create<ConstantOp>(loc, shape_spec_type, constant_attr); in createReshapeOp()
79 return rewriter.create<TF::ReshapeOp>(loc, resultType, /*tensor=*/value, in createReshapeOp()
85 Value value, int batch_size, Location loc, PatternRewriter& rewriter) { in sliceInput() argument
95 element_type, loc, rewriter); in sliceInput()
100 Type int64_type = rewriter.getIntegerType(64); in sliceInput()
111 auto begin = rewriter.create<ConstantOp>(loc, vector3_type, begin_attr); in sliceInput()
112 auto size = rewriter.create<ConstantOp>(loc, vector3_type, size_attr); in sliceInput()
113 auto slice_op = rewriter.create<TF::SliceOp>(loc, slice_result_type, in sliceInput()
[all …]
Doptimize.cc204 PatternRewriter &rewriter) const override { in matchAndRewrite()
264 auto attr = rewriter.getZeroAttr(type); in matchAndRewrite()
265 bias = rewriter.create<ConstantOp>(loc, type, attr); in matchAndRewrite()
266 auto none_af = rewriter.getStringAttr("NONE"); in matchAndRewrite()
268 rewriter.create<AddOp>(loc, bias, constant_val, none_af).output(); in matchAndRewrite()
275 auto none_af = rewriter.getStringAttr("NONE"); in matchAndRewrite()
276 bias = rewriter.create<AddOp>(loc, bias, constant_val, none_af).output(); in matchAndRewrite()
279 rewriter.replaceOpWithNewOp<TFL::FullyConnectedOp>( in matchAndRewrite()
285 rewriter.getStringAttr(add_op.fused_activation_function()), in matchAndRewrite()
286 /*weights_format=*/rewriter.getStringAttr(fc_op.weights_format()), in matchAndRewrite()
[all …]
Dunroll_batch_matmul.h38 PatternRewriter& rewriter);
41 Location loc, PatternRewriter& rewriter);
44 PatternRewriter& rewriter);
50 Location loc, PatternRewriter& rewriter);
53 PatternRewriter& rewriter) const override;
Ddilated_conv.h73 PatternRewriter& rewriter) const;
77 PatternRewriter& rewriter) const override;
82 Conv2dOpTy op, PatternRewriter& rewriter) const { in matchAndRewrite() argument
145 stb_op.block_shape(), bts_op.block_shape(), rewriter); in matchAndRewrite()
162 op.setAttr("padding", rewriter.getStringAttr("SAME")); in matchAndRewrite()
207 PatternRewriter& rewriter) const { in ExtractDilationsAttrFromBlockShape() argument
228 return rewriter.getI64ArrayAttr({1, dilation_h_factor, dilation_w_factor, 1}); in ExtractDilationsAttrFromBlockShape()
/external/tensorflow/tensorflow/compiler/mlir/xla/transforms/
Dlhlo_legalize_to_gpu.cc53 ConversionPatternRewriter& rewriter) const final { in matchAndRewrite()
83 auto block_size_x = rewriter.create<mlir::ConstantOp>( in matchAndRewrite()
84 loc, rewriter.getIndexType(), in matchAndRewrite()
85 rewriter.getIntegerAttr(rewriter.getIndexType(), size)); in matchAndRewrite()
86 auto one = rewriter.create<mlir::ConstantOp>( in matchAndRewrite()
87 loc, rewriter.getIndexType(), in matchAndRewrite()
88 rewriter.getIntegerAttr(rewriter.getIndexType(), 1)); in matchAndRewrite()
89 auto launch_op = rewriter.create<mlir::gpu::LaunchOp>( in matchAndRewrite()
92 OpBuilder::InsertionGuard guard(rewriter); in matchAndRewrite()
93 rewriter.setInsertionPointToEnd(&launch_op.body().front()); in matchAndRewrite()
[all …]
Dxla_legalize_to_linalg.cc56 ConversionPatternRewriter& rewriter) const final { in matchAndRewrite()
87 AffineMapAttr::get(rewriter.getMultiDimIdentityMap(nloops))); in matchAndRewrite()
108 auto linalgOp = rewriter.create<linalg::GenericOp>( in matchAndRewrite()
110 rewriter.getI64IntegerAttr(bodyArgTypes.size()), // args_in in matchAndRewrite()
111 rewriter.getI64IntegerAttr(bodyResultTypes.size()), // args_out in matchAndRewrite()
112 rewriter.getArrayAttr(indexingMaps), in matchAndRewrite()
113 GetNParallelLoopsAttrs(nloops, rewriter), in matchAndRewrite()
118 auto* block = rewriter.createBlock(region, region->end()); in matchAndRewrite()
127 rewriter.setInsertionPointToEnd(block); in matchAndRewrite()
131 llvm::cast<OpTy>(op), bodyResultTypes, bodyArgs, &rewriter); in matchAndRewrite()
[all …]
Dlegalize_tf.cc166 PatternRewriter *rewriter) { in CastValueToI64() argument
167 return rewriter->create<ConvertOp>(loc, value, rewriter->getIntegerType(64)); in CastValueToI64()
189 PatternRewriter *rewriter) { in GetMinValueForType() argument
202 return rewriter->create<ConstOp>(loc, attr); in GetMinValueForType()
207 PatternRewriter *rewriter) { in GetMaxValueForType() argument
220 return rewriter->create<ConstOp>(loc, attr); in GetMaxValueForType()
226 PatternRewriter *rewriter) { in GetScalarConstOfType() argument
227 return rewriter->create<ConstOp>(loc, xla::GetScalarOfType(ty, raw_value)); in GetScalarConstOfType()
727 PatternRewriter &rewriter) const override { in matchAndRewrite()
796 auto rhs_dilations_attr = rewriter.getNamedAttr( in matchAndRewrite()
[all …]
Dunfuse_batch_norm.cc34 ConversionPatternRewriter& rewriter) { in broadcastToFeatureDim() argument
35 Builder b(rewriter.getContext()); in broadcastToFeatureDim()
38 return rewriter.create<xla_hlo::BroadcastInDimOp>(loc, result_type, value_1d, in broadcastToFeatureDim()
44 ConversionPatternRewriter& rewriter) { in MaterializeEpsilon() argument
45 Builder b(rewriter.getContext()); in MaterializeEpsilon()
68 rewriter.create<xla_hlo::ConstOp>(op->getLoc(), epsilon_tensor_attr); in MaterializeEpsilon()
69 epsilon = rewriter.create<xla_hlo::BroadcastInDimOp>( in MaterializeEpsilon()
81 ConversionPatternRewriter& rewriter) const override { in matchAndRewrite()
101 fp_type, variance_type, rewriter); in matchAndRewrite()
106 rewriter.create<xla_hlo::AddOp>(bn_op.getLoc(), operands.variance(), in matchAndRewrite()
[all …]
Dhlo_legalize_to_lhlo.cc64 ConversionPatternRewriter* rewriter) { in InsertAllocAndDealloc() argument
80 alloc.setAttr(kTempBufferAttr, rewriter->getBoolAttr(true)); in InsertAllocAndDealloc()
92 ConversionPatternRewriter* rewriter) { in GetBufferForResultValue() argument
96 return InsertAllocAndDealloc(loc, result, rewriter); in GetBufferForResultValue()
107 ConversionPatternRewriter& rewriter) const final { in matchAndRewrite()
112 GetBufferForResultValue(op->getLoc(), result, &rewriter)); in matchAndRewrite()
114 rewriter.create<LhloOpTy>(op->getLoc(), llvm::None, buffer_args, in matchAndRewrite()
116 rewriter.replaceOp(op, ArrayRef<Value>(buffer_args).slice(operands.size())); in matchAndRewrite()
128 ConversionPatternRewriter& rewriter) const final { in matchAndRewrite()
140 buffer_args.push_back(GetBufferForResultValue(loc, result, &rewriter)); in matchAndRewrite()
[all …]
Dlower_general_dot.cc51 PatternRewriter *rewriter) { in TransposeReshape() argument
71 rewriter->getIntegerType(64)); in TransposeReshape()
84 auto transpose_result = rewriter->create<mlir::xla_hlo::TransposeOp>( in TransposeReshape()
90 return rewriter->create<mlir::xla_hlo::ReshapeOp>(loc, reshaped_type, in TransposeReshape()
96 PatternRewriter *rewriter) { in ProcessDotArg() argument
119 rewriter); in ProcessDotArg()
122 return TransposeReshape(arg, loc, contract_dims, outer_dims, shape, rewriter); in ProcessDotArg()
139 PatternRewriter &rewriter) const override { in matchAndRewrite()
150 /*outer_dims_first=*/true, &rewriter); in matchAndRewrite()
154 /*outer_dims_first=*/false, &rewriter); in matchAndRewrite()
[all …]
Dlhlo_legalize_to_affine.cc39 PatternRewriter& rewriter) const override { in matchAndRewrite()
53 auto forOp = rewriter.create<AffineForOp>(loc, 0, shape[i]); in matchAndRewrite()
55 rewriter.setInsertionPointToStart(forOp.getBody()); in matchAndRewrite()
57 auto l = rewriter.create<LoadOp>(loc, lhs, induction_vars); in matchAndRewrite()
58 auto r = rewriter.create<LoadOp>(loc, rhs, induction_vars); in matchAndRewrite()
60 llvm::cast<LhloOp>(op), element_type, {l, r}, &rewriter); in matchAndRewrite()
64 rewriter.create<StoreOp>(loc, opResult, op.out(), induction_vars); in matchAndRewrite()
65 rewriter.eraseOp(op); in matchAndRewrite()
Dmaterialize_broadcasts.cc50 bool CreateBroadcastsForBinaryOp(SrcOp op, PatternRewriter *rewriter, in CreateBroadcastsForBinaryOp() argument
86 GetI64ElementsAttrForSeq(0, std::max(lhs_rank, rhs_rank), rewriter); in CreateBroadcastsForBinaryOp()
114 *out_lhs = rewriter->createOrFold<BroadcastInDimOp>(op.getLoc(), lhs_type, in CreateBroadcastsForBinaryOp()
116 *out_rhs = rewriter->createOrFold<BroadcastInDimOp>(op.getLoc(), rhs_type, in CreateBroadcastsForBinaryOp()
127 PatternRewriter &rewriter) const override { in matchAndRewrite()
130 if (!CreateBroadcastsForBinaryOp(op, &rewriter, &new_lhs, &new_rhs)) { in matchAndRewrite()
136 rewriter.replaceOpWithNewOp<SrcOp>(op, op.getType(), new_lhs, new_rhs, in matchAndRewrite()
148 PatternRewriter &rewriter) const override { in matchAndRewrite()
151 if (!CreateBroadcastsForBinaryOp(op, &rewriter, &new_lhs, &new_rhs)) { in matchAndRewrite()
155 rewriter.replaceOpWithNewOp<CompareOp>(op, op.getType(), new_lhs, new_rhs, in matchAndRewrite()
/external/tensorflow/tensorflow/compiler/mlir/tensorflow/transforms/
Dlower_tf.cc129 PatternRewriter &rewriter) const override { in matchAndRewrite()
139 result = rewriter.create<TF::AddV2Op>(op.getLoc(), result, operand); in matchAndRewrite()
142 rewriter.replaceOp(op, result); in matchAndRewrite()
180 PatternRewriter &rewriter) const override { in matchAndRewrite()
212 auto packed_shape_val = rewriter.create<ConstOp>( in matchAndRewrite()
213 loc, GetI64ElementsAttr(packed_shape, &rewriter)); in matchAndRewrite()
223 rewriter.create<ReshapeOp>(loc, data, packed_shape_val); in matchAndRewrite()
226 auto items = rewriter.create<UnpackOp>( in matchAndRewrite()
236 auto axis = rewriter.create<ConstOp>(loc, rewriter.getI64IntegerAttr(0)); in matchAndRewrite()
237 rewriter.replaceOpWithNewOp<ConcatV2Op>(op, op.getType(), values, axis); in matchAndRewrite()
[all …]
/external/smali/dexlib2/src/main/java/org/jf/dexlib2/rewriter/
DRewriterUtils.java32 package org.jf.dexlib2.rewriter;
43 public static <T> T rewriteNullable(@Nonnull Rewriter<T> rewriter, @Nullable T value) { in rewriteNullable() argument
44 return value==null?null:rewriter.rewrite(value); in rewriteNullable()
47 public static <T> Set<T> rewriteSet(@Nonnull final Rewriter<T> rewriter, in rewriteSet() argument
58 return rewriteNullable(rewriter, iterator.next()); in rewriteSet()
73 public static <T> List<T> rewriteList(@Nonnull final Rewriter<T> rewriter,
77 return rewriteNullable(rewriter, list.get(i));
86 public static <T> Iterable<T> rewriteIterable(@Nonnull final Rewriter<T> rewriter,
97 return rewriteNullable(rewriter, iterator.next());
/external/desugar/java/com/google/devtools/build/android/desugar/
DClassReaderFactory.java26 private final CoreLibraryRewriter rewriter; field in ClassReaderFactory
28 public ClassReaderFactory(IndexedInputs indexedInputs, CoreLibraryRewriter rewriter) { in ClassReaderFactory() argument
29 this.rewriter = rewriter; in ClassReaderFactory()
40 String filename = rewriter.unprefix(internalClassName) + ".class"; in readIfKnown()
46 return rewriter.reader(bytecode); in readIfKnown()
61 String filename = rewriter.unprefix(internalClassName) + ".class"; in isKnown()
DLongCompareMethodRewriter.java30 private final CoreLibraryRewriter rewriter; field in LongCompareMethodRewriter
32 public LongCompareMethodRewriter(ClassVisitor cv, CoreLibraryRewriter rewriter) { in LongCompareMethodRewriter() argument
34 this.rewriter = rewriter; in LongCompareMethodRewriter()
53 && rewriter.unprefix(owner).equals("java/lang/Long") in visitMethodInsn()
DObjectsRequireNonNullMethodRewriter.java33 private final CoreLibraryRewriter rewriter; field in ObjectsRequireNonNullMethodRewriter
35 public ObjectsRequireNonNullMethodRewriter(ClassVisitor cv, CoreLibraryRewriter rewriter) { in ObjectsRequireNonNullMethodRewriter() argument
37 this.rewriter = rewriter; in ObjectsRequireNonNullMethodRewriter()
56 && rewriter.unprefix(owner).equals("java/util/Objects") in visitMethodInsn()
DDesugar.java326 private final CoreLibraryRewriter rewriter; field in Desugar
343 this.rewriter = new CoreLibraryRewriter(options.coreLibrary ? "__desugar__/" : ""); in Desugar()
367 : new HeaderClassLoader(indexedBootclasspath, rewriter, new ThrowingClassLoader()); in desugar()
377 new ClassReaderFactory(indexedBootclasspath, rewriter)); in desugar()
405 new HeaderClassLoader(indexedClasspathAndInputFiles, rewriter, bootclassloader); in desugarOneInput()
410 classpathReader = new ClassReaderFactory(indexedClasspathAndInputFiles, rewriter); in desugarOneInput()
414 bridgeMethodReader = new ClassReaderFactory(indexedInputFiles, rewriter); in desugarOneInput()
423 rewriter, in desugarOneInput()
536 ClassReader reader = rewriter.reader(content); in desugarClassesInInput()
537 UnprefixingClassWriter writer = rewriter.writer(ClassWriter.COMPUTE_MAXS); in desugarClassesInInput()
[all …]
/external/tensorflow/tensorflow/compiler/mlir/lite/quantization/tensorflow/
Dtf_to_quant.cc77 PatternRewriter &rewriter) const override { in matchAndRewrite()
91 rewriter.eraseOp(id1); in matchAndRewrite()
96 rewriter.eraseOp(id2); in matchAndRewrite()
109 rewriter.setInsertionPointAfter(tf_op); in matchAndRewrite()
111 rewriter.getI64IntegerAttr(tf_op.num_bits().getSExtValue()); in matchAndRewrite()
112 BoolAttr narrow_range = rewriter.getBoolAttr(tf_op.narrow_range()); in matchAndRewrite()
115 rewriter, res_type, min_value, max_value, quant_dim, num_bits, in matchAndRewrite()
123 auto quantize = rewriter.create<quant::QuantizeCastOp>( in matchAndRewrite()
125 auto dequantize = rewriter.create<quant::DequantizeCastOp>( in matchAndRewrite()
/external/tensorflow/tensorflow/compiler/mlir/lite/quantization/
Dquantization_utils.h86 PatternRewriter& rewriter) const override { in matchAndRewrite()
114 rewriter.setInsertionPointAfter(op); in matchAndRewrite()
116 auto q = rewriter.create<Q>(op.getLoc(), result_type, op.arg()); in matchAndRewrite()
117 auto dq = rewriter.create<DQ>(op.getLoc(), op.getType(), q); in matchAndRewrite()
159 PatternRewriter& rewriter) const override { in matchAndRewrite()
240 rewriter.setInsertionPointAfter(quantized_op); in matchAndRewrite()
244 Operation* new_op = rewriter.createOperation(new_state); in matchAndRewrite()
263 auto cst = rewriter.create<ConstantOp>(new_op->getLoc(), attr); in matchAndRewrite()
276 rewriter.setInsertionPointAfter(new_op); in matchAndRewrite()
277 FloatAttr tolerance = rewriter.getF32FloatAttr(error_tolerance); in matchAndRewrite()
[all …]
/external/tensorflow/tensorflow/compiler/xla/service/
Dbatchnorm_expander_test.cc80 BatchNormExpander rewriter(/*rewrite_training_op=*/true, in TEST_F() local
83 ASSERT_TRUE(rewriter.Run(module.get()).ValueOrDie()); in TEST_F()
123 BatchNormExpander rewriter(/*rewrite_training_op=*/true, in TEST_F() local
126 ASSERT_TRUE(rewriter.Run(module.get()).ValueOrDie()); in TEST_F()
146 BatchNormExpander rewriter(/*rewrite_training_op=*/true, in TEST_F() local
149 ASSERT_TRUE(rewriter.Run(m.get()).ValueOrDie()); in TEST_F()
/external/desugar/java/com/google/devtools/build/android/desugar/io/
DHeaderClassLoader.java39 private final CoreLibraryRewriter rewriter; field in HeaderClassLoader
42 IndexedInputs indexedInputs, CoreLibraryRewriter rewriter, ClassLoader parent) { in HeaderClassLoader() argument
44 this.rewriter = rewriter; in HeaderClassLoader()
50 String filename = rewriter.unprefix(name.replace('.', '/') + ".class"); in findClass()
57 ClassReader reader = rewriter.reader(content); in findClass()

1234