Device variables in an anonymous namespace may be
referenced by host code, therefore they need to
be externalized in a similar way as a static device
variables or kernels in an anonymous namespace.
Fixes: https://github.com/ROCm-Developer-Tools/HIP/issues/3246
Nit: I'd rename the patterns to reflect the names of the source entities they track, so we don't have to dig through multiple dependent matches in order to figure out what the test does.
E.g. for tempKern : KERN3, STR3 -> TKERN, TKERNSTR.
Maybe give kernels/variables more distinct names as well. My brain keeps trying to interpret temp as temporary.
A common naming scheme would be nice. E.g. tk, tv for the template kernel and variable, a* for anonymous entities.