2
0

Removing ATT buffer size limitation (#534)

* Removing SQTT buffer size limitation

* Update source/lib/rocprofiler-sdk/thread_trace/core.cpp

* Added testing for buffer size. Formatting.

* Add test as unstable

* Increase default buffer size

* Apply suggestions from code review

Co-authored-by: Indic, Vladimir <Vladimir.Indic@amd.com>

* Fix typo from code review

* Update tests/thread-trace/agent.cpp

---------

Co-authored-by: Giovanni <gbaraldi@amd.com>
Co-authored-by: Indic, Vladimir <Vladimir.Indic@amd.com>
Este cometimento está contido em:
Baraldi, Giovanni
2025-07-29 22:47:40 +02:00
cometido por GitHub
ascendente 2d8936362e
cometimento 1ba08cd4df
8 ficheiros modificados com 53 adições e 23 eliminações
+1 -1
Ver ficheiro
@@ -769,7 +769,7 @@ For MPI applications (or other job launchers such as SLURM), place rocprofv3 ins
att_options.add_argument(
"--att-buffer-size",
help="Thread trace buffer size. Default 96MB",
help="Thread trace buffer size. Default 256MB",
default=None,
type=str,
)
+2 -1
Ver ficheiro
@@ -139,7 +139,8 @@ struct config : output_config
int mpi_rank = get_mpi_rank();
uint64_t att_param_shader_engine_mask =
get_env<uint64_t>("ROCPROF_ATT_PARAM_SHADER_ENGINE_MASK", 0x1);
uint64_t att_param_buffer_size = get_env<uint64_t>("ROCPROF_ATT_PARAM_BUFFER_SIZE", 0x6000000);
// 256MB
uint64_t att_param_buffer_size = get_env<uint64_t>("ROCPROF_ATT_PARAM_BUFFER_SIZE", 0x10000000);
uint64_t att_param_simd_select = get_env<uint64_t>("ROCPROF_ATT_PARAM_SIMD_SELECT", 0xF);
uint64_t att_param_target_cu = get_env<uint64_t>("ROCPROF_ATT_PARAM_TARGET_CU", 1);
uint64_t att_param_perf_ctrl = get_env<uint64_t>("ROCPROF_ATT_PARAM_PERFCOUNTER_CTRL", 0);
+8
Ver ficheiro
@@ -184,6 +184,14 @@ aqlprofile_get_pmc_info(const aqlprofile_pmc_profile_t* profile,
aqlprofile_pmc_info_type_t attribute,
void* value);
typedef enum aqlprofile_att_parameter_name_ext_t
{
/**
* HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_ATT_BUFFER_SIZE + 1
*/
AQLPROFILE_ATT_PARAMETER_NAME_BUFFER_SIZE_HIGH = 11,
} aqlprofile_att_parameter_name_ext_t;
// Profile parameter object
typedef struct
{
+6 -2
Ver ficheiro
@@ -145,7 +145,8 @@ ThreadTraceAQLPacketFactory::ThreadTraceAQLPacketFactory(const hsa::AgentCache&
uint32_t cu = static_cast<uint32_t>(params.target_cu);
uint32_t shader_engine_mask = static_cast<uint32_t>(params.shader_engine_mask);
uint32_t simd = static_cast<uint32_t>(params.simd_select);
uint32_t buffer_size = static_cast<uint32_t>(params.buffer_size);
uint32_t buffer_size_lo = static_cast<uint32_t>(params.buffer_size);
uint32_t buffer_size_hi = static_cast<uint32_t>(params.buffer_size >> 32);
uint32_t perf_ctrl = static_cast<uint32_t>(params.perfcounter_ctrl);
aql_params.clear();
@@ -153,7 +154,10 @@ ThreadTraceAQLPacketFactory::ThreadTraceAQLPacketFactory(const hsa::AgentCache&
aql_params.push_back({HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_COMPUTE_UNIT_TARGET, {cu}});
aql_params.push_back({HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_SE_MASK, {shader_engine_mask}});
aql_params.push_back({HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_SIMD_SELECTION, {simd}});
aql_params.push_back({HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_ATT_BUFFER_SIZE, {buffer_size}});
aql_params.push_back({HSA_VEN_AMD_AQLPROFILE_PARAMETER_NAME_ATT_BUFFER_SIZE, {buffer_size_lo}});
if(buffer_size_hi != 0) aql_params.push_back({static_cast<hsa_ven_amd_aqlprofile_parameter_name_t>(
AQLPROFILE_ATT_PARAMETER_NAME_BUFFER_SIZE_HIGH), {buffer_size_hi}});
if(perf_ctrl != 0 && !params.perfcounters.empty())
{
+4 -5
Ver ficheiro
@@ -57,8 +57,7 @@ namespace rocprofiler
namespace thread_trace
{
constexpr size_t QUEUE_SIZE = 128;
constexpr uint64_t MIN_BUFFER_SIZE = 1 << 18; // 2 pages per SE
constexpr uint64_t MAX_BUFFER_SIZE = std::numeric_limits<int32_t>::max(); // aqlprofile limit
constexpr uint64_t MIN_BUFFER_SIZE = 1 << 20; // 1MB
struct cbdata_t
{
@@ -74,15 +73,15 @@ thread_trace_parameter_pack::are_params_valid() const
{
if(shader_cb_fn == nullptr)
{
ROCP_WARNING << "Callback cannot be null!";
ROCP_CI_LOG(WARNING) << "Callback cannot be null!";
return false;
}
if(shader_engine_mask == 0) return false;
if(buffer_size > MAX_BUFFER_SIZE || buffer_size < MIN_BUFFER_SIZE)
if(buffer_size < MIN_BUFFER_SIZE)
{
ROCP_WARNING << "Invalid buffer size: " << buffer_size;
ROCP_CI_LOG(WARNING) << "Invalid buffer size: " << buffer_size;
return false;
}