Skip to content

Commit e5676ee

Browse files
committed
reverted to ab4bc29 of btx_zeinterval_callbacks
1 parent 0eb2972 commit e5676ee

1 file changed

Lines changed: 40 additions & 16 deletions

File tree

‎backends/ze/btx_zeinterval_callbacks.hpp‎

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,44 @@ typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_pwr_handle
4141
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_freq_handle_t> hpdfreq_t;
4242
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_engine_handle_t> hpdeng_t;
4343

44-
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_mem_handle_t, uint32_t> hpdmsd_t;
45-
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_fabric_port_handle_t, uint32_t> hpdfsd_t;
46-
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_engine_handle_t, uint32_t> hpdesd_t;
47-
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_pwr_handle_t, uint32_t> hpdpwrd_t;
44+
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_mem_handle_t, uint32_t>
45+
hpdmsd_t;
46+
typedef std::
47+
tuple<hostname_t, process_id_t, zes_device_handle_t, zes_fabric_port_handle_t, uint32_t>
48+
hpdfsd_t;
49+
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_engine_handle_t, uint32_t>
50+
hpdesd_t;
51+
typedef std::tuple<hostname_t, process_id_t, zes_device_handle_t, zes_pwr_handle_t, uint32_t>
52+
hpdpwrd_t;
4853

4954
using btx_kernel_group_size_t = std::tuple<uint32_t, uint32_t, uint32_t>;
5055
using btx_kernel_desct_t =
5156
std::tuple<std::string /*ze_kernel_desc_t*/, ze_kernel_properties_t, btx_kernel_group_size_t>;
5257

53-
enum class btx_event_t { TRAFFIC, KERNEL, OTHER };
58+
// SIGNAL = zeCommandListAppendSignalEvent. Ring entry is created so state
59+
// stays consistent, but filtered out of the device tally (no GPU work).
60+
enum class btx_event_t { TRAFFIC, KERNEL, SIGNAL, OTHER };
5461
using btx_additional_info_traffic_t = std::tuple<int64_t /*ts*/, size_t /*size*/>;
5562
using btx_additional_info_kernel_t = std::string /*metadata*/;
5663
using btx_additional_info =
5764
std::variant<std::monostate, btx_additional_info_traffic_t, btx_additional_info_kernel_t>;
5865

59-
using btx_launch_desc_t =
60-
std::tuple<ze_command_list_handle_t, std::string /*name*/, int64_t /*ts min */,
61-
btx_event_t /* type of enum */, btx_additional_info /* additional data */>;
62-
63-
using btx_event_desct_t =
64-
std::tuple<thread_id_t, ze_command_queue_desc_t, ze_command_list_handle_t,
65-
bool /*hCommandListIsImmediate*/, ze_device_handle_t, std::string /*name*/,
66-
int64_t /*ts born min*/, clock_lttng_device_t /* clock sync pair */,
67-
btx_event_t /* type of enum */,
68-
btx_additional_info /* pointer to additional data */>;
66+
using btx_launch_desc_t = std::tuple<ze_command_list_handle_t,
67+
std::string /*name*/,
68+
int64_t /*ts min */,
69+
btx_event_t /* type of enum */,
70+
btx_additional_info /* additional data */>;
71+
72+
using btx_event_desct_t = std::tuple<thread_id_t,
73+
ze_command_queue_desc_t,
74+
ze_command_list_handle_t,
75+
bool /*hCommandListIsImmediate*/,
76+
ze_device_handle_t,
77+
std::string /*name*/,
78+
int64_t /*ts born min*/,
79+
clock_lttng_device_t /* clock sync pair */,
80+
btx_event_t /* type of enum */,
81+
btx_additional_info /* pointer to additional data */>;
6982

7083
using btx_command_list_desc_t =
7184
std::tuple<ze_command_queue_desc_t, ze_device_handle_t, bool /*hCommandListIsImmediate*/>;
@@ -82,7 +95,18 @@ struct data_s {
8295
std::unordered_map<hp_command_queue_t, ze_command_queue_desc_t> commandQueueToDesc;
8396

8497
std::unordered_map<hpt_t, btx_launch_desc_t> threadToLastLaunchInfo;
85-
std::unordered_map<hp_event_t, btx_event_desct_t> eventToBtxDesct;
98+
99+
/* Per-event metadata ring. An hEvent can be the signal event of N
100+
* Appends in one build phase, and the cl can be resubmitted M times,
101+
* yielding M*N result events. We store the N Appends as a vector and
102+
* advance `cursor` per result, wrapping at the end. A new push that
103+
* arrives after the cursor advanced indicates a new build phase —
104+
* we clear and start over so the ring tracks only the current phase. */
105+
struct event_ring_t {
106+
std::vector<btx_event_desct_t> entries;
107+
size_t cursor = 0;
108+
};
109+
std::unordered_map<hp_event_t, event_ring_t> eventToBtxDesct;
86110
// Require for non IMM
87111
std::unordered_map<hp_command_list_t, std::unordered_set<ze_event_handle_t>> commandListToEvents;
88112

0 commit comments

Comments
 (0)