Preserve typed dispatch preconditions through package and loader contracts
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- cpp
调研方向
Start by reading docs/REFLECTION_JSON_SCHEMA.md and runtime/README.md at the cited compiler revision to understand the current reflection and metadata-only loader contracts. Then trace package verify/inspect and source-free loader plan entry points for the Metal, DirectX, OpenGL, and Vulkan metadata paths. Done means a versioned contract, round-trip coverage, boundary and compatibility tests, and a source-free consumer fixture demonstrate outstanding runtime obligations and rejected invalid payloads.
由索引模型根据 Issue 内容生成。
描述
Problem
Repository ports need to carry typed host-metadata preconditions alongside generated kernels. A source-to-target conversion may be legal only when an immutable dispatch scalar, metadata element or record field lies in a checked range. Package admission alone cannot establish that a future caller will supply values in that range.
At compiler dev revision d43047c2a407a9bd1a90f21d1df0dd94507a698d, reflection retains source resource identities, target bindings and layouts, but its versioned schema has no dispatch-value-precondition record. The loader contract is explicitly metadata-only and does not consume actual dispatch values. That boundary is useful and should remain explicit.
Please add a versioned metadata contract that a compiler can emit or preserve and a downstream runtime can enforce. This is not a request to add device execution to the compiler package reader or to treat existing package loadable status as numerical/runtime validation.
Concrete Consumer
CrossGL/crosstl#2179 distinguishes caller-trusted index assertions from runtime-enforced metadata bounds. Its minimal case reads index = indices[0] from a uint64 resource and uses it to address a four-element uint32 resource. A declared [0, 3] assertion currently authorizes index conversion, but the application remains responsible for enforcing it. A runtime-owned dispatch contract needs to reject payloads 4 and 4294967296 before execution, without truncating or clamping them.
The same requirement appears in the MLX port at pin 9c3d35571ac450a8ecf5c17b4d0e3fac52c08bc8: reverse scans compose a row origin, axis size and block offset; GEMM forms batch-stride pointers from metadata. These are integration examples, not repository-specific schema requirements. The contract must work for arbitrary source repositories and target backends.
Requested Contract
- Identify the source entry, resource and optional immutable element/record-field path independently of generated helper names. Connect them to reflected target bindings and physical layout.
- Preserve integer width, signedness, byte offset, element stride and inclusive bounds. Define overflow and unit semantics for composed offset constraints rather than checking independent values whose sum may overflow.
- Distinguish statically proven facts, caller-trusted assertions and requirements that must be checked against actual dispatch values. Metadata presence or a package hash must never promote the latter to an already-enforced fact.
- Bind the contract to the appropriate artifact, entry and layout identities. Inspect/verify and loader plans must retain it and reject malformed, stale or unsupported mandatory contracts with structured diagnostics.
- Let metadata-only loader admission report outstanding runtime obligations without claiming to evaluate host payloads. A consuming runtime must explicitly support and enforce those obligations before dispatch. Unknown obligations must not be silently discarded.
- Mark the supported immutability boundary. A host snapshot must not authorize GPU-produced or subsequently mutated metadata; those require a separate validation strategy.
- Define backward compatibility for packages without the new optional contract and explicit version handling for packages that require it.
Acceptance
- Document and schema-test source identity, scalar/field paths, type/layout information, bound semantics, trust classification and enforcement state.
- Round-trip the contract through reflection or a declared sidecar, package verify/inspect and source-free loader plans on Metal, DirectX, OpenGL and Vulkan metadata paths.
- Test renamed resources, duplicate/unknown identities, type and layout drift, unsupported versions, offset views, negative/oversized boundaries and integer-overflow constraints. Admission must not reinterpret trusted assertions as enforced preconditions.
- Supply a small source-free consumer fixture demonstrating the separation between a valid package contract, a valid dispatch payload and a rejected payload. Device execution need not be implemented in this repository for this contract to be useful.
CrossTL can implement its runtime enforcement independently and align with this schema when available. No compiler release or stable published dependency is required to continue the translator work.
- 主要语言
- C++
- 星标
- 0
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
CrossGL/compiler 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
-
难度 5/5 一周以上 新手友好度 30/100
-
难度 5/5 一周以上 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 35/100
-
Track CrossTL project-porting report and source-remap compatibility可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 42/100
相似的 Issue
-
Remove source files from packaging for deb, zip, etc可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
OpenSpace/OpenSpace#4353 · 1 条评论 ·
维护者通常 5 天内回复
-
Scan commands do nothing after join or info until stopscan可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
justcallmekoko/ESP32Marauder#1656 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
-
Decompiler: convertCharRef() in xml.y overflows its int4 accumulator on long character references可能已有人在做 @kaayzouee 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 76/100
NationalSecurityAgency/ghidra#10009 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
mutationpp/Mutationpp#337 ·