// 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 }