fix(m0,docs): fail gamemode on unstarted placements and never overrun the game reserve

The gamemode stage was "ok" when only the normal placement started; a
placement that does not start, or a measurement error inside one, now marks
the stage partial. The design no longer raises the expert budget above the
computed one: it shrinks the game reserve to what the smallest placement
leaves, shows that, and pauses the LLM during games when nothing is left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-10 17:43:26 +09:00
parent 8124451402
commit 8dfab3ab6e
3 changed files with 25 additions and 2 deletions

View File

@@ -27,11 +27,12 @@
|---|---|---|---|
| 평소 | 게임이 없고 VRAM이 넉넉함 | 전문가 층을 VRAM에 들어가는 만큼 올림(Strata 자동 배치), 동시 요청 2개, 이미지는 GPU로 읽기 | 화면 캡처 미리 준비(말하는 중), 화질 보통, 지난 대화 약 8천 토큰 |
| 게임 중 | 게임을 감지했거나, 다른 프로그램이 VRAM을 써서 남은 VRAM이 "게임용으로 비울 VRAM"보다 적음 | 전문가 층의 VRAM 몫(`--expert-vram`)을 줄여 "게임용으로 비울 VRAM"(기본 8GB)을 비움. 나머지 전문가 층은 RAM에서 CPU로 계산. 동시 요청 1개, 이미지는 CPU로 읽기. CPU 작업자 수를 줄일지는 M0 `gamemode` 결과로 정함 | 캡처 미리 준비 끔, 화질 빠름(긴 변 768px), 지난 대화 약 4천 토큰 |
| 일시정지 | 사용자가 켠 경우에만(기본 꺼짐) | LLM을 멈춤 | 게임 중에는 대답하지 않음 |
| 일시정지 | 사용자가 켠 경우(기본 꺼짐), 또는 이 PC에서 최소 배치로도 게임 몫을 비울 수 없을 때 | LLM을 멈춤 | 게임 중에는 대답하지 않음 |
### PC마다 값을 계산
- **배치는 계산해서 정함**: 전문가 층 VRAM 몫 = 그래픽카드 VRAM − 게임용으로 비울 VRAM − 다른 프로그램이 이미 쓰는 VRAM − STT 몫(약 1.3GB) − 엔진 기본 버퍼. 정해 둔 숫자가 아니라 이 식으로 구하므로 VRAM이 작은 PC에도 같은 규칙이 맞습니다. 몫이 M0에서 잰 가장 작은 값보다 작으면 그 가장 작은 값을 씁니다.
- **배치는 계산해서 정함**: 전문가 층 VRAM 몫 = 그래픽카드 VRAM − 게임용으로 비울 VRAM − 다른 프로그램이 이미 쓰는 VRAM − STT 몫(약 1.3GB) − 엔진 기본 버퍼. 정해 둔 숫자가 아니라 이 식으로 구하므로 VRAM이 작은 PC에도 같은 규칙이 맞습니다.
- **몫이 최소 배치보다 작을 때**: 계산한 몫이 엔진이 시작할 수 있는 가장 작은 배치(M0 `gamemode`에서 시작에 성공한 가장 작은 값)보다 작으면, 몫을 늘려 게임 몫을 침범하지 않습니다. 대신 게임용으로 비울 VRAM을 "그래픽카드 VRAM − 다른 프로그램 − STT 몫 − 엔진 기본 버퍼 − 최소 배치"까지 줄이고, 대시보드와 게임 모드 설정 화면에 "이 PC에서는 게임에 X GB까지만 비울 수 있음"을 표시합니다. 이렇게 줄인 값이 0 이하이면(예: 8GB 그래픽카드에서 다른 프로그램이 이미 많이 씀) 게임 중에는 LLM을 멈추고 일시정지 단계로 갑니다. 게임 중 일시정지를 꺼 두었어도 마찬가지이고, 그 이유를 대시보드에 표시합니다. 게임이 끝나면 되돌리기 규칙대로 돌아옵니다.
- **첫 실행 자가 점검**: 설치가 끝나면 평소·게임 중 배치로 각각 30초씩 출력 속도와 음성 첫 문장 시간을 잽니다. 평소 배치가 기준(출력 30 tok/s, 음성 첫 문장 0.7초)에 못 미치는 PC는 평소에도 동시 요청 1개, 이미지 CPU 읽기, 지난 대화 약 4천 토큰으로 시작합니다. 게임 중 배치가 기준에 못 미치면 대시보드와 설정 화면에 "게임 중에는 답이 느릴 수 있음"을 표시합니다.
- **실행 중 감시**: 대시보드가 이미 재는 단계별 지연을 씁니다. 음성 첫 문장이 최근 5번 중 3번 이상 0.7초를 넘으면 다시 시작 없이 바꿀 수 있는 것부터 낮춥니다: 지난 대화 양 → 화질 → 캡처 미리 준비. 10분 동안 기준 안에 들면 하나씩 되돌립니다. 다시 시작이 필요한 배치 변경은 게임 감지와 VRAM 부족 때만 합니다.

View File

@@ -311,8 +311,12 @@ def measure_levels(r: StageResult, s: Strata, preset: dict, context: int, levels
r["server"] = {"model": c.model, "info": server_info(base)}
c.chat([{"role": "user", "content": "안녕"}], max_tokens=8) # loading is not answer time
row.update(quick_bench(c))
for err in row["errors"]:
r.error(f"level {lv['key']}", err)
except Exception as e:
r.error(f"level {lv['key']}", e)
else:
r.error(f"level {lv['key']}", "the placement did not start")
now = gpu_memory_mib() if ready else None # the sampler can miss a short run
peak = max(x for x in (g.peak, now[0] if now else None) if x is not None) \
if g.peak is not None or now else None

View File

@@ -513,6 +513,17 @@ def test_a_placement_that_does_not_start_is_recorded_and_the_rest_still_run(tmp_
assert len(started) == len(llm.LEVELS)
row = next(x for x in r["levels"] if x["key"] == "game_experts_4g")
assert row["switch_s"] is None and "decode_tok_s" not in row
# A placement that never started is a gap in the measurement, not a pass.
assert r["status"] == "partial"
assert any("game_experts_4g" in e["where"] for e in r["errors"])
def test_only_the_normal_placement_starting_is_not_ok(tmp_path, monkeypatch, fake_server):
r, _, _ = _run_levels_stage(tmp_path, monkeypatch, fake_server, _vram,
ready=lambda sets: not any(s.startswith("expert-vram=") for s in sets))
assert r["game_choice"] is None
assert r["status"] == "partial"
assert sum(1 for e in r["errors"] if e["where"].startswith("level game_")) == 4
def _row(key, free, tok_s):
@@ -537,3 +548,10 @@ def test_kit_has_a_one_click_runner_for_desktop_and_gamemode():
assert "gamemode" in keys
bat = (Path(m0.KIT) / "run_m0_gamemode.bat").read_text(encoding="utf-8")
assert "-Only desktop,gamemode" in bat and "-Redo" in bat
def test_a_measurement_error_inside_a_placement_marks_the_stage_partial(tmp_path, monkeypatch, fake_server):
monkeypatch.setattr(llm, "quick_bench", lambda c: {"errors": ["decode: TimeoutError"], "decode_tok_s": {"n": 0}})
r, _, _ = _run_levels_stage(tmp_path, monkeypatch, fake_server, _vram)
assert r["status"] == "partial"
assert any(e["error"] == "decode: TimeoutError" for e in r["errors"])