Issue 154925
Summary AMDGPU triples should start making use of subarch field
Labels backend:AMDGPU
Assignees
Reporter arsenm
    AMDGPU has pushed the usage of subtargets far beyond what is reasonable. Major target revisions have module level incompatibilities that are not well modeled by the function-level subtarget.

For example, the target ID emitted for the module scope depends on the global subtarget, which should not be used. This only exists in the compilation context / command line, and is not represented in the IR. If the top level architecture were properly represented in the triple, this would not be necessary.

Additionally, the "amdgcn" name is quite old and doesn't really apply to new architectures. I'm thinking we should introduce a new top-level "amdgpu" triple arch, which will be treated as an alias for amdgcn. From there, we can start parsing the subarch as the suffix to AMDGPU. I was thinking we would just have the major digit for the gfx version, e.g.

```
amdgpu6, amdgpu7, amdgpu8, amdgpu9, amdgpu10, amdgp11, amdgpu12
```

Given the target ID is directly including the full gfx version, we may need to fully push the gfx version into the subarch. e.g.

```
amdgpu600, amdgpu940, amdgpu1030...
```

Maybe we only need to do this for legacy architectures, and going forward we can only use the major digits as used in the -generic subtargets. e.g.

```
amdgpu600, amdgpu602, ..., amdgpu9, amdgpu9.4, amdgpu10.1,amdgpu10.3,amdgpu11
```

Whatever we do, to maintain command compatibility we'll need to do triple rewriting based on the subtarget, [similar to what ARM does](https://github.com/llvm/llvm-project/blob/d5af08a221fd3e6a6bf635ab05a69bbf1c0a14e3/clang/lib/Driver/ToolChains/Arch/ARM.cpp#L172).

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to