diff --git a/tt_metal/impl/buffers/global_circular_buffer.cpp b/tt_metal/impl/buffers/global_circular_buffer.cpp index 4d438e91fcc..2d8760f1af5 100644 --- a/tt_metal/impl/buffers/global_circular_buffer.cpp +++ b/tt_metal/impl/buffers/global_circular_buffer.cpp @@ -159,3 +159,12 @@ uint32_t GlobalCircularBuffer::size() const { return this->size_; } } // namespace v1 } // namespace tt::tt_metal + +namespace std { + +std::size_t hash::operator()( + const tt::tt_metal::v1::experimental::GlobalCircularBuffer& global_circular_buffer) const { + return tt::stl::hash::hash_objects_with_default_seed(global_circular_buffer); +} + +} // namespace std diff --git a/tt_metal/impl/buffers/global_circular_buffer.hpp b/tt_metal/impl/buffers/global_circular_buffer.hpp index c263fe47d00..d18ed91e0c4 100644 --- a/tt_metal/impl/buffers/global_circular_buffer.hpp +++ b/tt_metal/impl/buffers/global_circular_buffer.hpp @@ -76,3 +76,12 @@ class GlobalCircularBuffer { } // namespace v1 } // namespace tt::tt_metal + +namespace std { + +template <> +struct hash { + std::size_t operator()(const tt::tt_metal::v1::experimental::GlobalCircularBuffer& global_circular_buffer) const; +}; + +} // namespace std diff --git a/tt_metal/impl/buffers/global_semaphore.cpp b/tt_metal/impl/buffers/global_semaphore.cpp index 807e74a8e10..64d16beb377 100644 --- a/tt_metal/impl/buffers/global_semaphore.cpp +++ b/tt_metal/impl/buffers/global_semaphore.cpp @@ -77,3 +77,12 @@ void GlobalSemaphore::reset_semaphore_value() { } } // namespace tt::tt_metal + +namespace std { + +std::size_t hash::operator()( + const tt::tt_metal::GlobalSemaphore& global_semaphore) const { + return tt::stl::hash::hash_objects_with_default_seed(global_semaphore); +} + +} // namespace std diff --git a/tt_metal/impl/buffers/global_semaphore.hpp b/tt_metal/impl/buffers/global_semaphore.hpp index 6c2f8d17947..f6d657998f8 100644 --- a/tt_metal/impl/buffers/global_semaphore.hpp +++ b/tt_metal/impl/buffers/global_semaphore.hpp @@ -44,6 +44,9 @@ class GlobalSemaphore { void reset_semaphore_value(); + static constexpr auto attribute_names = std::forward_as_tuple("cores", "initial_value"); + const auto attribute_values() const { return std::make_tuple(this->cores_, this->initial_value_); } + private: void setup_buffer(BufferType buffer_type); @@ -59,3 +62,12 @@ class GlobalSemaphore { } // namespace v0 } // namespace tt::tt_metal + +namespace std { + +template <> +struct hash { + std::size_t operator()(const tt::tt_metal::GlobalSemaphore& global_semaphore) const; +}; + +} // namespace std