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