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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio int8 GEMM: the unlisted-card race switch acts between loads (#17084)
Daniel Han8b11dabec942
diff --git a/studio/backend/core/inference/diffusion_int8_gemm.py b/studio/backend/core/inference/diffusion_int8_gemm.pyindex 5036753c4bf..8f0522784b3 100644--- a/studio/backend/core/inference/diffusion_int8_gemm.py+++ b/studio/backend/core/inference/diffusion_int8_gemm.py@@ -733,8 +733,8 @@ def unlisted_config(index: int) -> Optional[tuple]:if index not in _UNLISTED_PROBE:_UNLISTED_PROBE[index] = _probe(index, _FALLBACK_CONFIG)if _UNLISTED_PROBE[index]:- key = (index, mode)tile = _FALLBACK_CONFIG if mode == "force" else _unlisted_tile(index)+ key = (index, mode, tile)if key not in _UNLISTED_OK:ok = Trueif mode != "force":@@ -837,6 +837,10 @@ def _race_cache_store(key: Optional[str], tile: tuple) -> None:def _unlisted_tile(index: int) -> tuple:"""Once per device: fastest probe-passing tile vs the fallback (ties keep the fallback), persisted per card andtoolchain. Any failure, or UNSLOTH_DIFFUSION_INT8_GEMM_RACE=0, keeps the fallback."""+ if (+ not race_enabled()+ ): # read per load, ahead of the kept winner, so the switch acts between loads+ return _FALLBACK_CONFIGif index not in _UNLISTED_TILE:best = _FALLBACK_CONFIGtry:diff --git a/studio/backend/tests/test_diffusion_int8_gemm_unlisted.py b/studio/backend/tests/test_diffusion_int8_gemm_unlisted.pyindex d6e0240be46..901b382a13b 100644--- a/studio/backend/tests/test_diffusion_int8_gemm_unlisted.py+++ b/studio/backend/tests/test_diffusion_int8_gemm_unlisted.py@@ -450,6 +450,17 @@ def test_race_switch_off_keeps_the_fallback_and_never_reads_the_file(monkeypatchassert fake.raced == [] and fake.probes == [g8._FALLBACK_CONFIG]+def test_race_switch_acts_between_loads_after_a_winner_is_kept(monkeypatch):+ fake = _Fake(monkeypatch, (8, 6), race = {_L4_TILE: 7.0})+ assert g8.device_config(0) == _L4_TILE+ monkeypatch.setenv(g8.INT8_GEMM_RACE_ENV, "0")+ assert g8.device_config(0) == g8._FALLBACK_CONFIG+ assert fake.timed[-1] == g8._FALLBACK_CONFIG+ monkeypatch.delenv(g8.INT8_GEMM_RACE_ENV)+ assert g8.device_config(0) == _L4_TILE+ assert len(fake.raced) == 1 # the kept winner, not a second race++def test_cache_keeps_a_bounded_number_of_cards(monkeypatch, tmp_path):import json