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

[CUDA] clang calls __cxa_guard* on the GPU side #117023

Open
Artem-B opened this issue Nov 20, 2024 · 0 comments
Open

[CUDA] clang calls __cxa_guard* on the GPU side #117023

Artem-B opened this issue Nov 20, 2024 · 0 comments
Assignees
Labels
clang Clang issues not falling into any other category cuda

Comments

@Artem-B
Copy link
Member

Artem-B commented Nov 20, 2024

Dynamic initializers are not allowed on the GPU.

CUDA allows using empty initializers, but when we actually have one, it goes through the regular codegen and ens up being guarded by __cxa_guard_* calls, if the empty initializer is not eliminated by the optimizations.

E.g. https://godbolt.org/z/P67j7M81c

This also exposes inconsistent behavior vs nvcc.

When initializer is not empty, clang does allow for static local variables (and that does need a guard), but NVCC rejects it, presumably because it would require guarding it.

I think we need to
a) make sure we do not emit thread guards for the static initializers
b) disallow non-empty initializers for static local variables (that would include local __shared__ variables that are implicitly static).

@github-actions github-actions bot added the clang Clang issues not falling into any other category label Nov 20, 2024
@Artem-B Artem-B self-assigned this Nov 20, 2024
@Artem-B Artem-B added the cuda label Nov 20, 2024
Artem-B added a commit that referenced this issue Nov 22, 2024
We do not have support for the threadsafe statics on the GPU side.

However, we do sometimes end up with empty local static initializers,
and those happen to trigger calls to `__cxa_guard*`, which breaks
compilation.

Partially addresses #117023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category cuda
Projects
None yet
Development

No branches or pull requests

1 participant