Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds arg for exec file dump dir, instruction counter script #12

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

monorimet
Copy link
Contributor

@monorimet monorimet commented Oct 7, 2024

Adds the --exec_dump_dir flag to the gemmbench script and creates a script for generating a .csv with instruction counts (naive) from dumped .rocmasm files.

By naive, I mean it starts counting lines at "Kernarg preload header" and stops at "---" to count instructions.
@kuhar is the stopping criteria here too late? it includes what seems to be metadata, so maybe it should stop at "s_endpgm" or "func_end0"?

Perhaps some of the counter utilities should be further integrated into the benchmarking tooling.

The instruction counter generates a file like this (also attached):

Filename,Instruction Count
./dumps/gemm_4096_640_2560_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1074
./dumps/gemm_4096_5120_640_f16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1074
./dumps/gemm_8192_640_2560_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1074
./dumps/gemm_1024_1280_1280_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1067
./dumps/gemm_2048_1280_1280_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1067
./dumps/gemm_1024_10240_1280_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1064
./dumps/gemm_128_1280_2048_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1064
./dumps/gemm_64_640_2048_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1064
./dumps/gemm_4096_4096_8192_f16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1034
./dumps/gemm_1024_1280_5120_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,1003
./dumps/gemm_4096_4096_8192_bf16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,997
./dumps/gemm_64_1280_2048_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,997
./dumps/gemm_2048_10240_1280_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,997
./dumps/gemm_2048_1280_5120_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,993
./dumps/gemm_8192_640_640_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,993
./dumps/gemm_4096_640_640_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,993
./dumps/gemm_8192_5120_640_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,983
./dumps/gemm_4096_640_2560_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,931
./dumps/gemm_8192_640_2560_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,931
./dumps/gemm_4096_4096_8192_bf16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,929
./dumps/gemm_1024_1280_1280_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,914
./dumps/gemm_2048_1280_1280_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,914
./dumps/gemm_2048_2048_65536_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,909
./dumps/gemm_2048_8192_8192_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,909
./dumps/gemm_8192_8192_8192_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,909
./dumps/gemm_8192_2048_65536_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,909
./dumps/gemm_2_7168_8192_bf16_tB/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,908
./dumps/gemm_2048_2048_1024_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,901
./dumps/gemm_8192_2048_1024_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,901
./dumps/gemm_128_1280_2048_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,899
./dumps/gemm_1024_10240_1280_f16/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,899
./dumps/gemm_5120_8_3456_f16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,890
./dumps/gemm_3456_8_5120_f16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,890
./dumps/gemm_7680_8_5120_f16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,890
./dumps/gemm_8000_8_8192_f16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,890
./dumps/gemm_1920_8_5120_f16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,890
./dumps/gemm_5120_8_8192_f16_tA/module_main_dispatch_0_rocm_hsaco_fb.rocmasm,890
<truncated>

rocmasm_line_counts.csv

@monorimet monorimet requested a review from kuhar October 7, 2024 14:51
Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! We should be able to add more stats to this easily

gemmbench/gemm_bench.py Outdated Show resolved Hide resolved
common_tools/instruction_count.py Outdated Show resolved Hide resolved
common_tools/instruction_count.py Outdated Show resolved Hide resolved
common_tools/instruction_count.py Outdated Show resolved Hide resolved
@monorimet monorimet requested a review from kuhar October 7, 2024 15:20
@monorimet
Copy link
Contributor Author

monorimet commented Oct 7, 2024

Updated results with the counter stopping fixed:
rocmasm_instr_counts.csv

Potential follow-ups:

  • Cleanup dictionary entries i.e. gemm_<shape>_<dtype>_<variant> instead of relative path
  • Detailed breakdown of instruction counts or other useful metrics

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % nit

common_tools/instruction_count.py Outdated Show resolved Hide resolved
monorimet and others added 2 commits October 7, 2024 11:29
@monorimet monorimet merged commit 218e39c into main Oct 7, 2024
@monorimet monorimet deleted the ean-isa-count branch October 7, 2024 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants