Fix use-after-free for ATT code objects (#35)

* Fix use-after-free for ATT code objects

* Formatting

* Temporary fix for last kernel

---------

Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com>

[ROCm/rocprofiler-sdk commit: 21c577ba60]
Этот коммит содержится в:
Baraldi, Giovanni
2024-12-04 19:22:57 +01:00
коммит произвёл GitHub
родитель 1055ba96b4
Коммит 145d94495a
4 изменённых файлов: 49 добавлений и 43 удалений
+3 -2
Просмотреть файл
@@ -43,6 +43,7 @@
#include <vector>
constexpr double WAVE_RATIO_TOLERANCE = 0.05;
constexpr size_t NUM_KERNELS = 5;
namespace ATTTest
{
@@ -59,12 +60,12 @@ dispatch_callback(rocprofiler_queue_id_t /* queue_id */,
rocprofiler_user_data_t* dispatch_userdata,
void* userdata)
{
C_API_BEGIN
static std::atomic<size_t> count{0};
if(count.fetch_add(1) > NUM_KERNELS) return ROCPROFILER_ATT_CONTROL_NONE;
assert(userdata && "Dispatch callback passed null!");
dispatch_userdata->ptr = userdata;
C_API_END
return ROCPROFILER_ATT_CONTROL_START_AND_STOP;
}