Kjetil Kjeka 265d093d8f
[NVPTX] fix illegal name for .extern .shared global variables (#173018)
In ptx we can create a GV in AS(3) that will be compiled to a `.extern
.shared` in ptx. Since the `.extern .shared` is not an "extern" in the
traditional sense of the word it will not be linked based on name but
rather refer to the shared memory allocated at kernel launch.

Since we don't care about the name it's tempting to make the GV unnamed.
Then the problem that the `nameUnamedGlobals` will use a name for the
global that is invalid ptx occurs. For non-extern globals, this is later
fixed by running the `NVPTXAssignValidGlobalNames` pass. However, It
makes sure to not touch externs as changing the name of "traditional
externs" will cause linking issues down the road.

This MR treats `.extern .shared` in the same manner as non-extern
globals during `NVPTXAssignValidGlobalNames` to fix the invalid names
given by `nameUnamedGlobals`.

Co-authored-by: Kjetil Kjeka <kjetil@muybridge.com>
2026-01-22 21:28:07 +01:00
..