Skip to content

explain SIMD terminology and commonly-confused terms#535

Closed
enthropy7 wants to merge 1 commit into
rust-lang:masterfrom
enthropy7:guide/terminology
Closed

explain SIMD terminology and commonly-confused terms#535
enthropy7 wants to merge 1 commit into
rust-lang:masterfrom
enthropy7:guide/terminology

Conversation

@enthropy7

@enthropy7 enthropy7 commented Jun 24, 2026

Copy link
Copy Markdown

Part of #29. Second PR in the series.

This PR broadens the beginner vocabulary and adds new terms, bringing the guide closer to how the finished documentation should look.

Addresses these checklist items:

  • "field"
  • "element"
  • "intrinsics"
  • intrinsics vs. instructions
  • instructions vs. operations
  • lane vs. field vs. element
  • scalar vs. vector

New Terms entries: Element, Splat, Mask, Horizontal, and Intrinsic (covering both vendor core::arch intrinsics and compiler/LLVM intrinsics, so readers can see what intrinsics actually look like). New "Words That Are Easy to Mix Up" section for the four distinctions above. Splat/Mask/Horizontal aren't on the checklist, but they're core beginner-facing vocabulary for this crate (splat appears in the README's hello-world, masks have a whole README section, and horizontal pairs with the existing "vertical" term), so I included them while we're here.

Comment thread beginners-guide.md Outdated

**Lane vs. field vs. element.** A *lane* is a position in the vector, numbered `0` to `N-1`, like an index into an array. An *element* is the value that currently occupies a lane. So "lane 2" is a slot, and "the element in lane 2" is its contents. *Field* is a third word you'll occasionally see — usually in older or vendor-specific writing — for the same idea; it carries no separate meaning here, and this guide sticks to *lane* for the position and *element* for the value.

**Scalar vs. vector.** A *scalar* is a single value, the ordinary `f32` or `i32` you're already used to. A *vector* is a fixed-size group of those values that the CPU operates on together — an `f32x4` is four `f32` scalars packed into one register. The whole point of SIMD is to replace many scalar operations with one vector operation, so "scalar code" is the non-SIMD baseline you're comparing against.

@programmerjake programmerjake Jun 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on some architectures and target features (RISC-V V and Arm SVE), vectors are inherently variable-size (with the size determined by the programmer and/or the cpu, depending on the architecture) and portable-simd's fixed-size types are converted by the compiler to variable-size instructions when those are better. portable-simd doesn't yet have variable-size types.

View changes since the review

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks

@workingjubilee

Copy link
Copy Markdown
Member

See #534 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants