Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Intercept calls to (rust) libm and emit a builtin instead of the soft impl #81

Closed

Description

@khyperia

Plan is to go with @bjorn3's comment below and expose the GLOps not in std::intrinsics via intercepting calls to https://github.com/rust-lang/libm, which is used in e.g. glam's no_std implementation.

Old title: Expose GLOps not in std::intrinsics

https://docs.rs/spirv_headers/1.5.0/spirv_headers/enum.GLOp.html , same with CLOp.

For example, acos.

Activity

  1. self-assigned this
    on Oct 21, 2020
  2. repi commented on Oct 25, 2020

    @repi
    Contributor

    Ran into this today with tan that glam is using (#134), it is not part of the Rust core intrinsics functions. Any idea of how to add our own intrinsics, do we have to do that in core or as another set of intrinsics for the specific target?

  3. bjorn3 commented on Oct 25, 2020

    @bjorn3
    Contributor

    libstd directly calls the libm functions. Adding an extra intrinsic requires a rustc change to add it to the list of intrinsics of typeck.

  4. repi commented on Oct 25, 2020

    @repi
    Contributor

    Suspected that, definitely don't want to use libm on the GPU for where there is real GPU/SPIRV intrinsics to use

  5. bjorn3 commented on Oct 25, 2020

    @bjorn3
    Contributor

    It should be possible to intercept calls to functions with specific names and instead emit a SPIRV instruction.

  6. changed the title [-]Expose GLOps not in std::intrinsics[/-] [+]Intercept calls to (rust) libm and emit a builtin instead of the soft impl[/+] on Nov 10, 2020
  7. khyperia commented on Nov 25, 2020

    @khyperia
    ContributorAuthor

    Fixed by #264

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

Metadata

Metadata

Assignees

Labels

c: rustc_codegen_spirvIssues specific to the rustc_codegen_spirv crate.t: enhancementA new feature or improvement to an existing one.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions