Skip to content

[安卓 / 门禁] 出包预编库(LibPack)与设备现编同口径:等价检查进门禁 + release 冒烟进列车 #1836

Open

Description

@n06ody

@jhaizhou-ops 提议:把「出包预编库(LibPack)与设备现编同口径」接进安卓门禁和文档。

为什么

安卓上着色器有两条翻译路:

  • 设备现编:起局后在手机上按本机能力翻。debug 包只走这条。
  • LibPack:出包时在电脑上预先翻好、随正式包分发,设备取件后收编使用。只有 release 包走这条。

两条共用 Ryujinx 的翻译核心,但「回答层」(能力 / 格式等查询怎么答)和「收编层」(取件后的核对、补绑定、建管线)是两套代码。日常开发和性能对比几乎都用 debug 包,LibPack 这条路长期没人跑。贡献者改其中一边时,很容易意识不到另一边也要跟着改。

这几天空轨 2nd 上连续踩到的都是这一类:

现象 根因 怎么暴露的
Mali 上 94.6% 的库程序被拒,整库退回现编 出库答「支持像素锁」、挂了空声明,设备不支持 #1774
8E 正式包读档后 3D 全黑 出库对只读按位读答「不支持无格式读」,声明 R32ui;现编答支持、声明 Unknown。运行时格式核对失败,整笔跳过色调映射 同 APK 开 / 关库单变量,关库即正常
计算程序 45 KB 共享内存超 Mali 32 KB 上限 收编只核能力声明,没核 SPIR-V 里的资源需求 9000 正式包设备丢失排查中
绑定槽 = -1 的库程序 出库生成器的映射缺口 r2 统计「不可用 27」

这些在 debug 包上都不会出现,只在正式包、而且要真进到场景才暴露。

提议

  1. 门禁:库版 ≡ 现编版的等价检查(宿主,所有游戏通用)

    • 对一组着色器语料(翻译器夹具 + 每次出库的实际程序),分别按「出库口径」和「设备口径」翻一遍。设备口径用仓里的设备能力事实档案,例如 8E / 9000 的 profile。
    • 比对接口事实:绑定集合与描述符类型、图像声明格式和维度、共享内存与工作组大小、能力 / 扩展声明、输入输出接口。
    • 出包时:不一致的程序不进库,具名记录差异项和程序键,设备上照常现编。
    • 门禁时:改了任一边的回答层或收编层、导致语料出现新差异,判红。

    这样谁改了一边忘了另一边,都会在门禁里被拦下。

  2. 运行时:库版核对失败时回退现编,而不是跳过。只有现编也做不到,才具名红并跳过。

  3. 列车加一项 release 冒烟(带 LibPack):至少一款游戏进到可操控场景,库确实打开且有命中;GPU 故障(设备丢失 / vkQueueSubmit 失败 / present_failed)为 0,运行时拒收后跳过为 0。

  4. 文档:在《贡献指南》或《方案》里加一节「两条翻译路」,说明改动回答层、收编层或绑定模型时,两边都要看,并用第 1 条的检查自证。

我们这边在做 / 能做的

Activity

  1. jhaizhou-ops commented on Nov 21, 2026

    @jhaizhou-ops
    Owner

    n06ody 谢谢,提议写得很清楚:两条翻译路(设备现编 / 出包预编库 LibPack)共用翻译核心、但回答层和收编层是两套代码,debug 包只走现编,LibPack 长期没人跑;表里四个空轨 2nd 的实例(Mali 像素锁、8E 只读按位读格式不符致 3D 全黑、共享内存超上限、绑定槽 -1)都只在正式包进场景才暴露,很有说服力。

    你们在做的两项(出包侧不一致程序不进库、运行时核对失败回退现编而不是跳过)方向我们同意,做完开 PR 就好。等价检查接进哪一层门禁、语料与设备档案放哪、release 冒烟由谁接列车、文档放哪一节,这几件交给负责安卓门禁和车道的安卓线来定,在这里回你。


    n06ody Thanks, the proposal is clear: the two translation paths (on-device compile / prebuilt LibPack) share the translator core but have separate answer and adoption layers, debug builds only exercise on-device compile, and LibPack has long gone unexercised. The four Trails 2nd cases in the table (Mali pixel interlock, 8E read-only bitwise format mismatch causing a black 3D scene, shared memory over the limit, binding slot -1) only surface in release builds once in a scene, which makes a strong case.

    We agree with the two items you're already doing (mismatching programs stay out of the library at build time; on adoption mismatch, fall back to on-device compile instead of skipping); open PRs when ready. Which gate layer the equivalence check goes into, where the corpus and device profiles live, who wires the release smoke into the merge train, and where the docs section goes will be decided by the Android maintainers, who own the Android gate and lanes; they'll reply here.

  2. jhaizhou-ops commented on Nov 21, 2026

    @jhaizhou-ops
    Owner

    @n06ody 方向同意,四件事这样定:

    1. 等价检查放哪层门禁

    • 门禁里跑小语料:做成一个单测(tests/libpack_device_parity_test.sh 之类),语料是仓里固定的一小份(翻译器夹具 + 从你们踩到的那几类各挑代表程序,几十到一两百个),设备口径用仓里的档案。预算按普通单测 60 秒以内;路由写在文件头 # 门禁路由:,覆盖两边的回答层和收编层(graphics/tools/direct/compiler/、graphics/tools/direct/vklib/ 一带、android/native/direct/libpack_vk.c、android/native/nvn/nvn_vk_program_result.c、android/native/direct/device_caps.c),只在改到这些时才跑,放合入前。这样改了一边忘了另一边,入车就会被拦下。
    • 全量语料不进门禁:每次出库的实际程序走你说的出包侧硬闸(不一致的程序不进库、具名记录、设备照常现编)。全量比对放在出包里做,不拖门禁吞吐。
    • 新差异判红,已有的存量差异先列白名单(带程序键和差异项),只减不增。

    2. 语料与设备档案放哪

    • 设备档案:仓里已有 android/tests/vk/profiles/s2a_sim_tiers.json(模拟档位),真机能力事实建议同目录加 android/tests/vk/profiles/devices/<设备>.json,内容就是会话起点日志里那行 direct device caps(s2a-device-caps-v1),8E、9000 先入两份。我们这边的骁龙 8 至尊版(Adreno 830,驱动 2150760521)可以补一份。
    • 语料:放 graphics/tools/direct/tests/parity_corpus/。只放翻译器夹具和合成 / 最小化的着色器,不放游戏原始着色器字节(公开仓)。从游戏里踩到的形态,最小化成合成用例再入库。

    3. release 冒烟谁接:列车跑在没有安卓真机的门禁机上,不进列车。由安卓线接,放在我们的真机通路上:

    • 每天用当天 main 出一次 release 包(带 LibPack),在我们的骁龙 8 至尊版上进可操控场景。判据照你写的:库打开且有命中、GPU 故障 0、拒收后跳过 0。
    • 发版前的安卓验收也走这一项。
    • Mali 那一档我们手上没有设备,需要你们的天玑 9000 按同一判据跑,结果贴到总表 [安卓 / 总表] 安卓直连追平 iOS:缺陷重提、性能分批与认领 #48。

    4. 文档:放根目录 CONTRIBUTING.md 加一节「安卓两条翻译路(设备现编 / 出包预编库)」,写清改回答层、收编层或绑定模型时两边都要看,并用第 1 条的单测自证;docs/ 里的设计文档只链过去,不重复写。

    ② 运行时核对失败回退现编、不跳过:同意,这一条直接修了你踩到的「读档后 3D 全黑」那类问题,PR 开出来我们优先审。


    Agreed. (1) A small fixed-corpus parity unit test in the pre-merge gate (≤60 s, routed on the answer / adoption layers of both paths), plus the full per-pack comparison as a pack-time hard gate, not in CI; existing differences go on a shrink-only allowlist. (2) Device capability profiles under android/tests/vk/profiles/devices/ (the s2a-device-caps-v1 line), corpus under graphics/tools/direct/tests/parity_corpus/ — fixtures and synthetic/minimised shaders only, no game shader bytes. (3) The release smoke can't run on the gate machines (no Android device); the Android line will own a daily release-with-LibPack smoke on our Snapdragon 8 Elite, and we'd ask you to run the same criteria on the Dimensity 9000. (4) A "two translation paths" section in CONTRIBUTING.md. The runtime fallback to device compile is welcome; we'll review it first.

  3. added 20 commits that reference this issue on Nov 21, 2026
  4. added a commit that references this issue on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions