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

fix cast of vectypes with sizeof < vec4f (16) #1457

Merged
merged 1 commit into from
Dec 28, 2024

Conversation

virt00l
Copy link
Collaborator

@virt00l virt00l commented Dec 28, 2024

Do use memcpy-to-temp-var cast as it's portable, correct and fast

This fixes clang18 binding of inline functions that return vec3/Point3 and return special code path for TSAN.

@AndreiPotapov
Copy link
Contributor

Это замедлит код. Надо хотя бы оптимизировать загрузку всех типов меньше 12 байт.

@virt00l
Copy link
Collaborator Author

virt00l commented Dec 28, 2024

Это замедлит код. Надо хотя бы оптимизировать загрузку всех типов меньше 12 байт.

No, it won't.
At least on clang it doesnt.
See downstream commit for detalis.
It does slow it down on gcc (11) - WIP

@AndreiPotapov
Copy link
Contributor

How? v_ldu forces loading garbage from stack to unused components, your version forces zeroing.

@virt00l virt00l self-assigned this Dec 28, 2024
@virt00l
Copy link
Collaborator Author

virt00l commented Dec 28, 2024

How? v_ldu forces loading garbage from stack to unused components, your version forces zeroing.

Well, stack part is optional. Compiler might not use stack at all. And using v_ldu() on vec3 cause it to miscompile stuff. See downstream commit for additional details

Do use memcpy-to-temp-var on clang cast as it's portable, correct and fast
and use various type of loads for other compilers (msvc/gcc) to match
generated code on clang

This fixes clang18 binding of inline functions that return vec3/Point3
and removes special code path for TSAN.
@virt00l virt00l merged commit e7299a6 into GaijinEntertainment:master Dec 28, 2024
15 checks passed
@virt00l virt00l deleted the fix-vectypes-cast branch December 28, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants