Skip to content
Merged
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
14 changes: 7 additions & 7 deletions crates/onnx-genai-engine/src/engine/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2981,7 +2981,7 @@ mod tests {
fn interpreted_engine_with_byte_budget(budget_bytes: u64) -> anyhow::Result<Engine> {
interpreted_engine_inner(
budget_bytes,
crate::pipeline::generation::TestWorkflowShape::Stateless,
crate::pipeline::generation::TestSessionShape::Stateless,
)
}

Expand All @@ -2996,7 +2996,7 @@ mod tests {
fn interpreted_session_engine_with_byte_budget(budget_bytes: u64) -> anyhow::Result<Engine> {
interpreted_engine_inner(
budget_bytes,
crate::pipeline::generation::TestWorkflowShape::LoopCarriedSession,
crate::pipeline::generation::TestSessionShape::LoopCarriedSession,
)
}

Expand All @@ -3008,14 +3008,14 @@ mod tests {
) -> anyhow::Result<Engine> {
interpreted_engine_inner(
budget_bytes,
crate::pipeline::generation::TestWorkflowShape::PromptPrefixConversation,
crate::pipeline::generation::TestSessionShape::PromptPrefixConversation,
)
}

#[cfg(feature = "native-backend")]
fn interpreted_engine_inner(
budget_bytes: u64,
shape: crate::pipeline::generation::TestWorkflowShape,
shape: crate::pipeline::generation::TestSessionShape,
) -> anyhow::Result<Engine> {
let tokenizer_path = Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../../tests/fixtures/tiny-llm/tokenizer.json")
Expand All @@ -3034,13 +3034,13 @@ mod tests {
)?;
Ok(Engine {
workflow: Box::new(match shape {
crate::pipeline::generation::TestWorkflowShape::Stateless => {
crate::pipeline::generation::TestSessionShape::Stateless => {
crate::pipeline::generation::test_decoder_runtime()?
}
crate::pipeline::generation::TestWorkflowShape::LoopCarriedSession => {
crate::pipeline::generation::TestSessionShape::LoopCarriedSession => {
crate::pipeline::generation::test_session_decoder_runtime()?
}
crate::pipeline::generation::TestWorkflowShape::PromptPrefixConversation => {
crate::pipeline::generation::TestSessionShape::PromptPrefixConversation => {
crate::pipeline::generation::test_conversation_decoder_runtime()?
}
}),
Expand Down
16 changes: 8 additions & 8 deletions crates/onnx-genai-engine/src/pipeline/generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ fn loop_carried_cell_names(

#[cfg(test)]
pub(crate) fn test_decoder_runtime() -> anyhow::Result<WorkflowRuntime> {
test_decoder_runtime_inner(TestWorkflowShape::Stateless)
test_decoder_runtime_inner(TestSessionShape::Stateless)
}

/// The same canonical decoder, declaring the conversation it carries.
Expand All @@ -945,7 +945,7 @@ pub(crate) fn test_decoder_runtime() -> anyhow::Result<WorkflowRuntime> {
/// unrelated fixtures.
#[cfg(all(test, feature = "native-backend"))]
pub(crate) fn test_session_decoder_runtime() -> anyhow::Result<WorkflowRuntime> {
test_decoder_runtime_inner(TestWorkflowShape::LoopCarriedSession)
test_decoder_runtime_inner(TestSessionShape::LoopCarriedSession)
}

/// A package whose session carries the conversation as a **prompt prefix**.
Expand All @@ -967,13 +967,13 @@ pub(crate) fn test_session_decoder_runtime() -> anyhow::Result<WorkflowRuntime>
/// binding carries has no reader inside the workflow.
#[cfg(all(test, feature = "native-backend"))]
pub(crate) fn test_conversation_decoder_runtime() -> anyhow::Result<WorkflowRuntime> {
test_decoder_runtime_inner(TestWorkflowShape::PromptPrefixConversation)
test_decoder_runtime_inner(TestSessionShape::PromptPrefixConversation)
}

/// Which of the three declarable session shapes a test fixture should build.
#[cfg(test)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub(crate) enum TestWorkflowShape {
pub(crate) enum TestSessionShape {
/// All state invocation-scoped: every turn restarts.
Stateless,
/// The cells the loop threads are session-scoped, so turns continue.
Expand All @@ -984,7 +984,7 @@ pub(crate) enum TestWorkflowShape {
}

#[cfg(test)]
fn test_decoder_runtime_inner(shape: TestWorkflowShape) -> anyhow::Result<WorkflowRuntime> {
fn test_decoder_runtime_inner(shape: TestSessionShape) -> anyhow::Result<WorkflowRuntime> {
let abi = onnx_genai_metadata::DecoderAbi {
token_input: Some("input_ids".to_string()),
logits_output: Some("logits".to_string()),
Expand All @@ -1000,7 +1000,7 @@ fn test_decoder_runtime_inner(shape: TestWorkflowShape) -> anyhow::Result<Workfl
.map_err(|error| {
anyhow::anyhow!("a minimal decoder is expressible as a workflow: {error:?}")
})?;
if shape == TestWorkflowShape::PromptPrefixConversation {
if shape == TestSessionShape::PromptPrefixConversation {
// Every constraint below is one the validator enforces on a
// continuation, asserted here by construction rather than discovered as
// a validation failure with no explanation attached. `conversation` is
Expand Down Expand Up @@ -1081,7 +1081,7 @@ fn test_decoder_runtime_inner(shape: TestWorkflowShape) -> anyhow::Result<Workfl
fixture pins a carry the scheduler never charges for"
);
}
if shape == TestWorkflowShape::LoopCarriedSession {
if shape == TestSessionShape::LoopCarriedSession {
let carried = loop_carried_cell_names(&workflow.steps);
anyhow::ensure!(
!carried.is_empty(),
Expand All @@ -1107,7 +1107,7 @@ fn test_decoder_runtime_inner(shape: TestWorkflowShape) -> anyhow::Result<Workfl
or this fixture proves nothing about sessions"
);
}
if shape != TestWorkflowShape::Stateless {
if shape != TestSessionShape::Stateless {
// The lease and the capability are one statement, and the validator
// says so: a reader that cannot honour leased state must be able to
// see that it is being asked to. Both session shapes declare a lease,
Expand Down
Loading