Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
liulx20 committed Jan 12, 2025
1 parent d514b16 commit f72570b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,6 @@ Context EdgeExpand::expand_vertex_ep_gt(const GraphReadInterface& graph,
}
}
SLVertexColumnBuilder builder(std::get<0>(label_dirs[0]));
size_t csr_idx = 0;
std::vector<size_t> offsets;
for (auto& csr : views) {
size_t idx = 0;
Expand All @@ -806,7 +805,6 @@ Context EdgeExpand::expand_vertex_ep_gt(const GraphReadInterface& graph,
});
++idx;
}
++csr_idx;
}
std::shared_ptr<IContextColumn> col = builder.finish();
ctx.set_with_reshuffle(params.alias, col, offsets);
Expand Down
4 changes: 2 additions & 2 deletions flex/storages/rt_mutable_graph/csr/adj_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class MutableAdjlist {
nbr.timestamp.store(ts);
}

slice_t get_edges() const {
inline slice_t get_edges() const {
slice_t ret;
ret.set_size(size_.load(std::memory_order_acquire));
ret.set_begin(buffer_);
return ret;
}

mut_slice_t get_edges_mut() {
inline mut_slice_t get_edges_mut() {
mut_slice_t ret;
ret.set_size(size_.load());
ret.set_begin(buffer_);
Expand Down
42 changes: 24 additions & 18 deletions flex/storages/rt_mutable_graph/csr/mutable_csr.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,11 +532,13 @@ class MutableCsr : public TypedMutableCsrBase<EDATA_T> {
locks_[src].unlock();
}

slice_t get_edges(vid_t v) const override {
inline slice_t get_edges(vid_t v) const override {
return adj_lists_[v].get_edges();
}

mut_slice_t get_edges_mut(vid_t i) { return adj_lists_[i].get_edges_mut(); }
inline mut_slice_t get_edges_mut(vid_t i) {
return adj_lists_[i].get_edges_mut();
}

void close() override {
if (locks_ != nullptr) {
Expand Down Expand Up @@ -642,11 +644,11 @@ class MutableCsr<std::string_view>
csr_.put_edge(src, dst, index, ts, alloc);
}

slice_t get_edges(vid_t i) const override {
inline slice_t get_edges(vid_t i) const override {
return slice_t(csr_.get_edges(i), column_);
}

mut_slice_t get_edges_mut(vid_t i) {
inline mut_slice_t get_edges_mut(vid_t i) {
return mut_slice_t(csr_.get_edges_mut(i), column_);
}

Expand Down Expand Up @@ -726,11 +728,11 @@ class MutableCsr<RecordView> : public TypedMutableCsrBase<RecordView> {
csr_.put_edge(src, dst, index, ts, alloc);
}

slice_t get_edges(vid_t i) const override {
inline slice_t get_edges(vid_t i) const override {
return slice_t(csr_.get_edges(i), table_);
}

mut_slice_t get_edges_mut(vid_t i) {
inline mut_slice_t get_edges_mut(vid_t i) {
return mut_slice_t(csr_.get_edges_mut(i), table_);
}

Expand Down Expand Up @@ -918,7 +920,7 @@ class SingleMutableCsr : public TypedMutableCsrBase<EDATA_T> {
nbr_list_[src].timestamp.store(ts);
}

slice_t get_edges(vid_t v) const override {
inline slice_t get_edges(vid_t v) const override {
slice_t ret;
ret.set_size(nbr_list_[v].timestamp.load() ==
std::numeric_limits<timestamp_t>::max()
Expand All @@ -930,7 +932,7 @@ class SingleMutableCsr : public TypedMutableCsrBase<EDATA_T> {
return ret;
}

mut_slice_t get_edges_mut(vid_t i) {
inline mut_slice_t get_edges_mut(vid_t i) {
mut_slice_t ret;
ret.set_size(nbr_list_[i].timestamp.load() ==
std::numeric_limits<timestamp_t>::max()
Expand All @@ -942,7 +944,7 @@ class SingleMutableCsr : public TypedMutableCsrBase<EDATA_T> {
return ret;
}

const nbr_t& get_edge(vid_t i) const { return nbr_list_[i]; }
inline const nbr_t& get_edge(vid_t i) const { return nbr_list_[i]; }

void close() override { nbr_list_.reset(); }

Expand Down Expand Up @@ -1029,17 +1031,17 @@ class SingleMutableCsr<std::string_view>
put_edge(src, dst, index, ts, alloc);
}

slice_t get_edges(vid_t i) const override {
inline slice_t get_edges(vid_t i) const override {
auto ret = csr_.get_edges(i);
return slice_t(ret, column_);
}

mut_slice_t get_edges_mut(vid_t i) {
inline mut_slice_t get_edges_mut(vid_t i) {
auto ret = csr_.get_edges_mut(i);
return mut_slice_t(ret, column_);
}

MutableNbr<std::string_view> get_edge(vid_t i) const {
inline MutableNbr<std::string_view> get_edge(vid_t i) const {
MutableNbr<std::string_view> nbr;
auto nbr_tmp = csr_.get_edge(i);
nbr.neighbor = nbr_tmp.neighbor;
Expand Down Expand Up @@ -1131,12 +1133,12 @@ class SingleMutableCsr<RecordView> : public TypedMutableCsrBase<RecordView> {
put_edge(src, dst, index, ts, alloc);
}

slice_t get_edges(vid_t i) const override {
inline slice_t get_edges(vid_t i) const override {
auto ret = csr_.get_edges(i);
return slice_t(ret, table_);
}

mut_slice_t get_edges_mut(vid_t i) {
inline mut_slice_t get_edges_mut(vid_t i) {
auto ret = csr_.get_edges_mut(i);
return mut_slice_t(ret, table_);
}
Expand All @@ -1152,7 +1154,7 @@ class SingleMutableCsr<RecordView> : public TypedMutableCsrBase<RecordView> {
Table table_;
};

RecordNbr get_edge(vid_t i) const {
inline RecordNbr get_edge(vid_t i) const {
auto nbr = csr_.get_edge(i);
return RecordNbr(&nbr, table_);
}
Expand Down Expand Up @@ -1225,7 +1227,7 @@ class EmptyCsr : public TypedMutableCsrBase<EDATA_T> {
return std::numeric_limits<timestamp_t>::max();
}

slice_t get_edges(vid_t v) const override { return slice_t::empty(); }
inline slice_t get_edges(vid_t v) const override { return slice_t::empty(); }

void close() override {}
};
Expand Down Expand Up @@ -1282,7 +1284,9 @@ class EmptyCsr<std::string_view>
MutableNbrSliceMut<std::string_view>::empty(column_));
}

slice_t get_edges(vid_t v) const override { return slice_t::empty(column_); }
inline slice_t get_edges(vid_t v) const override {
return slice_t::empty(column_);
}

void close() override {}

Expand Down Expand Up @@ -1341,7 +1345,9 @@ class EmptyCsr<RecordView> : public TypedMutableCsrBase<RecordView> {
MutableNbrSliceMut<RecordView>::empty(table_));
}

slice_t get_edges(vid_t v) const override { return slice_t::empty(table_); }
inline slice_t get_edges(vid_t v) const override {
return slice_t::empty(table_);
}

void close() override {}

Expand Down
10 changes: 5 additions & 5 deletions flex/storages/rt_mutable_graph/csr/nbr.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,18 @@ class MutableNbrSlice {
public:
using const_nbr_t = const MutableNbr<EDATA_T>;
using const_nbr_ptr_t = const MutableNbr<EDATA_T>*;
MutableNbrSlice() : ptr_(nullptr), size_(0){};
MutableNbrSlice() : ptr_(nullptr), size_(0) {};
MutableNbrSlice(const MutableNbrSlice& rhs)
: ptr_(rhs.ptr_), size_(rhs.size_) {}
~MutableNbrSlice() = default;

void set_size(int size) { size_ = size; }
int size() const { return size_; }
inline int size() const { return size_; }

void set_begin(const_nbr_ptr_t ptr) { ptr_ = ptr; }

const_nbr_ptr_t begin() const { return ptr_; }
const_nbr_ptr_t end() const { return ptr_ + size_; }
inline const_nbr_ptr_t begin() const { return ptr_; }
inline const_nbr_ptr_t end() const { return ptr_ + size_; }

static MutableNbrSlice empty() {
MutableNbrSlice ret;
Expand Down Expand Up @@ -432,7 +432,7 @@ class MutableNbrSliceMut {
public:
using nbr_t = MutableNbr<EDATA_T>;
using nbr_ptr_t = MutableNbr<EDATA_T>*;
MutableNbrSliceMut() : ptr_(nullptr), size_(0){};
MutableNbrSliceMut() : ptr_(nullptr), size_(0) {};
~MutableNbrSliceMut() = default;

void set_size(int size) { size_ = size; }
Expand Down

0 comments on commit f72570b

Please sign in to comment.