Rust-GPU / Rust-GPU/rust-gpu

[Migrated] We should ensure entry interface types have reliable layout.

Open
#127 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/575
Old labels: t: enhancement,c: rustc_codegen_spirv
Originally creatd by eddyb on 2021-04-05T07:04:27Z 👍: 3


Sadly, it's hard/impossible to account for #[cfg]s in e.g. glam, and vector types in general tend to have weirder alignment rules than scalars (and aggregates thereof).

But we should at the very least require #[repr(C)], and maybe even disallow any interior padding or wildly varying alignments (as that would imply potentially different alignments on the host).

I almost wish Rust had explicit field offsets with a per-field attribute - we could require that to guarantee that the host would see the same layout and it would let us have the weirder layouts mentioned in #11.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the rustc_codegen_spirv area and the constraints described for #[repr(C)], interior padding, and varying alignments. Read the related discussion in issue #11; this issue is complete only when a decided, reliable layout policy for entry interface types is specified and implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.