[solved] How to measuer performance when use multiply module?

hello!

I wonder how to measure performance when creating multiple modules with TOPI.

for example, when i make single module by using TOPI. i use this function to evaluate performance.

conv2d_relu = tvm.build( sch, [A,W,B] , 'cuda' , name='conv2d_relu' )
evaluator = conv2d_relu.time_evaluator(conv2d_relu.entry_name, ctx, number=1)
print('Convolution+relu: %f ms' % (evaluator(A, W, B).mean * 1e3))

but, If i run two modules, the time is measured as follows.

conv2d_relu = tvm.build( sch, [A,W,B] , 'cuda' , name='conv2d_relu' )
avg_pool = tvm.build( sch2, [B,C] , 'cuda' , name='avg_pool' )

timer = 0
evaluator = conv2d_relu.time_evaluator(conv2d_relu.entry_name, ctx, number=1)
timer = timer + evaluator(A, W, B).mean * 1e3
evaluator = avg_pool.time_evaluator(avg_pool.entry_name, ctx, number=1)
timer = timer + evaluator(B,C).mean * 1e3

print('Convolution+relu+pool : %f ms' % timer)

Is it correct way to evaluate performance of two module? or is there a way to measure all module’s performance at once?

your method is correct

1 Like

Thank you for reply! vinx13