Skip to content

simd: unify API generation around executable spec #81819

Open

Description

@aclements

TL;DR: This is a tracking issue for transitioning the myriad SIMD API generators to build around a single, shared, executable API specification to ensure API consistency.

The central rule of the SIMD project is "one name means one thing": a given function or method need not exist on across all SIMD packages or platforms, but wherever it does exist, it must denote the same operation, with the same signature and the same semantics.

However, nothing currently enforces this. The closest thing we have is the apisum tool, which audits after the fact and requires human review of the audit. The original intent was that the simdgen tool would be the sole API generator, and that simdgen's categories.yaml files would enforce consistency, but this has proven flawed in three ways: 1. simdgen is not a good approach for some API generation, so we now have several other generators and they have no idea how to read the unifier dialect that categories.yaml is in; 2. categories.yaml only enforces consistency of API names and documentation, not types or argument names; 3. since categories.yaml is just another unifier input, nothing prevents architecture-specific information from leaking into it or architecture-independent information from leaking out of it.

Hence, I've been working on a new approach based on an executable API specification. This specification is hand-written in Go, but in a particular style that lets it compress the repetition across types, while being easy to map to the SIMD API. For example, there's a single description of the Add method that gets expanded to all of the SIMD types. This single API description provides: 1) the name of the operation, 2) the argument/result names and types, 3) the doc comment, and 4) a pure Go implementation that can be used as a conformance test. The spec is maximalist: it may describe operations on types that no platform actually implements today.

This API description will be parsed by an internal/specgen package with a lightweight API, so it can be used directly by all of the generators to ensure conformance.

The goals of this transition are to unify documentation across the SIMD API and to ensure semantic consistency.

Activity

  1. added theissue type on Sep 28, 2026
  2. self-assigned this
    on Sep 28, 2026
  3. added this to the Go1.28 milestone on Sep 28, 2026
  4. gabyhelp commented on Sep 28, 2026

    @gabyhelp

    Related Issues

    Related Code Changes

    (Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

  5. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/838629 mentions this issue: simd/archsimd/{_gen/specdoc,cmd/specfill}: reporting of major API mismatches

  6. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/838626 mentions this issue: simd/archsimd/_gen/specgen: add doc comment classification and handling

  7. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/832924 mentions this issue: simd/archsimd/_gen: plan for transitioning to spec

  8. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/838627 mentions this issue: simd/archsimd/_gen/specgen: add a (receiver, name) index

  9. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/835527 mentions this issue: simd/archsimd/_gen: mark doc-explore done in SPEC-TRANSITION.md

  10. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/835525 mentions this issue: simd/internal/spec: implement all of ops/AddSub

  11. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/840445 mentions this issue: simd/archsimd/_gen: complete task specfill``

  12. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/835526 mentions this issue: simd/internal/spec: add ShiftSaturated, ShiftAllRight, and ShiftRight

  13. gopherbot commented on Sep 28, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/838628 mentions this issue: simd/archsimd/_gen/specexpr: generalize signature formatting

  14. 56 remaining items

  15. gopherbot commented on Oct 8, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/847730 mentions this issue: simd/archsimd/_gen/cmd/specfill: accept files on command line

  16. gopherbot commented on Oct 8, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/847728 mentions this issue: simd/internal/spec: implement all common operations

  17. gopherbot commented on Oct 8, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/847733 mentions this issue: simd/archsimd/_gen: complete task comments-yaml``

  18. gopherbot commented on Oct 8, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/847731 mentions this issue: simd/archsimd/_gen/midway: drop spec-covered docs from comments.yaml

  19. gopherbot commented on Oct 9, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/848165 mentions this issue: simd/archsimd: naming cleanups in wasm

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

Metadata

Metadata

Assignees

Labels

compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions