Skip to content

[wgsl] Builtins/intrinsics are unnecessarily part of the WGSL grammar #616

Closed

Description

@kdashg

I don't think the intrinsics should be part of the grammar, just as __popcnt() isn't part of the C++ grammar.

I envision these as builtin callable functions that are always present.

Activity

  1. added
    wgsl
    on Mar 16, 2020
  2. kvark commented on Mar 16, 2020

    @kvark
    Contributor

    On the other hand, there are only 8 intrinsics at the moment, and they aren't about to change any time soon.

  3. dneto0 commented on Mar 23, 2020

    @dneto0
    Contributor

    I don't have a big stake in how they are modeled.

    For the initial proposal, we tried to use regular operators like + and * that map directly to SPIR-V (maybe type-dependently, e.g. int vs. float).

    The current list of 8 intrinsics are "core" SPIR-V instructions: they are in the main spec.

    Other things that might reasonably modeled as WGSL intrinsics would be:

    • things that are currently in a SPIR-V extended instruction set (for GLSL.std.450); but we made them be explicitly imported, with a namespace. I'm happy with that choice.
    • depending on other conversations: disambiguation between signed and unsigned inequalities (e.g. < where the two operands are integers of differing signedness.)
  4. kdashg commented on Mar 24, 2020

    @kdashg
    ContributorAuthor

    I prefer to map (typename T, U) T < U to less(T, U), for which we only have "overloads" for less(T, T).
    u32 < i32 should probably be an error.

  5. grorg commented on Mar 24, 2020

    @grorg
    Contributor

    Discussed at the 2020-03-25 meeting

  6. grorg commented on Mar 24, 2020

    @grorg
    Contributor

    Resolved: Intrinsics will be moved out of the grammar.

  7. added
    wgsl resolved
    on Mar 24, 2020
  8. grorg commented on Mar 24, 2020

    @grorg
    Contributor

    @jdashg will open some new issues and PRs from this.

  9. dj2 commented on Jun 9, 2020

    @dj2
    Member

    I believe this was fixed by #655. Closing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    wgslwgsl resolved

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions