Perfetto annotation from timemory components (#289)
* Annotate perfetto with timemory component data
- support perfetto annotations via timemory component data, e.g. use PAPI component for exact HW counter annotations
* Tests for perfetto annotation via timemory data
* Update omnitrace-instrument
- remove --default-components argument as this overrides any components set in configuration file
- required by perfetto annotation via timemory data tests
* filter unavailable timemory components
- filter out unavailable timemory components before attempting to invoke the annotate operation on the bundle
* update annotate tests
- account for no PAPI support
* update lulesh-timemory test
- replace '-d wall_clock peak_rss' with '--env OMNITRACE_TIMEMORY_COMPONENTS="wall_clock peak_rss"'
* annotate tests update
- fix misnamed test
* annotate tests update
- restrict binary rewrite to run function to force instrumentation despite heuristics
* annotate tests update
- print {available,overlapping,excluded,instrumented} functions during binary rewrite
* annotate tests update
- add allow-overlapping flag
* Support PAPI with CAP_SYS_ADMIN
- do not disable PAPI if perf_event_paranoid > 2 but has CAP_SYS_ADMIN capability
[ROCm/rocprofiler-systems commit: 1aca8c177b]
This commit is contained in:
committed by
GitHub
parent
a0812bfa0b
commit
c6929f545d
@@ -21,5 +21,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-critical-trace-tests.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-attach-tests.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-rccl-tests.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-overflow-tests.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-annotate-tests.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-causal-tests.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/omnitrace-python-tests.cmake)
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
#
|
||||
# papi tests
|
||||
#
|
||||
# -------------------------------------------------------------------------------------- #
|
||||
|
||||
if(OMNITRACE_USE_PAPI
|
||||
AND (omnitrace_perf_event_paranoid LESS_EQUAL 3
|
||||
OR omnitrace_cap_sys_admin EQUAL 0
|
||||
OR omnitrace_cap_perfmon EQUAL 0))
|
||||
set(_annotate_environment
|
||||
"${_base_environment}"
|
||||
"OMNITRACE_TIMEMORY_COMPONENTS=thread_cpu_clock papi_array"
|
||||
"OMNITRACE_PAPI_EVENTS=perf::PERF_COUNT_SW_CPU_CLOCK"
|
||||
"OMNITRACE_USE_SAMPLING=OFF")
|
||||
|
||||
omnitrace_add_test(
|
||||
SKIP_BASELINE SKIP_RUNTIME
|
||||
NAME annotate
|
||||
TARGET parallel-overhead
|
||||
RUN_ARGS 30 2 200
|
||||
REWRITE_ARGS
|
||||
-e
|
||||
-v
|
||||
2
|
||||
-R
|
||||
run
|
||||
--allow-overlapping
|
||||
--print-available
|
||||
functions
|
||||
--print-overlapping
|
||||
functions
|
||||
--print-excluded
|
||||
functions
|
||||
--print-instrumented
|
||||
functions
|
||||
--print-instructions
|
||||
ENVIRONMENT "${_annotate_environment}"
|
||||
LABELS "annotate;papi")
|
||||
|
||||
omnitrace_add_validation_test(
|
||||
NAME annotate-binary-rewrite
|
||||
PERFETTO_FILE "perfetto-trace.proto"
|
||||
LABELS "annotate;papi"
|
||||
ARGS --key-names perf::PERF_COUNT_SW_CPU_CLOCK thread_cpu_clock --key-counts 8 8)
|
||||
|
||||
omnitrace_add_validation_test(
|
||||
NAME annotate-sampling
|
||||
PERFETTO_FILE "perfetto-trace.proto"
|
||||
LABELS "papi"
|
||||
ARGS --key-names thread_cpu_clock --key-counts 6)
|
||||
else()
|
||||
set(_annotate_environment
|
||||
"${_base_environment}" "OMNITRACE_TIMEMORY_COMPONENTS=thread_cpu_clock"
|
||||
"OMNITRACE_USE_SAMPLING=OFF")
|
||||
|
||||
omnitrace_add_test(
|
||||
SKIP_BASELINE SKIP_RUNTIME
|
||||
NAME annotate
|
||||
TARGET parallel-overhead
|
||||
RUN_ARGS 30 2 200
|
||||
REWRITE_ARGS
|
||||
-e
|
||||
-v
|
||||
2
|
||||
-R
|
||||
run
|
||||
--allow-overlapping
|
||||
--print-available
|
||||
functions
|
||||
--print-overlapping
|
||||
functions
|
||||
--print-excluded
|
||||
functions
|
||||
--print-instrumented
|
||||
functions
|
||||
--print-instructions
|
||||
ENVIRONMENT "${_annotate_environment}"
|
||||
LABELS "annotate")
|
||||
|
||||
omnitrace_add_validation_test(
|
||||
NAME annotate-binary-rewrite
|
||||
PERFETTO_FILE "perfetto-trace.proto"
|
||||
LABELS "annotate"
|
||||
ARGS --key-names thread_cpu_clock --key-counts 8)
|
||||
|
||||
omnitrace_add_validation_test(
|
||||
NAME annotate-sampling
|
||||
PERFETTO_FILE "perfetto-trace.proto"
|
||||
LABELS "annotate"
|
||||
ARGS --key-names thread_cpu_clock --key-counts 6)
|
||||
endif()
|
||||
@@ -119,9 +119,8 @@ omnitrace_add_test(
|
||||
--dynamic-callsites
|
||||
-ME
|
||||
[==[libgomp]==]
|
||||
-d
|
||||
wall_clock
|
||||
peak_rss
|
||||
--env
|
||||
OMNITRACE_TIMEMORY_COMPONENTS="wall_clock peak_rss"
|
||||
RUN_ARGS -i 10 -s 20 -p
|
||||
ENVIRONMENT
|
||||
"${_timemory_environment};OMNITRACE_CRITICAL_TRACE=OFF;OMNITRACE_USE_KOKKOSP=OFF"
|
||||
|
||||
@@ -995,22 +995,24 @@ function(OMNITRACE_ADD_VALIDATION_TEST)
|
||||
)
|
||||
endif()
|
||||
|
||||
add_test(
|
||||
NAME validate-${TEST_NAME}-timemory
|
||||
COMMAND
|
||||
${OMNITRACE_VALIDATION_PYTHON}
|
||||
${CMAKE_CURRENT_LIST_DIR}/validate-timemory-json.py -m ${TEST_TIMEMORY_METRIC}
|
||||
${TEST_ARGS} -i
|
||||
${PROJECT_BINARY_DIR}/omnitrace-tests-output/${TEST_NAME}/${TEST_TIMEMORY_FILE}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
if(TEST_TIMEMORY_FILE)
|
||||
add_test(
|
||||
NAME validate-${TEST_NAME}-timemory
|
||||
COMMAND
|
||||
${OMNITRACE_VALIDATION_PYTHON}
|
||||
${CMAKE_CURRENT_LIST_DIR}/validate-timemory-json.py -m
|
||||
"${TEST_TIMEMORY_METRIC}" ${TEST_ARGS} -i
|
||||
${PROJECT_BINARY_DIR}/omnitrace-tests-output/${TEST_NAME}/${TEST_TIMEMORY_FILE}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
if(OMNITRACE_VALIDATION_PYTHON_PERFETTO EQUAL 0)
|
||||
if(OMNITRACE_VALIDATION_PYTHON_PERFETTO EQUAL 0 AND TEST_PERFETTO_FILE)
|
||||
add_test(
|
||||
NAME validate-${TEST_NAME}-perfetto
|
||||
COMMAND
|
||||
${OMNITRACE_VALIDATION_PYTHON}
|
||||
${CMAKE_CURRENT_LIST_DIR}/validate-perfetto-proto.py -m
|
||||
${TEST_PERFETTO_METRIC} ${TEST_ARGS} -i
|
||||
"${TEST_PERFETTO_METRIC}" ${TEST_ARGS} -i
|
||||
${PROJECT_BINARY_DIR}/omnitrace-tests-output/${TEST_NAME}/${TEST_PERFETTO_FILE}
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
endif()
|
||||
|
||||
@@ -71,6 +71,20 @@ if __name__ == "__main__":
|
||||
"-p", "--print", action="store_true", help="Print the processed perfetto data"
|
||||
)
|
||||
parser.add_argument("-i", "--input", type=str, help="Input file", required=True)
|
||||
parser.add_argument(
|
||||
"--key-names",
|
||||
type=str,
|
||||
help="Require debug args contain a specific key",
|
||||
default=[],
|
||||
nargs="*",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--key-counts",
|
||||
type=int,
|
||||
help="Required number of debug args",
|
||||
default=[],
|
||||
nargs="*",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -128,6 +142,26 @@ if __name__ == "__main__":
|
||||
except RuntimeError as e:
|
||||
print(f"{e}")
|
||||
ret = 1
|
||||
|
||||
for key_name, key_count in zip(args.key_names, args.key_counts):
|
||||
slice_args = tp.query(
|
||||
f"select * from slice join args using (arg_set_id) where key='debug.{key_name}'"
|
||||
)
|
||||
count = 0
|
||||
if args.print:
|
||||
print(f"{key_name} (expected: {key_count}):")
|
||||
for row in slice_args:
|
||||
count += 1
|
||||
if args.print:
|
||||
for key, val in row.__dict__.items():
|
||||
print(f" - {key:20} :: {val}")
|
||||
print(f"Number of entries with {key_name} = {count} (expected: {key_count})")
|
||||
if key_count != count:
|
||||
ret = 1
|
||||
|
||||
if ret == 0:
|
||||
print(f"{args.input} validated")
|
||||
else:
|
||||
print(f"Failure validating {args.input}")
|
||||
|
||||
sys.exit(ret)
|
||||
|
||||
Reference in New Issue
Block a user