Commit 413e058
committed
[UR][L0] Fix event refcount bugs in L0 v1 adapter barrier handling
Fixes three issues in the Level Zero v1 adapter that caused
urEventWait to be called for an internal event crashes
and segfaults when mixing multiple in-order queues with
ext_oneapi_submit_barrier.
1. Fix insertBarrierIntoCmdList passing InterruptBasedEventsEnabled
as IsMultiDevice to createEventAndAssociateQueue. Barrier events
do not need multi-device visibility; pass false instead.
2. In urEventWait, replace die() with continue when hasExternalRefs()
is false. A recycled event (RefCountExternal == 0) was already
completed before recycling, so skipping the wait is safe.
3. In urEventRelease, use CleanupCompletedEvent (which is a no-op
when CleanedUp is true) instead of calling urEventReleaseInternal
directly. The old code double-released the internal refcount when
CleanupEventListFromResetCmdList had already cleaned the event.
UR_L0_SERIALIZE=2 masked the race by forcing synchronous execution.
UR_L0_DISABLE_EVENTS_CACHING=1 turned the recycling into a delete,
escalating the bug from a stale-data read to a segfault.
Fixes: #21704
Signed-off-by: Zhang, Winston <winston.zhang@intel.com>1 parent 57aa8ab commit 413e058
1 file changed
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | | - | |
| 205 | + | |
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| |||
796 | 797 | | |
797 | 798 | | |
798 | 799 | | |
799 | | - | |
| 800 | + | |
800 | 801 | | |
801 | 802 | | |
802 | 803 | | |
| |||
822 | 823 | | |
823 | 824 | | |
824 | 825 | | |
825 | | - | |
| 826 | + | |
826 | 827 | | |
827 | 828 | | |
828 | 829 | | |
| |||
894 | 895 | | |
895 | 896 | | |
896 | 897 | | |
897 | | - | |
898 | | - | |
899 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
900 | 901 | | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
| 902 | + | |
906 | 903 | | |
907 | 904 | | |
908 | 905 | | |
| |||
0 commit comments