rust-lang / rust-lang/portable-simd

Better ergonomics for working with vector of pointers to structs/enums

Open
#459 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature-request
Dominant language
Rust
Stars
1.1k
Forks
108
Avg merge
22h 53m
Merged PRs (30d)
3

Description

I think there should be some support for working with vectors of pointers to structs. Specifically I think the following features would be helpful:

  • Having a way to pass from pointers to a struct/enum to pointers to a member. Today this can be done by casting to const* u8, adding the offset_of! and casting back, but I think a dedicated macro for this would be cleaner. Also the enum part needs a nightly feature to work (offset_of_enum)
  • Having a way to "match" a vector of enums, i.e., given a variant getting a mask encoding which lanes point to instances of this variant. Today there is no general way of doing it (you can try doing the same trick to get the discriminant, but there's no way to know what is the relevant discriminant value for each variant, and it becomes even trickier if the discriminant is optimized in some way (e.g. the niche optimization))

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 examining the issue's proposed pointer-to-member workflow using const* u8, offset_of!, and offset_of_enum, then compare it with existing portable-SIMD vector and enum facilities. Before implementation, define the supported APIs for member access and variant matching, along with tests that establish the expected masks and behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
performance
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.