Selected changesmerged Oct 22, 2026
Add webpack utilsTypeScript · 650 + / 0 −
Introduces 14 new declarations in turbopack/crates/turbopack-node/js/src/transforms/webpack-loaders-utils.ts.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
turbopack/crates/turbopack-node/js/src/transforms/webpack-loaders-utils.ts ↗ · 12 files
@@ -0,0 +1,648 @@+import { createHash as nodeCreateHash } from 'crypto'+import path from 'path'++const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/++function relativePathToRequest(relativePath: string): string {+ if (relativePath === '') return './.'+ if (relativePath === '..') return '../.'+ if (relativePath.startsWith('../')) return relativePath+ return `./${relativePath}`+}++// Matches webpack's lib/util/identifier.js, including regexp-like requests.+function absoluteToRequest(context: string, request: string): string {+ const windows = WINDOWS_ABS_PATH_REGEXP.test(request)+ if (!windows && request[0] !== '/') return request+ if (!windows && request.length > 1 && request.endsWith('/')) return request++ const queryIndex = request.indexOf('?')+ const resource = queryIndex === -1 ? request : request.slice(0, queryIndex)+ let relative = windows+ ? path.win32.relative(context, resource)+ : path.posix.relative(context, resource)+ if (!windows || !WINDOWS_ABS_PATH_REGEXP.test(relative)) {+ relative = relativePathToRequest(+ windows ? relative.replace(/\\/g, '/') : relative+ )+ }+ return relative + (queryIndex === -1 ? '' : request.slice(queryIndex))+}++export function contextify(context: string, request: string): string {+ return request
🚨Add an FP8 backend to `QuantizedCache`Python · 144 + / 27 −
Introduces 14 new declarations in src/transformers/cache_utils.py.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/cache_utils.py ↗ · 6 files
@@ -919,6 +941,76 @@ def _dequantize(self, qtensor): return tensor +class Fp8QuantizedLayer(BaseQuantizedLayer):+ """+ A quantized layer storing the key and value states in 8-bit floating point. The per-tensor scale is frozen+ after the first `update`, so new states are appended as-is: no residual cache, no re-quantization.++ A finer-grained variant belongs here rather than under `QuantizedLayer`, as grouping along the head+ dimension keeps states appendable and only turns the stored scale into a tensor.+ """++ fp8_dtype = torch.float8_e4m3fn+ fp8_max = torch.finfo(fp8_dtype).max++ def lazy_initialization(self, key_states: torch.Tensor, value_states: torch.Tensor) -> None:+ super().lazy_initialization(key_states, value_states)+ self._quantized_keys = self._quantize(key_states)+ self._quantized_values = self._quantize(value_states)++ def _quantize(self, tensor, scale=None):+ """Quantize `tensor` to FP8, calibrating the scale on its amplitude if it is not provided."""+ if scale is None:+ # `clamp` guards against an all-zeros tensor, which would give a null scale+ scale = (tensor.abs().amax().float() / self.fp8_max).clamp(min=torch.finfo(torch.float32).tiny)+ return (tensor.float() / scale).to(self.fp8_dtype), scale++ def _dequantize(self, qtensor):+ quant_tensor, scale = qtensor+ return (quant_tensor.float() * scale).to(self.dtype)++ def update(+ self, key_states: torch.Tensor, value_states: torch.Tensor, *args, **kwargs
Reland debug impl for fieldless enums with concatenated string without using discriminant_valueRust · 108 + / 0 −
Introduces 3 new declarations in compiler/rustc_builtin_macros/src/deriving/debug.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_builtin_macros/src/deriving/debug.rs ↗ · 6 files
@@ -256,3 +259,94 @@ fn show_fieldless_enum( let fn_path_write_str = cx.std_path(span, &[sym::fmt, sym::Formatter, sym::write_str]); BlockOrExpr::new_expr(cx.expr_call_global(span, fn_path_write_str, thin_vec![fmt, name])) }++/// Special case for large enums with no fields. Builds:+/// ```text+/// impl ::core::fmt::Debug for A {+/// fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {+/// ::core::fmt::Formatter::debug_c_like_enum_write_str(f,+/// "A B C D E F",+/// match self {+/// A::A => 0usize,+/// A::B => 2usize,+/// A::C => 4usize,+/// A::D => 6usize,+/// A::E => 8usize,+/// A::F => 10usize,+/// })+/// }+/// }+/// ```+fn show_fieldless_enum_concat_str(+ cx: &ExtCtxt<'_>,+ span: Span,+ def: &EnumDef,+ type_ident: Ident,+) -> Option<Box<ast::Expr>> {+ // Minimum variant count where this optimization starts to pay off.+ // Initial value of 10 came from https://github.com/rust-lang/rust/pull/155452.+ // Refined with the new impl in https://github.com/rust-lang/rust/pull/162535.+ // Tested with thresholds 10,5,2 on rustc-perf+ // and by comparing MIR sizes for various enums in GodBolt.+ //
node: resourcemanager: API to check exclusive assignment availabilityGo · 252 + / 21 −
Introduces 24 new declarations in pkg/kubelet/cm/testing/mocks.go.
Adds new systems design rather than adjusting what was there. Tests changed with it, with code of their own.
pkg/kubelet/cm/testing/mocks.go ↗ · 27 files
@@ -67,6 +67,57 @@ func (_m *MockContainerManager) EXPECT() *MockContainerManager_Expecter { return &MockContainerManager_Expecter{mock: &_m.Mock} } +// AllocationMode provides a mock function for the type MockContainerManager+func (_mock *MockContainerManager) AllocationMode(res v1.ResourceName) cm.ResourceAllocationMode {+ ret := _mock.Called(res)++ if len(ret) == 0 {+ panic("no return value specified for AllocationMode")+ }++ var r0 cm.ResourceAllocationMode+ if returnFunc, ok := ret.Get(0).(func(v1.ResourceName) cm.ResourceAllocationMode); ok {+ r0 = returnFunc(res)+ } else {+ r0 = ret.Get(0).(cm.ResourceAllocationMode)+ }+ return r0+}++// MockContainerManager_AllocationMode_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AllocationMode'+type MockContainerManager_AllocationMode_Call struct {+ *mock.Call+}++// AllocationMode is a helper method to define mock.On call+// - res v1.ResourceName+func (_e *MockContainerManager_Expecter) AllocationMode(res any) *MockContainerManager_AllocationMode_Call {+ return &MockContainerManager_AllocationMode_Call{Call: _e.mock.On("AllocationMode", res)}+}++func (_c *MockContainerManager_AllocationMode_Call) Run(run func(res v1.ResourceName)) *MockContainerManager_AllocationMode_Call {+ _c.Call.Run(func(args mock.Arguments) {
sqlite: propagate option getter errors and dedupe boolean optionsC++ · 79 + / 386 −
Reworks 433 lines of existing logic in src/node_sqlite.cc.
Changes how existing runtime behaves. Tests changed with it, with code of their own.
src/node_sqlite.cc ↗ · 2 files
@@ -1893,90 +1919,23 @@ void Database::New(const FunctionCallbackInfo<Value>& args) { } Local<Object> options = args[1].As<Object>();- Local<String> open_string = FIXED_ONE_BYTE_STRING(env->isolate(), "open");- Local<Value> open_v;- if (!options->Get(env->context(), open_string).ToLocal(&open_v)) {+ bool read_only = open_config.get_read_only();+ bool enable_foreign_keys = open_config.get_enable_foreign_keys();+ bool enable_dqs = open_config.get_enable_dqs();+ if (!ReadOptionalBool(env, options, "open", &open)) return;+ if (!ReadOptionalBool(env, options, "readOnly", &read_only)) return;+ if (!ReadOptionalBool(+ env, options, "enableForeignKeyConstraints", &enable_foreign_keys)) return;- }- if (!open_v->IsUndefined()) {- if (!open_v->IsBoolean()) {- THROW_ERR_INVALID_ARG_TYPE(- env->isolate(), "The \"options.open\" argument must be a boolean.");- return;- }- open = open_v.As<Boolean>()->Value();- }-- Local<String> read_only_string =- FIXED_ONE_BYTE_STRING(env->isolate(), "readOnly");- Local<Value> read_only_v;- if (!options->Get(env->context(), read_only_string).ToLocal(&read_only_v)) {+ if (!ReadOptionalBool(+ env, options, "enableDoubleQuotedStringLiterals", &enable_dqs)) return;- }- if (!read_only_v->IsUndefined()) {