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

feat(ffi): extra FFI improvements #2679

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from
Draft

Conversation

a10y
Copy link
Contributor

@a10y a10y commented Mar 12, 2025

  • Expose projection pushdown over FFI
  • Enable object store reads over FFI
  • Generate C header file with cbindgen
  • Add buildable example for FFI with C

@a10y a10y force-pushed the aduffy/ffi-project-scan branch 2 times, most recently from 07f2edf to 3a9f1f9 Compare March 13, 2025 14:04
@a10y a10y marked this pull request as draft March 13, 2025 14:09
@@ -48,7 +48,6 @@ impl Field {
}

/// A path through a (possibly nested) struct, composed of a sequence of field selectors
// TODO(ngates): wrap `Vec<Field>` in Option for cheaper "root" path.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

empty Vec doesn't allocate

@@ -0,0 +1,72 @@
# Directory containing the Rust crate
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Claude wrote 99% of this Makefile 🚀

@a10y a10y force-pushed the aduffy/ffi-project-scan branch from 9231566 to 62e7c0d Compare March 13, 2025 18:15
Copy link

codspeed-hq bot commented Mar 13, 2025

CodSpeed Performance Report

Merging #2679 will degrade performances by 11.2%

Comparing aduffy/ffi-project-scan (78710fd) with develop (a873885)

Summary

❌ 1 regressions
✅ 774 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
new_raw_prim_test_between[i32, 2048] 19.5 µs 22 µs -11.2%

@a10y a10y force-pushed the aduffy/ffi-project-scan branch from ed97baa to 254d76b Compare March 13, 2025 18:44
@@ -43,7 +43,7 @@ impl ViewedDType {

impl StructDType {
/// Creates a new instance from a flatbuffer-defined object and its underlying buffer.
pub fn from_fb(fb_struct: fbd::Struct_<'_>, buffer: FlatBuffer) -> VortexResult<Self> {
fn from_fb(fb_struct: fbd::Struct_<'_>, buffer: FlatBuffer) -> VortexResult<Self> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i was browsing our docs.rs page and this method felt out of place, but not sure

@@ -15,7 +15,6 @@ use vortex::{Array, ArrayRef, ArrayVariants};
/// Because dyn Trait pointers cannot be shared across FFI, we create a new struct to hold
/// the wide pointer. The C FFI only seems a pointer to this structure, and can pass it into
/// one of the various `FFIArray_*` functions.
#[repr(C)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not actually repr(C), it's only accessed opaquely via pointer

pub struct FFIFile {
pub(crate) inner: VortexFile<GenericVortexFile<ObjectStoreReadAt>>,
}

/// Options supplied for opening a file.
#[repr(C)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not accessed opaquely, and thus needs to be repr(C) so we can build this struct in other languages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps this would be better opaque, and then build it using a function over FFI that accepts all of these fields as parameters. but that kinda is just the same thing? idk

@a10y a10y changed the title feat(ffi): expose projection for scans feat(ffi): extra FFI improvements Mar 14, 2025
@a10y a10y force-pushed the aduffy/ffi-project-scan branch from ccb6a54 to 78710fd Compare March 17, 2025 20:12
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.

1 participant