C++ headers for std::hash, operator==, operator!= (#833)

* C++ headers for std::hash, operator==, operator!=

* std::hash specializations for some HSA types
This commit is contained in:
Jonathan R. Madsen authored and GitHub committed 2024-05-02 01:50:28 -05:00
1 parent d15cf17635
commit bf75579566
6 files changed
+199 -47

No files matched your search

+2 -15
View File
@@ -41,6 +41,8 @@
#include <rocprofiler-sdk/internal_threading.h>
#include <rocprofiler-sdk/marker/api_id.h>
#include <rocprofiler-sdk/rocprofiler.h>
#include <rocprofiler-sdk/cxx/hash.hpp>
#include <rocprofiler-sdk/cxx/operators.hpp>
#include <glog/logging.h>
@@ -67,21 +69,6 @@ __gcov_dump(void);
namespace common = ::rocprofiler::common;
namespace tool = ::rocprofiler::tool;
namespace std
{
template <>
struct hash<rocprofiler_agent_id_t>
{
size_t operator()(rocprofiler_agent_id_t id) const { return id.handle; }
};
} // namespace std
inline bool
operator==(rocprofiler_agent_id_t lhs, rocprofiler_agent_id_t rhs)
{
return (lhs.handle == rhs.handle);
}
namespace
{
constexpr uint32_t lds_block_size = 128 * 4;
@@ -35,6 +35,7 @@
#include <rocprofiler-sdk/fwd.h>
#include <rocprofiler-sdk/registration.h>
#include <rocprofiler-sdk/rocprofiler.h>
#include <rocprofiler-sdk/cxx/operators.hpp>
#include <fmt/core.h>
#include <gtest/gtest.h>
@@ -342,18 +343,6 @@ private:
} // namespace hsa
} // namespace rocprofiler
bool
operator==(rocprofiler_dim3_t lhs, rocprofiler_dim3_t rhs)
{
return std::tie(lhs.x, lhs.y, lhs.z) == std::tie(rhs.x, rhs.y, rhs.z);
}
bool
operator==(rocprofiler_agent_id_t lhs, rocprofiler_agent_id_t rhs)
{
return (lhs.handle == rhs.handle);
}
namespace
{
struct expected_dispatch