From 12f1e9720684907240b736cbe823f84417972960 Mon Sep 17 00:00:00 2001 From: Meyer Zinn Date: Tue, 19 Mar 2024 01:00:10 +0000 Subject: [PATCH] reduce vertex metadata size --- libgalois/include/galois/graphs/LS_LC_CSR_Graph.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libgalois/include/galois/graphs/LS_LC_CSR_Graph.h b/libgalois/include/galois/graphs/LS_LC_CSR_Graph.h index 78e78c62b..8357d8821 100644 --- a/libgalois/include/galois/graphs/LS_LC_CSR_Graph.h +++ b/libgalois/include/galois/graphs/LS_LC_CSR_Graph.h @@ -251,7 +251,8 @@ class LS_LC_CSR_Graph : private boost::noncopyable { } private: - struct VertexMetadata : public SpinLock { + struct VertexMetadata { + std::atomic_uint8_t spinlock = ATOMIC_VAR_INIT(0); uint8_t buffer : 1; uint64_t begin : 48; // inclusive uint64_t end : 48; // exclusive @@ -266,6 +267,13 @@ class LS_LC_CSR_Graph : private boost::noncopyable { VertexMetadata(VertexMetadata&& other) : buffer(std::move(other.buffer)), begin(std::move(other.begin)), end(std::move(other.end)), degree(std::move(other.degree)) {} + + inline void lock() { + while (spinlock.exchange(1, std::memory_order_acquire)) + ; + } + + inline void unlock() { spinlock.store(0, std::memory_order_release); } }; struct EdgeMetadata {