Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ package-test:
examples/setup_test_model.rs \
examples/stream.rs \
examples/structured.rs \
src/abi.rs \
src/callback.rs \
src/engine.rs \
src/error.rs \
Expand Down Expand Up @@ -726,7 +727,7 @@ package-test:
((sys_unpacked_size <= 40 * 1024 * 1024))
((sys_entry_count <= 1400))
((safe_package_size <= 128 * 1024))
((safe_unpacked_size <= 256 * 1024))
((safe_unpacked_size <= 512 * 1024))
((safe_entry_count <= 40))

jq -e --arg version "$version" '
Expand Down
62 changes: 61 additions & 1 deletion vllm-cpp/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@ impl Compatibility {
unsafe { ffi::vllm_transcription_params_default() }
}

pub(crate) fn video_model_params_default(&self) -> ffi::vllm_video_model_params {
// SAFETY: possession of this token proves exact ABI equality before
// this versioned struct is returned by value.
unsafe { ffi::vllm_video_model_params_default() }
}

pub(crate) fn video_params_default(&self) -> ffi::vllm_video_params {
// SAFETY: possession of this token proves exact ABI equality before
// this versioned struct is returned by value.
unsafe { ffi::vllm_video_params_default() }
}

pub(crate) fn video_mux_params_default(&self) -> ffi::vllm_video_mux_params {
// SAFETY: possession of this token proves exact ABI equality before
// this versioned struct is returned by value.
unsafe { ffi::vllm_video_mux_params_default() }
}

fn from_actual(actual: i32) -> Result<Self, Error> {
let expected = ffi::VLLM_ABI_VERSION as i32;
if actual != expected {
Expand Down Expand Up @@ -68,6 +86,30 @@ impl Compatibility {
) -> ffi::vllm_transcription_params {
default()
}

#[cfg(test)]
fn video_model_params_default_with(
&self,
default: impl FnOnce() -> ffi::vllm_video_model_params,
) -> ffi::vllm_video_model_params {
default()
}

#[cfg(test)]
fn video_params_default_with(
&self,
default: impl FnOnce() -> ffi::vllm_video_params,
) -> ffi::vllm_video_params {
default()
}

#[cfg(test)]
fn video_mux_params_default_with(
&self,
default: impl FnOnce() -> ffi::vllm_video_mux_params,
) -> ffi::vllm_video_mux_params {
default()
}
}

#[cfg(test)]
Expand Down Expand Up @@ -119,14 +161,32 @@ mod tests {
// SAFETY: every field in this generated C struct permits zero.
unsafe { std::mem::zeroed() }
});
compatibility.video_model_params_default_with(|| {
calls.borrow_mut().push("video_model_default");
// SAFETY: every field in this generated C struct permits zero.
unsafe { std::mem::zeroed() }
});
compatibility.video_params_default_with(|| {
calls.borrow_mut().push("video_default");
// SAFETY: every field in this generated C struct permits zero.
unsafe { std::mem::zeroed() }
});
compatibility.video_mux_params_default_with(|| {
calls.borrow_mut().push("video_mux_default");
// SAFETY: every field in this generated C struct permits zero.
unsafe { std::mem::zeroed() }
});

assert_eq!(
*calls.borrow(),
[
"abi",
"model_default",
"sampling_default",
"transcription_default"
"transcription_default",
"video_model_default",
"video_default",
"video_mux_default"
]
);
}
Expand Down
Loading
Loading