benchmark.mlir 850 字节
Newer Older
1
// RUN: infrtexec -i %s | FileCheck %s
Y
Yan Chunwei 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
// CHECK-LABEL: @benchmark
func @benchmark() {
  // CHECK-LABEL: BM:add.f32:Count: 3
  // CHECK-LABEL: BM:add.f32:Duration(ns)
  // CHECK-LABEL: BM:add.f32:Time Min(ns)
  // CHECK-LABEL: BM:add.f32:Time 50%(ns)
  // CHECK-LABEL: BM:add.f32:Time 95%(ns)
  // CHECK-LABEL: BM:add.f32:Time 99%(ns)
  // CHECK-LABEL: BM:add.f32:CPU Min(ns)
  // CHECK-LABEL: BM:add.f32:CPU 50%(ns)
  // CHECK-LABEL: BM:add.f32:CPU 95%(ns)
  // CHECK-LABEL: BM:add.f32:CPU 99%(ns)
  // CHECK-LABEL: BM:add.f32:CPU utilization(percent)
  infrt.benchmark "add.f32"() duration_secs = 1, max_count = 3, num_warmup_runs = 3
  {
    %0 = infrt.constant.f32 1.0
    %1 = infrt.constant.f32 2.0
    %res = "infrt.add.f32"(%0, %1) : (f32, f32) -> f32
    "infrt.print.f32"(%res) : (f32) -> ()
    infrt.return %res : f32
  }
  infrt.return
}