Compare commits

...
Author SHA1 Message Date
yogyamandClaude Sonnet 5 ed07862b2e [bugfix] Skip CUDA-only fastvideo-kernel/flashinfer-python deps on non-Linux
Both packages are CUDA-only native extensions: fastvideo-kernel only
publishes manylinux wheels and its sdist build requires nvcc via CMake;
flashinfer-python ships no wheels at all and its sdist build shells out
to nvcc directly. Neither has a build path on macOS (or any platform
without a CUDA toolchain), so `uv pip install -e .` fails there even
though docs/getting_started/installation/mps.md documents that exact
command for Apple Silicon.

Every import of fastvideo_kernel/flashinfer in the codebase is already
guarded (try/except ImportError or importlib.util.find_spec), so the
package degrades gracefully without them - confirmed by a clean
`uv pip install -e ".[dev]"` + `import fastvideo` + `fastvideo --help`
on an arm64 Mac with neither package present.

Gating both on `sys_platform == 'linux'` matches the existing
platform-marker convention already used for fastvideo-kernel's local
source path in [tool.uv.sources], and leaves Linux+CUDA installs
byte-for-byte unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 13:00:57 -07:00
William Lin 10546353da [ci]: extend Full Suite training lane timeouts (#1616) 2026-07-23 13:00:00 -07:00
pkisfaludi-nvandClaude Opus 4.8 9fb74b9732 Make LTX-2 RMSNorm out-of-place so torch_tensorrt + Ulysses SP compiles (#1623)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 04:32:04 -07:00
3 changed files with 42 additions and 7 deletions
+2 -2
View File
@@ -404,7 +404,7 @@ steps:
- "pyproject.toml"
- "docker/Dockerfile"
config:
command: "timeout 15m .buildkite/scripts/pr_test.sh"
command: "timeout 25m .buildkite/scripts/pr_test.sh"
label: ":test_tube: Training Tests"
env:
- TEST_TYPE=training
@@ -415,7 +415,7 @@ steps:
- "pyproject.toml"
- "docker/Dockerfile"
config:
command: "timeout 15m .buildkite/scripts/pr_test.sh"
command: "timeout 25m .buildkite/scripts/pr_test.sh"
label: ":test_tube: Distillation DMD Tests"
env:
- TEST_TYPE=distillation_dmd
+30 -3
View File
@@ -62,6 +62,34 @@ def _is_ltx2_refine_stage() -> bool:
return forward_batch.extra.get("ltx2_fp4_stage_profile") == "refine"
def _functional_rms_norm(
x: torch.Tensor,
eps: float,
weight: torch.Tensor | None = None,
) -> torch.Tensor:
"""Out-of-place RMSNorm equivalent to ``torch.nn.functional.rms_norm``.
``F.rms_norm`` / ``nn.RMSNorm`` decompose under AOTAutograd into an
in-place ``variance.add_(eps)`` (an ``aten.copy_`` into the computed
``mean``). AOTAutograd's ``assert_functional_graph`` requires every
``copy_`` destination to be a graph input, so this trips when the DiT is
compiled through the ``torch.compile(backend="torch_tensorrt")`` path
(Dynamo -> AOTAutograd functionalization -> torch-tensorrt), breaking
TensorRT + sequence-parallel (Ulysses) export. Computing ``variance + eps``
out-of-place keeps the graph functional. Numerically matches
``F.rms_norm`` (fp32 accumulation, dtype restored to the input)."""
input_dtype = x.dtype
hidden = x.to(torch.float32)
variance = hidden.pow(2).mean(-1, keepdim=True)
hidden = hidden * torch.rsqrt(variance + eps)
out = hidden.to(input_dtype)
if weight is not None:
# A weight dtype differing from x (e.g. fp32 params under autocast)
# would promote the output; keep the input-dtype guarantee.
out = out * weight
return out.to(input_dtype)
def _rms_norm_dispatch(
x: torch.Tensor,
eps: float,
@@ -75,8 +103,7 @@ def _rms_norm_dispatch(
# rms_norm to autocast's float32 cast policy, which under our
# autocast(bfloat16) forward returns float32 instead. Restore the input
# dtype to match the official numerics (and torch <= 2.11 behavior).
return torch.nn.functional.rms_norm(
x, (x.shape[-1], ), weight=weight, eps=eps).to(x.dtype)
return _functional_rms_norm(x, eps, weight)
class StageAwareRMSNorm(nn.RMSNorm):
@@ -101,7 +128,7 @@ class StageAwareRMSNorm(nn.RMSNorm):
# norm now returns float32 where torch <= 2.11 returned bfloat16.
# Restore the input dtype so autocast-blind consumers downstream
# (e.g. the flash-attention custom op) don't receive upcast q/k.
return super().forward(x).to(x.dtype)
return _functional_rms_norm(x, self.eps, self.weight)
def _supports_prequantized_input(linear: ReplicatedLinear) -> bool:
+10 -2
View File
@@ -35,7 +35,10 @@ dependencies = [
"torch==2.12.0",
"torchvision",
"torchaudio",
"flashinfer-python",
# CUDA-only: no wheels for non-Linux platforms, and the sdist build shells
# out to nvcc unconditionally. Gate on sys_platform so installs on macOS
# (MPS) and other non-Linux platforms don't try to build it from source.
"flashinfer-python; sys_platform == 'linux'",
# Acceleration & Optimization
"accelerate==1.0.1",
@@ -73,7 +76,12 @@ dependencies = [
"remote-pdb",
# Kernel & Packaging
"fastvideo-kernel==0.3.2",
# CUDA-only: PyPI only publishes manylinux wheels, and the sdist build
# requires nvcc via CMake. Gate on sys_platform so installs on macOS
# (MPS) and other non-Linux platforms don't try to build it from source;
# every fastvideo_kernel import elsewhere is already guarded to degrade
# gracefully when the package is absent.
"fastvideo-kernel==0.3.2; sys_platform == 'linux'",
"wheel",
# Training Dependencies