Skip to content

Commit

Permalink
Merge 80ad63f into f427965
Browse files Browse the repository at this point in the history
  • Loading branch information
antiagainst committed Jun 20, 2024
2 parents f427965 + 80ad63f commit b918d15
Show file tree
Hide file tree
Showing 49 changed files with 205 additions and 221 deletions.
17 changes: 1 addition & 16 deletions build_tools/pkgci/external_test_suite/onnx_cpu_llvm_sync.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
"test_ai_onnx_ml_label_encoder_string_int_no_default",
"test_ai_onnx_ml_label_encoder_tensor_value_only_mapping",
"test_averagepool_2d_dilations",
"test_averagepool_2d_pads",
"test_averagepool_2d_precomputed_pads",
"test_averagepool_2d_precomputed_same_upper",
"test_averagepool_2d_same_lower",
"test_averagepool_2d_same_upper",
Expand Down Expand Up @@ -134,8 +132,6 @@
"test_dequantizelinear_e4m3fn_float16",
"test_dequantizelinear_e4m3fn_zero_point",
"test_dequantizelinear_e5m2",
"test_dequantizelinear_int16",
"test_dequantizelinear_uint16",
"test_det_2d",
"test_det_nd",
"test_dft",
Expand Down Expand Up @@ -260,7 +256,6 @@
"test_quantizelinear_blocked",
"test_quantizelinear_e4m3fn",
"test_quantizelinear_e5m2",
"test_quantizelinear_int16",
"test_quantizelinear_uint16",
"test_range_float_type_positive_delta_expanded",
"test_range_int32_type_negative_delta_expanded",
Expand Down Expand Up @@ -373,12 +368,9 @@
"test_resize_downsample_scales_cubic_align_corners",
"test_resize_downsample_scales_cubic_antialias",
"test_resize_downsample_scales_linear_antialias",
"test_resize_downsample_scales_linear_half_pixel_symmetric",
"test_resize_downsample_scales_nearest",
"test_resize_downsample_sizes_cubic",
"test_resize_downsample_sizes_cubic_antialias",
"test_resize_downsample_sizes_linear_antialias",
"test_resize_downsample_sizes_nearest",
"test_resize_downsample_sizes_nearest_not_larger",
"test_resize_downsample_sizes_nearest_not_smaller",
"test_resize_tf_crop_and_resize",
Expand All @@ -388,17 +380,13 @@
"test_resize_upsample_scales_cubic_A_n0p5_exclude_outside",
"test_resize_upsample_scales_cubic_align_corners",
"test_resize_upsample_scales_cubic_asymmetric",
"test_resize_upsample_scales_linear_half_pixel_symmetric",
"test_resize_upsample_scales_nearest",
"test_resize_upsample_scales_nearest_axes_2_3",
"test_resize_upsample_scales_nearest_axes_3_2",
"test_resize_upsample_sizes_cubic",
"test_resize_upsample_sizes_nearest",
"test_resize_upsample_sizes_nearest_axes_2_3",
"test_resize_upsample_sizes_nearest_axes_3_2",
"test_resize_upsample_sizes_nearest_ceil_half_pixel",
"test_resize_upsample_sizes_nearest_floor_align_corners",
"test_resize_upsample_sizes_nearest_not_larger",
"test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric",
"test_reversesequence_batch",
"test_reversesequence_time",
"test_rnn_seq_length",
Expand Down Expand Up @@ -537,12 +525,10 @@
"test_unique_sorted_with_axis_3d",
"test_unique_sorted_with_negative_axis",
"test_unique_sorted_without_axis",
"test_upsample_nearest",
"test_wrap_pad"
],
"expected_run_failures": [
"test_asin",
"test_averagepool_2d_ceil",
"test_bernoulli",
"test_bernoulli_double",
"test_bernoulli_double_expanded",
Expand Down Expand Up @@ -608,7 +594,6 @@
"test_reduce_min_empty_set",
"test_reduce_sum_empty_set_non_reduced_axis_zero",
"test_resize_downsample_scales_linear_align_corners",
"test_resize_upsample_sizes_nearest_floor_align_corners",
"test_scatter_elements_with_negative_indices",
"test_sce_mean_no_weight_ii",
"test_sce_mean_no_weight_ii_log_prob",
Expand Down
17 changes: 1 addition & 16 deletions build_tools/pkgci/external_test_suite/onnx_gpu_cuda.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
"test_ai_onnx_ml_label_encoder_string_int_no_default",
"test_ai_onnx_ml_label_encoder_tensor_value_only_mapping",
"test_averagepool_2d_dilations",
"test_averagepool_2d_pads",
"test_averagepool_2d_precomputed_pads",
"test_averagepool_2d_precomputed_same_upper",
"test_averagepool_2d_same_lower",
"test_averagepool_2d_same_upper",
Expand Down Expand Up @@ -140,8 +138,6 @@
"test_dequantizelinear_e4m3fn_float16",
"test_dequantizelinear_e4m3fn_zero_point",
"test_dequantizelinear_e5m2",
"test_dequantizelinear_int16",
"test_dequantizelinear_uint16",
"test_det_2d",
"test_det_nd",
"test_dft",
Expand Down Expand Up @@ -263,7 +259,6 @@
"test_quantizelinear_blocked",
"test_quantizelinear_e4m3fn",
"test_quantizelinear_e5m2",
"test_quantizelinear_int16",
"test_quantizelinear_uint16",
"test_range_float_type_positive_delta_expanded",
"test_range_int32_type_negative_delta_expanded",
Expand Down Expand Up @@ -376,12 +371,9 @@
"test_resize_downsample_scales_cubic_align_corners",
"test_resize_downsample_scales_cubic_antialias",
"test_resize_downsample_scales_linear_antialias",
"test_resize_downsample_scales_linear_half_pixel_symmetric",
"test_resize_downsample_scales_nearest",
"test_resize_downsample_sizes_cubic",
"test_resize_downsample_sizes_cubic_antialias",
"test_resize_downsample_sizes_linear_antialias",
"test_resize_downsample_sizes_nearest",
"test_resize_downsample_sizes_nearest_not_larger",
"test_resize_downsample_sizes_nearest_not_smaller",
"test_resize_tf_crop_and_resize",
Expand All @@ -391,17 +383,13 @@
"test_resize_upsample_scales_cubic_A_n0p5_exclude_outside",
"test_resize_upsample_scales_cubic_align_corners",
"test_resize_upsample_scales_cubic_asymmetric",
"test_resize_upsample_scales_linear_half_pixel_symmetric",
"test_resize_upsample_scales_nearest",
"test_resize_upsample_scales_nearest_axes_2_3",
"test_resize_upsample_scales_nearest_axes_3_2",
"test_resize_upsample_sizes_cubic",
"test_resize_upsample_sizes_nearest",
"test_resize_upsample_sizes_nearest_axes_2_3",
"test_resize_upsample_sizes_nearest_axes_3_2",
"test_resize_upsample_sizes_nearest_ceil_half_pixel",
"test_resize_upsample_sizes_nearest_floor_align_corners",
"test_resize_upsample_sizes_nearest_not_larger",
"test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric",
"test_reversesequence_batch",
"test_reversesequence_time",
"test_rnn_seq_length",
Expand Down Expand Up @@ -540,12 +528,10 @@
"test_unique_sorted_with_axis_3d",
"test_unique_sorted_with_negative_axis",
"test_unique_sorted_without_axis",
"test_upsample_nearest",
"test_wrap_pad"
],
"expected_run_failures": [
"test_asin",
"test_averagepool_2d_ceil",
"test_bernoulli",
"test_bernoulli_double",
"test_bernoulli_double_expanded",
Expand Down Expand Up @@ -626,7 +612,6 @@
"test_reduce_sum_square_default_axes_keepdims_example_expanded",
"test_reduce_sum_square_default_axes_keepdims_random",
"test_reduce_sum_square_default_axes_keepdims_random_expanded",
"test_resize_upsample_sizes_nearest_floor_align_corners",
"test_sce_mean_no_weight_ii",
"test_sce_mean_no_weight_ii_log_prob",
"test_shape_end_1",
Expand Down
18 changes: 2 additions & 16 deletions build_tools/pkgci/external_test_suite/onnx_gpu_rocm_rdna3.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
"test_ai_onnx_ml_label_encoder_string_int_no_default",
"test_ai_onnx_ml_label_encoder_tensor_value_only_mapping",
"test_averagepool_2d_dilations",
"test_averagepool_2d_pads",
"test_averagepool_2d_precomputed_pads",
"test_averagepool_2d_precomputed_same_upper",
"test_averagepool_2d_same_lower",
"test_averagepool_2d_same_upper",
Expand Down Expand Up @@ -135,8 +133,6 @@
"test_dequantizelinear_e4m3fn_float16",
"test_dequantizelinear_e4m3fn_zero_point",
"test_dequantizelinear_e5m2",
"test_dequantizelinear_int16",
"test_dequantizelinear_uint16",
"test_det_2d",
"test_det_nd",
"test_dft",
Expand Down Expand Up @@ -258,7 +254,6 @@
"test_quantizelinear_blocked",
"test_quantizelinear_e4m3fn",
"test_quantizelinear_e5m2",
"test_quantizelinear_int16",
"test_quantizelinear_uint16",
"test_range_float_type_positive_delta_expanded",
"test_range_int32_type_negative_delta_expanded",
Expand Down Expand Up @@ -371,12 +366,9 @@
"test_resize_downsample_scales_cubic_align_corners",
"test_resize_downsample_scales_cubic_antialias",
"test_resize_downsample_scales_linear_antialias",
"test_resize_downsample_scales_linear_half_pixel_symmetric",
"test_resize_downsample_scales_nearest",
"test_resize_downsample_sizes_cubic",
"test_resize_downsample_sizes_cubic_antialias",
"test_resize_downsample_sizes_linear_antialias",
"test_resize_downsample_sizes_nearest",
"test_resize_downsample_sizes_nearest_not_larger",
"test_resize_downsample_sizes_nearest_not_smaller",
"test_resize_tf_crop_and_resize",
Expand All @@ -386,17 +378,13 @@
"test_resize_upsample_scales_cubic_A_n0p5_exclude_outside",
"test_resize_upsample_scales_cubic_align_corners",
"test_resize_upsample_scales_cubic_asymmetric",
"test_resize_upsample_scales_linear_half_pixel_symmetric",
"test_resize_upsample_scales_nearest",
"test_resize_upsample_scales_nearest_axes_2_3",
"test_resize_upsample_scales_nearest_axes_3_2",
"test_resize_upsample_sizes_cubic",
"test_resize_upsample_sizes_nearest",
"test_resize_upsample_sizes_nearest_axes_2_3",
"test_resize_upsample_sizes_nearest_axes_3_2",
"test_resize_upsample_sizes_nearest_ceil_half_pixel",
"test_resize_upsample_sizes_nearest_floor_align_corners",
"test_resize_upsample_sizes_nearest_not_larger",
"test_resize_upsample_sizes_nearest_round_prefer_ceil_asymmetric",
"test_reversesequence_batch",
"test_reversesequence_time",
"test_rnn_seq_length",
Expand Down Expand Up @@ -535,12 +523,10 @@
"test_unique_sorted_with_axis_3d",
"test_unique_sorted_with_negative_axis",
"test_unique_sorted_without_axis",
"test_upsample_nearest",
"test_wrap_pad"
],
"expected_run_failures": [
"test_asin",
"test_averagepool_2d_ceil",
"test_bernoulli",
"test_bernoulli_double",
"test_bernoulli_double_expanded",
Expand Down Expand Up @@ -637,7 +623,7 @@
"test_reduce_sum_square_default_axes_keepdims_random",
"test_reduce_sum_square_default_axes_keepdims_random_expanded",
"test_resize_downsample_scales_linear_align_corners",
"test_resize_upsample_sizes_nearest_floor_align_corners",
"test_resize_downsample_scales_linear_half_pixel_symmetric",
"test_scatter_elements_with_negative_indices",
"test_sce_mean_no_weight_ii",
"test_sce_mean_no_weight_ii_log_prob",
Expand Down
17 changes: 11 additions & 6 deletions build_tools/pkgci/external_test_suite/onnx_gpu_vulkan.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@
"test_argmin_negative_axis_keepdims_random_select_last_index",
"test_argmin_no_keepdims_example_select_last_index",
"test_argmin_no_keepdims_random_select_last_index",
"test_averagepool_2d_ceil",
"test_averagepool_2d_default",
"test_averagepool_2d_dilations",
"test_averagepool_2d_pads",
"test_averagepool_2d_pads_count_include_pad",
"test_averagepool_2d_precomputed_pads",
"test_averagepool_2d_precomputed_pads_count_include_pad",
"test_averagepool_2d_precomputed_same_upper",
"test_averagepool_2d_precomputed_strides",
"test_averagepool_2d_same_lower",
"test_averagepool_2d_same_upper",
"test_averagepool_2d_strides",
"test_averagepool_3d_dilations_large_count_include_pad_is_0_ceil_mode_is_False",
"test_averagepool_3d_dilations_large_count_include_pad_is_0_ceil_mode_is_True",
"test_averagepool_3d_dilations_large_count_include_pad_is_1_ceil_mode_is_False",
Expand Down Expand Up @@ -132,6 +138,8 @@
"test_constant_pad_axes",
"test_constant_pad_negative_axes",
"test_conv_with_autopad_same",
"test_convinteger_with_padding",
"test_convinteger_without_padding",
"test_convtranspose_autopad_same",
"test_convtranspose_kernel_shape",
"test_convtranspose_output_shape",
Expand All @@ -150,8 +158,6 @@
"test_dequantizelinear_e4m3fn_float16",
"test_dequantizelinear_e4m3fn_zero_point",
"test_dequantizelinear_e5m2",
"test_dequantizelinear_int16",
"test_dequantizelinear_uint16",
"test_det_2d",
"test_det_nd",
"test_dft",
Expand Down Expand Up @@ -294,7 +300,6 @@
"test_quantizelinear_blocked",
"test_quantizelinear_e4m3fn",
"test_quantizelinear_e5m2",
"test_quantizelinear_int16",
"test_quantizelinear_uint16",
"test_range_float_type_positive_delta_expanded",
"test_range_int32_type_negative_delta_expanded",
Expand Down Expand Up @@ -585,7 +590,6 @@
"test_and_bcast4v2d",
"test_and_bcast4v4d",
"test_asin",
"test_averagepool_2d_ceil",
"test_bernoulli",
"test_bernoulli_double",
"test_bernoulli_double_expanded",
Expand Down Expand Up @@ -628,8 +632,8 @@
"test_constantofshape_float_ones",
"test_constantofshape_int_shape_zero",
"test_constantofshape_int_zeros",
"test_convinteger_with_padding",
"test_convinteger_without_padding",
"test_dequantizelinear_int16",
"test_dequantizelinear_uint16",
"test_dropout_default_mask_ratio",
"test_dynamicquantizelinear",
"test_dynamicquantizelinear_expanded",
Expand Down Expand Up @@ -677,6 +681,7 @@
"test_qlinearmatmul_3D_uint8_float16",
"test_qlinearmatmul_3D_uint8_float32",
"test_quantizelinear",
"test_quantizelinear_int16",
"test_reduce_l1_default_axes_keepdims_example",
"test_reduce_l1_default_axes_keepdims_example_expanded",
"test_reduce_l1_default_axes_keepdims_random",
Expand Down
38 changes: 1 addition & 37 deletions compiler/plugins/input/StableHLO/Conversion/LegalizeCHLO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "stablehlo/dialect/BroadcastUtils.h"
Expand Down Expand Up @@ -443,38 +442,6 @@ struct ConvertSelectOp final
}
};

struct ConvertDynamicReshapeOp final
: OpRewritePattern<mlir::chlo::DynamicReshapeOp> {
using OpRewritePattern::OpRewritePattern;

LogicalResult matchAndRewrite(mlir::chlo::DynamicReshapeOp op,
PatternRewriter &rewriter) const override {
Location loc = op.getLoc();
TypedValue<TensorType> tensor = op.getOperand();
TypedValue<RankedTensorType> shape = op.getOutputShape();

auto shapeTy = cast<ShapedType>(shape.getType());
auto resultTy = cast<ShapedType>(op.getType());

Value inputShape = rewriter.create<shape::ShapeOfOp>(loc, tensor);
Value numEls = rewriter.create<shape::NumElementsOp>(loc, inputShape);
Value cstr =
rewriter.create<mlir::stablehlo::CstrReshapableOp>(loc, numEls, shape);
rewriter.replaceOpWithNewOp<shape::AssumingOp>(
op, cstr, [&](OpBuilder &b, Location l) {
Value computedShape =
b.create<mlir::stablehlo::ComputeReshapeShapeOp>(l, shapeTy,
numEls, shape);
SmallVector<Value> result;
result.push_back(b.create<mlir::stablehlo::DynamicReshapeOp>(
l, resultTy, tensor, computedShape));
return result;
});

return success();
}
};

//===----------------------------------------------------------------------===//
// Decomposition Patterns.
//===----------------------------------------------------------------------===//
Expand Down Expand Up @@ -2192,7 +2159,6 @@ struct LegalizeChlo final : impl::LegalizeChloBase<LegalizeChlo> {
ConversionTarget conversionTarget(getContext());
RewritePatternSet conversionPatterns(ctx);
conversionTarget.addIllegalDialect<chlo::ChloDialect>();
conversionTarget.addLegalOp<chlo::MinimumBroadcastShapesOp>();
conversionTarget.addLegalDialect<
mlir::stablehlo::StablehloDialect, mlir::arith::ArithDialect,
mlir::shape::ShapeDialect, mlir::scf::SCFDialect,
Expand Down Expand Up @@ -2239,9 +2205,7 @@ static void populateBroadcastingPatterns(MLIRContext *context,
context, patterns, 10);
populateForBroadcastingBinaryOp<ConvertRankedDynamicBroadcastBinaryOp>(
context, patterns, 5);
patterns
->add<ConvertConstantLikeOp, ConvertDynamicReshapeOp, ConvertSelectOp>(
context);
patterns->add<ConvertConstantLikeOp, ConvertSelectOp>(context);
}

static void populateDecompositionPatterns(MLIRContext *context,
Expand Down
Loading

0 comments on commit b918d15

Please sign in to comment.