Skip to content

TensorRT-EdgeLLM 0.4.0 Release - #2

Closed
poweiw wants to merge 1 commit into
NVIDIA:mainfrom
poweiw:dev-release/0.4.0
Closed

poweiw wants to merge 1 commit into
NVIDIA:mainfrom
poweiw:dev-release/0.4.0

Conversation

@poweiw

@poweiw poweiw commented Dec 22, 2025

Copy link
Copy Markdown
Contributor

Key features

  • Refactored AttentionPlugin to use Tensor class and clearer shape checks
  • Enabled Open-AI style chat template
  • Enabled vocab reduction to improve lm_head time
  • Removed deprecated plugin fields
  • Added Qwen3-VL support
  • Added Phi-4-Multimodal support

@nvluxiaoz nvluxiaoz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we remove package.sh? This file seems not relevant.

@nvluxiaoz

Copy link
Copy Markdown
Collaborator

Fully verified that I can push to your branch. Nice.

@nvluxiaoz nvluxiaoz closed this Jan 5, 2026
suharvest added a commit to suharvest/TensorRT-Edge-LLM that referenced this pull request May 22, 2026
Codex final audit (finding #1) identified that the slot pool ALREADY
allocates per-slot IExecutionContext pairs (cpp:1914-1915 CP,
:2952-2953 Talker), but the hot path in three call sites
unconditionally falls back to the engine-global mPrefillContext /
mDecodeContext whenever no explicit ctxOverride is passed:

  - CP generatePreparedInputs at cpp:1099-1100
  - Talker prefill at cpp:2339-2341
  - Talker decode at cpp:2508

Two concurrent handleAudioGeneration calls pass `slot != nullptr` but
not `ctxOverride`, so both threads enqueueV3 against the SAME IContext.
TRT IExecutionContext is not safe for concurrent enqueue — each call
mutates input shapes, tensor address bindings, and profile index.
That is the cumulative-state-corruption root cause behind the
cudaMemsetAsync(state.read.rawPointer(), ...) illegal-access errors
observed after 2-3 N=2 bursts under the prior C1+C2+C3+C5 config.

Fix: in each of the three sites, when slot is non-null and owns a
context, route through slot->prefillCtxOwned.get() /
decodeCtxOwned.get() — keeping ctxOverride priority for the legacy
captureDecodingCUDAGraph path. ~10-15 LOC.

Empirical post-fix (orin-nx, profile jetson-multilang-highperf-nx,
OVS_TTS_WORKER_CONCURRENCY=2, max_workers=2):
  - 30 sustained N=2 dual-client bursts: zero broken-state TTFAs
  - Mid-stress + post-stress N=1 audio MD5 = baseline
    f515a4376962cca876f21089130d7253 (byte-identical)
  - Audio quality preserved across the full gauntlet

Caveat: throughput is now lower than the C2-first-burst peak. slow-
client TTFA p50 ~4× single-client baseline, vs 1.4× pre-C6. That's
likely findings NVIDIA#2 (slot reused mid-request) + NVIDIA#3 (resetSampling
mutates all slots) from the audit — coming in follow-up commits.
This commit closes the CRASH path; the THROUGHPUT path needs the
remaining audit items addressed.

Signed-off-by: suharvest <[email protected]>
suharvest added a commit to suharvest/TensorRT-Edge-LLM that referenced this pull request May 22, 2026
…ll request

Codex audit finding NVIDIA#2: at N=1 each engine method (prefill, decode)
acquired+released its own slot. With concurrent N=2 requests, two
threads played musical chairs with slots — request A's prefill
could write KV into slot 0, slot 0 returned to pool, request B's
decode then grabbed slot 0 and overwrote it. KV state corruption
cascaded down through the codec frame loop and surfaced as
cudaMemsetAsync(state.read.rawPointer(), ...) illegal-access in
Code2Wav after 2-3 N=2 bursts under the prior C6 ctx-per-slot
fix alone.

Fix: add Qwen3TTSTalkerEngine::beginRequest() / endRequest() and the
matching pair on Qwen3TTSCodePredictorEngine. Each one acquires the
slot once at request start and stores it in an mActiveSlots map
keyed by std::thread::id. The pre-existing slot-pool recursive
acquire path in prefill/decode now first checks getActiveSlot()
and uses that if present, only falling back to per-call acquire
when no request guard is in scope (matches N=1 byte-equivalence
at single-client).

handleAudioGeneration calls beginRequest on both engines at the
top of the function under an RAII EnginesRequestGuard that calls
endRequest on scope exit, covering all error paths. Worker
dispatch threads each run one handleAudioGeneration per request,
so std::thread::id-keyed map is stable for the request lifetime.

Empirical post-fix (orin-nx, profile jetson-multilang-highperf-nx,
OVS_TTS_WORKER_CONCURRENCY=2, max_workers=2):
  - 30 sustained N=2 dual-client bursts: zero broken-state TTFAs
  - Zero CUDA runtime errors in docker logs across the gauntlet
  - N=1 audio MD5 = f515a4376962cca876f21089130d7253 baseline
    before AND after the 30-run stress (byte-identical)

What's now SOLID:
  - Functional correctness under sustained concurrent load
  - Audio quality preservation
  - No crashes / no state corruption / no recovery needed

What's still NOT met (deferred to next phase, finding #D):
  - Throughput target ≤ 1.5× single-client TTFA
  - Current slow-client p50 ~5× single-client baseline
  - Root cause: worker uses ONE shared CUDA stream
    (examples/omni/qwen3_tts_worker.cpp:656-658) for all
    handleAudioGeneration calls — CUDA ops serialize on stream
    regardless of per-slot ctx. Real parallelism needs per-request
    CUDA stream creation in the worker dispatch path.

Signed-off-by: suharvest <[email protected]>
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.

2 participants