Skip to content

test(cpu-model-test): 3D mesh parse + slice + point-cloud carpet - #1871

Open
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-model-test
Open

test(cpu-model-test): 3D mesh parse + slice + point-cloud carpet#1871
Lfan-ke wants to merge 1 commit into
rcore-os:devfrom
Lfan-ke:apps-starry-cpu-model-test

Conversation

@Lfan-ke

@Lfan-ke Lfan-ke commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

概述

apps/starry/cpu-model-test:3D 模型 carpet(C 侧纯 CPU),覆盖 mesh 解析 + 3D 打印切片 + 点云。每断言都是精确几何 / 闭式对 golden 硬断言。自写 OBJ/STL/PLY 解析器、mesh-plane 切片器、barycentric+z-buffer 光栅器、点云统计;glTF/glb 用 vendored cgltf.h;仅 SHA-256+比对+golden 自写。无重库(assimp),静态链接。

Cells 与断言(host 真跑绿, 三门 fail==0 && total==EXPECTED==pass, mutation-tested)

cell 断言
model_parse OBJ/STL(bin+ASCII)/PLY(ASCII+bin) 解析: cube 5 解析器同几何(12三角/8角/bbox[0,1]³)+suzanne OBJ==STL+benchy+glb cgltf
model_slice ★mesh-plane 切片: cube 任意内部 Z→正方形 perimeter=4.0/area=1.0(1e-9, 8段1环)闭式 + cylinder→圆 + suzanne/benchy 各层 vs golden
model_render 软光栅 barycentric+z-buffer: cube 轮廓+深度均匀+遮挡(远 cube 更少更深)+suzanne 覆盖+深度签名 SHA
model_pointcloud 合成球采样→centroid=origin/半径 r 闭式 + Stanford bunny 精确 35947 顶点+bbox+centroid+16³空间hash签名
model_realassets 全模型解析+counts/bbox vs golden; MODEL_DIR 缺 honest-skip(闭式腿恒运行)

共 117 断言。测试 mesh+点云(Suzanne/3DBenchy/Stanford bunny)在 git submodule(Lfan-ke/hw4os-s5d1t2 media 分支, git-LFS)经 ASSET_DIR 引用,仓库只放 carpet 代码+golden(避污染主仓)。

特殊声明:素材仅用于 OS 功能完整性 & 正确性验证,不作他用!有事请找:@Lfan-ke

切片几何闭式可证(cube→正方形 perimeter=4/area=1、sphere 切→圆),复用 cgltf 单头不造 glTF 解析,其余自写轻量 musl 静态。

关键文件: carpetsprebuild.sh

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-model-test,计划在四个架构的 StarryOS QEMU 中运行 C 侧模型解析、切片、软件光栅化与点云断言。feature-development.md 适用;这是局部的 operator-facing app/test 工作流,设计材料位于 PR 描述和新增 README。实现不改内核 ABI,预期与既有功能隔离。

阻塞问题见行内评论:预构建无条件包含的 vendored cgltf.h 没有提交,导致应用无法编译、无法生成 overlay,也无法执行任何声明的 QEMU 场景。请提交版本固定且带许可证/来源的头文件(或采用带完整性校验的可复现获取方式),再重新验证四个目标架构。

验证:bash -n prebuild.shsh -n programs/run_all.sh 及全部 8 个 TOML 的 tomllib 解析通过;gcc -O2 -std=c11 -I programs/carpets model_parse.c -lm 失败,报 third_party/cgltf.h: No such file or directory。因此本次不能按 README/应用规则完成当前 head 的 QEMU 运行,新增应用的运行时覆盖也尚未成立。

组织 CI(head de29dbdc559ab57b9a22d38f12c2c4638d2a4bf7)为 success=35、skipped=35、failure=1;唯一失败是 JL-LSGD2K10 自托管板卡任务,与该应用路径无直接关系,且已有 #1654 / #1666 跟踪该板卡租约/启动基础设施问题。Starry x86_64 QEMU CI job 在本次为 skipped,不能替代该应用的运行证据。

已检查历史评审和 PR 评论:均为空。已在 base 搜索 cpu-model-test/model_parse,无等价实现;开放 PR 搜索只命中本 PR,未发现重复或需排序的重叠改动。待头文件与运行验证补齐后,建议由 apps/ 路径匹配的维护者继续复核。

Powered by gpt-5.6-terra

#include "model_parse.h"

#define CGLTF_IMPLEMENTATION
#include "third_party/cgltf.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞:这里引用的 third_party/cgltf.h 未随 PR 提交,且 prebuild.sh 会无条件编译本 cell 和 model_realassets。当前树中找不到该文件,宿主 C11 编译已直接报 No such file or directory,所以任一架构都无法完成预构建或启动 QEMU。请提交版本固定且附带许可证/来源的头文件(或实现校验后的可复现获取),并重新验证各架构工作流。

@Lfan-ke
Lfan-ke force-pushed the apps-starry-cpu-model-test branch from de29dbd to 83d6af8 Compare August 4, 2026 22:58

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-model-test,拟在四个架构的 StarryOS QEMU 中运行 C 侧模型解析、切片、软件光栅化和点云断言。feature-development.md 适用;这是局部的 operator-facing 应用工作流,不改变内核 ABI,预期与既有功能隔离。

存在两个阻塞项:

  1. 行内问题:必需的 vendored cgltf.h 未提交,所有架构的 model_parse 预构建都会失败。
  2. README 没有任何可执行的 cargo xtask/starry app QEMU 命令,也未说明环境准备、架构选择、子模块/LFS 前置条件和通过标记;干净环境无法复现四架构声明。请补充实际入口(例如 cargo xtask starry app qemu -t cpu-model-test --arch <arch>)及完整准备/成功条件,并按文档重新验证。

验证结果:bash -n apps/starry/cpu-model-test/prebuild.shsh -n programs/run_all.sh、8 个 TOML 的 tomllib 解析和 git diff --check 通过;当前 head 的直接 C11 编译 model_parse.c 失败,报 third_party/cgltf.h: No such file or directory。因此无法完成文档所称应用的 QEMU 运行,新增运行时覆盖尚未成立。

组织 CI(当前 head)共 71 个 checks:success=33、skipped=35、failure=1、cancelled=2;相关 Starry QEMU 矩阵未提供该新增应用的实际运行证据,不能替代本地应用验证。失败项并非从本改动可见的应用路径;本结论的阻塞依据是本地可复现的编译失败。

已检查历史评审:当前 head 上已有同一 cgltf.h 缺失的行内意见,仍然技术上成立。PR/issue 评论为空。已在 base 搜索 cpu-model-testmodel_parse 和相关资产路径,无等价实现;审阅开放 PR 后,#1872#1876 是相邻但独立的 CPU carpet,未发现重复实现或必须排序的重叠。无需额外 reviewer 请求;待补齐依赖、文档和当前 head 的运行证据后再复核。

Powered by gpt-5.6-terra

#include "model_parse.h"

#define CGLTF_IMPLEMENTATION
#include "third_party/cgltf.h"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞(正确性):这里无条件包含的 third_party/cgltf.h 没有随 PR 提交,但 prebuild.sh 会在所有架构中强制编译 model_parse。当前 head 的直接 C11 编译已报 fatal error: third_party/cgltf.h: No such file or directory,因此预构建无法完成,文档声明的 QEMU 流程也不可能到达成功标记。请提交版本固定且附带许可证/来源的头文件(或提供带完整性校验的可复现获取步骤),并重新运行文档中的应用验证。

@Lfan-ke
Lfan-ke force-pushed the apps-starry-cpu-model-test branch 2 times, most recently from 1e95008 to 0b383d2 Compare August 6, 2026 15:06
…rpet

3D-model carpet (C-side, pure CPU). Every assertion is an exact-geometry / closed-form
check against an analytic or golden reference - no smoke. Self-written OBJ/STL/PLY parsers,
mesh-plane slicer, barycentric+z-buffer rasterizer, and point-cloud stats; glTF/glb via
vendored cgltf.h; only SHA-256 + comparison + goldens self-written. No heavy lib (assimp);
static-link, no runtime 3D dependency.

Cells (three-gate fail==0 && total==EXPECTED==pass, mutation-tested):
- model_parse (38): OBJ / STL(binary+ASCII) / PLY(ASCII+binary) parsers - a known unit
  cube parses to IDENTICAL geometry across 5 readers (12 tris, 8-corner set, bbox [0,1]^3);
  suzanne OBJ==STL, benchy STL count+bbox; glb via cgltf (valid glTF 2.0).
- model_slice (52): mesh-plane intersection (3D-print slicer). A unit cube sliced at any
  interior Z -> a square with perimeter 4.0 / area 1.0 to 1e-9 (8 segments, 1 loop) -
  closed form; a tessellated cylinder -> circle within O(1/N^2); suzanne/benchy per-layer
  perimeter/area/loop-count == golden.
- model_render (11): barycentric + z-buffer software rasterizer - cube silhouette + uniform
  front-face depth + occlusion (farther cube fewer, strictly deeper pixels) + suzanne
  coverage + depth-signature SHA vs golden.
- model_pointcloud (17): a synthetic sphere-sampled cloud -> centroid at origin, all points
  at radius r (closed form); Stanford bunny -> exact 35947 vertices, bbox, centroid, and a
  16^3 spatial-hash signature vs golden.
- model_realassets (13): iterate the shipped models, parse + counts/bbox vs golden;
  honest-skip when the media submodule (MODEL_DIR/ASSET_DIR) is absent (closed-form legs
  always run).

Test meshes + point clouds (Suzanne, 3DBenchy, Stanford bunny) live in a git submodule
(Lfan-ke/hw4os-s5d1t2 media branch, git-LFS) via ASSET_DIR; only carpet code + golden
references are committed here.

Signed-off-by: 林晨/禾可 <chengkelfan@qq.com>
Signed-off-by: Leo Cheng <chengkelfan@qq.com>
@Lfan-ke
Lfan-ke force-pushed the apps-starry-cpu-model-test branch from 0b383d2 to 3cd7ab8 Compare August 6, 2026 16:00

@mai-team-app mai-team-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本 PR 新增 apps/starry/cpu-model-test,在四种架构的 StarryOS QEMU 中执行 C 侧模型解析、切片、软件光栅化与点云 carpet。feature-development.md 适用:这是局部、operator-facing 的应用工作流,未改变 StarryOS syscall/Linux ABI;实现与现有内核功能隔离。

存在一个阻塞的可复现运行问题,见行内评论:prebuild.sh 在 Git LFS 不可用或拉取失败时静默继续,把 LFS pointer 当作真实模型暂存。干净工作区中 suzanne.glb 是 130 字节 pointer,导致 model_parsemodel_realassets 失败,run_all.sh 无法输出 TEST PASSED。安装 git-lfs 并 materialize 同一子模块后,五个 x86_64 cell 都通过,说明该问题由脚本的失败处理引起。

验证:git diff --checkcargo fmt --checkbash -n prebuild.shsh -n run_all.sh 和 8 个 TOML 的 tomllib 解析通过。使用 STARRY_ARCH=x86_64 的预构建可完成;LFS pointer 状态下运行结果为 model_parse pass=26 total=27 fail=1model_realassets pass=6 total=8 fail=2。安装 git-lfs、执行 materialization 后,在同一预构建产物上 model_parse=38model_slice=52model_render=11model_pointcloud=17model_realassets=13 均通过。尚未将该完整应用启动到 QEMU:当前组织 CI 的 6 个检查中仅 Cancel stale CI runs 成功,Detect changed paths 失败、其余 4 个预期跳过,未覆盖新增应用;这不替代当前 head 的应用运行证据。

已检查此前两条 change-request 和两条行内意见:它们所述“未提交 cgltf.h”已不再成立,因为当前 prebuild.sh 会下载并校验固定 SHA-256 的头文件;新发现是 LFS 失败被静默吞掉,仍会破坏当前 head。已在 base 检索 cpu-model-testmodel_parse、资产与子模块模式,无等价实现;相关开放 PR 检索只命中本 PR,未发现重复或必须排序的重叠。.github/MAINTAINERS.mdapps/ 路径匹配 YanLien,待修复后可继续请求该领域复核。

审查清单:规则、特性分级、实现/配置/失败传播、重复与重叠、历史意见、CI、格式与 x86_64 预构建验证均已完成;syscall 语义、Cargo/patch 与冲突处理不适用。剩余阻塞项是将 LFS 获取或明确的 asset-dependent capability 跳过变为可验证的正确行为,并在当前 head 完成文档化 QEMU 工作流。

Powered by gpt-5.6-terra

git -C "$app_dir" submodule update --init assets >/dev/null 2>&1 || true
fi
if command -v git >/dev/null 2>&1 && git -C "$app_dir/assets" lfs env >/dev/null 2>&1; then
git -C "$app_dir/assets" lfs pull --include="models/*,pointcloud/*,golden/*" >/dev/null 2>&1 || true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

阻塞(正确性):这些 || true 会吞掉 Git-LFS 缺失或拉取失败,随后把 LFS pointer 当成真实素材复制进 overlay。干净工作区中 suzanne.glb 因此只有 130 字节且以 version https://git-lfs.github.com/spec/v1 开头;生成的 model_parseFAIL: glb cgltf parse okpass=26 total=27 fail=1),model_realassets 也失败,run_all.sh 无法输出 TEST PASSED。安装并成功 lfs pull 后五个 x86_64 cell 均通过,说明问题在这里的静默失败处理。请把需要素材时的 LFS 初始化/拉取失败改为预构建错误,或可靠识别未 materialize 的 pointer 并从 capability manifest 排除所有依赖素材的 cell;不能继续暂存 pointer。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant