Skip to content

Commit c238ace

Browse files
authored
[UR][Sanitizer] Fix of destroyed stack (#20475)
Stack sometimes is destroyed in EnqueueUSMSet() before USMFill() finishes Signed-off-by: Mateusz P. Nowak <mateusz.p.nowak@intel.com>
1 parent 29435fc commit c238ace

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

unified-runtime/source/loader/layers/sanitizer/sanitizer_common/sanitizer_utils.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ ur_result_t EnqueueUSMSet(ur_queue_handle_t Queue, void *Ptr, T Value,
7575
const ur_event_handle_t *EventWaitList = nullptr,
7676
ur_event_handle_t *OutEvent = nullptr) {
7777
assert(Size % sizeof(T) == 0);
78+
thread_local static T StaticValue;
79+
80+
StaticValue = Value;
7881
return getContext()->urDdiTable.Enqueue.pfnUSMFill(
79-
Queue, Ptr, sizeof(T), &Value, Size, NumEvents, EventWaitList, OutEvent);
82+
Queue, Ptr, sizeof(T), &StaticValue, Size, NumEvents, EventWaitList,
83+
OutEvent);
8084
}
8185

8286
void PrintUrBuildLogIfError(ur_result_t Result, ur_program_handle_t Program,

0 commit comments

Comments
 (0)