Skip to content

[SYCL] Simplify storePlainArg to avoid alias violations #14344

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

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

steffenlarsen
Copy link
Contributor

The helper function storePlainArg in handler and jit_compiler reinterpret-casts pointers to memory in vectors of char in order to store arguments in them. However, this violates strict aliasing and is unnecessary as the resulting pointers are immediately converted to void* after all calls to the function. As such, this patch simplfies these implementations to always return void* and use memcpy to avoid the alias violation.

The helper function storePlainArg in handler and jit_compiler
reinterpret-casts pointers to memory in vectors of char in order to
store arguments in them. However, this violates strict aliasing and is
unnecessary as the resulting pointers are immediately converted to void*
after all calls to the function. As such, this patch simplfies these
implementations to always return void* and use memcpy to avoid the
alias violation.

Signed-off-by: Larsen, Steffen <[email protected]>
Copy link
Contributor

@sommerlukas sommerlukas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes to jit_compiler.cpp LGTM, thanks for taking care of this!

@againull againull merged commit bf7c84c into intel:sycl Jun 28, 2024
15 checks passed
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.

4 participants