Skip to content

Conversation

AlexGuteniev
Copy link
Contributor

Yes it does not compile without [[gnu::target("fma")]] magic spell.

@StephanTLavavej StephanTLavavej added the performance Must go faster label Sep 17, 2025
@StephanTLavavej StephanTLavavej self-assigned this Sep 17, 2025
@StephanTLavavej
Copy link
Member

Thanks for figuring out the magic incantation here! 😻

I observe that this is inconsistent with the spelling of

#pragma clang attribute _STD_ATOMIC_HEADER.push([[gnu::target("cx16")]], apply_to = function)
but I don't care enough to iterate.

@StephanTLavavej StephanTLavavej removed their assignment Sep 17, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Sep 17, 2025
@AlexGuteniev
Copy link
Contributor Author

I observe that this is inconsistent with the spelling of

If you want consistency, I'd change <atomic> actually.

The spell in <atomic> allows cx16 insn in any function, and this theoretically permits generating one out of thin air. In contrast, the approach in this PR allows fma only in specific function, for which we have runtime check.

<atomic> does not centralize cx16, and there would be few functions, so it takes more changes, but still may be worth doing.

@StephanTLavavej
Copy link
Member

Oh, all I meant was the spelling of __gnu__::__target__.

@AlexGuteniev
Copy link
Contributor Author

Aha! It was suggested by @philnik777. Makes sense as a defense from user's macro, #define gnu 1 is allowed. And in pragma there's no preprocessor, since pragma itself is considered preprocessor.

@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Sep 19, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 2510fe9 into microsoft:main Sep 22, 2025
39 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Sep 22, 2025
@StephanTLavavej
Copy link
Member

Thanks for multiplying and adding to the compilers where we use these intrinsics! 😹 ✖️ ➕

@AlexGuteniev AlexGuteniev deleted the its-there-if-you-ask branch September 22, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants