Skip to content

Commit

Permalink
Add basic benchmarking standard support
Browse files Browse the repository at this point in the history
  • Loading branch information
per-mathisen-arm committed Jun 27, 2024
1 parent 686f750 commit 6262682
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion external/tracetooltests
Submodule tracetooltests updated 95 files
+1 −0 .gitignore
+18 −5 CMakeLists.txt
+11 −0 benchmarking/gles_bindbufferrange_1.bench
+11 −0 benchmarking/gles_compute_1.bench
+11 −0 benchmarking/gles_compute_2.bench
+11 −0 benchmarking/gles_compute_3.bench
+11 −0 benchmarking/gles_copy_image_1.bench
+11 −0 benchmarking/gles_copytexsubimage3d.bench
+11 −0 benchmarking/gles_draw_1.bench
+11 −0 benchmarking/gles_draw_2.bench
+11 −0 benchmarking/gles_drawrange_1.bench
+11 −0 benchmarking/gles_drawrange_2.bench
+11 −0 benchmarking/gles_dummy_1.bench
+11 −0 benchmarking/gles_ext_gpu_shader5.bench
+11 −0 benchmarking/gles_ext_tessellation_shader.bench
+11 −0 benchmarking/gles_ext_texture_border_clamp.bench
+11 −0 benchmarking/gles_ext_texture_buffer.bench
+11 −0 benchmarking/gles_ext_texture_cube_map_array.bench
+11 −0 benchmarking/gles_ext_texture_sRGB_decode.bench
+11 −0 benchmarking/gles_extension_pack_es31a.bench
+11 −0 benchmarking/gles_geometry_shader_1.bench
+11 −0 benchmarking/gles_imagetex_1.bench
+11 −0 benchmarking/gles_indirectdraw_1.bench
+11 −0 benchmarking/gles_indirectdraw_2.bench
+11 −0 benchmarking/gles_khr_blend_equation_advanced.bench
+11 −0 benchmarking/gles_khr_debug.bench
+11 −0 benchmarking/gles_multisample_1.bench
+11 −0 benchmarking/gles_multisurface_1.bench
+11 −0 benchmarking/gles_multithread_1.bench
+11 −0 benchmarking/gles_multithread_2.bench
+11 −0 benchmarking/gles_multithread_3.bench
+11 −0 benchmarking/gles_oes_sample_shading.bench
+11 −0 benchmarking/gles_oes_texture_stencil8.bench
+11 −0 benchmarking/gles_programs_1.bench
+11 −0 benchmarking/gles_texsubimage3d.bench
+11 −0 benchmarking/gles_uninit_texture_1.bench
+11 −0 benchmarking/gles_uninit_texture_2.bench
+11 −0 benchmarking/gles_vertexbuffer_1.bench
+17 −0 benchmarking/vulkan_as_1.bench
+17 −0 benchmarking/vulkan_as_2.bench
+17 −0 benchmarking/vulkan_as_3.bench
+17 −0 benchmarking/vulkan_as_4.bench
+17 −0 benchmarking/vulkan_as_5.bench
+17 −0 benchmarking/vulkan_compute_1.bench
+18 −0 benchmarking/vulkan_compute_2.bench
+17 −0 benchmarking/vulkan_copying_1.bench
+18 −0 benchmarking/vulkan_copying_2.bench
+18 −0 benchmarking/vulkan_copying_3.bench
+17 −0 benchmarking/vulkan_debug_marker.bench
+17 −0 benchmarking/vulkan_debug_report.bench
+17 −0 benchmarking/vulkan_feature_1.bench
+18 −0 benchmarking/vulkan_general.bench
+17 −0 benchmarking/vulkan_init.bench
+17 −0 benchmarking/vulkan_memory_1.bench
+17 −0 benchmarking/vulkan_memory_1_1.bench
+17 −0 benchmarking/vulkan_multidevice_1.bench
+18 −0 benchmarking/vulkan_multiinstance.bench
+17 −0 benchmarking/vulkan_pipelinecache_1.bench
+17 −0 benchmarking/vulkan_pnext_chain.bench
+17 −0 benchmarking/vulkan_stress_1.bench
+17 −0 benchmarking/vulkan_thread_1.bench
+17 −0 benchmarking/vulkan_thread_2.bench
+17 −0 benchmarking/vulkan_thread_3.bench
+17 −0 benchmarking/vulkan_tool_1.bench
+17 −0 benchmarking/vulkan_xfb.bench
+328 −0 doc/BenchmarkingStandard.md
+10 −9 doc/VulkanContent.md
+24,765 −0 external/json.hpp
+0 −14 patches/vkquake1_patch.diff
+91 −0 scripts/demo_list.sh
+47 −127 scripts/functional_gfxr_demos.sh
+20 −13 scripts/functional_gfxr_games.sh
+16 −85 scripts/functional_gfxr_samples.sh
+37 −112 scripts/functional_lavatube_demos.sh
+90 −0 scripts/functional_vktrace_demos.sh
+60 −0 scripts/perf_cpu_demos.sh
+74 −0 scripts/perf_gpu_demos.sh
+63 −0 scripts/samples_list.sh
+5 −0 scripts/setup_benchmarks.sh
+48 −13 src/gles_common.cpp
+2 −0 src/gles_common.h
+31 −1 src/util.cpp
+51 −0 src/util.h
+4 −4 src/vulkan_as_4.cpp
+75 −23 src/vulkan_common.cpp
+18 −17 src/vulkan_common.h
+2 −0 src/vulkan_compute_2.cpp
+3 −0 src/vulkan_copying_1.cpp
+5 −4 src/vulkan_copying_2.cpp
+86 −0 src/vulkan_debug_marker.cpp
+43 −0 src/vulkan_debug_report.cpp
+1 −1 src/vulkan_feature_1.cpp
+10 −6 src/vulkan_general.cpp
+1 −1 src/vulkan_memory_mprotect.cpp
+12 −6 src/vulkan_stress_1.cpp
45 changes: 45 additions & 0 deletions scripts/lava-capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import argparse
import subprocess
import json

def args():
parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]), description='Trace a Vulkan application', allow_abbrev=False)
Expand All @@ -20,9 +21,50 @@ def args():
parser.add_argument('--dedicated-image', dest='dedimg', action='store_true', help='Request dedicated memory allocation for images')
parser.add_argument('--delayfence', dest='delayfence', metavar='<times>', help='Delay successful fence waits the given number of times')
parser.add_argument('--gpu', dest='gpu', metavar='<gpu>', help='Use the specified GPU for tracing')
parser.add_argument('--automate', dest='automate', action='store_true', help='Try to automate the run as much as possible if app supports CBS')
parser.add_argument('programAndArgs', metavar='<program> [<program args>]', nargs=argparse.REMAINDER, help='Application to capture and any program arguments')
return parser

# See https://github.com/ARM-software/tracetooltests/blob/main/doc/BenchmarkingStandard.md for details
def DetectCBS(args):
program = args.programAndArgs[0]
tail, base = os.path.split(program)
cap_file = None
if program.startswith('/usr/bin/'):
cap_file = '/usr/share/benchmarking/' + base + ".bench"
else:
cap_file = program + '.bench'

if not cap_file or not os.path.exists(cap_file):
print('No capabilities file found') # TBD remove too spammy
return # No capabilities file

if not os.path.isfile(cap_file) or not os.access(cap_file, os.R_OK):
print('Capabilities file %s is not a readable' % cap_file)
return

if 'BENCHMARKING_ENABLE_JSON' in os.environ or 'BENCHMARKING_ENABLE_PATH' in os.environ:
print('Existing benchmarking environment found - not overwriting')
return

cap_fp = open(cap_file, 'r') # should always load now
cap_data = json.load(cap_fp)
if not cap_data:
print('%s is not a valid JSON file' % cap_file)
return

enable_file = {}
enable_file['target'] = base
if 'capabilities' in cap_data and args.automate:
if 'non_interactive' in cap_data['capabilities'] and cap_data['capabilities']['non_interactive'] == 'option':
enable_file['capabilities'] = { 'non_interactive': true }
if 'fixed_framerate' in cap_data['capabilities'] and cap_data['capabilities']['fixed_framerate'] == 'option':
enable_file['capabilities'] = { 'fixed_framerate': 0 }
if 'gpu_frame_deterministic' in cap_data['capabilities'] and cap_data['capabilities']['gpu_frame_deterministic'] == 'option':
enable_file['capabilities'] = { 'gpu_frame_deterministic': true }

os.environ['BENCHMARKING_ENABLE_JSON'] = json.dumps(enable_file, sort_keys=True, separators=(',', ':'))

def PrintEnvVar(envVar):
if envVar in os.environ:
print((envVar, os.environ[envVar]))
Expand All @@ -46,6 +88,8 @@ def PrintEnvVar(envVar):
parser.print_help()
sys.exit(0)

DetectCBS(args)

PrintEnvVar('LAVATUBE_DESTINATION')
PrintEnvVar('LAVATUBE_DEBUG')
PrintEnvVar('LAVATUBE_DEBUG_FILE')
Expand All @@ -55,6 +99,7 @@ def PrintEnvVar(envVar):
PrintEnvVar('LAVATUBE_DEDICATED_BUFFER')
PrintEnvVar('LAVATUBE_DEDICATED_IMAGE')
PrintEnvVar('LAVATUBE_DELAY_FENCE_SUCCESS_FRAMES')
PrintEnvVar('BENCHMARKING_ENABLE_JSON')

if args.gdb:
result = subprocess.run(['gdb', '-q', '-ex', 'run', '--args'] + args.programAndArgs)
Expand Down

0 comments on commit 6262682

Please sign in to comment.