// CHECK-LABEL: @fc func @fc(%input : !infrt.dense_tensor, %w : !infrt.dense_tensor, %bias : !infrt.dense_tensor) -> !infrt.dense_tensor { %out = dt.create_uninit_tensor.f32 [30, 50] -> !infrt.dense_tensor // dt.fill_tensor_with_constant.f32 (%out : !infrt.dense_tensor) {value=0.0:f32} // fc1 "external.matmul"(%input, %w, %out) {}: (!infrt.dense_tensor, !infrt.dense_tensor, !infrt.dense_tensor) -> () "external.elementwise_add"(%out, %bias, %out) {axis = -1}: (!infrt.dense_tensor, !infrt.dense_tensor, !infrt.dense_tensor) -> () "external.sigmoid"(%out, %out) {}: (!infrt.dense_tensor, !infrt.dense_tensor) -> () // fc2 "external.matmul"(%out, %w, %out) {}: (!infrt.dense_tensor, !infrt.dense_tensor, !infrt.dense_tensor) -> () "external.elementwise_add"(%out, %bias, %out) {axis = -1}: (!infrt.dense_tensor, !infrt.dense_tensor, !infrt.dense_tensor) -> () "external.sigmoid"(%out, %out) {}: (!infrt.dense_tensor, !infrt.dense_tensor) -> () infrt.return %out : !infrt.dense_tensor } // CHECK-LABEL: @benchmark func @benchmark() { %input = dt.create_uninit_tensor.f32 [30, 50] -> !infrt.dense_tensor dt.fill_tensor_with_constant.f32 (%input : !infrt.dense_tensor) {value=1.0:f32} %w = dt.create_uninit_tensor.f32 [50, 50] -> !infrt.dense_tensor dt.fill_tensor_with_constant.f32 (%w : !infrt.dense_tensor) {value=2.0:f32} %bias = dt.create_uninit_tensor.f32 [30, 50] -> !infrt.dense_tensor dt.fill_tensor_with_constant.f32 (%bias : !infrt.dense_tensor) {value=3.0:f32} infrt.benchmark "add.f32"( %input:!infrt.dense_tensor, %w:!infrt.dense_tensor, %bias:!infrt.dense_tensor) duration_secs = 100, max_count = 300000, num_warmup_runs = 3 { %res = infrt.call @fc(%input, %w, %bias) : (!infrt.dense_tensor, !infrt.dense_tensor, !infrt.dense_tensor) -> (!infrt.dense_tensor) infrt.return %res : !infrt.dense_tensor } infrt.return }