Skip to content

Commit 8bdfc73

Browse files
committed
[AMDGPU][clang] Definition of gfx11 subtarget
Contributors: Jay Foad <jay.foad@amd.com> Konstantin Zhuravlyov <kzhuravl_dev@outlook.com> Patch 2/N for upstreaming of AMDGPU gfx11 architecture Depends on D124536 Reviewed By: foad, kzhuravl, #amdgpu, arsenm Differential Revision: https://reviews.llvm.org/D124537
1 parent 51e0240 commit 8bdfc73

File tree

9 files changed

+57
-1
lines changed

9 files changed

+57
-1
lines changed

clang/include/clang/Basic/Cuda.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ enum class CudaArch {
9797
GFX1034,
9898
GFX1035,
9999
GFX1036,
100+
GFX1100,
101+
GFX1101,
102+
GFX1102,
103+
GFX1103,
100104
Generic, // A processor model named 'generic' if the target backend defines a
101105
// public one.
102106
LAST,

clang/lib/Basic/Cuda.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ static const CudaArchToStringMap arch_names[] = {
125125
GFX(1034), // gfx1034
126126
GFX(1035), // gfx1035
127127
GFX(1036), // gfx1036
128+
GFX(1100), // gfx1100
129+
GFX(1101), // gfx1101
130+
GFX(1102), // gfx1102
131+
GFX(1103), // gfx1103
128132
{CudaArch::Generic, "generic", ""},
129133
// clang-format on
130134
};

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,26 @@ bool AMDGPUTargetInfo::initFeatureMap(
183183
// XXX - What does the member GPU mean if device name string passed here?
184184
if (isAMDGCN(getTriple())) {
185185
switch (llvm::AMDGPU::parseArchAMDGCN(CPU)) {
186+
case GK_GFX1103:
187+
case GK_GFX1102:
188+
case GK_GFX1101:
189+
case GK_GFX1100:
190+
Features["ci-insts"] = true;
191+
Features["dot1-insts"] = true;
192+
Features["dot5-insts"] = true;
193+
Features["dot6-insts"] = true;
194+
Features["dot7-insts"] = true;
195+
Features["dot8-insts"] = true;
196+
Features["dl-insts"] = true;
197+
Features["flat-address-space"] = true;
198+
Features["16-bit-insts"] = true;
199+
Features["dpp"] = true;
200+
Features["gfx8-insts"] = true;
201+
Features["gfx9-insts"] = true;
202+
Features["gfx10-insts"] = true;
203+
Features["gfx10-3-insts"] = true;
204+
Features["gfx11-insts"] = true;
205+
break;
186206
case GK_GFX1036:
187207
case GK_GFX1035:
188208
case GK_GFX1034:

clang/lib/Basic/Targets/NVPTX.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions &Opts,
217217
case CudaArch::GFX1034:
218218
case CudaArch::GFX1035:
219219
case CudaArch::GFX1036:
220+
case CudaArch::GFX1100:
221+
case CudaArch::GFX1101:
222+
case CudaArch::GFX1102:
223+
case CudaArch::GFX1103:
220224
case CudaArch::Generic:
221225
case CudaArch::LAST:
222226
break;

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3946,6 +3946,10 @@ void CGOpenMPRuntimeGPU::processRequiresDirective(
39463946
case CudaArch::GFX1034:
39473947
case CudaArch::GFX1035:
39483948
case CudaArch::GFX1036:
3949+
case CudaArch::GFX1100:
3950+
case CudaArch::GFX1101:
3951+
case CudaArch::GFX1102:
3952+
case CudaArch::GFX1103:
39493953
case CudaArch::Generic:
39503954
case CudaArch::UNUSED:
39513955
case CudaArch::UNKNOWN:

clang/test/CodeGenOpenCL/amdgpu-features.cl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1034 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1034 %s
3838
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1035 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1035 %s
3939
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1036 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1036 %s
40+
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1100 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1100 %s
41+
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1101 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1101 %s
42+
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1102 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1102 %s
43+
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1103 -S -emit-llvm -o - %s | FileCheck --check-prefix=GFX1103 %s
4044

4145
// GFX600: "target-features"="+s-memtime-inst"
4246
// GFX601: "target-features"="+s-memtime-inst"
@@ -72,5 +76,9 @@
7276
// GFX1034: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst"
7377
// GFX1035: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst"
7478
// GFX1036: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst"
79+
// GFX1100: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dot8-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx11-insts,+gfx8-insts,+gfx9-insts"
80+
// GFX1101: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dot8-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx11-insts,+gfx8-insts,+gfx9-insts"
81+
// GFX1102: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dot8-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx11-insts,+gfx8-insts,+gfx9-insts"
82+
// GFX1103: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dot8-insts,+dpp,+flat-address-space,+gfx10-3-insts,+gfx10-insts,+gfx11-insts,+gfx8-insts,+gfx9-insts"
7583

7684
kernel void test() {}

clang/test/Driver/amdgpu-macros.cl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1034 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1034
121121
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1035 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1035
122122
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1036 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1036
123+
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1100 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1100
124+
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1101 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1101
125+
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1102 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1102
126+
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1103 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1103
123127

124128
// ARCH-GCN-DAG: #define FP_FAST_FMA 1
125129

clang/test/Driver/amdgpu-mcpu.cl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@
104104
// RUN: %clang -### -target amdgcn -mcpu=gfx1034 %s 2>&1 | FileCheck --check-prefix=GFX1034 %s
105105
// RUN: %clang -### -target amdgcn -mcpu=gfx1035 %s 2>&1 | FileCheck --check-prefix=GFX1035 %s
106106
// RUN: %clang -### -target amdgcn -mcpu=gfx1036 %s 2>&1 | FileCheck --check-prefix=GFX1036 %s
107+
// RUN: %clang -### -target amdgcn -mcpu=gfx1100 %s 2>&1 | FileCheck --check-prefix=GFX1100 %s
108+
// RUN: %clang -### -target amdgcn -mcpu=gfx1101 %s 2>&1 | FileCheck --check-prefix=GFX1101 %s
109+
// RUN: %clang -### -target amdgcn -mcpu=gfx1102 %s 2>&1 | FileCheck --check-prefix=GFX1102 %s
110+
// RUN: %clang -### -target amdgcn -mcpu=gfx1103 %s 2>&1 | FileCheck --check-prefix=GFX1103 %s
107111

108112
// GCNDEFAULT-NOT: -target-cpu
109113
// GFX600: "-target-cpu" "gfx600"
@@ -140,3 +144,7 @@
140144
// GFX1034: "-target-cpu" "gfx1034"
141145
// GFX1035: "-target-cpu" "gfx1035"
142146
// GFX1036: "-target-cpu" "gfx1036"
147+
// GFX1100: "-target-cpu" "gfx1100"
148+
// GFX1101: "-target-cpu" "gfx1101"
149+
// GFX1102: "-target-cpu" "gfx1102"
150+
// GFX1103: "-target-cpu" "gfx1103"

clang/test/Misc/target-invalid-cpu-note.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
// RUN: not %clang_cc1 -triple nvptx--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix NVPTX
3131
// NVPTX: error: unknown target CPU 'not-a-cpu'
32-
// NVPTX-NEXT: note: valid target CPU values are: sm_20, sm_21, sm_30, sm_32, sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80, sm_86, gfx600, gfx601, gfx602, gfx700, gfx701, gfx702, gfx703, gfx704, gfx705, gfx801, gfx802, gfx803, gfx805, gfx810, gfx900, gfx902, gfx904, gfx906, gfx908, gfx909, gfx90a, gfx90c, gfx940, gfx1010, gfx1011, gfx1012, gfx1013, gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035, gfx1036{{$}}
32+
// NVPTX-NEXT: note: valid target CPU values are: sm_20, sm_21, sm_30, sm_32, sm_35, sm_37, sm_50, sm_52, sm_53, sm_60, sm_61, sm_62, sm_70, sm_72, sm_75, sm_80, sm_86, gfx600, gfx601, gfx602, gfx700, gfx701, gfx702, gfx703, gfx704, gfx705, gfx801, gfx802, gfx803, gfx805, gfx810, gfx900, gfx902, gfx904, gfx906, gfx908, gfx909, gfx90a, gfx90c, gfx940, gfx1010, gfx1011, gfx1012, gfx1013, gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035, gfx1036, gfx1100, gfx1101, gfx1102, gfx1103{{$}}
3333

3434
// RUN: not %clang_cc1 -triple r600--- -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix R600
3535
// R600: error: unknown target CPU 'not-a-cpu'

0 commit comments

Comments
 (0)