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

int(simd.h): Make the simd types trivially_copyable #4173

Closed

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Mar 3, 2024

Basically, this is a way of saying memcpy of any of these simd types is fine. It doesn't matter a lot for OIIO itself, but it helps quiet some static analysis warnings for OSL.

Basically, this is a way of saying memcpy of any of these simd types
is fine. It doesn't matter a lot for OIIO itself, but it helps quiet
some static analysis warnings for OSL.

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@ThiagoIze
Copy link
Collaborator

Could the approach from #4110 (comment) be used?

@lgritz
Copy link
Collaborator Author

lgritz commented Mar 7, 2024

Could the approach from #4110 (comment) be used?

I think that can't work in this case (I tried) because these types contain a union. I've tried a bunch of different things, and I can't seem to coax C++ into figuring it out on its own for these oddball types, even though we humans know that it's just memory and are indeed trivially copyable.

@ThiagoIze
Copy link
Collaborator

In my quick test it seems to work: https://gcc.godbolt.org/z/bdxYbY7dv (toggle the #if to see the assert fail and then pass with the default). Could it be maybe that there's only some of the classes that won't work?

@lgritz
Copy link
Collaborator Author

lgritz commented Mar 7, 2024

Ok, let me try that approach and see if it works everywhere. Maybe I am either misremembering what trouble I ran into last time, or it's only on some combination of compilers. Thanks for prodding me to reexamine the assumptions.

@lgritz
Copy link
Collaborator Author

lgritz commented Mar 8, 2024

Just as an update, looking into this sent me down a rathole that might end up being a much larger overhaul to the simd internals. Will post an update in a few days, I'm working on it in dribs and drabs.

@lgritz
Copy link
Collaborator Author

lgritz commented Mar 13, 2024

I'm going to withdraw this PR and start a new one, I got this working in a better way.

@lgritz lgritz closed this Mar 13, 2024
@lgritz lgritz deleted the lg-simdtrivial branch March 17, 2024 20:13
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