diff --git a/tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py b/tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py index 79c2f064e1ac..ba01e7ad536a 100644 --- a/tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py +++ b/tensorrt_llm/_torch/modules/fused_moe/fused_moe_trtllm_gen.py @@ -339,6 +339,11 @@ def is_situ_activation(self) -> bool: return self.trtllm_gen_activation_type == ActType_TrtllmGen.SiTu def _validate_backend_local_activation(self) -> None: + # Runs from __init__, before create_weights, so the swiglu_* attributes + # checked below are still the constructor-provided values. For SiTu, + # create_weights later reuses the swiglu_alpha/swiglu_beta storage for + # the backend-local activation parameters (SiTu and SwiGLU are mutually + # exclusive and feed the same gemm1_alpha/gemm1_beta op slots). if self.trtllm_gen_activation_type is None: if (self.trtllm_gen_activation_alpha is not None or self.trtllm_gen_activation_beta is not None): @@ -549,7 +554,9 @@ def _check_configs(self): raise ValueError( "TRTLLM-Gen SiTu requires MXFP4 scaling vector size 32, " f"got {self.scaling_vector_size}.") - for name in ("situ_alpha", "situ_beta"): + # For SiTu these hold the backend-local activation parameters + # (populated by create_weights, which runs before this check). + for name in ("swiglu_alpha", "swiglu_beta"): value = getattr(self, name) if (value.dtype != torch.float32 or value.shape != (self.expert_size_per_partition, ) @@ -594,19 +601,26 @@ def create_weights(self): else: self.quant_method.create_weights(self) + # SiTu reuses the swiglu_alpha/swiglu_beta storage: SiTu and SwiGLU are + # mutually exclusive (constructor-provided SwiGLU parameters are + # rejected by _validate_backend_local_activation) and feed the same + # gemm1_alpha/gemm1_beta op slots. Safe with respect to the + # `swiglu_alpha is not None` gates: create_moe.py checks the + # constructor kwargs (None for SiTu); _get_quant_method consults + # swiglu_alpha only on the nvfp4 branch (SiTu requires + # W4A8_MXFP4_MXFP8) and has already run above; _check_configs runs + # after this point and its swiglu gate admits w4a8_mxfp4_mxfp8. if self.is_situ_activation: - situ_alpha = nn.Parameter(torch.full( + self.swiglu_alpha = nn.Parameter(torch.full( (self.expert_size_per_partition, ), float(self.trtllm_gen_activation_alpha), dtype=torch.float32), - requires_grad=False) - situ_beta = nn.Parameter(torch.full( + requires_grad=False) + self.swiglu_beta = nn.Parameter(torch.full( (self.expert_size_per_partition, ), float(self.trtllm_gen_activation_beta), dtype=torch.float32), - requires_grad=False) - self.register_parameter("situ_alpha", situ_alpha) - self.register_parameter("situ_beta", situ_beta) + requires_grad=False) self._weights_created = True self._check_configs() @@ -630,8 +644,9 @@ def cache_derived_state(self) -> None: if self.is_situ_activation: # Reinitialize constants after meta-device materialization. These # are backend configuration, not checkpoint weights. - self.situ_alpha.data.fill_(float(self.trtllm_gen_activation_alpha)) - self.situ_beta.data.fill_(float(self.trtllm_gen_activation_beta)) + self.swiglu_alpha.data.fill_(float( + self.trtllm_gen_activation_alpha)) + self.swiglu_beta.data.fill_(float(self.trtllm_gen_activation_beta)) def load_weights(self, weights: List[Dict], @@ -901,10 +916,10 @@ def run_moe( ] else 2 intermediate_size_per_partition_padded = self.w3_w1_weight.shape[ -2] // factor - gemm1_alpha = (self.situ_alpha - if self.is_situ_activation else self.swiglu_alpha) - gemm1_beta = (self.situ_beta - if self.is_situ_activation else self.swiglu_beta) + # Holds SwiGLU's per-expert alpha/beta, or SiTu's backend-local + # activation parameters (which reuse this storage; see + # create_weights). + gemm1_alpha, gemm1_beta = self.swiglu_alpha, self.swiglu_beta output1_scale_scalar = self._get_data_or_none("fc31_scale_c") output1_scale_gate_scalar = self._get_data_or_none("fc31_alpha") diff --git a/tensorrt_llm/_torch/utils.py b/tensorrt_llm/_torch/utils.py index cb62ec99f76b..3899c560eb69 100644 --- a/tensorrt_llm/_torch/utils.py +++ b/tensorrt_llm/_torch/utils.py @@ -63,6 +63,12 @@ class ActivationType(IntEnum): Relu2 = 8 +# TRTLLM-Gen-local activation encoding, kept separate from the shared +# ActivationType above ON PURPOSE: ActivationType mirrors the cutlass enum in +# common.h and drives cutlass MoE kernels, whereas SiTu exists only in the +# trtllm-gen batched-GEMM kernels. Adding SiTu to the shared ActivationType +# would force a matching cutlass enum member that no cutlass kernel implements. +# So SiTu stays here (TRTLLM-15177 item 1.2(a): decided keep-backend-local). # Keep this in sync with the ActType enum in # cpp/tensorrt_llm/kernels/trtllmGenKernels/batchedGemm/KernelRunner.h class ActType_TrtllmGen(IntEnum): diff --git a/tests/integration/test_lists/waives.txt b/tests/integration/test_lists/waives.txt index d3bfb4973452..2955a786ea27 100644 --- a/tests/integration/test_lists/waives.txt +++ b/tests/integration/test_lists/waives.txt @@ -294,6 +294,7 @@ full:RTX_PRO_6000_Blackwell_Server_Edition/accuracy/test_llm_api_pytorch.py::Tes full:RTX_PRO_6000_Blackwell_Server_Edition/accuracy/test_llm_api_pytorch.py::TestQwen3_5_4B::test_fp8 SKIP (https://nvbugs/6273850) full:sm100/unittest/bindings SKIP (Disable for Blackwell) kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_chunked_prefill SKIP (https://nvbugs/6428002) +kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_chunked_prefill_eviction_block_reuse SKIP (https://nvbugs/6607481) kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_eviction[cuda_graph] SKIP (https://nvbugs/6600098) kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_eviction_with_block_reuse SKIP (https://nvbugs/6462303) kv_cache/test_kv_cache_v2_scheduler.py::TestKVCacheV2Llama::test_overlap_scheduler[non_overlap] SKIP (https://nvbugs/6600098) @@ -348,6 +349,7 @@ perf/test_perf_sanity.py::test_e2e[disagg_upload-gen_only-gb300_kimi-k25-thinkin test_e2e.py::test_multi_nodes_eval[MiniMax-M3-tp16-mmlu] SKIP (https://nvbugs/6373561) test_e2e.py::test_ptp_quickstart_advanced_deepseek_r1_w4afp8_8gpus[DeepSeek-R1-W4AFP8-DeepSeek-R1/DeepSeek-R1-W4AFP8] SKIP (https://nvbugs/5836830) test_e2e.py::test_ptp_quickstart_bert[TRTLLM-BertForSequenceClassification-bert/bert-base-uncased-yelp-polarity] SKIP (https://nvbugs/6605819) +test_e2e.py::test_ptp_quickstart_bert[VANILLA-BertForSequenceClassification-bert/bert-base-uncased-yelp-polarity] SKIP (bug pending, tracked in PR 17414) test_e2e.py::test_trtllm_bench_llmapi_launch[pytorch_backend-llama-v3-llama3-8b] SKIP (https://nvbugs/6568058) unittest/_torch/attention/sparse/dsa/test_req_idx_per_token.py::test_on_update_kv_lens_rebuilds_stale_map SKIP (https://nvbugs/6574939) unittest/_torch/attention/sparse/rocketkv/test_rocketkv.py::test_model[TRTLLM-llama-3.1-model/Llama-3.1-8B-Instruct-pytorch] SKIP (https://nvbugs/6602094) @@ -355,6 +357,7 @@ unittest/_torch/attention/sparse/rocketkv/test_rocketkv.py::test_model[VANILLA-l unittest/_torch/attention/test_attention_backends.py::test_attention_backend[deepseekv3_mla-gen-bf16-HND-p32-v1] SKIP (https://nvbugs/6507109) unittest/_torch/executor/test_overlap_scheduler.py::test_overlap_scheduler_consistency[no_reuse-cpp_scheduler-TorchSampler] SKIP (https://nvbugs/6561559) unittest/_torch/misc/test_autotuner.py::test_cutedsl_nvfp4_heuristic_matches_full_sweep SKIP (https://nvbugs/6490028) +unittest/_torch/modeling/test_gemma4_e2e_dummy.py::test_e2e_text_31b_dummy SKIP (https://nvbugs/6607482) unittest/_torch/modeling/test_modeling_qwen_moe.py::TestQwenMoe::test_qwen_moe_allclose_to_hf[backend:trtllm-use_cuda_graph:False] SKIP (https://nvbugs/6566765) unittest/_torch/modeling/test_modeling_qwen_moe.py::TestQwenMoe::test_qwen_moe_allclose_to_hf[backend:trtllm-use_cuda_graph:True] SKIP (https://nvbugs/6575012) unittest/_torch/modeling/test_modeling_qwen_moe.py::TestQwenMoe::test_qwen_moe_allclose_to_hf[backend:vanilla-use_cuda_graph:False] SKIP (https://nvbugs/6566765) @@ -365,6 +368,7 @@ unittest/_torch/modules/moe/test_moe_module.py::test_configurable_moe_single_gpu unittest/_torch/modules/moe/test_moe_module.py::test_configurable_moe_single_gpu -k "TRTLLM" SKIP (https://nvbugs/6464169) unittest/_torch/modules/test_w4a16_nvfp4_linear.py::test_nvfp4_attention_keeps_high_precision_output_for_hopper_marlin SKIP (https://nvbugs/6581071) unittest/_torch/modules/tests_lora_modules/test_nemotron_h_lora_sanity.py::TestNemotronHLoRA::test_lora_pp2_sanity SKIP (https://nvbugs/6428124) +unittest/_torch/modules/tests_lora_modules/test_qwen3_sanity.py::TestQwen3LoRA::test_qwen3_fp8_lora SKIP (https://nvbugs/6607487) unittest/_torch/multi_gpu/test_linear.py::test_row_linear[2-balanced] SKIP (https://nvbugs/6507113) unittest/_torch/multi_gpu/test_linear.py::test_row_linear_norm_fusion[2-hidden:16-seqlen:2] SKIP (https://nvbugs/6501404) unittest/_torch/ray_orchestrator/multi_gpu/test_llm_update_weights_multi_gpu.py -m "part4" SKIP (https://nvbugs/6437410)