Skip to content

pipeline: initialize once; klein: refuse engines whose I/O types differ - #27

Merged
jcelerier merged 1 commit into
mainfrom
fix/init-once-klein-io-check
Nov 7, 2026
Merged

jcelerier merged 1 commit into
mainfrom
fix/init-once-klein-io-check

Conversation

@jcelerier

Copy link
Copy Markdown
Owner

Follow-up to #26: this commit was on that branch locally but not pushed before the merge.

  • pipeline_create already runs init_cuda / npp / engines / buffers; pipeline_init_all running them again rebuilt every execution context and buffer (~0.7 s per pipeline, a transient second copy of the TensorRT activation memory) and leaked the first CUDA stream. init_all now only validates the handle; init_cuda keeps an existing stream. No C API symbol changes.
  • klein wrappers check each engine's tensor names and dtypes at load, so a qwen encoder from an older exporter is a load error instead of an illegal address that loses the CUDA context.

🤖 Generated with Claude Code

- pipeline_create already runs init_cuda / npp / engines / buffers, so
  pipeline_init_all running them again rebuilt every execution context and
  buffer (~0.7 s per pipeline, a transient second copy of the TensorRT
  activation memory) and leaked the first CUDA stream. init_all now only
  validates the handle; init_cuda keeps an existing stream; stream_ is
  zero-initialized. Output unchanged (48 sync presets pixel-identical).
- klein wrappers check each engine's tensor names and dtypes at load. A qwen
  encoder from an older exporter writes fp32 encoder_hidden_states into a
  bf16-sized buffer: an illegal address that lost the CUDA context. It is
  now a load error naming the tensor and asking for a rebuild.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C4EF6Wn6C3bruJdcjnT9n2
@jcelerier
jcelerier merged commit 4a93120 into main Nov 7, 2026
3 checks passed
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