Skip to content

[HLSL] Support noinline attribute to prevent automatic inlining #89806

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

Open
pow2clk opened this issue Apr 23, 2024 · 0 comments
Open

[HLSL] Support noinline attribute to prevent automatic inlining #89806

pow2clk opened this issue Apr 23, 2024 · 0 comments
Labels
HLSL HLSL Language Support

Comments

@pow2clk
Copy link
Contributor

pow2clk commented Apr 23, 2024

#89282 will result in inlining all non-entry functions. That isn't quite right as functions with the noinline attribute shouldn't be.

Deliverables

Fully document how noinline should work in the context of passed resources and different qualifiers including the notoriously buggy globallycoherent and precise qualifiers. There is a chance that these will depend on further outside specification of how these qualifiers are expected to work.

Support for noinline in HLSL and the resulting functions remaining as separate calls in the output DXIL or SPIR-V.

Acceptance Criteria

A large swath of tests that verify that an assortment of user functions with different parameters, return values, semantics and other qualifiers correctly retain those features when they are called independently.

@EugeneZelenko EugeneZelenko added HLSL HLSL Language Support and removed new issue labels Apr 23, 2024
pow2clk added a commit to pow2clk/llvm-project that referenced this issue Aug 26, 2024
Thread init guards are generated for local static variables when
using the Microsoft CXX ABI. This ABI is also used for HLSL generation,
but DXIL doesn't need the corresponding _Init_thread_header/footer
calls and doesn't really have a way to handle them in its output
targets.

This modifies the language ops when the target is DXIL to exclude this
so that they won't be generated and an alternate guardvar method is used.

Done to facilitate testing for llvm#89806, but isn't really related
pow2clk added a commit that referenced this issue Aug 28, 2024
Thread init guards are generated for local static variables when using
the Microsoft CXX ABI. This ABI is also used for HLSL generation, but
DXIL doesn't need the corresponding _Init_thread_header/footer calls and
doesn't really have a way to handle them in its output targets.

This modifies the language ops when the target is DXIL to exclude this
so that they won't be generated and an alternate guardvar method is used
that is compatible with the usage.

Done to facilitate testing for #89806, but isn't really related
pow2clk added a commit that referenced this issue Aug 29, 2024
Previously, functions named "main" got the NoRecurse attribute
consistent with the behavior of C++, which HLSL largely follows.
However, standard recursion is not allowed in HLSL, so all functions
should really have this attribute. This doesn't prevent recursion, but
rather signals that these functions aren't expected to recurse.

Practically, this was done so that entry point functions named "main"
would have all have the same attributes as otherwise identical entry
points with other names.

This required small changes to the this assignment tests because they no
longer generate so many attribute sets since more of them match.

related to #105244
but done to simplify testing for #89806
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HLSL HLSL Language Support
Projects
Status: No status
Development

No branches or pull requests

2 participants