Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GIE/Runtime] Support Entry Trait in GIE/Runtime #2300

Merged
merged 12 commits into from Jan 19, 2023

Conversation

BingqingLyu
Copy link
Collaborator

@BingqingLyu BingqingLyu commented Dec 6, 2022

What do these changes do?

As titled.

A test of PatternMatch on LDBC.30 shows a 10-40% acceleration in time cost (when using a IdEntry in ExpandItersect).

Related issue number

Fixes #2317

@BingqingLyu BingqingLyu marked this pull request as draft December 6, 2022 03:19
@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2022

Codecov Report

Merging #2300 (67d1f96) into main (7836d85) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2300   +/-   ##
=======================================
  Coverage   39.95%   39.95%           
=======================================
  Files          88       88           
  Lines        9757     9757           
=======================================
  Hits         3898     3898           
  Misses       5859     5859           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7836d85...67d1f96. Read the comment docs.

@BingqingLyu BingqingLyu marked this pull request as ready for review December 7, 2022 02:49
Copy link
Collaborator

@longbinlai longbinlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments in Entry definitions.


#[derive(Debug)]
pub enum EntryDataType {
Vid, // A vertex global id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not assume Vid. Id is fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Vid here since we may need to specify whether it is a Vid or Eid when getting properties in Auxilia. It would be modified as an Id once we separate GetVProp and GetEProp from Auxilia.

fn eq(&self, other: &Self) -> bool {
match (self, other) {
(EntryDataType::Vid, EntryDataType::Vid)
| (EntryDataType::Vid, EntryDataType::V)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why V and Vid should be compared to equal?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vid (for now) denotes an IdOnlyVertex, and can be compared with a V. Later, it can also be reffered as an IdOnlyEdge, etc.


pub trait Entry: Debug + Send + Sync + AsAny + Element {
fn get_type(&self) -> EntryDataType;
fn as_vid(&self) -> Option<ID> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly as_id()

impl Eq for DynEntry {}

// demanded when need to group (ToSum) the entry;
impl std::ops::Add for DynEntry {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we should not implement Add for entry.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Move this logic into the implementation of Accumulator.

P,
Obj,
Intersect,
Collection,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment these entry options.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

#[derive(Debug, Clone, Default)]
pub struct IDEntry {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IdEntry. BTW, for the next a few definitions, can put VertexEntry, EdgeEntry, PathEntry, IntersectionEntry and CollectionEntry. Anyway, if we already have DynEntry, why we should have so many different entry definitions?

}
}

impl From<Vertex> for DynEntry {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not implement

impl<E: Entry + 'static> From<E> for DynEntry { ... }

Then the new() function in DynEntry can be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot do this since DynEntry is also an Entry, and we'll get the error:

error[E0119]: conflicting implementations of trait `std::convert::From<process::entry::DynEntry>` for type `process::entry::DynEntry`
   --> runtime/src/process/entry.rs:574:1
    |
574 | impl<E: Entry + 'static> From<E> for DynEntry {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: conflicting implementation in crate `core`:
            - impl<T> From<T> for T;

pub struct Intersection {
vertex_vec: Vec<Vertex>,
pub struct IntersectionEntry {
vertex_vec: Vec<ID>,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also comment in details for what the IntersectionEntry is, and how it will be used.

@BingqingLyu BingqingLyu merged commit d797bbe into alibaba:main Jan 19, 2023
@BingqingLyu BingqingLyu deleted the runtime_entry branch January 19, 2023 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GIE/Runtime] Support Entry Trait for optimization
3 participants