Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Preserve typed dispatch preconditions through package and loader contracts

未关闭
#41 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 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

  1. Document and schema-test source identity, scalar/field paths, type/layout information, bound semantics, trust classification and enforcement state.
  2. 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.
  3. 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.
  4. 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CrossGL/compiler 的其他 Issue

查看 CrossGL/compiler 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。