KhronosGroup / KhronosGroup/SPIRV-Cross
[MSL] Attribute `[[clang::optnone]]` causes significant performance hit on M1 Macs.
Nobody has claimed this yet.
- Dominant language
- GLSL
- Stars
- 2.5k
- Forks
- 713
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 16
Description
After briefly discussing commit fb3defc with @billhollings we decided to open a new ticket for this issue.
We tracked down a significant performance hit with the introduction of the [[clang::optnone]] attribute in UE5 (according to one of my colleagues from 100 fps down to 5 fps).
We only experience this regression on M1 Macs and in combination with our option invariant_float_math, but we solved the issue by removing all occurrences of that attribute via a simple std::string::find/replace after cross-compilation.
We can't simply disable invariant floating-point math, i.e. fma intrinsics, because we constantly had Z-fighting issues without it.
Our solution works for now, but it would be desirable to introduce a new option to allow to enable/disable the output of such attributes globally in SPIRV-Cross.
We haven't identified any issues with other attributes, so we only strip this attribute with a hardcoded string search-replace.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing SPIRV-Cross's MSL output handling for the [[clang::optnone]] attribute, considering how it interacts with invariant_float_math. The change is done when a global option can suppress this attribute without disabling invariant floating-point math; no specific source file or test is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100