SWDEV-516846: Fix serialization services conflicts and ATT counter streaming (#230)
* Update TT API * Rework serialization * update att_core * Fix tests * Fix tool * Formatting * Fix perfcounter * Formatting * Rename agent TT * Format * Workaround for codeQL alert * Tidy fix * Fix compiler error * Tidy * Fix some tests * Fixing some tests * formatting * Fixing ATT serialization * Format * Fix test commandline * Fixing init order * Format * Tidy fixes * Removing unused sample * Fix tests and schema * Added ATT + PMC test * Fix mode * Fix file mode * Review comments * Fix typo * Review comments * Review comments * Fix missing id inc after review comment * Review comments * Suggested Fixes * Testing changes * Test fix * Build fixes * Minor build fix --------- Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com> Co-authored-by: Benjamin Welton <bewelton@amd.com> Co-authored-by: Welton, Benjamin <Benjamin.Welton@amd.com>
This commit is contained in:
zatwierdzone przez
GitHub
rodzic
914923f688
commit
821918a512
@@ -38,7 +38,7 @@ add_subdirectory(pc-sampling)
|
||||
add_subdirectory(collection-period)
|
||||
add_subdirectory(rocdecode-trace)
|
||||
add_subdirectory(rocjpeg-trace)
|
||||
if(TARGET att_decoder_testing)
|
||||
if(TARGET att_decoder_testing1)
|
||||
add_subdirectory(advanced-thread-trace)
|
||||
endif()
|
||||
add_subdirectory(hip-stream-display)
|
||||
|
||||
@@ -18,12 +18,14 @@ find_package(rocprofiler-sdk REQUIRED)
|
||||
|
||||
# hsa multiqueue dependency test
|
||||
|
||||
message("Add rocprofv3-test-hsa-multiqueue-att-cmd-env-ld-lib-path-execute")
|
||||
|
||||
add_test(
|
||||
NAME rocprofv3-test-hsa-multiqueue-att-cmd-env-ld-lib-path-execute
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --log-level env --advanced-thread-trace
|
||||
1 --att-target-cu 1 --att-shader-engine-mask 0x11 --kernel-include-regex copyD
|
||||
--att-buffer-size 0x6000000 --att-simd-select 0x3 --att-parse testing
|
||||
--att-buffer-size 0x6000000 --att-simd-select 0x3 --att-parse testing1
|
||||
--att-serialize-all 1 -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace/cmd_input -o
|
||||
out --output-format json ${PRELOAD_ARGS} --
|
||||
$<TARGET_FILE:hsa_code_object_testapp>)
|
||||
@@ -38,7 +40,7 @@ add_test(
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --log-level env --advanced-thread-trace
|
||||
1 --att-target-cu 1 --att-shader-engine-mask 0x11 --kernel-include-regex copyD
|
||||
--att-buffer-size 0x6000000 --att-simd-select 0x3 --att-parse testing
|
||||
--att-buffer-size 0x6000000 --att-simd-select 0x3 --att-parse testing1
|
||||
--att-serialize-all 1 -d ${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace/cmd_input -o
|
||||
out --output-format json ${PRELOAD_ARGS} --
|
||||
$<TARGET_FILE:hsa_code_object_testapp>)
|
||||
@@ -96,8 +98,8 @@ set_tests_properties(
|
||||
"rocprofv3-test-hsa-multiqueue-att-json-execute" FAIL_REGULAR_EXPRESSION
|
||||
"AssertionError")
|
||||
|
||||
if(TARGET rocprofiler-sdk::att-decoder-testing AND TARGET
|
||||
rocprofiler-sdk::att-decoder-summary)
|
||||
if(TARGET rocprofiler-sdk::att-decoder-testing1 AND TARGET
|
||||
rocprofiler-sdk::att-decoder-testing2)
|
||||
set(MISSING_TEST_DECODER_LIBS OFF)
|
||||
else()
|
||||
set(MISSING_TEST_DECODER_LIBS ON)
|
||||
@@ -144,7 +146,7 @@ add_test(
|
||||
NAME rocprofv3-test-att-library-path-cmd-line
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --att --att-library-path
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/att --att-parse summary --log-level env --echo
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/att --att-parse testing2 --log-level env --echo
|
||||
-- sleep 0)
|
||||
|
||||
set_tests_properties(
|
||||
@@ -156,7 +158,7 @@ add_test(
|
||||
NAME rocprofv3-test-att-library-path-cmd-line-will-fail
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --att --att-library-path
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/att --att-parse testing --log-level env --echo
|
||||
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/att --att-parse testing1 --log-level env --echo
|
||||
-- sleep 0)
|
||||
|
||||
set_tests_properties(
|
||||
@@ -168,7 +170,7 @@ set_tests_properties(
|
||||
# Uses ROCPROF_ATT_LIBRARY_PATH to specify ATT library path
|
||||
#
|
||||
add_test(NAME rocprofv3-test-att-library-path-env-var
|
||||
COMMAND $<TARGET_FILE:rocprofiler-sdk::rocprofv3> --att --att-parse summary
|
||||
COMMAND $<TARGET_FILE:rocprofiler-sdk::rocprofv3> --att --att-parse testing2
|
||||
--log-level env --echo -- sleep 0)
|
||||
|
||||
set_tests_properties(
|
||||
@@ -178,7 +180,7 @@ set_tests_properties(
|
||||
"${MISSING_TEST_DECODER_LIBS}")
|
||||
|
||||
add_test(NAME rocprofv3-test-att-library-path-env-var-will-fail
|
||||
COMMAND $<TARGET_FILE:rocprofiler-sdk::rocprofv3> --att --att-parse testing
|
||||
COMMAND $<TARGET_FILE:rocprofiler-sdk::rocprofv3> --att --att-parse testing1
|
||||
--log-level env --echo -- sleep 0)
|
||||
|
||||
set_tests_properties(
|
||||
@@ -193,3 +195,19 @@ set_tests_properties(
|
||||
ON
|
||||
DISABLED
|
||||
"${MISSING_TEST_DECODER_LIBS}")
|
||||
|
||||
#
|
||||
# Uses ATT and Counter Collection at the same time
|
||||
#
|
||||
add_test(
|
||||
NAME rocprofv3-test-hsa-multiqueue-att-plus-pmc-execute
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --log-level env --pmc SQ_WAVES
|
||||
--advanced-thread-trace --att-parse testing1 -d
|
||||
${CMAKE_CURRENT_BINARY_DIR}/%argt%-trace/cmd_input -o out --output-format json
|
||||
${PRELOAD_ARGS} -- $<TARGET_FILE:vector-ops>)
|
||||
|
||||
set_tests_properties(
|
||||
rocprofv3-test-hsa-multiqueue-att-plus-pmc-execute
|
||||
PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT
|
||||
LD_LIBRARY_PATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{LD_LIBRARY_PATH})
|
||||
|
||||
@@ -9,12 +9,13 @@
|
||||
],
|
||||
"truncate_kernels": true,
|
||||
"advanced_thread_trace": true,
|
||||
"att_parse": "testing",
|
||||
"att_parse": "testing1",
|
||||
"att_target_cu": 1,
|
||||
"att_shader_engine_mask": "0x11",
|
||||
"att_simd_select": "0x3",
|
||||
"att_buffer_size": "0x6000000",
|
||||
"att_perfcounters": "SQ_WAVES:0x1 SQ_INSTS_VALU:0x3 SQ_INSTS_SALU:0xF"
|
||||
"att_perfcounters": "SQ_WAVES:0x1 SQ_INSTS_VALU:0x3 SQ_INSTS_SALU",
|
||||
"att_perfcounter_ctrl": 3
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
jobs:
|
||||
- advanced_thread_trace: True
|
||||
att_parse: summary
|
||||
att_parse: testing2
|
||||
att_library_path:
|
||||
- @LIBRARY_OUTPUT_DIR@/att
|
||||
|
||||
- advanced_thread_trace: True
|
||||
att_parse: summary
|
||||
att_parse: testing2
|
||||
att_library_path:
|
||||
- @LIBRARY_OUTPUT_DIR@/att
|
||||
- @LIBRARY_OUTPUT_DIR@
|
||||
|
||||
- advanced_thread_trace: True
|
||||
att_parse: testing
|
||||
att_parse: testing1
|
||||
att_library_path:
|
||||
- @LIBRARY_OUTPUT_DIR@/att
|
||||
- @LIBRARY_OUTPUT_DIR@
|
||||
|
||||
- advanced_thread_trace: True
|
||||
att_parse: testing
|
||||
att_parse: testing1
|
||||
|
||||
- advanced_thread_trace: True
|
||||
att_parse: testing
|
||||
att_parse: testing1
|
||||
att_library_path:
|
||||
- @LIBRARY_OUTPUT_DIR@
|
||||
|
||||
- advanced_thread_trace: True
|
||||
att_parse: testing
|
||||
att_parse: testing1
|
||||
att_library_path:
|
||||
- @LIBRARY_OUTPUT_DIR@
|
||||
|
||||
@@ -19,11 +19,14 @@ def test_code_object_memory(code_object_file_path, json_data, output_path):
|
||||
data = json_data["rocprofiler-sdk-tool"]
|
||||
tool_memory_load = data["strings"]["code_object_snapshot_filenames"]
|
||||
gfx_pattern = "gfx[a-z0-9]+"
|
||||
match = re.search(gfx_pattern, tool_memory_load[0])
|
||||
match = re.search(gfx_pattern, tool_memory_load[1])
|
||||
assert match != None
|
||||
gpu_name = match.group(0)
|
||||
tool_memory_load_1 = open(os.path.join(output_path, tool_memory_load[0]), "rb")
|
||||
tool_memory_load_2 = open(os.path.join(output_path, tool_memory_load[1]), "rb")
|
||||
|
||||
read_bytes = lambda filename: open(os.path.join(output_path, filename), "rb").read()
|
||||
# Loads all saved code objects
|
||||
tool_memory = [read_bytes(saved) for saved in tool_memory_load[1:]]
|
||||
|
||||
found = False
|
||||
for hsa_file in code_object_file_path["hsa_memory_load"]:
|
||||
|
||||
@@ -33,11 +36,9 @@ def test_code_object_memory(code_object_file_path, json_data, output_path):
|
||||
|
||||
if gpu == gpu_name:
|
||||
found = True
|
||||
hsa_memory_load = open(hsa_file, "rb")
|
||||
hsa_memory_fs = hsa_memory_load.read()
|
||||
tool_memory_fs_1 = tool_memory_load_1.read()
|
||||
tool_memory_fs_2 = tool_memory_load_2.read()
|
||||
assert hsa_memory_fs == tool_memory_fs_2 or hsa_memory_fs == tool_memory_fs_1
|
||||
hsa_memory_bytes = open(hsa_file, "rb").read()
|
||||
# Checks if hsa_file is one of the saved code objects
|
||||
assert any([hsa_memory_bytes == fs for fs in tool_memory])
|
||||
break
|
||||
assert found == True
|
||||
|
||||
|
||||
@@ -123,12 +123,12 @@ query_available_agents(rocprofiler_agent_version_t /* version */,
|
||||
parameters.push_back({ROCPROFILER_ATT_PARAMETER_SERIALIZE_ALL, 0});
|
||||
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_configure_agent_thread_trace_service(agent_ctx,
|
||||
parameters.data(),
|
||||
parameters.size(),
|
||||
agent->id,
|
||||
Callbacks::shader_data_callback,
|
||||
user),
|
||||
rocprofiler_configure_device_thread_trace_service(agent_ctx,
|
||||
agent->id,
|
||||
parameters.data(),
|
||||
parameters.size(),
|
||||
Callbacks::shader_data_callback,
|
||||
user),
|
||||
"thread trace service configure");
|
||||
}
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
|
||||
@@ -73,14 +73,36 @@ tool_init(rocprofiler_client_finalize_t /* fini_func */, void* tool_data)
|
||||
std::vector<rocprofiler_att_parameter_t> params{};
|
||||
params.push_back({ROCPROFILER_ATT_PARAMETER_SERIALIZE_ALL, 1});
|
||||
|
||||
std::vector<rocprofiler_agent_id_t> agents{};
|
||||
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_configure_dispatch_thread_trace_service(client_ctx,
|
||||
params.data(),
|
||||
params.size(),
|
||||
dispatch_callback,
|
||||
Callbacks::shader_data_callback,
|
||||
tool_data),
|
||||
"thread trace service configure");
|
||||
rocprofiler_query_available_agents(
|
||||
ROCPROFILER_AGENT_INFO_VERSION_0,
|
||||
[](rocprofiler_agent_version_t, const void** _agents, size_t _num_agents, void* _data) {
|
||||
auto* agent_v = static_cast<std::vector<rocprofiler_agent_id_t>*>(_data);
|
||||
for(size_t i = 0; i < _num_agents; ++i)
|
||||
{
|
||||
auto* agent = static_cast<const rocprofiler_agent_v0_t*>(_agents[i]);
|
||||
if(agent->type == ROCPROFILER_AGENT_TYPE_GPU) agent_v->emplace_back(agent->id);
|
||||
}
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
},
|
||||
sizeof(rocprofiler_agent_v0_t),
|
||||
&agents),
|
||||
"Failed to iterate agents");
|
||||
|
||||
for(auto id : agents)
|
||||
{
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_configure_dispatch_thread_trace_service(client_ctx,
|
||||
id,
|
||||
params.data(),
|
||||
params.size(),
|
||||
dispatch_callback,
|
||||
Callbacks::shader_data_callback,
|
||||
tool_data),
|
||||
"thread trace service configure");
|
||||
}
|
||||
|
||||
int valid_ctx = 0;
|
||||
ROCPROFILER_CALL(rocprofiler_context_is_valid(client_ctx, &valid_ctx),
|
||||
|
||||
@@ -83,10 +83,36 @@ tool_init(rocprofiler_client_finalize_t /* fini_func */, void* tool_data)
|
||||
tool_data),
|
||||
"code object tracing service configure");
|
||||
|
||||
std::vector<rocprofiler_agent_id_t> agents{};
|
||||
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_configure_dispatch_thread_trace_service(
|
||||
client_ctx, nullptr, 0, dispatch_callback, Callbacks::shader_data_callback, tool_data),
|
||||
"thread trace service configure");
|
||||
rocprofiler_query_available_agents(
|
||||
ROCPROFILER_AGENT_INFO_VERSION_0,
|
||||
[](rocprofiler_agent_version_t, const void** _agents, size_t _num_agents, void* _data) {
|
||||
auto* agent_v = static_cast<std::vector<rocprofiler_agent_id_t>*>(_data);
|
||||
for(size_t i = 0; i < _num_agents; ++i)
|
||||
{
|
||||
auto* agent = static_cast<const rocprofiler_agent_v0_t*>(_agents[i]);
|
||||
if(agent->type == ROCPROFILER_AGENT_TYPE_GPU) agent_v->emplace_back(agent->id);
|
||||
}
|
||||
return ROCPROFILER_STATUS_SUCCESS;
|
||||
},
|
||||
sizeof(rocprofiler_agent_v0_t),
|
||||
&agents),
|
||||
"Failed to iterate agents");
|
||||
|
||||
for(auto id : agents)
|
||||
{
|
||||
ROCPROFILER_CALL(
|
||||
rocprofiler_configure_dispatch_thread_trace_service(client_ctx,
|
||||
id,
|
||||
nullptr,
|
||||
0,
|
||||
dispatch_callback,
|
||||
Callbacks::shader_data_callback,
|
||||
tool_data),
|
||||
"thread trace service configure");
|
||||
}
|
||||
|
||||
int valid_ctx = 0;
|
||||
ROCPROFILER_CALL(rocprofiler_context_is_valid(client_ctx, &valid_ctx),
|
||||
|
||||
Reference in New Issue
Block a user