How many FLOPs does one tensor_op_hmma instruction do?

I’m trying to get the FLOPs of a DNN model using nsight compute. If I don’t use tensorcore, I can count the ffma fmul fadd instructions to get the FLOPs. But if I use tensorcore, can I use the counter to calculate the FLOPs of the model?

Hi, @1055057679

You can refer below metrics to calculate FLOPs

ncu --query-metrics | grep sm__ops_

sm__ops_path_tensor_src_bf16_dst_fp32                                         Counter                         # of math ops executed in Tensor path with source BF16 and
sm__ops_path_tensor_src_bf16_dst_fp32_sparsity_off                            Counter                         # of math ops executed in Tensor path with source BF16 and
sm__ops_path_tensor_src_bf16_dst_fp32_sparsity_on                             Counter                         # of math ops executed in Tensor path with source BF16 and
sm__ops_path_tensor_src_fp16_dst_fp16                                         Counter                         # of math ops executed in Tensor path with source FP16 and
sm__ops_path_tensor_src_fp16_dst_fp16_sparsity_off                            Counter                         # of math ops executed in Tensor path with source FP16 and
sm__ops_path_tensor_src_fp16_dst_fp16_sparsity_on                             Counter                         # of math ops executed in Tensor path with source FP16 and
sm__ops_path_tensor_src_fp16_dst_fp32                                         Counter                         # of math ops executed in Tensor path with source FP16 and
sm__ops_path_tensor_src_fp16_dst_fp32_sparsity_off                            Counter                         # of math ops executed in Tensor path with source FP16 and
sm__ops_path_tensor_src_fp16_dst_fp32_sparsity_on                             Counter                         # of math ops executed in Tensor path with source FP16 and
sm__ops_path_tensor_src_fp64                                                  Counter                         # of math ops executed in Tensor path with source FP64
sm__ops_path_tensor_src_int1                                                  Counter                         # of math ops executed in Tensor path with source INT1
sm__ops_path_tensor_src_int4                                                  Counter                         # of math ops executed in Tensor path with source INT4
sm__ops_path_tensor_src_int4_sparsity_off                                     Counter                         # of math ops executed in Tensor path with source INT4 with sparsity
sm__ops_path_tensor_src_int4_sparsity_on                                      Counter                         # of math ops executed in Tensor path with source INT4 with sparsity
sm__ops_path_tensor_src_int8                                                  Counter                         # of math ops executed in Tensor path with source INT8
sm__ops_path_tensor_src_int8_sparsity_off                                     Counter                         # of math ops executed in Tensor path with source INT8 with sparsity
sm__ops_path_tensor_src_int8_sparsity_on                                      Counter                         # of math ops executed in Tensor path with source INT8 with sparsity
sm__ops_path_tensor_src_tf32_dst_fp32                                         Counter                         # of math ops executed in Tensor path with source TF32 and
sm__ops_path_tensor_src_tf32_dst_fp32_sparsity_off                            Counter                         # of math ops executed in Tensor path with source TF32 and
sm__ops_path_tensor_src_tf32_dst_fp32_sparsity_on                             Counter                         # of math ops executed in Tensor path with source TF32 and

Hello,

I found your answer after having a very similar problem, and I would like to ask if these metrics are available in all GPUs, and if so, from what version of Nsight Compute, as in my current system RTX3080 with 2022.4 version of ncu I can’t find the metrics with the same command.
Thank you!

Hi, @diogo.s.matos

If you can’t find the metrics, that means not support.
So please get ncu latest version.