kyty: compile admission deadlocks when a background job holds the memory reservation while the title waits for a pipeline
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with core/kyty/graphics/host_gpu/renderer/pipeline/manifestAdmission.h, especially ManifestAdmission::Decide, and trace how reservation refresh interacts with the Refusal::Limit check. Reproduce the reported sequence with the probe described for KytyShim/tests/ManifestStartup.cpp. Done when the awaited foreground compile is admitted after the background reservation expires and the startup checks pass.
索引モデルが issue の本文から書いたものです。
説明
What happens
PPSA38500 01.002.001 on Windows, AnyKyty a79cd8d8d3 (RTX 5070 Ti, 31.1 GiB RAM). The pipeline cache was cold, so the manifest compiled 3061 modules in about 15 minutes. At about 1000 s the title waited for fragment shader 0x1c4c15c7b1b44579 and never got it. The screen stayed black with Waiting for shader 0x1c4c15c7b1b44579 (794 s) until the run was stopped at 1800 s. Pipeline stall: 31 pipelines left repeated every 10 s.
For those 13 minutes the manifest log said nothing was compiling, but admission was still refusing for memory:
Pipeline manifest: concurrency 0 of 8 (CPU cap 8, 0.0 of 0 CPUs busy elsewhere), 7.0 GiB available of 31.1, reserve 6.2, committed 0.0, in use by compilations 0.0, 3.0 KiB per SPIR-V word, waiting for memory, driver compilations at most 4 (3 for startup jobs nobody waits for) and 1000000 SPIR-V words while the title runs
There was no crash and no device loss.
Cause
In ManifestAdmission::Decide (core/kyty/graphics/host_gpu/renderer/pipeline/manifestAdmission.h), the reservation holder refreshes m_reservation->seen before the Refusal::Limit check:
if (m_reservation && m_reservation->caller == caller) m_reservation->seen = now;
const auto running = foreground ? m_foreground_jobs : static_cast<uint32_t>(m_jobs.size());
if (running >= m_limit || (!foreground && m_foreground_waiting != 0)) return Refusal::Limit;
The deadlock happens in this order:
- A background
Source::Manifestjob is refused for memory forStarveWait(60 s) while another compile runs. It takesm_reservation. - The running compile finishes. A compile the title waits for arrives, so
NoteForegroundWaiting(true). - The background job keeps retrying every 250 ms. Each time it is refused with
Limitbecause a foreground compile is waiting, but it still refreshesseen, soReservationLife(2 s) never expires the reservation. - The title's compile sees
other_reserved. That failsestimate + reserved <= Room()and blocks the lone-job path, so it getsMemoryforever.
Neither job can run. Translations (state.Admit(stop, code.size(), false)) and the manifest callers get no deferred pointer outside a manifest worker (Deferrable), so they keep retrying instead of leaving.
Reproduction without a game
This probe drives ManifestAdmission with the numbers from the run (31 GiB total, 7 GiB available, playing). It goes in KytyShim/tests/ManifestStartup.cpp:
ManifestAdmission admission(8, nullptr);
ManifestAdmissionSample sample {.total = 31 * GiB, .available = 7 * GiB, .process = 20 * GiB, .busy_cpus = 0.0, .cpus = 16};
admission.Sample(start, sample);
admission.SetPlaying(true);
const auto running = admission.AdmitPromoted(start, 500'000, true, runner, start);
auto now = start + ManifestAdmission::StarveWait;
admission.Sample(now, sample);
admission.Admit(now, 500'000, true, background, start); // refused: Memory, takes the reservation
admission.Finish(*running);
admission.NoteForegroundWaiting(true);
// then every 250 ms for 15 simulated minutes: Sample, Admit(background), AdmitAwaitedForeground(title)
On a79cd8d8d3, the background job is refused with Limit and keeps the reservation, the title is refused with Memory, and neither is admitted in 15 simulated minutes.
Possible fix
Refresh the reservation only after the Limit check, so a job turned away because the title is waiting stops holding it, and it expires after ReservationLife:
if (m_closed) return Refusal::Closed;
- if (m_reservation && m_reservation->caller == caller) m_reservation->seen = now;
const auto running = foreground ? m_foreground_jobs : static_cast<uint32_t>(m_jobs.size());
if (running >= m_limit || (!foreground && m_foreground_waiting != 0)) return Refusal::Limit;
+ if (m_reservation && m_reservation->caller == caller) m_reservation->seen = now;
With this change the probe admits the title's compile 2 s later, and all existing checks in kyty_shim_manifest_startup_tests still pass.
In the game, with this change and the warm cache from the stalled run, PPSA38500 reached gameplay at about 8 minutes. The log never says waiting for memory, and every shader wait ended; the longest was 87 s, with 52 compiles finished meanwhile. The run then ended at 520 s on an unrelated sceAgcJumpPatchSetTarget_0300: unexpected packet type, size or flags abort in libSceAgc.
AI-assisted: yes
- 主要言語
- C++
- スター
- 214
- フォーク
- 7
- 平均マージ
- 7時間 53分
- マージ済み PR(30日)
- 280
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
simnJS/AnyPS5 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
simnJS/AnyPS5#735 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
simnJS/AnyPS5#721 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
simnJS/AnyPS5#716 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Call for contributions: Windows, AMD and Intel validation (run the tests on your hardware)対応中かも @adam25136 が今日担当しました。 オープンarea: tools-ci area: windows good first issue help wanted needs: AMD needs: Windows
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
simnJS/AnyPS5#705 · コメント 8 件 ·
メンテナーはふだん 1 日以内に返信
-
kyty: kyty_shim_rt_context_pick fails pipeline creation with ErrorUnknown on AMD Windows (RX 6800)オープン
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
simnJS/AnyPS5#741 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
area:tests kind:test
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
? - Needs Triage bot_watch bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/cudf-spark-jni#5594 ·
メンテナーはふだん 1 日以内に返信
-
Branch-master
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TrinityCore/TrinityCore#32177 ·
メンテナーはふだん 10 日以内に返信
-
area:manager enhancement kind:ux P3 platform:windows
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信