-
Notifications
You must be signed in to change notification settings - Fork 789
[SYCL] Enable discard_events mode for the Level Zero #6533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/verify with intel/llvm-test-suite#1132 |
/verify with intel/llvm-test-suite#1132 |
/verify with intel/llvm-test-suite#1132 |
SYCL/Plugin/level_zero_events_caching.cpp failure is unrelated to this PR, fix is uploaded for review here: intel/llvm-test-suite#1138 HIP backend failures are unrelated because changes are isolated to L0 plugin. |
@smaslov-intel Could you please review this PR? |
@@ -1374,6 +1377,10 @@ struct _pi_event : _pi_object { | |||
// being visible to the host at all. | |||
bool Completed = {false}; | |||
|
|||
// Indicates that event is internal, i.e. it is visible inside the L0 plugin | |||
// only. | |||
bool Internal = {false}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we instead do similar as we do for queue
llvm/sycl/plugins/level_zero/pi_level_zero.hpp
Line 1038 in bfc7e98
pi_uint32 RefCountExternal{1}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do optimization (2-event model) only for discarded events in in-order queue then bool variable seems enough. But if we want to extend optimization for events which are not discarded then we need this ref count of external references to know when event is not externally visible anymore.
So I used the ext ref count approach as suggested.
* Use RefCountExternal to keep track of external references * Rename PI_EXT_ONEAPI_QUEUE_DISCARD_EVENTS_MODE_ENABLE -> PI_EXT_ONEAPI_QUEUE_DISCARD_EVENTS * Pass property to all backends
@@ -686,7 +690,7 @@ inline static pi_result createEventAndAssociateQueue( | |||
// Append this Event to the CommandList, if any | |||
if (CommandList != Queue->CommandListMap.end()) { | |||
CommandList->second.append(*Event); | |||
PI_CALL(piEventRetain(*Event)); | |||
(*Event)->RefCount.increment(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: why is this change needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
piEventRetain increments external ref count, but we need to increment only internal ref count here. Same logic as for pi_queue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Uh oh!
There was an error while loading. Please reload this page.