Skip to content

Commit 466a814

Browse files
authored
Revert "[AMDGPU] Make default AMDHSA Code Object Version to be 5 (#65410)" (#66060)
This reverts commit 0a8d17e.
1 parent 22f96ab commit 466a814

File tree

109 files changed

+9724
-9196
lines changed

Some content is hidden

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

109 files changed

+9724
-9196
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4616,12 +4616,12 @@ defm amdgpu_ieee : BoolOption<"m", "amdgpu-ieee",
46164616
NegFlag<SetFalse, [], [ClangOption, CC1Option]>>, Group<m_Group>;
46174617

46184618
def mcode_object_version_EQ : Joined<["-"], "mcode-object-version=">, Group<m_Group>,
4619-
HelpText<"Specify code object ABI version. Defaults to 5. (AMDGPU only)">,
4619+
HelpText<"Specify code object ABI version. Defaults to 4. (AMDGPU only)">,
46204620
Visibility<[ClangOption, CC1Option]>,
46214621
Values<"none,2,3,4,5">,
46224622
NormalizedValuesScope<"TargetOptions">,
46234623
NormalizedValues<["COV_None", "COV_2", "COV_3", "COV_4", "COV_5"]>,
4624-
MarshallingInfoEnum<TargetOpts<"CodeObjectVersion">, "COV_5">;
4624+
MarshallingInfoEnum<TargetOpts<"CodeObjectVersion">, "COV_4">;
46254625

46264626
defm cumode : SimpleMFlag<"cumode",
46274627
"Specify CU wavefront", "Specify WGP wavefront",

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2341,7 +2341,7 @@ void tools::checkAMDGPUCodeObjectVersion(const Driver &D,
23412341

23422342
unsigned tools::getAMDGPUCodeObjectVersion(const Driver &D,
23432343
const llvm::opt::ArgList &Args) {
2344-
unsigned CodeObjVer = 5; // default
2344+
unsigned CodeObjVer = 4; // default
23452345
if (auto *CodeObjArg = getAMDGPUCodeObjectArgument(D, Args))
23462346
StringRef(CodeObjArg->getValue()).getAsInteger(0, CodeObjVer);
23472347
return CodeObjVer;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Create module flag for code object version.
22

33
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
4-
// RUN: -o - %s | FileCheck %s -check-prefix=V5
4+
// RUN: -o - %s | FileCheck %s -check-prefix=V4
55

66
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \
77
// RUN: -mcode-object-version=2 -o - %s | FileCheck -check-prefix=V2 %s

clang/test/CodeGenCUDA/amdgpu-workgroup-size.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa \
2-
// RUN: -fcuda-is-device -mcode-object-version=4 -emit-llvm -o - -x hip %s \
2+
// RUN: -fcuda-is-device -emit-llvm -o - -x hip %s \
33
// RUN: | FileCheck -check-prefix=PRECOV5 %s
44

55

66
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa \
7-
// RUN: -fcuda-is-device -emit-llvm -o - -x hip %s \
7+
// RUN: -fcuda-is-device -mcode-object-version=5 -emit-llvm -o - -x hip %s \
88
// RUN: | FileCheck -check-prefix=COV5 %s
99

1010
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa \

clang/test/CodeGenHIP/default-attributes.hip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ __global__ void kernel() {
4646
// OPT: attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
4747
// OPT: attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) "amdgpu-flat-work-group-size"="1,1024" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" }
4848
//.
49-
// OPTNONE: !0 = !{i32 1, !"amdgpu_code_object_version", i32 500}
49+
// OPTNONE: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
5050
// OPTNONE: !1 = !{i32 1, !"amdgpu_printf_kind", !"hostcall"}
5151
// OPTNONE: !2 = !{i32 1, !"wchar_size", i32 4}
5252
//.
53-
// OPT: !0 = !{i32 1, !"amdgpu_code_object_version", i32 500}
53+
// OPT: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
5454
// OPT: !1 = !{i32 1, !"amdgpu_printf_kind", !"hostcall"}
5555
// OPT: !2 = !{i32 1, !"wchar_size", i32 4}
5656
//.

clang/test/CodeGenOpenCL/amdgpu-enqueue-kernel.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ kernel void test_target_features_kernel(global int *i) {
703703
// GFX900: attributes #8 = { nounwind }
704704
// GFX900: attributes #9 = { convergent nounwind }
705705
//.
706-
// NOCPU: !0 = !{i32 1, !"amdgpu_code_object_version", i32 500}
706+
// NOCPU: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
707707
// NOCPU: !1 = !{i32 1, !"wchar_size", i32 4}
708708
// NOCPU: !2 = !{i32 2, i32 0}
709709
// NOCPU: !3 = !{i32 1, i32 0, i32 1, i32 0}
@@ -721,7 +721,7 @@ kernel void test_target_features_kernel(global int *i) {
721721
// NOCPU: !15 = !{i32 1}
722722
// NOCPU: !16 = !{!"int*"}
723723
//.
724-
// GFX900: !0 = !{i32 1, !"amdgpu_code_object_version", i32 500}
724+
// GFX900: !0 = !{i32 1, !"amdgpu_code_object_version", i32 400}
725725
// GFX900: !1 = !{i32 1, !"wchar_size", i32 4}
726726
// GFX900: !2 = !{i32 2, i32 0}
727727
// GFX900: !3 = !{!4, !4, i64 0}

clang/test/CodeGenOpenCL/builtins-amdgcn.cl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -599,13 +599,13 @@ void test_get_local_id(int d, global int *out)
599599
}
600600

601601
// CHECK-LABEL: @test_get_workgroup_size(
602-
// CHECK: call align 8 dereferenceable(256) ptr addrspace(4) @llvm.amdgcn.implicitarg.ptr()
603-
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 12
602+
// CHECK: call align 4 dereferenceable(64) ptr addrspace(4) @llvm.amdgcn.dispatch.ptr()
603+
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 4
604604
// CHECK: load i16, ptr addrspace(4) %{{.*}}, align 4, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef
605-
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 14
605+
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 6
606606
// CHECK: load i16, ptr addrspace(4) %{{.*}}, align 2, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef
607-
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 16
608-
// CHECK: load i16, ptr addrspace(4) %{{.*}}, align 8, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef
607+
// CHECK: getelementptr inbounds i8, ptr addrspace(4) %{{.*}}, i64 8
608+
// CHECK: load i16, ptr addrspace(4) %{{.*}}, align 4, !range [[$WS_RANGE:![0-9]*]], !invariant.load{{.*}}, !noundef
609609
void test_get_workgroup_size(int d, global int *out)
610610
{
611611
switch (d) {

clang/test/Driver/hip-device-libs.hip

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@
160160
// Test default code object version.
161161
// RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \
162162
// RUN: --rocm-path=%S/Inputs/rocm %S/Inputs/hip_multiple_inputs/b.hip \
163-
// RUN: 2>&1 | FileCheck %s --check-prefixes=ABI5
163+
// RUN: 2>&1 | FileCheck %s --check-prefixes=ABI4
164164

165-
// Test default code object version with old device library without abi_version_500.bc
166-
// RUN: not %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \
165+
// Test default code object version with old device library without abi_version_400.bc
166+
// RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \
167167
// RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode-no-abi-ver \
168168
// RUN: --rocm-path=%S/Inputs/rocm %S/Inputs/hip_multiple_inputs/b.hip \
169-
// RUN: 2>&1 | FileCheck %s --check-prefixes=NOABI5
169+
// RUN: 2>&1 | FileCheck %s --check-prefixes=NOABI4
170170

171171
// Test -mcode-object-version=3
172172
// RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \
@@ -193,12 +193,12 @@
193193
// RUN: --rocm-path=%S/Inputs/rocm %S/Inputs/hip_multiple_inputs/b.hip \
194194
// RUN: 2>&1 | FileCheck %s --check-prefixes=ABI5
195195

196-
// Test -mcode-object-version=4 with old device library without abi_version_400.bc
197-
// RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \
198-
// RUN: -mcode-object-version=4 \
196+
// Test -mcode-object-version=5 with old device library without abi_version_400.bc
197+
// RUN: not %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \
198+
// RUN: -mcode-object-version=5 \
199199
// RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode-no-abi-ver \
200200
// RUN: --rocm-path=%S/Inputs/rocm %S/Inputs/hip_multiple_inputs/b.hip \
201-
// RUN: 2>&1 | FileCheck %s --check-prefixes=NOABI4
201+
// RUN: 2>&1 | FileCheck %s --check-prefixes=NOABI5
202202

203203
// ALL-NOT: error:
204204
// ALL: {{"[^"]*clang[^"]*"}}

lld/test/ELF/emulation-amdgpu.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# CHECK-NEXT: DataEncoding: LittleEndian (0x1)
1414
# CHECK-NEXT: FileVersion: 1
1515
# CHECK-NEXT: OS/ABI: AMDGPU_HSA (0x40)
16-
# CHECK-NEXT: ABIVersion: 3
16+
# CHECK-NEXT: ABIVersion: 2
1717
# CHECK-NEXT: Unused: (00 00 00 00 00 00 00)
1818
# CHECK-NEXT: }
1919
# CHECK-NEXT: Type: Executable (0x2)

lld/test/ELF/lto/amdgcn-oses.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
; RUN: llvm-readobj --file-headers %t/mesa3d.so | FileCheck %s --check-prefixes=GCN,NON-AMDHSA,MESA3D
1616

1717
; AMDHSA: OS/ABI: AMDGPU_HSA (0x40)
18-
; AMDHSA: ABIVersion: 3
18+
; AMDHSA: ABIVersion: 2
1919

2020
; AMDPAL: OS/ABI: AMDGPU_PAL (0x41)
2121
; MESA3D: OS/ABI: AMDGPU_MESA3D (0x42)

0 commit comments

Comments
 (0)