| ... | ... | @@ -1507,7 +1507,7 @@ pub const Object = struct { |
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | const arch = comp.root_mod.resolved_target.result.cpu.arch; |
| 1510 | | const is_nvptx = arch == .nvptx or arch == .nvptx64; |
| 1510 | const workaround_alias_bugs = arch == .amdgcn or arch == .nvptx or arch == .nvptx64; |
| 1511 | 1511 | |
| 1512 | 1512 | const llvm_global_ty = llvm_global.typeOf(&o.builder); |
| 1513 | 1513 | |
| ... | ... | @@ -1528,10 +1528,11 @@ pub const Object = struct { |
| 1528 | 1528 | // alias will be set below. |
| 1529 | 1529 | const alias_global: Builder.Global.Index = global: { |
| 1530 | 1530 | |
| 1531 | | // WORKAROUND (see https://github.com/llvm/llvm-project/issues/213504) |
| 1532 | | // LLVM throws "NVPTX aliasee must be a non-kernel function definition" |
| 1533 | | // if we try to alias a kernel, so we just rename the global directly. |
| 1534 | | if (is_nvptx and export_i == 0) { |
| 1531 | // WORKAROUND (see https://github.com/llvm/llvm-project/issues/213504, https://github.com/llvm/llvm-project/issues/214835) |
| 1532 | // For NVPTX, LLVM throws "NVPTX aliasee must be a non-kernel function definition" if we try to alias a kernel |
| 1533 | // On AMDGCN, LLVM does not generate an alias for the kernel descriptor symbol on associated functions |
| 1534 | // To solve these, we rename the global |
| 1535 | if (workaround_alias_bugs and export_i == 0) { |
| 1535 | 1536 | try llvm_global.rename(exp_name, &o.builder); |
| 1536 | 1537 | break :global llvm_global; |
| 1537 | 1538 | } |