PC Sampling - blit kernels handling (#878)

* correlation id 0 for blit kernels' samples

* rocprofiler_pc_sampling_snapshot_v1_t docs update (for future use)

* ROCPROFILER_CORRELATION_ID_VALUE_NONE introduced

* Simplifying ROCPROFILER_CORRELATION_ID_VALUE_NONE

* Apply suggestions from code review

Co-authored-by: Vladimir Indic <139573562+vlaindic@users.noreply.github.com>

---------

Co-authored-by: Jonathan R. Madsen <jrmadsen@users.noreply.github.com>
Tá an tiomantas seo le fáil i:
Vladimir Indic
2024-05-29 12:55:47 +02:00
tiomanta ag GitHub
tuismitheoir dc054eea76
tiomantas c45bf712d1
D'athraigh 4 comhad le 19 breiseanna agus 9 scriosta
@@ -176,8 +176,7 @@ data_ready_callback(void* client_callback_data,
if(pcs_parser_status != PCSAMPLE_STATUS_SUCCESS)
{
// TODO: should we end program here or somehow report an error to the user and continue?
throw std::runtime_error("Error while parsing PC samples");
ROCP_INFO << "PCS Parser encountered samples from a blit kernel.\n";
}
});
}
@@ -140,9 +140,9 @@ public:
if(dev.handle == cache_dev_id && correlation_in == cache_correlation_id_in)
return cache_correlation_id_out;
#endif
cache_correlation_id_out = dispatch_to_correlation.at({correlation_in, dev});
cache_dev_id = dev.handle;
cache_correlation_id_in = correlation_in;
cache_correlation_id_out = dispatch_to_correlation.at({correlation_in, dev});
return cache_correlation_id_out;
}
@@ -191,16 +191,17 @@ add_upcoming_samples(const device_handle device,
{
const auto* snap = reinterpret_cast<const perf_sample_snapshot_v1*>(buffer + p);
samples[p] = copySample<bHostTrap, GFXIP>((const void*) (buffer + p));
samples[p].size = 0; // pc sampling record with size 0 will indicate invalid sample
samples[p].size = sizeof(rocprofiler_pc_sampling_record_t);
try
{
Parser::trap_correlation_id_t trap{.raw = snap->correlation_id};
samples[p].correlation_id = corr_map->get(device, trap);
samples[p].size = sizeof(rocprofiler_pc_sampling_record_t);
// set size after corr_map->get which may throw
} catch(std::exception& e)
{
status = PCSAMPLE_STATUS_PARSER_ERROR;
samples[p].correlation_id = {.internal = ROCPROFILER_CORRELATION_ID_VALUE_NONE,
.external = rocprofiler_user_data_t{
.value = ROCPROFILER_CORRELATION_ID_VALUE_NONE}};
status = PCSAMPLE_STATUS_PARSER_ERROR;
}
}
return status;