Skip to content

Commit 223d2ba

Browse files
committed
[AMDGPU] Remove Code Object V2
Code Object V2 has been deprecated for more than a year now. We can safely remove it from LLVM. - [clang] Remove support for the `-mcode-object-version=2` option. - [lld] Remove/refactor tests that were still using COV2 - [llvm] Update AMDGPUUsage.rst - Code Object V2 docs are left for informational purposes because those code objects may still be supported by the runtime/loaders for a while. - [AMDGPU] Remove COV2 emission capabilities. - [AMDGPU] Remove `MetadataStreamerYamlV2` which was only used by COV2 - [AMDGPU] Update all tests that were still using COV2 - They are either deleted or ported directly to code object v4 (as v3 is also planned to be removed soon).
1 parent ca3ed7b commit 223d2ba

File tree

82 files changed

+705
-6645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+705
-6645
lines changed

clang/include/clang/Basic/TargetOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class TargetOptions {
8282
/// code object version times 100.
8383
enum CodeObjectVersionKind {
8484
COV_None,
85-
COV_2 = 200,
85+
COV_2 = 200, // Unsupported.
8686
COV_3 = 300,
8787
COV_4 = 400,
8888
COV_5 = 500,

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4624,9 +4624,9 @@ defm amdgpu_ieee : BoolOption<"m", "amdgpu-ieee",
46244624
def mcode_object_version_EQ : Joined<["-"], "mcode-object-version=">, Group<m_Group>,
46254625
HelpText<"Specify code object ABI version. Defaults to 4. (AMDGPU only)">,
46264626
Visibility<[ClangOption, CC1Option]>,
4627-
Values<"none,2,3,4,5">,
4627+
Values<"none,3,4,5">,
46284628
NormalizedValuesScope<"TargetOptions">,
4629-
NormalizedValues<["COV_None", "COV_2", "COV_3", "COV_4", "COV_5"]>,
4629+
NormalizedValues<["COV_None", "COV_3", "COV_4", "COV_5"]>,
46304630
MarshallingInfoEnum<TargetOpts<"CodeObjectVersion">, "COV_4">;
46314631

46324632
defm cumode : SimpleMFlag<"cumode",

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2323,7 +2323,7 @@ getAMDGPUCodeObjectArgument(const Driver &D, const llvm::opt::ArgList &Args) {
23232323

23242324
void tools::checkAMDGPUCodeObjectVersion(const Driver &D,
23252325
const llvm::opt::ArgList &Args) {
2326-
const unsigned MinCodeObjVer = 2;
2326+
const unsigned MinCodeObjVer = 3;
23272327
const unsigned MaxCodeObjVer = 5;
23282328

23292329
if (auto *CodeObjArg = getAMDGPUCodeObjectArgument(D, Args)) {

clang/test/CodeGenCUDA/amdgpu-code-object-version.cu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
44
// RUN: -o - %s | FileCheck %s -check-prefix=V4
55

6-
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
7-
// RUN: -mcode-object-version=2 -o - %s | FileCheck -check-prefix=V2 %s
8-
96
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
107
// RUN: -mcode-object-version=3 -o - %s | FileCheck -check-prefix=V3 %s
118

@@ -21,7 +18,6 @@
2118
// RUN: not %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
2219
// RUN: -mcode-object-version=4.1 -o - %s 2>&1| FileCheck %s -check-prefix=INV
2320

24-
// V2: !{{.*}} = !{i32 1, !"amdgpu_code_object_version", i32 200}
2521
// V3: !{{.*}} = !{i32 1, !"amdgpu_code_object_version", i32 300}
2622
// V4: !{{.*}} = !{i32 1, !"amdgpu_code_object_version", i32 400}
2723
// V5: !{{.*}} = !{i32 1, !"amdgpu_code_object_version", i32 500}

clang/test/Driver/hip-code-object-version.hip

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
// REQUIRES: amdgpu-registered-target
22

3-
// Check bundle ID for code object v2.
4-
5-
// RUN: not %clang -### --target=x86_64-linux-gnu \
6-
// RUN: -mcode-object-version=2 \
7-
// RUN: --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
8-
// RUN: %s 2>&1 | FileCheck -check-prefix=V2 %s
9-
10-
// V2: "-mllvm" "--amdhsa-code-object-version=2"
11-
// V2: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
12-
133
// Check bundle ID for code object v3.
144

155
// RUN: not %clang -### --target=x86_64-linux-gnu \
@@ -61,9 +51,16 @@
6151
// RUN: not %clang -### --target=x86_64-linux-gnu \
6252
// RUN: -mcode-object-version=1 \
6353
// RUN: --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
64-
// RUN: %s 2>&1 | FileCheck -check-prefix=INVALID %s
65-
// INVALID: error: invalid integral value '1' in '-mcode-object-version=1'
66-
// INVALID-NOT: error: invalid integral value
54+
// RUN: %s 2>&1 | FileCheck -check-prefix=INVALID_1 %s
55+
// INVALID_1: error: invalid integral value '1' in '-mcode-object-version=1'
56+
// INVALID_1-NOT: error: invalid integral value
57+
58+
// RUN: not %clang -### --target=x86_64-linux-gnu \
59+
// RUN: -mcode-object-version=2 \
60+
// RUN: --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
61+
// RUN: %s 2>&1 | FileCheck -check-prefix=INVALID_2 %s
62+
// INVALID_2: error: invalid integral value '2' in '-mcode-object-version=2'
63+
// INVALID_2-NOT: error: invalid integral value
6764

6865
// Check LLVM code object version option --amdhsa-code-object-version
6966
// is passed to -cc1 and -cc1as, and -mcode-object-version is passed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.text
22
.globl kernel_0
33
.align 64
4-
.amdgpu_hsa_kernel kernel_0
54
kernel_0:
65
s_endpgm
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.text
22
.globl kernel_1
33
.align 64
4-
.amdgpu_hsa_kernel kernel_1
54
kernel_1:
65
s_endpgm

lld/test/ELF/amdgpu-abi-version-err.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REQUIRES: amdgpu
2-
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 -filetype=obj %s -o %t-0.o
3-
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=2 -filetype=obj %s -o %t-1.o
2+
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=4 -filetype=obj %s -o %t-0.o
3+
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx900 --amdhsa-code-object-version=5 -filetype=obj %s -o %t-1.o
44
# RUN: not ld.lld -shared %t-0.o %t-1.o -o /dev/null 2>&1 | FileCheck %s
55

66
# CHECK: ld.lld: error: incompatible ABI version: {{.*}}-1.o
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REQUIRES: amdgpu
2-
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx802 --amdhsa-code-object-version=2 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
3-
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=2 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
2+
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx802 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
3+
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
44
# RUN: not ld.lld -shared %t-0.o %t-1.o -o /dev/null 2>&1 | FileCheck %s
55

6-
# CHECK: error: incompatible e_flags: {{.*}}-1.o
6+
# CHECK: error: incompatible mach: {{.*}}-1.o

lld/test/ELF/amdgpu-elf-flags.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# REQUIRES: amdgpu
2-
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=2 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
3-
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=2 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
2+
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-0.s -o %t-0.o
3+
# RUN: llvm-mc -triple amdgcn-amd-amdhsa -mcpu=gfx803 --amdhsa-code-object-version=4 -filetype=obj %S/Inputs/amdgpu-kernel-1.s -o %t-1.o
44
# RUN: ld.lld -shared %t-0.o %t-1.o -o %t.so
55
# RUN: llvm-readobj --file-headers %t.so | FileCheck --check-prefix=FIRSTLINK %s
66

0 commit comments

Comments
 (0)