vx-lang / vx-lang/Vx

vector types · phase 5: vectors in structs and across FFI

Open
#485 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

codegen core-lang enhancement
Dominant language
Rust
Stars
14
Forks
2
Avg merge
12h 42m
Merged PRs (30d)
61

Description

Phase 5 of docs/discussions/design-vector-types.md (Section 5a).

  • Ordinary structs: allowed, at the datalayout's natural alignment. No frontend-side layout rule is added beyond giving layout.rs a Simd arm; field_info has none today (src/layout.rs:180-195), so a struct with a vector field currently declines.
  • Test the layouts agree. !llvm.struct<(f32, vector<4xf32>)> measures 32 bytes with the vector field at offset 16, measured through mlir-translate --mlir-to-llvmir (design Section 11.2 item 4). The frontend's offset must equal it. This is the test that keeps decision 7's one-alignment invariant honest, and it matters because the frontend computes layouts rather than querying a datalayout (Section 11.5 item 2): scalar_size_align derives from ElementType::bits() and a pointer field is a hardcoded (8, 8). The only datalayout in the tree is a string attached to the module for the target (src/driver.rs:969-988).
  • extern "C" structs: refused in the first cut, with a diagnostic. The C ABI for vector members is target-specific and not worth guessing before there is a user.
  • By-value vector parameters or returns across extern "C": refused in the first cut. Pass by pointer.

The two refusals are the same policy already applied to tensor fields in extern "C" structs: refuse rather than silently pick a layout.

Blocked on Vx#478.

Contributor guide

No contributing guide indexed for this repository

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

Read docs/discussions/design-vector-types.md Section 5a, then inspect src/layout.rs:180-195 and the target datalayout handling in src/driver.rs:969-988. Use mlir-translate --mlir-to-llvmir to compare the ordinary-struct layout, and review the existing tensor-field policy for extern "C". Done means vector layouts agree with LLVM and both extern C refusals produce diagnostics; the work is blocked on Vx#478.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.