Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
khyperia opened this issue Oct 21, 2020 · 5 comments
Closed
Assignees
Labels
c: rustc_codegen_spirv Issues specific to the rustc_codegen_spirv crate. t: enhancement A new feature or improvement to an existing one.

Comments

@khyperia
Copy link
Contributor

khyperia commented Oct 21, 2020

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.

@khyperia khyperia added the t: enhancement A new feature or improvement to an existing one. label Oct 21, 2020
@khyperia khyperia self-assigned this Oct 21, 2020
@repi
Copy link
Contributor

repi commented Oct 25, 2020

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?

@bjorn3
Copy link
Contributor

bjorn3 commented Oct 25, 2020

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

@repi
Copy link
Contributor

repi commented Oct 25, 2020

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

@bjorn3
Copy link
Contributor

bjorn3 commented Oct 25, 2020

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

@XAMPPRocky XAMPPRocky mentioned this issue Nov 6, 2020
18 tasks
@khyperia khyperia changed the title Expose GLOps not in std::intrinsics Intercept calls to (rust) libm and emit a builtin instead of the soft impl Nov 10, 2020
@khyperia khyperia added the c: rustc_codegen_spirv Issues specific to the rustc_codegen_spirv crate. label Nov 10, 2020
@khyperia
Copy link
Contributor Author

Fixed by #264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: rustc_codegen_spirv Issues specific to the rustc_codegen_spirv crate. t: enhancement A new feature or improvement to an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants