-
Notifications
You must be signed in to change notification settings - Fork 738
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Make queue hash dependent on its unique ID (#12578)
Using implementation pointer as the hash can lead to situations where queues consistently get assigned the same hash as a queue that has been destroyed (due to being allocated at the same address). In some cases, this can cause consistent hash collisions if a library uses these hashes as a fast way to detect a different queue being passed to it.
- Loading branch information
1 parent
3031733
commit 6b5cb12
Showing
7 changed files
with
69 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include <detail/queue_impl.hpp> | ||
#include <gtest/gtest.h> | ||
#include <helpers/PiMock.hpp> | ||
#include <sycl/queue.hpp> | ||
|
||
using namespace sycl; | ||
|
||
// Checks that the queue hash uses its unique ID. | ||
TEST(QueueHash, QueueHashUsesID) { | ||
unittest::PiMock Mock; | ||
queue Q; | ||
unsigned long long ID = detail::getSyclObjImpl(Q)->getQueueID(); | ||
ASSERT_EQ(std::hash<unsigned long long>{}(ID), std::hash<queue>{}(Q)); | ||
} |