- Under different ABIs, it's obvious that assertion is too strong. Even under the same ABI, once there are unnamed type not required to follow ODR rule, host- and device-side mangling may still get different names. As both the host- and device-side compilation always observe the same AST tree, even with different names, we still could associate the correct pairs, i.e., we don't use (mangled) names to linkage host- and device-side globals. There's no need to have this assertion.
LGTM. It seems no reason to assume the mangled name to be same on host and device side once anonymous types are mangled differently in host and device code. On windows, kernel has totally different names on host and device side without issues.
device-side mangled name, notice that $_0 refers to the unnamed closure in f1.
the registration of host-side stub function to the device-side function name, which is defined in @0. Notice that the host-side stub function has $_1, which refers to the closure in f1 as there's another closure (host-only) in f0.