Skip to content

Commit 28711a7

Browse files
[SYCL] Check for duplicates in handler::addAccessorReq()
Constructor of accessors add them to MRequirements and MAccStorage of the associated handler, so do not add duplicates here if same handler was used during construction.
1 parent 7116e9d commit 28711a7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sycl/source/handler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,14 @@ void handler::SetHostTask(std::function<void(interop_handle)> &&Func) {
20562056
}
20572057

20582058
void handler::addAccessorReq(detail::AccessorImplPtr Accessor) {
2059+
// Constructor of accessors add them to MRequirements and MAccStorage
2060+
// of the associated handler, so do not add duplicates if use same
2061+
// handler as during construction.
2062+
if (impl->CGData.MRequirements.end() !=
2063+
std::find(impl->CGData.MRequirements.begin(),
2064+
impl->CGData.MRequirements.end(), Accessor.get()))
2065+
return;
2066+
20592067
// Add accessor to the list of requirements.
20602068
impl->CGData.MRequirements.push_back(Accessor.get());
20612069
// Store copy of the accessor.

0 commit comments

Comments
 (0)