Repository navigation
Conversation
…ters Pass split Linear parameters through the custom-op boundary, reconstruct checked views at execution time and split full gradients outside backward. Preserve concatenation for disjoint storage and returned biases, handle promoted dtypes, and compute bias gradients when weights are frozen. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Replace ConcatenatedTensor with DeferredCat(parts), expose metadata through to_spec and keep materialization inside the custom op. Preserve deferred backward operands for non-FP8 training, reject quantized parts, and make dimension checks consume explicit metadata. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Keep singleton operands unwrapped and represent split parameters with immutable ParameterParts through the ConcatInput alias. Centralize eager and compiled input preparation, let the custom-op adapter restore saved parts, and select the execution path before concatenating parameters. Name backward weights by their role and update the existing MLA caller. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Restore compile_unsupported_reason, setup_saved_tensors(ctx), the original backward operand names, and the existing adapter contract. Remove the unrelated MLA changes. Retain the parameter-parts alias and helper, split-parameter correctness fixes, and focused regression coverage. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Use None when Linear has no deferred parameter parts, including eager forward, saved backward arguments and compile fallbacks. This avoids allocating empty weight and bias lists on the ordinary eager path. Transport Optional[List[Tensor]] through Tensor[]? custom-op inputs, preserving None without allocating replacement lists. Keep split-gradient handling outside the backward op and let the adapter supply absent list gradients when needed. Cover ordinary and optional lists, empty lists and None in the adapter test. Validate the full compile suite (384 passed, 62 skipped, one existing XPASS), 55 focused cases, 30 numerical Linear cases, pre-commit and Python L0 lint. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Use the same checked view or concatenation in eager and compiled Linear. Pass individual parts as explicit autograd inputs and save the materialized operands for eager backward, which returns views of the full gradients. Preserve the single-parameter and external-bias paths. Derive the view strides directly from contiguous parts to avoid symbolic stride-helper overhead. Extend the existing storage and cat-count tests. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
|
TE CI — selected tests Pipeline ID: Selected CI jobs and pytest filters are listed below. Frameworks: PyTorch Mode: PR Python, tests and QA with prebuilt native libraries; no TE rebuild. Selected jobs: 1
Not run (manual/skipped): 14 Show jobs not run
Results are reported as individual commit statuses on this PR. |
|
TE CI — selected tests Pipeline ID: Selected CI jobs and pytest filters are listed below. Frameworks: PyTorch Mode: PR Python, tests and QA with prebuilt native libraries; no TE rebuild. Pytest include: Job results cover this pytest subset. Non-pytest QA commands are unchanged. Selected jobs: 1
Not run (manual/skipped): 14 Show jobs not run
Results are reported as individual commit statuses on this PR. |
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
|
TE CI — selected tests Pipeline ID: Selected CI jobs and pytest filters are listed below. Frameworks: PyTorch Mode: PR Python, tests and QA with prebuilt native libraries; no TE rebuild. Pytest exclude: Job results cover this pytest subset. Non-pytest QA commands are unchanged. Selected jobs: 7
Not run (manual/skipped): 9 Show jobs not run
Results are reported as individual commit statuses on this PR. |
Merge main 9b7e959. Preserve the existing seven-file split Linear change without conflicts. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Restore the tree from 917773b. The split-parameter support belongs in PR NVIDIA#3623. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Share Linear's checked view/cat helper for split weights and fused biases. Pass the parts as explicit autograd inputs, save full operands for backward and return views of the full parameter gradients. Keep backward computation and saved-tensor restoration unchanged. Compute split shapes only when configuring weight quantization, and extend the existing cat-count regression to eager LayerNormLinear. Remove standalone storage-helper and tensor-list adapter tests at the user's request. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Replace five split-parameter tests with one parameterized integration test. Cover gradients, inference, recipes, bias modes, storage and parameter updates, saved-version checks and concatenation counts in a shared execution flow. Use ordinary torch.cat in the reference to verify deferred gradient routing. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Rely on concat_input to select nonempty ordinary tensor lists. Preserve storage, layout, offset and bounds checks before reconstructing a view. Extend the shared integration test with LayerNormLinear recipes and dtype/ split variants, plus mixed parameter dtypes under autocast. Keep dtype promotion in fake concatenation to match torch.cat metadata. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Remove the deferred-concatenation switch from Linear and LayerNormLinear parameter getters. Keep bias routing in the getters and explicitly concatenate deferred operands in the ONNX inference paths. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Rename concat_input to prepare_parameter and drop the tensors suffix from the Linear and LayerNormLinear getters, which can return split lists. Use the same forward operand names in LayerNormLinear as in Linear. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Use the presence of parameter_split_sizes to select gradient splitting in eager Linear and LayerNormLinear backward instead of counting the fixed positional autograd inputs. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Restore parameter lists from named input-list lengths already tracked by the custom-op adapter. Remove the duplicate lengths and the saved weight alias flag from Linear backward arguments. Resolve a missing plain split weight in the existing backward workspace reconstruction path. Extend the split integration test with workspace caching, reconstruction and high-precision/dequantized backward overrides. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Move selected split scenarios into the Linear compile and LayerNormLinear sanity tests, and add a split case to the existing microbatch cache test. Share parameter-update assertions and remove the standalone split test. Append complete scenarios without multiplying the existing parameter axes. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Move the parameter-update helper from the shared test utilities into test_torch_compile.py and name it _check_module_outputs_and_grads. Restore the shared utility module to its upstream contents. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Run split and unsplit scenarios through the same local output and gradient checker. Keep CUDA graph warmup and exact unsplit comparisons while removing the duplicated test body and its early return. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Fall back to cat when the first split is empty, since its trailing strides need not describe the concatenated tensor. Restore the existing empty bias tensor for LayerNormLinear without bias. Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryAdds split-parameter support for
No new actionable issues were found. The earlier unnumbered test suggestion was manually resolved by Review was static; tests were not run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
P[Separate parameters] --> B[Forward receives tensor lists]
B --> C{Parts occupy adjacent shared storage?}
C -->|Yes| V[Build checked view]
C -->|No| T[Concatenate parts]
V --> F[Run Linear]
T --> F
F --> S[Save original parts for compiled backward]
S --> G[Compute full gradients]
G --> D[Split gradients outside custom operation]
D --> R[Return gradients to separate parameters]
Reviews (4) · Last reviewed commit: "Merge main into split_parameters_linear" · Reviewed by Greptile |
…torage Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
|
/te-ci pytorch L0 |
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
|
/te-ci pytorch L0 |
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>
Description
Support
torch.compile(fullgraph=True)forte.Linear(parameters_split=...), preserving separate Parameters,state-dict entries and gradients.
Split weights and biases cross the custom-op boundary as tensor lists.
Contiguous parts occupying adjacent regions of the same storage are consumed
through a checked view without a concatenation copy. Other layouts fall back
to
torch.cat. Storage is checked on each execution.Eager Linear and LayerNormLinear assemble split operands inside forward
and save the resulting tensors for backward. LayerNormLinear compile support
is outside this PR's scope. Disjoint parameters still require concatenation
in both compiled forward and backward.
Type of change
Changes
Please list the changes introduced in this PR:
handling to Linear's fake implementations.
gradients into views outside the backward op.
retaining them for backward.
recipes, selective gradients, weight caching, storage changes and cat counts.
Checklist: