Selected changesmerged Aug 31, 2026 – Sep 6, 2026
[generate] stop synchronizing the accelerator on every decode stepPython · 185 + / 3 −
Introduces 13 new declarations in src/transformers/generation/utils.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/generation/utils.py ↗ · 5 files
@@ -356,6 +357,127 @@ class GenerateBeamEncoderDecoderOutput(ModelOutput): GenerateOutput = GenerateNonBeamOutput | GenerateBeamOutput +def _undo_generation_steps(num_steps: int, input_ids: torch.LongTensor, *recorded: "tuple | None") -> tuple:+ """+ Undo the last `num_steps` decoding steps, so that they leave no trace in what `generate` returns.+ Note that the cache entries those steps wrote are dropped by `DeferredStopCheck.finish` instead.+ """+ # `[:-0]` is `[:0]`, which would empty everything rather than leave it alone+ if num_steps == 0:+ return (input_ids, *recorded)+ return (input_ids[..., :-num_steps], *(record[:-num_steps] if record else record for record in recorded))+++class StopCheck:+ """+ Decides when the decoding loop should stop, and hands each new token to a streamer.+ """++ def __init__(self, streamer: "BaseStreamer | None" = None):+ self.streamer = streamer++ def __call__(self, unfinished_sequences: torch.Tensor, tokens: torch.Tensor, length: int) -> bool:+ if self.streamer is not None:+ self.streamer.put(tokens.cpu())+ return bool(unfinished_sequences.max() == 0)++ def finish(self) -> int:+ """Flush whatever is still held back, and report how many decoding steps have to be undone."""+ return 0+++class DeferredStopCheck(StopCheck):
Model: add Tencent Hy 4 (hy_v4) preview architecture supportC++ · 734 + / 4 −
Introduces 3 new declarations in src/models/hy-v4.cpp.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
src/models/hy-v4.cpp ↗ · 18 files
@@ -0,0 +1,601 @@+#include "models.h"++#include "llama-kv-cache.h"+#include "llama-kv-cache-dsa.h"++#include <cmath>++// iHC (independent Hyper-Connections) helpers. Same layout as the DeepSeek-V4 HC, but without+// the comb/sinkhorn term: hc_fn makes only 2*hc coefficients (pre + post). The streams mix+// through the pre-reduce / post-distribute round trip instead.++static size_t hy_v4_elem_offset(const ggml_tensor * t, int64_t i) {+ return ggml_row_size(t->type, i);+}++static ggml_tensor * hy_v4_view_1d(ggml_context * ctx, ggml_tensor * t, int64_t ne0, int64_t i0) {+ return ggml_view_1d(ctx, t, ne0, hy_v4_elem_offset(t, i0));+}++static ggml_tensor * hy_v4_view_2d(ggml_context * ctx, ggml_tensor * t, int64_t ne0, int64_t ne1, int64_t i0) {+ return ggml_view_2d(ctx, t, ne0, ne1, t->nb[1], hy_v4_elem_offset(t, i0));+}++void llama_model_hy_v4::load_arch_hparams(llama_model_loader & ml) {+ ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);+ ml.get_key(LLM_KV_LEADING_DENSE_BLOCK_COUNT, hparams.n_layer_dense_lead, false);+ ml.get_key(LLM_KV_ATTENTION_Q_LORA_RANK, hparams.n_lora_q);+ ml.get_key(LLM_KV_ATTENTION_KV_LORA_RANK, hparams.n_lora_kv);+ ml.get_key(LLM_KV_ATTENTION_KEY_LENGTH_MLA, hparams.n_embd_head_k_mla_impl);+ ml.get_key(LLM_KV_ATTENTION_VALUE_LENGTH_MLA, hparams.n_embd_head_v_mla_impl);+ ml.get_key_or_arr(LLM_KV_EXPERT_FEED_FORWARD_LENGTH, hparams.n_ff_exp_arr, hparams.n_layer_all);+ ml.get_key(LLM_KV_EXPERT_SHARED_COUNT, hparams.n_expert_shared);+ ml.get_key(LLM_KV_EXPERT_WEIGHTS_SCALE, hparams.expert_weights_scale, false);
fix(npm): correct the pnpm lockfile import against real-world lockfilesRust · 848 + / 20 −
Introduces 19 new declarations in libs/resolver/pnpm_lockfile_import.rs.
Adds new language design rather than adjusting what was there. Read the linked PR for the surrounding test context.
libs/resolver/pnpm_lockfile_import.rs ↗ · 1 files
@@ -756,6 +972,618 @@ snapshots: assert_eq!(v["npm"]["lodash@4.17.21"]["integrity"], "sha512-AAA"); } + #[test]+ fn aliased_snapshot_dependency() {+ // `string-width-cjs: string-width@4.2.3` names a package, not a version,+ // so it must not collapse into `string-width-cjs@string-width@4.2.3`.+ let input = r#"+lockfileVersion: '9.0'++importers:+ .:+ dependencies:+ wrap-ansi:+ specifier: ^8.1.0+ version: 8.1.0++packages:+ wrap-ansi@8.1.0:+ resolution: {integrity: sha512-WRAP}+ ansi-styles@6.2.1:+ resolution: {integrity: sha512-ANSI}+ string-width@4.2.3:+ resolution: {integrity: sha512-WIDTH}+ '@scope/pkg@1.0.0':+ resolution: {integrity: sha512-SCOPED}++snapshots:+ wrap-ansi@8.1.0:+ dependencies:+ ansi-styles: 6.2.1+ string-width-cjs: string-width@4.2.3+ scoped-alias: '@scope/pkg@1.0.0'
[Model] Support for Spark2_5ForCausalLM implementationC++ · 178 + / 0 −
Introduces 2 new declarations in src/models/spark2-5.cpp.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
src/models/spark2-5.cpp ↗ · 18 files
@@ -0,0 +1,146 @@+#include "models.h"++void llama_model_spark2_5::load_arch_hparams(llama_model_loader & ml) {+ ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps);+ ml.get_key(LLM_KV_ATTENTION_SLIDING_WINDOW, hparams.n_swa);++ hparams.swa_type = LLAMA_SWA_TYPE_STANDARD;+ ml.get_arr(LLM_KV_ATTENTION_SLIDING_WINDOW_PATTERN, hparams.is_swa_impl);++ hparams.rope_freq_base_train_swa = hparams.rope_freq_base_train;+ hparams.rope_freq_scale_train_swa = hparams.rope_freq_scale_train;+ ml.get_key(LLM_KV_ROPE_FREQ_BASE_SWA, hparams.rope_freq_base_train_swa, false);++ switch (hparams.n_layer()) {+ case 28: type = LLM_TYPE_1_7B; break;+ default: type = LLM_TYPE_UNKNOWN;+ }+}++void llama_model_spark2_5::load_arch_tensors(llama_model_loader &) {+ LLAMA_LOAD_LOCALS;++ tok_embd = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, 0);++ output_norm = create_tensor(tn(LLM_TENSOR_OUTPUT_NORM, "weight"), {n_embd}, 0);+ output = create_tensor(tn(LLM_TENSOR_OUTPUT, "weight"), {n_embd, n_vocab}, TENSOR_NOT_REQUIRED);+ if (output == nullptr) {+ output = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, TENSOR_DUPLICATED);+ }++ for (int i = 0; i < n_layer; ++i) {+ auto & layer = layers[i];+
Introduce `rustc_middle::middle::resolve`Rust · 378 + / 363 −
Introduces 28 new declarations in compiler/rustc_middle/src/middle/resolve.rs.
Adds new language design rather than adjusting what was there. Read the linked PR for the surrounding test context.
compiler/rustc_middle/src/middle/resolve.rs ↗ · 28 files
@@ -0,0 +1,309 @@+//! This module contains types that carry name resolution results from `rustc_resolve` to a+//! consumer in another crate (e.g. AST lowering, metadata, or a query).++use rustc_ast::node_id::NodeMap;+use rustc_ast::{self as ast, NodeId};+use rustc_attr_ir::StrippedCfgItem;+use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};+use rustc_data_structures::steal::Steal;+use rustc_data_structures::unord::{UnordMap, UnordSet};+use rustc_errors::{ErrorGuaranteed, LintBuffer};+use rustc_hir::def::{DefKind, Namespace, PerNS, Res};+use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, LocalModId, ModId};+use rustc_hir::definitions::PerParentDisambiguatorState;+use rustc_hir::{MissingLifetimeKind, TraitCandidate};+use rustc_macros::{StableHash, TyDecodable, TyEncodable};+use rustc_span::{ExpnId, Ident, Span, Symbol};+use smallvec::SmallVec;++use crate::middle::privacy::EffectiveVisibilities;+use crate::ty::Visibility;++/// The result of resolving a path before lowering to HIR,+/// with "module" segments resolved and associated item+/// segments deferred to type checking.+/// `base_res` is the resolution of the resolved part of the+/// path, `unresolved_segments` is the number of unresolved+/// segments.+///+/// ```text+/// module::Type::AssocX::AssocY::MethodOrAssocType+/// ^~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+/// base_res unresolved_segments = 3+///
crypto: fix multi-prime RSA JWKsC++ · 102 + / 8 −
Reworks 99 lines of existing logic in src/crypto/crypto_rsa.cc.
Changes how existing runtime behaves. Tests changed with it, with code of their own.
src/crypto/crypto_rsa.cc ↗ · 7 files
@@ -417,19 +448,79 @@ KeyObjectData ImportJWKRsaKey(Environment* env, Local<Object> jwk) { ByteSource dq = ByteSource::FromEncodedString(env, dq_value.As<String>()); ByteSource qi = ByteSource::FromEncodedString(env, qi_value.As<String>()); - if (!rsa_view.setPrivateKey(- d.ToBN(), q.ToBN(), p.ToBN(), dp.ToBN(), dq.ToBN(), qi.ToBN())) {+ ncrypto::Rsa::OtherPrimeInfoPointers other_prime_infos;+ if (!oth_value->IsUndefined()) {+ if (!oth_value->IsArray()) {+ THROW_ERR_CRYPTO_INVALID_JWK(env, "Invalid JWK RSA key");+ return {};+ }++ Local<Array> oth = oth_value.As<Array>();+ const uint32_t length = oth->Length();+ if (length == 0 || length > kMaxRsaOtherPrimeInfos) {+ THROW_ERR_CRYPTO_INVALID_JWK(env, "Invalid JWK RSA key");+ return {};+ }+ other_prime_infos.reserve(length);+ for (uint32_t i = 0; i < length; i++) {+ Local<Value> item_value;+ Local<Value> r_value;+ Local<Value> other_d_value;+ Local<Value> t_value;+ if (!oth->Get(env->context(), i).ToLocal(&item_value) ||+ !item_value->IsObject()) {+ THROW_ERR_CRYPTO_INVALID_JWK(env, "Invalid JWK RSA key");+ return {};+ }++ Local<Object> item = item_value.As<Object>();+ if (!item->Get(env->context(), env->jwk_r_string()).ToLocal(&r_value) ||+ !item->Get(env->context(), env->jwk_d_string())
Clean up the AST visitorRust · 189 + / 230 −
Introduces 14 new declarations in compiler/rustc_ast/src/visit.rs.
Adds new language design rather than adjusting what was there. Read the linked PR for the surrounding test context.
compiler/rustc_ast/src/visit.rs ↗ · 2 files
@@ -929,98 +916,110 @@ macro_rules! common_visitor_and_walkers { ) -> V::Result { match self { ForeignItemKind::Static(item) =>- visit_visitable!($($mut)? vis, item),+ visit_visitable!(vis, item), ForeignItemKind::Fn(func) => {- let kind = FnKind::Fn(FnCtxt::Foreign, visibility, &$($mut)?*func);+ let kind = FnKind::Fn(FnCtxt::Foreign, visibility, &$($mut)? *func); try_visit!(vis.visit_fn(kind, attrs, span, id)) } ForeignItemKind::TyAlias(alias) =>- visit_visitable!($($mut)? vis, alias),+ visit_visitable!(vis, alias), ForeignItemKind::MacCall(mac) =>- visit_visitable!($($mut)? vis, mac),+ visit_visitable!(vis, mac), } V::Result::output() } } - pub fn walk_fn<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, kind: FnKind<$($lt)? $(${ignore($mut)} '_)?>) -> V::Result {+ pub fn walk_fn<$($lt,)? V: $Visitor$(<$lt>)?>(+ vis: &mut V,+ kind: FnKind<$($lt)? $(${ignore($mut)} '_)?>,+ ) -> V::Result { match kind { FnKind::Fn( _ctxt, // Visibility is visited as a part of the item. _vis,- Fn { defaultness, ident, sig, generics, contract, body, define_opaque, eii_impl },+ Fn {
[rust-compiler] Propagate block lowering errorsRust · 38 + / 27 −
Introduces 1 new declaration in compiler/crates/react_compiler_lowering/src/build_hir.rs.
Adds new language design rather than adjusting what was there. Read the linked PR for the surrounding test context.
compiler/crates/react_compiler_lowering/src/build_hir.rs ↗ · 2 files
@@ -2589,17 +2588,25 @@ fn lower_block_statement( block: &react_compiler_ast::statements::BlockStatement, parent_scope: Option<react_compiler_ast::scope::ScopeId>, ) -> Result<(), CompilerError> {- let _ = lower_block_statement_inner(builder, block, None, parent_scope);- Ok(())+ Ok(lower_block_statement_inner(+ builder,+ block,+ None,+ parent_scope,+ )?) } fn lower_block_statement_with_scope( builder: &mut HirBuilder, block: &react_compiler_ast::statements::BlockStatement, scope_override: react_compiler_ast::scope::ScopeId, ) -> Result<(), CompilerError> {- let _ = lower_block_statement_inner(builder, block, Some(scope_override), None);- Ok(())+ Ok(lower_block_statement_inner(+ builder,+ block,+ Some(scope_override),+ None,+ )?) } fn lower_block_statement_inner(
quic: stop guarding ngtcp2_recv_stop_sending callback fieldC++ · 16 + / 20 −
Reworks 32 lines of existing logic in src/quic/session.cc.
Changes how existing framework internals behaves. Read the linked PR for the surrounding test context.
src/quic/session.cc ↗ · 2 files
@@ -1720,44 +1718,42 @@ struct Session::Impl final : public MemoryRetainer { on_stream_open, on_stream_close, nullptr, // recv_stateless_reset (deprecated, use v2 below)- nullptr,+ nullptr, // recv_retry on_extend_max_streams_bidi, on_extend_max_streams_uni, on_rand, nullptr, // get_new_connection_id (deprecated, use v2 below) on_remove_connection_id, ngtcp2_crypto_update_key_cb, on_path_validation,- nullptr,+ nullptr, // select_preferred_addr on_stream_reset, on_extend_max_remote_streams_bidi, on_extend_max_remote_streams_uni, on_extend_max_stream_data, nullptr, // dcid_status (deprecated, use v2 below)- nullptr,- nullptr,+ nullptr, // handshake_confirmed+ nullptr, // recv_new_token ngtcp2_crypto_delete_crypto_aead_ctx_cb, ngtcp2_crypto_delete_crypto_cipher_ctx_cb, on_receive_datagram, on_acknowledge_datagram, on_lost_datagram, nullptr, // get_path_challenge_data (deprecated, use v2 below)- nullptr, // stream_stop_sending+ nullptr, // stream_stop_sending (deprecated, use v2 below) ngtcp2_crypto_version_negotiation_cb,- nullptr,