Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Skip pinned staging for native int8 host quantisation on integrated GPUs (#16235)

Daniel Han9fd853350a39
diff --git a/studio/backend/core/inference/diffusion_native_quant.py b/studio/backend/core/inference/diffusion_native_quant.py
index c160968fdef..9d7104dac6b 100644
--- a/studio/backend/core/inference/diffusion_native_quant.py
+++ b/studio/backend/core/inference/diffusion_native_quant.py
@@ -781,6 +781,10 @@ class _HostLinearMover:
def _staging(self, slot: str, nbytes: int) -> Any:
import torch
+ from .host_pinning import host_pinning_allowed
+
+ if not host_pinning_allowed(self.device):
+ return None
buf = self._pinned.get(slot)
if buf is None or buf.numel() < nbytes:
self._pinned[slot] = None
diff --git a/studio/backend/tests/test_integrated_gpu_no_host_pin.py b/studio/backend/tests/test_integrated_gpu_no_host_pin.py
index e2ae3057961..44ba29766a7 100644
--- a/studio/backend/tests/test_integrated_gpu_no_host_pin.py
+++ b/studio/backend/tests/test_integrated_gpu_no_host_pin.py
@@ -606,6 +606,22 @@ def test_keep_cpu_weights_follow_the_target_device(
assert pinned > 0 and pins
[email protected]("current_integrated, target_integrated", _MIXED)
+def test_native_quant_host_staging_follows_the_target_device(
+ mixed_gpu, pins, current_integrated, target_integrated
+):
+ from core.inference import diffusion_native_quant as nq
+
+ mixed_gpu(current_integrated, target_integrated)
+ mover = nq._HostLinearMover(_TARGET)
+ up = mover._staging("up", 1024)
+ down = mover._staging("down", 512)
+ if target_integrated:
+ assert up is None and down is None and pins == []
+ else:
+ assert up.numel() >= 1024 and down.numel() >= 512 and pins == ["empty", "empty"]
+
+
@pytest.mark.parametrize("current_integrated, target_integrated", _MIXED)
def test_pin_planners_follow_the_target_device(
monkeypatch, mixed_gpu, current_integrated, target_integrated