Selected changesmerged Nov 23, 2026
TST: fix flaky memory growth testsPython · 47 + / 20 −
Introduces 5 new declarations in numpy/testing/_private/utils.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
numpy/testing/_private/utils.py ↗ · 3 files
@@ -2924,24 +2924,42 @@ def run_subprocess(cmd, cwd=None, **kwargs): return res +def run_function_with_args_in_subprocess(func, *args):+ """Call ``func(*args)`` in a new Python subprocess, failing the test if+ it raises.++ ``func`` must be a module-level function and ``args`` must survive a+ round trip through `repr`.+ """+ import pytest++ if not HAS_SUBPROCESSES:+ pytest.skip("requires subprocesses")+ location = (func.__module__,+ getattr(sys.modules[func.__module__], "__file__", None),+ func.__qualname__)+ code = ("from numpy.testing._private.utils import _load_function; "+ f"_load_function(*{location!r})(*{args!r})")+ run_subprocess([sys.executable, "-c", code])++ def run_with_memory_limit(func, make_args, limit): """Fail the test if any call needs more than ``limit`` bytes of address space beyond what the process already uses. ``make_args()`` returns a mapping of labels to argument tuples, and ``func(*args)`` runs for each of them. Both run in a fresh subprocess, so they must be module-level functions, and each call runs in its own forked- child of that subprocess. Runs on Linux and on arm64 macOS 26 or later.+ child of that subprocess. Runs on Linux only. """ import pytest
Turbopack: diff server HMR pulls against a Rust-owned loaded-module setRust · 666 + / 505 −
Introduces 44 new declarations in crates/next-api/src/aggregate_hmr.rs.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
crates/next-api/src/aggregate_hmr.rs ↗ · 27 files
@@ -199,321 +422,251 @@ impl CompilationEvent for ServerHmrChunkListDiffEvent { } } -async fn diff_chunks_against(- chunk_lists: &[ServerHmrChunkList],- from: &ServerHmrChunkListVersion,-) -> Result<DiffResult> {- let current_chunk_list_paths = chunk_lists- .iter()- .map(|chunk_list| &chunk_list.relative_path)- .collect::<FxIndexSet<_>>();- let has_removed_chunk_lists = from- .versions_by_chunk_list_path- .keys()- .any(|path| !current_chunk_list_paths.contains(path));- let mut has_new_chunk_lists = false;- let chunk_updates = chunk_lists- .iter()- .filter_map(- |ServerHmrChunkList {- relative_path,- versioned_content,- }| {- if *TRACE_DIFFING {- turbo_tasks().send_compilation_event(Arc::new(ServerHmrChunkListDiffEvent {- chunk_list_path: relative_path.clone(),- }));- }- let Some(prev) = from.versions_by_chunk_list_path.get(relative_path).cloned()- else {- has_new_chunk_lists = true;- return None;- };
feat(asr): Triton kernel for the sequence-packed relative-position attentionPython · 1130 + / 66 −
Introduces 35 new declarations in nemo/collections/asr/parts/triton/rel_pos_attention.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
nemo/collections/asr/parts/triton/rel_pos_attention.py ↗ · 12 files
@@ -0,0 +1,914 @@+# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++"""Transformer-XL self-attention over sequence-packed activations, with dropout on the attention weights.++The utterances of a batch are concatenated along the token axis;+``seq_starts`` and ``seq_lens`` say where each one lies, so gaps between them are allowed,+and a program of the kernels never reads or writes a row outside its utterance.+Queries, keys and values have shape ``(T_total, H, D)``.+The score of query position ``i`` and key position ``j`` of one utterance is+``scale * q_i . k_j + scale * pos_query_i . pos_emb[c - (i - j)]`` with ``c = max_seqlen - 1``,+the convention of ``RelPositionMultiHeadAttention`` (``rel_shift`` selects the same entries in the padded forward).++The position term ``(T_total, H, 2 * max_seqlen - 1)`` is computed from ``pos_query`` and ``pos_emb``+inside the custom ops, in the forward and again in the backward,+so it is never saved for the backward and no layer retains one;+the kernels read it through 64-bit offsets,+since ``H * T_total * (2 * max_seqlen - 1)`` passes 2**31 at large packed batches.+Its buffer is ``(H, T_total, R)`` with ``R`` rounded up to a multiple of eight,+because an odd leading dimension sends the GEMMs to slow unaligned kernels;+the kernels take the strides of the ``(T_total, H, R)`` view.
Fix dory static cachePython · 116 + / 46 −
Introduces 10 new declarations in src/transformers/models/dory/modeling_dory.py.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/models/dory/modeling_dory.py ↗ · 3 files
@@ -119,6 +127,42 @@ def forward(self, x, position_ids, layer_type): return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype) +class DoryPastReader(DummyLayer):+ """+ Read-only view of a cache layer, for `last_loop` loops before the last: `update` returns the states `layer.update`+ would, without writing them, so these loops attend over the cached past and their own tokens.+ """++ def __init__(self, layer: DynamicLayer | StaticLayer):+ super().__init__()+ if type(layer) not in (DynamicLayer, DynamicSlidingWindowLayer, StaticLayer, StaticSlidingWindowLayer):+ raise NotImplementedError(f"`last_loop` does not support {type(layer).__name__} cache layers")+ self.layer = layer++ def update(self, key_states: torch.Tensor, value_states: torch.Tensor, *args, **kwargs):+ if not self.layer.is_initialized:+ # Allocates the (static) buffers only, so the states keep the shapes the attention mask was built for+ self.layer.lazy_initialization(key_states, value_states)+ return self._read(self.layer.keys, key_states), self._read(self.layer.values, value_states)++ def _read(self, past: torch.Tensor, states: torch.Tensor) -> torch.Tensor:+ layer, num_new = self.layer, states.shape[-2]+ if isinstance(layer, DynamicLayer):+ states = torch.cat([past, states], dim=-2)+ # The cache may hold more than the window if past recording is on+ return states[..., -(layer.sliding_window - 1 + num_new) :, :] if layer.is_sliding else states+ if layer.is_sliding and layer.cumulative_length_int + num_new > layer.max_cache_len:+ # Full or becoming full: the window slides, as in `StaticSlidingWindowLayer.update`+ start = 1 if layer.cumulative_length_int >= layer.max_cache_len else 0+ return torch.cat([past[..., start : layer.cumulative_length_int, :], states], dim=-2)+ # Out-of-place write into the static buffer, keeping its shape+ cache_position = torch.arange(num_new, device=past.device) + layer.cumulative_length
view-types: handle field accessesRust · 231 + / 67 −
Introduces 8 new declarations in compiler/rustc_hir_typeck/src/expr.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_hir_typeck/src/expr.rs ↗ · 11 files
@@ -2480,6 +2458,104 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Ty::new_error(self.tcx(), guar) } + fn check_field_access_for_deref_step(+ &self,+ expr: &'tcx rustc_hir::Expr<'tcx>,+ base: &'tcx rustc_hir::Expr<'tcx>,+ field: Ident,+ autoderef: &Autoderef<'_, 'tcx>,+ deref_base_ty: Ty<'tcx>,+ base_ty: Ty<'tcx>,+ ) -> ControlFlow<Ty<'tcx>, Option<(Vec<Adjustment<'tcx>>, DefId)>> {+ let (field_ty, field_idx) = match deref_base_ty.kind() {+ ty::Adt(base_def, args) | ty::View(base_def, args, _) if !base_def.is_enum() => {+ debug!("struct named {:?}", deref_base_ty);+ // we don't care to report errors for a struct if the struct itself is tainted+ if let Err(guar) = base_def.non_enum_variant().has_errors() {+ return ControlFlow::Break(Ty::new_error(self.tcx(), guar));+ }++ let (ident, def_scope) =+ self.tcx.adjust_ident_and_get_scope(field, base_def.did(), self.mod_id);++ let Some((idx, field)) = self.find_adt_field(*base_def, ident) else {+ return ControlFlow::Continue(None);+ };++ if !field.vis.is_accessible_from(def_scope, self.tcx) {+ // The field is not accessible, fall through to error reporting.+ let adjustments = self.adjust_steps(autoderef);+ return ControlFlow::Continue(Some((adjustments, base_def.did())));+ }+