<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/185728>185728</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[Offload] Add support for measuring elapsed time between events
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
leandrolcampos
</td>
</tr>
</table>
<pre>
The LLVM Offload API currently provides event objects that can be used for synchronization and completion tracking, but it does not appear to provide a way to measure elapsed time between two events, similar to `cudaEventElapsedTime` in CUDA.
For performance work, it is often important to measure kernel execution time directly from the device execution timeline rather than relying only on host-side timers around submission and synchronization calls.
### Requested feature
Add an API to measure elapsed time between two events recorded on a queue, for example something conceptually similar to:
```c
ol_result_t olGetEventElapsedTime(ol_event_handle_t Start,
ol_event_handle_t End,
float *Milliseconds);
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMlEGP2zYThn8NfRmsIVFrW3vQQdldf_iABC3atFdjRI4tdimOQg7tuL--oOWgi6RAKxAQpCGH77zPkJiSOwWiTm0-qM3LCrOMHDtPGGxkb3CaOa0Gttfu80jw8ePvn-Cn49EzWuh__j-YHCMF8VeYI5-dpQR0piDAwx9kJIGMKGAwwECQE1k4coR0DWaMHNyfKI4DYLBgeJo93T4lonlz4aT0MwxZwAlYpgSBBXCeCSMIf9sQEC54LT8mwpQjAXmcy07iJoKB5EIUQC68KEsla3KT80sata1MtvhaYq_Lys9uIrWtwAV4_u2lX6uqV1W_5wgzxSPHCYMhuHB8K7mcgEvAR6EAbpo5CgZ5r-eNYiAP9JVMXuorwqyLZIpxx8gTyEhg6ewMfTfPu0AQUUaKxcsAkfzVhRNw8FfgACMneUjFiDI9JsDIOVhIeZhcSt_s_d5yg96ne2VKN8uAX-hLpiQFE6HkSMuE3lrAcAP-332GSIajJVtUInzJlKn4VRqAvmKhDYknkrGUYzgYmiWj99d3eFTT3zVuq2UYVfXsD5FS9nIQYP8_kh_o6Zb94abjMGKwng4CvwpGUfpZVT38GH0N9h7716e0v4DS_SfnvUtkONik9JNqPrxXurJdY5-aJ1xRV-92Tb2r6uZxNXbVrrWWcFvt8HG7w1oP5qgtbhqi9qiRVq7Tld5WTV3VT_Wmada23dXbyiKZoa7atlWPFU3o_Nr787TmeFq5lDJ1dbvZ6XblcSCfbmda60AXuEWV1uWIx64sehjyKanHyrsk6e804sTfLoP7IVebFyj0U55LZ9_gLfwLtH_sgIX-KkffjSJzKgj1Xun9ycmYh7XhSel92fH-epgjl8tC6f1NZ1J6fy_k3Om_AgAA__8rl5M-">