|
| 1 | +// RUN: %pick-one-gpu tensorrt-opt -split-input-file -pass-pipeline="builtin.module(translate-tensorrt-to-engine)" \ |
| 2 | +// RUN: -mlir-elide-elementsattrs-if-larger=32 -tensorrt-builder-opt-level=0 %s | FileCheck %s |
| 3 | + |
| 4 | +// CHECK-LABEL: func.func @trt_host_input |
| 5 | +// CHECK-SAME: tensorrt.engine |
| 6 | +func.func @trt_host_input( |
| 7 | + %arg0: tensor<?x4xf32> {tensorrt.dimension_names = {}, tensorrt.shape_profile = #tensorrt.shape_profile<min = [2, 4], opt = [4, 4], max = [6, 4]>}, |
| 8 | + %arg1: tensor<i32> {tensorrt.host_tensor, tensorrt.value_bounds = #tensorrt.shape_profile<min = [1], opt = [2], max = [3]>}) |
| 9 | + -> tensor<?x?xf32> { |
| 10 | + %cst_i32 = tensorrt.constant dense<1> : tensor<i32> |
| 11 | + %0 = tensorrt.element_wise <kSUM>(%arg0, %arg0 : tensor<?x4xf32>, tensor<?x4xf32>) -> tensor<?x4xf32> |
| 12 | + %1 = tensorrt.shape %0 : tensor<?x4xf32> -> tensor<2xi32> |
| 13 | + %2 = tensorrt.slice %1[0][1][1] : tensor<2xi32> to tensor<1xi32> |
| 14 | + %3 = tensorrt.shuffle {first_transpose = array<i64: 0>, reshape = array<i64>, second_transpose = array<i64>, zero_is_placeholder = false} ins(%2 : tensor<1xi32>) -> tensor<i32> |
| 15 | + %4 = tensorrt.element_wise <kPROD>(%3, %cst_i32 : tensor<i32>, tensor<i32>) -> tensor<i32> |
| 16 | + %5 = tensorrt.slice %1[1][1][1] : tensor<2xi32> to tensor<1xi32> |
| 17 | + %6 = tensorrt.shuffle {first_transpose = array<i64: 0>, reshape = array<i64>, second_transpose = array<i64>, zero_is_placeholder = false} ins(%5 : tensor<1xi32>) -> tensor<i32> |
| 18 | + %7 = tensorrt.element_wise <kPROD>(%4, %6 : tensor<i32>, tensor<i32>) -> tensor<i32> |
| 19 | + %8 = tensorrt.element_wise <kPROD>(%arg1, %cst_i32 : tensor<i32>, tensor<i32>) -> tensor<i32> |
| 20 | + %9 = tensorrt.element_wise <kFLOOR_DIV>(%7, %8 : tensor<i32>, tensor<i32>) -> tensor<i32> |
| 21 | + %10 = tensorrt.shuffle {first_transpose = array<i64>, reshape = array<i64: 1>, second_transpose = array<i64: 0>, zero_is_placeholder = false} ins(%9 : tensor<i32>) -> tensor<?xi32> |
| 22 | + %11 = tensorrt.shuffle {first_transpose = array<i64>, reshape = array<i64: 1>, second_transpose = array<i64: 0>, zero_is_placeholder = false} ins(%arg1 : tensor<i32>) -> tensor<?xi32> |
| 23 | + %12 = tensorrt.concatenation {axis = 0 : i32} ins(%10, %11 : tensor<?xi32>, tensor<?xi32>) -> tensor<2xi32> |
| 24 | + %13 = tensorrt.shuffle {first_transpose = array<i64: 0, 1>, second_transpose = array<i64: 0, 1>, zero_is_placeholder = false} ins(%0, %12 : tensor<?x4xf32>, tensor<2xi32>) -> tensor<?x?xf32> |
| 25 | + return %13 : tensor<?x?xf32> |
| 26 | +} |
0 commit comments