Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ba1f808
[None][feat] Rubin kernels & attention: DSV4/DSA, Helix, CuteDSL GEMM
reasonsolo Sep 15, 2026
860350e
[None][feat] restore the Rubin fused-FC12 NVFP4 MoE op registration
reasonsolo Sep 15, 2026
6f843fa
[None][fix] drop two stray args from the mixed-cluster grid call
reasonsolo Sep 16, 2026
f79af97
[None][fix] repair two defects in the GatedMLP SwiGLU fallback test
reasonsolo Sep 16, 2026
ce8e2b7
[None][fix] gate the fused NVFP4 SwiGLU epilogue on swiglu_limit
reasonsolo Sep 16, 2026
f847447
[None][fix] accept q_rope_applied in the mla_rope_generation fake impl
reasonsolo Sep 16, 2026
bf6a9fe
[None][fix] restore SM107 in the CuteDSL MLA decode reduction path
reasonsolo Sep 16, 2026
29b1b2f
[None][chore] move the Helix verify-group work out of this PR
reasonsolo Sep 16, 2026
cc0120b
[None][fix] rebase the new DSA TopK tests onto main's production code
reasonsolo Sep 17, 2026
eb7f559
[None][feat] complete the SiTU plumbing for the gather grouped GEMM ops
reasonsolo Sep 17, 2026
67f81c8
[None][fix] restore the mHC Phase-4 store-to-load coherence fix
reasonsolo Sep 17, 2026
3fed8f9
[None][fix] keep Flux on the shared fused NVFP4 SwiGLU predicate
reasonsolo Sep 17, 2026
f01972b
[None][fix] stop the gather act-fusion test staging weights through i…
reasonsolo Sep 17, 2026
2d75179
[None][fix] address review: f32x2 arch bound and FC12 activation guard
reasonsolo Sep 17, 2026
57b6791
[None][fix] register the missing fp8_prequantized_swap_ab_gemm op
reasonsolo Sep 17, 2026
639140f
[None][fix] repair the C++ unit-test build and the fused FP8 SwiGLU gate
reasonsolo Sep 17, 2026
1111762
[None][fix] align the mla_rope_generation fake with the native schema
reasonsolo Sep 17, 2026
43b49d1
[None][fix] drop the re-introduced trtllm-gen FMHA CGA smem-reduction…
reasonsolo Sep 18, 2026
8de1a1f
[None][fix] rebase the GVR prior indexer test onto main's TopK contract
reasonsolo Sep 18, 2026
ac15adf
[None][fix] teach the Flux guard fixture the shared fused SwiGLU pred…
reasonsolo Sep 18, 2026
3cffef1
[None][fix] refresh the Rubin MoE op-schema expectations for SiTU
reasonsolo Sep 18, 2026
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
19 changes: 12 additions & 7 deletions cpp/tensorrt_llm/common/attentionOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,13 @@ size_t AttentionOp::getWorkspaceSizeForContext(tensorrt_llm::DataType type, int3

auto const batch_size = static_cast<size_t>(max_num_seq);
auto const kv_seq_length = (isCrossAttention() ? cross_kv_length : input_seq_length);
// The unfused-MHA buffers below must upper-bound the enqueueContext carve, which sizes them by
// batch_size * input_seq_length (not num_tokens): with padding removal the actual token count can be
// smaller than batch_size * max(context q length), so sizing by max_num_tokens underestimates.
size_t const attention_mask_size = mEnableContextFMHA ? 0 : size * batch_size * input_seq_length * kv_seq_length;
// Unfused context attention operates on padded [batch, sequence] tensors,
// even when the input QKV is packed. Size those buffers from the padded
// token counts exactly as enqueueContext does; max_num_tokens remains the
// packed count used by the fused paths below.
size_t const padded_num_tokens = batch_size * static_cast<size_t>(input_seq_length);
size_t const padded_kv_tokens = batch_size * static_cast<size_t>(kv_seq_length);
size_t const attention_mask_size = mEnableContextFMHA ? 0 : size * padded_num_tokens * kv_seq_length;
size_t const cu_seqlens_size = sizeof(int) * (batch_size + 1);
size_t const rotary_inv_freq_size = sizeof(float) * batch_size * mRotaryEmbeddingDim / 2;

Expand All @@ -823,7 +826,7 @@ size_t AttentionOp::getWorkspaceSizeForContext(tensorrt_llm::DataType type, int3
size_t const v_buf_2_size = mEnableContextFMHA ? 0 : size * batch_size * kv_seq_length * local_hidden_units_kv;
size_t const qk_buf_size
= mEnableContextFMHA ? 0 : size * batch_size * mNumHeads * input_seq_length * kv_seq_length;
size_t const qkv_buf_2_size = mEnableContextFMHA ? 0 : size * batch_size * input_seq_length * local_hidden_units_qo;
size_t const qkv_buf_2_size = mEnableContextFMHA ? 0 : size * padded_num_tokens * local_hidden_units_qo;
size_t const qk_buf_float_size
= mEnableContextFMHA ? 0 : sizeof(float) * batch_size * mNumHeads * input_seq_length * kv_seq_length;
int dim_q_per_head = (mMLAParams.qk_rope_head_dim + mMLAParams.qk_nope_head_dim);
Expand Down Expand Up @@ -899,8 +902,8 @@ size_t AttentionOp::getWorkspaceSizeForContext(tensorrt_llm::DataType type, int3
? sizeof(float) * tc::divUp(local_hidden_units_kv, std::max(1, mSageAttnNumEltsPerBlkV))
: 0;

size_t const padding_offset_size = mEnableContextFMHA ? 0 : sizeof(int) * batch_size * input_seq_length;
size_t const encoder_padding_offset_size = mEnableContextFMHA ? 0 : sizeof(int) * batch_size * cross_kv_length;
size_t const padding_offset_size = mEnableContextFMHA ? 0 : sizeof(int) * padded_num_tokens;
size_t const encoder_padding_offset_size = mEnableContextFMHA ? 0 : sizeof(int) * padded_kv_tokens;
// Each token holds (batch_idx, token_idx_in_seq) int2.
size_t const tokens_info_size = sizeof(int2) * max_num_tokens;
size_t const fmha_scheduler_counter = mEnableContextFMHA ? sizeof(uint32_t) : 0;
Expand Down Expand Up @@ -1886,6 +1889,7 @@ int AttentionOp::enqueueContext(EnqueueContextParams<T> const& params, cudaStrea
preprocessingParams.is_last_chunk
= !mAttentionChunkSize.has_value() || (params.input_seq_length == params.max_past_kv_length);

if (!(mIsMLAEnabled && params.mla_param != nullptr && params.mla_param->q_rope_applied))
{
std::string const beforeRopeStr = "ctx attention before RoPE at layer " + std::to_string(mLayerIdx);
TLLM_CHECK_DEBUG_WITH_INFO(tensorrt_llm::runtime::utils::tensorHasInvalid(params.num_tokens,
Expand Down Expand Up @@ -1991,6 +1995,7 @@ int AttentionOp::enqueueContext(EnqueueContextParams<T> const& params, cudaStrea
invokeQKVPreprocessing(preprocessingParams, stream);
}
sync_check_cuda_error(stream);
if (!(mIsMLAEnabled && params.mla_param != nullptr && params.mla_param->q_rope_applied))
{
std::string const afterRopeStr = "ctx attention after RoPE at layer " + std::to_string(mLayerIdx);
TLLM_CHECK_DEBUG_WITH_INFO(tensorrt_llm::runtime::utils::tensorHasInvalid(params.num_tokens,
Expand Down
15 changes: 11 additions & 4 deletions cpp/tensorrt_llm/common/envUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ bool getEnvUseFineGrainedSync();
void setFineGrainedSyncDisabledOverride(bool disabled);

template <typename KernelFn, typename... Args>
inline void launchWithPdlWhenEnabled(char const* name, KernelFn kernelFn, dim3 grid, dim3 block, size_t dynamicShmSize,
cudaStream_t stream, Args&&... args)
inline void launchWithPdl(char const* name, bool enablePdl, KernelFn kernelFn, dim3 grid, dim3 block,
size_t dynamicShmSize, cudaStream_t stream, Args&&... args)
{
TLLM_LOG_DEBUG("Enable PDL in %s", name);
TLLM_LOG_DEBUG("PDL in %s: %s", name, enablePdl ? "enabled" : "disabled");
cudaLaunchConfig_t kernelConfig;
kernelConfig.gridDim = grid;
kernelConfig.blockDim = block;
Expand All @@ -84,13 +84,20 @@ inline void launchWithPdlWhenEnabled(char const* name, KernelFn kernelFn, dim3 g

cudaLaunchAttribute attrs[1];
attrs[0].id = cudaLaunchAttributeProgrammaticStreamSerialization;
attrs[0].val.programmaticStreamSerializationAllowed = tensorrt_llm::common::getEnvEnablePDL();
attrs[0].val.programmaticStreamSerializationAllowed = enablePdl;
kernelConfig.attrs = attrs;
kernelConfig.numAttrs = 1;

TLLM_CUDA_CHECK(cudaLaunchKernelEx(&kernelConfig, kernelFn, std::forward<Args>(args)...));
}

template <typename KernelFn, typename... Args>
inline void launchWithPdlWhenEnabled(char const* name, KernelFn kernelFn, dim3 grid, dim3 block, size_t dynamicShmSize,
cudaStream_t stream, Args&&... args)
{
launchWithPdl(name, getEnvEnablePDL(), kernelFn, grid, block, dynamicShmSize, stream, std::forward<Args>(args)...);
}

bool getEnvUseUCXKvCache();

bool getEnvUseMPIKvCache();
Expand Down
Loading
Loading