Skip to content

Commit de0fd64

Browse files
authored
[AMDGPU] Introduce a new generic target gfx9-4-generic (llvm#115190)
This patch introduces a new generic target, `gfx9-4-generic`. Since it doesn’t support FP8 and XF32-related instructions, the patch includes several code reorganizations to accommodate these changes.
1 parent 5a5502b commit de0fd64

34 files changed

+245
-13
lines changed

clang/include/clang/Basic/Cuda.h

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ enum class OffloadArch {
103103
GFX909,
104104
GFX90a,
105105
GFX90c,
106+
GFX9_4_GENERIC,
106107
GFX940,
107108
GFX941,
108109
GFX942,

clang/lib/Basic/Cuda.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static const OffloadArchToStringMap arch_names[] = {
121121
GFX(909), // gfx909
122122
GFX(90a), // gfx90a
123123
GFX(90c), // gfx90c
124+
{OffloadArch::GFX9_4_GENERIC, "gfx9-4-generic", "compute_amdgcn"},
124125
GFX(940), // gfx940
125126
GFX(941), // gfx941
126127
GFX(942), // gfx942

clang/lib/Basic/Targets/NVPTX.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions &Opts,
205205
case OffloadArch::GFX909:
206206
case OffloadArch::GFX90a:
207207
case OffloadArch::GFX90c:
208+
case OffloadArch::GFX9_4_GENERIC:
208209
case OffloadArch::GFX940:
209210
case OffloadArch::GFX941:
210211
case OffloadArch::GFX942:

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2301,6 +2301,7 @@ void CGOpenMPRuntimeGPU::processRequiresDirective(const OMPRequiresDecl *D) {
23012301
case OffloadArch::GFX909:
23022302
case OffloadArch::GFX90a:
23032303
case OffloadArch::GFX90c:
2304+
case OffloadArch::GFX9_4_GENERIC:
23042305
case OffloadArch::GFX940:
23052306
case OffloadArch::GFX941:
23062307
case OffloadArch::GFX942:

clang/test/CodeGenOpenCL/amdgpu-features.cl

+6-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656

5757
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx1103 -target-feature +wavefrontsize64 -emit-llvm -o - %s | FileCheck --check-prefix=GFX1103-W64 %s
5858

59+
// RUN: %clang_cc1 -triple amdgcn -target-cpu gfx9-4-generic -emit-llvm -o - %s | FileCheck --check-prefix=GFX9_4_Generic %s
60+
5961
// NOCPU-NOT: "target-features"
6062
// NOCPU-WAVE32: "target-features"="+wavefrontsize32"
6163
// NOCPU-WAVE64: "target-features"="+wavefrontsize64"
@@ -82,9 +84,10 @@
8284
// GFX909: "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
8385
// GFX90A: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
8486
// GFX90C: "target-features"="+16-bit-insts,+ci-insts,+dpp,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
85-
// GFX940: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
86-
// GFX941: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
87-
// GFX942: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
87+
// GFX940: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,+xf32-insts"
88+
// GFX941: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,+xf32-insts"
89+
// GFX942: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,+xf32-insts"
90+
// GFX9_4_Generic: "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64"
8891
// GFX1010: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dpp,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize32"
8992
// GFX1011: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize32"
9093
// GFX1012: "target-features"="+16-bit-insts,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+gfx10-insts,+gfx8-insts,+gfx9-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize32"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// REQUIRES: amdgpu-registered-target
2+
3+
// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -target-cpu gfx9-4-generic -verify -emit-llvm -o - %s
4+
5+
typedef unsigned int uint;
6+
typedef float float2 __attribute__((ext_vector_type(2)));
7+
typedef float float4 __attribute__((ext_vector_type(4)));
8+
typedef float float16 __attribute__((ext_vector_type(16)));
9+
typedef int int2 __attribute__((ext_vector_type(2)));
10+
typedef int int4 __attribute__((ext_vector_type(4)));
11+
12+
void builtin_test_unsupported(uint a, uint b, int a_int, long a_long, float a_float, float b_float,
13+
int2 a_int2, int4 a_int4, float2 a_float2, float4 a_float4, float16 a_float16) {
14+
a_float4 = __builtin_amdgcn_mfma_f32_16x16x32_bf8_bf8(a_long, a_long, a_float4, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x32_bf8_bf8' needs target feature fp8-insts}}
15+
a_float4 = __builtin_amdgcn_mfma_f32_16x16x32_bf8_fp8(a_long, a_long, a_float4, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x32_bf8_fp8' needs target feature fp8-insts}}
16+
a_float4 = __builtin_amdgcn_mfma_f32_16x16x32_fp8_bf8(a_long, a_long, a_float4, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x32_fp8_bf8' needs target feature fp8-insts}}
17+
a_float4 = __builtin_amdgcn_mfma_f32_16x16x32_fp8_fp8(a_long, a_long, a_float4, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_16x16x32_fp8_fp8' needs target feature fp8-insts}}
18+
a_float16 = __builtin_amdgcn_mfma_f32_32x32x16_bf8_bf8(a_long, a_long, a_float16, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x16_bf8_bf8' needs target feature fp8-insts}}
19+
a_float16 = __builtin_amdgcn_mfma_f32_32x32x16_bf8_fp8(a_long, a_long, a_float16, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x16_bf8_fp8' needs target feature fp8-insts}}
20+
a_float16 = __builtin_amdgcn_mfma_f32_32x32x16_fp8_bf8(a_long, a_long, a_float16, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x16_fp8_bf8' needs target feature fp8-insts}}
21+
a_float16 = __builtin_amdgcn_mfma_f32_32x32x16_fp8_fp8(a_long, a_long, a_float16, 0, 0, 0); // expected-error {{'__builtin_amdgcn_mfma_f32_32x32x16_fp8_fp8' needs target feature fp8-insts}}
22+
a_float4 = __builtin_amdgcn_smfmac_f32_16x16x64_bf8_bf8(a_int2, a_int4, a_float4, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_16x16x64_bf8_bf8' needs target feature fp8-insts}}
23+
a_float4 = __builtin_amdgcn_smfmac_f32_16x16x64_bf8_fp8(a_int2, a_int4, a_float4, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_16x16x64_bf8_fp8' needs target feature fp8-insts}}
24+
a_float4 = __builtin_amdgcn_smfmac_f32_16x16x64_fp8_bf8(a_int2, a_int4, a_float4, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_16x16x64_fp8_bf8' needs target feature fp8-insts}}
25+
a_float4 = __builtin_amdgcn_smfmac_f32_16x16x64_fp8_fp8(a_int2, a_int4, a_float4, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_16x16x64_fp8_fp8' needs target feature fp8-insts}}
26+
a_float16 = __builtin_amdgcn_smfmac_f32_32x32x32_bf8_bf8(a_int2, a_int4, a_float16, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_32x32x32_bf8_bf8' needs target feature fp8-insts}}
27+
a_float16 = __builtin_amdgcn_smfmac_f32_32x32x32_bf8_fp8(a_int2, a_int4, a_float16, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_32x32x32_bf8_fp8' needs target feature fp8-insts}}
28+
a_float16 = __builtin_amdgcn_smfmac_f32_32x32x32_fp8_bf8(a_int2, a_int4, a_float16, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_32x32x32_fp8_bf8' needs target feature fp8-insts}}
29+
a_float16 = __builtin_amdgcn_smfmac_f32_32x32x32_fp8_fp8(a_int2, a_int4, a_float16, a_int, 0, 0); // expected-error {{'__builtin_amdgcn_smfmac_f32_32x32x32_fp8_fp8' needs target feature fp8-insts}}
30+
b = __builtin_amdgcn_cvt_f32_bf8(a, 0); // expected-error {{'__builtin_amdgcn_cvt_f32_bf8' needs target feature fp8-conversion-insts}}
31+
b = __builtin_amdgcn_cvt_f32_fp8(a, 1); // expected-error {{'__builtin_amdgcn_cvt_f32_fp8' needs target feature fp8-conversion-insts}}
32+
a_float2 = __builtin_amdgcn_cvt_pk_f32_bf8(a, false); // expected-error {{'__builtin_amdgcn_cvt_pk_f32_bf8' needs target feature fp8-conversion-insts}}
33+
a_float2 = __builtin_amdgcn_cvt_pk_f32_fp8(a, true); // expected-error {{'__builtin_amdgcn_cvt_pk_f32_fp8' needs target feature fp8-conversion-insts}}
34+
b = __builtin_amdgcn_cvt_pk_bf8_f32(a_float, b_float, a, false); // expected-error {{'__builtin_amdgcn_cvt_pk_bf8_f32' needs target feature fp8-conversion-insts}}
35+
b = __builtin_amdgcn_cvt_pk_fp8_f32(a_float, b_float, a, true); // expected-error {{'__builtin_amdgcn_cvt_pk_fp8_f32' needs target feature fp8-conversion-insts}}
36+
b = __builtin_amdgcn_cvt_sr_bf8_f32(a_float, b_float, a, 2); // expected-error {{'__builtin_amdgcn_cvt_sr_bf8_f32' needs target feature fp8-conversion-insts}}
37+
b = __builtin_amdgcn_cvt_sr_fp8_f32(a_float, b_float, a, 3); // expected-error {{'__builtin_amdgcn_cvt_sr_fp8_f32' needs target feature fp8-conversion-insts}}
38+
}

clang/test/Driver/amdgpu-macros.cl

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx1201 %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx1201 -DFAMILY=GFX12
134134

135135
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx9-generic %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=64 -DCPU=gfx9_generic -DFAMILY=GFX9
136+
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx9-4-generic %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=64 -DCPU=gfx9_4_generic -DFAMILY=GFX9
136137
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx10-1-generic %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx10_1_generic -DFAMILY=GFX10
137138
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx10-3-generic %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx10_3_generic -DFAMILY=GFX10
138139
// RUN: %clang -E -dM -target amdgcn -mcpu=gfx11-generic %s 2>&1 | FileCheck --check-prefixes=ARCH-GCN,FAST_FMAF %s -DWAVEFRONT_SIZE=32 -DCPU=gfx11_generic -DFAMILY=GFX11

clang/test/Driver/amdgpu-mcpu.cl

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
// RUN: %clang -### -target amdgcn -mcpu=gfx1201 %s 2>&1 | FileCheck --check-prefix=GFX1201 %s
119119

120120
// RUN: %clang -### -target amdgcn -mcpu=gfx9-generic %s 2>&1 | FileCheck --check-prefix=GFX9_GENERIC %s
121+
// RUN: %clang -### -target amdgcn -mcpu=gfx9-4-generic %s 2>&1 | FileCheck --check-prefix=GFX9_4_GENERIC %s
121122
// RUN: %clang -### -target amdgcn -mcpu=gfx10-1-generic %s 2>&1 | FileCheck --check-prefix=GFX10_1_GENERIC %s
122123
// RUN: %clang -### -target amdgcn -mcpu=gfx10-3-generic %s 2>&1 | FileCheck --check-prefix=GFX10_3_GENERIC %s
123124
// RUN: %clang -### -target amdgcn -mcpu=gfx11-generic %s 2>&1 | FileCheck --check-prefix=GFX11_GENERIC %s
@@ -172,6 +173,7 @@
172173
// GFX1201: "-target-cpu" "gfx1201"
173174

174175
// GFX9_GENERIC: "-target-cpu" "gfx9-generic"
176+
// GFX9_4_GENERIC: "-target-cpu" "gfx9-4-generic"
175177
// GFX10_1_GENERIC: "-target-cpu" "gfx10-1-generic"
176178
// GFX10_3_GENERIC: "-target-cpu" "gfx10-3-generic"
177179
// GFX11_GENERIC: "-target-cpu" "gfx11-generic"

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

+1
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,5 @@
7474
// CHECK-SAME: {{^}}, gfx10-3-generic
7575
// CHECK-SAME: {{^}}, gfx11-generic
7676
// CHECK-SAME: {{^}}, gfx12-generic
77+
// CHECK-SAME: {{^}}, gfx9-4-generic
7778
// CHECK-SAME: {{$}}

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

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
// CHECK-SAME: {{^}}, gfx909
5151
// CHECK-SAME: {{^}}, gfx90a
5252
// CHECK-SAME: {{^}}, gfx90c
53+
// CHECK-SAME: {{^}}, gfx9-4-generic
5354
// CHECK-SAME: {{^}}, gfx940
5455
// CHECK-SAME: {{^}}, gfx941
5556
// CHECK-SAME: {{^}}, gfx942

llvm/docs/AMDGPUUsage.rst

+7
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,12 @@ Generic processor code objects are versioned. See :ref:`amdgpu-generic-processor
576576
- ``v_dot2_f32_f16``
577577

578578

579+
``gfx9-4-generic`` ``amdgcn`` - ``gfx940`` - xnack - Absolute flat FP8 and BF8 instructions,
580+
- ``gfx941`` - sramecc scratch FP8 and BF8 conversion instructions,
581+
- ``gfx942`` as well as instructions with XF32 format support
582+
are not available.
583+
584+
579585
``gfx10-1-generic`` ``amdgcn`` - ``gfx1010`` - xnack - Absolute flat - The following instructions are
580586
- ``gfx1011`` - wavefrontsize64 scratch not available on ``gfx1011``
581587
- ``gfx1012`` - cumode and ``gfx1012``
@@ -2180,6 +2186,7 @@ The AMDGPU backend uses the following ELF header:
21802186
*reserved* 0x057 Reserved.
21812187
``EF_AMDGPU_MACH_AMDGCN_GFX1153`` 0x058 ``gfx1153``.
21822188
``EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC`` 0x059 ``gfx12-generic``
2189+
``EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC`` 0x05f ``gfx9-4-generic``
21832190
========================================== ========== =============================
21842191

21852192
Sections

llvm/include/llvm/BinaryFormat/ELF.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -822,11 +822,12 @@ enum : unsigned {
822822
EF_AMDGPU_MACH_AMDGCN_RESERVED_0X57 = 0x057,
823823
EF_AMDGPU_MACH_AMDGCN_GFX1153 = 0x058,
824824
EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC = 0x059,
825+
EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC = 0x05f,
825826
// clang-format on
826827

827828
// First/last AMDGCN-based processors.
828829
EF_AMDGPU_MACH_AMDGCN_FIRST = EF_AMDGPU_MACH_AMDGCN_GFX600,
829-
EF_AMDGPU_MACH_AMDGCN_LAST = EF_AMDGPU_MACH_AMDGCN_GFX12_GENERIC,
830+
EF_AMDGPU_MACH_AMDGCN_LAST = EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC,
830831

831832
// Indicates if the "xnack" target feature is enabled for all code contained
832833
// in the object.

llvm/include/llvm/TargetParser/TargetParser.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ enum GPUKind : uint32_t {
119119
GK_GFX10_3_GENERIC = 194,
120120
GK_GFX11_GENERIC = 195,
121121
GK_GFX12_GENERIC = 196,
122+
GK_GFX9_4_GENERIC = 197,
122123

123124
GK_AMDGCN_GENERIC_FIRST = GK_GFX9_GENERIC,
124-
GK_AMDGCN_GENERIC_LAST = GK_GFX12_GENERIC,
125+
GK_AMDGCN_GENERIC_LAST = GK_GFX9_4_GENERIC,
125126
};
126127

127128
/// Instruction set architecture version.

llvm/lib/Object/ELFObjectFile.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,8 @@ StringRef ELFObjectFileBase::getAMDGPUCPUName() const {
602602
// Generic AMDGCN targets
603603
case ELF::EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC:
604604
return "gfx9-generic";
605+
case ELF::EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC:
606+
return "gfx9-4-generic";
605607
case ELF::EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC:
606608
return "gfx10-1-generic";
607609
case ELF::EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC:

llvm/lib/ObjectYAML/ELFYAML.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ void ScalarBitSetTraits<ELFYAML::ELF_EF>::bitset(IO &IO,
631631
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX1200, EF_AMDGPU_MACH);
632632
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX1201, EF_AMDGPU_MACH);
633633
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX9_GENERIC, EF_AMDGPU_MACH);
634+
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX9_4_GENERIC, EF_AMDGPU_MACH);
634635
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX10_1_GENERIC, EF_AMDGPU_MACH);
635636
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX10_3_GENERIC, EF_AMDGPU_MACH);
636637
BCaseMask(EF_AMDGPU_MACH_AMDGCN_GFX11_GENERIC, EF_AMDGPU_MACH);

llvm/lib/Target/AMDGPU/AMDGPU.td

+24-7
Original file line numberDiff line numberDiff line change
@@ -1451,11 +1451,7 @@ def FeatureISAVersion9_4_Common : FeatureSet<
14511451
FeatureDPALU_DPP,
14521452
FeaturePackedFP32Ops,
14531453
FeatureMAIInsts,
1454-
FeatureFP8Insts,
1455-
FeatureFP8ConversionInsts,
1456-
FeatureCvtFP8VOP1Bug,
14571454
FeaturePkFmacF16Inst,
1458-
FeatureXF32Insts,
14591455
FeatureAtomicFaddRtnInsts,
14601456
FeatureAtomicFaddNoRtnInsts,
14611457
FeatureAtomicBufferGlobalPkAddF16Insts,
@@ -1476,15 +1472,36 @@ def FeatureISAVersion9_4_Common : FeatureSet<
14761472

14771473
def FeatureISAVersion9_4_0 : FeatureSet<
14781474
!listconcat(FeatureISAVersion9_4_Common.Features,
1479-
[FeatureForceStoreSC0SC1])>;
1475+
[
1476+
FeatureForceStoreSC0SC1,
1477+
FeatureFP8Insts,
1478+
FeatureFP8ConversionInsts,
1479+
FeatureCvtFP8VOP1Bug,
1480+
FeatureXF32Insts
1481+
])>;
14801482

14811483
def FeatureISAVersion9_4_1 : FeatureSet<
14821484
!listconcat(FeatureISAVersion9_4_Common.Features,
1483-
[FeatureForceStoreSC0SC1])>;
1485+
[
1486+
FeatureForceStoreSC0SC1,
1487+
FeatureFP8Insts,
1488+
FeatureFP8ConversionInsts,
1489+
FeatureCvtFP8VOP1Bug,
1490+
FeatureXF32Insts
1491+
])>;
14841492

14851493
def FeatureISAVersion9_4_2 : FeatureSet<
14861494
!listconcat(FeatureISAVersion9_4_Common.Features,
1487-
[])>;
1495+
[
1496+
FeatureFP8Insts,
1497+
FeatureFP8ConversionInsts,
1498+
FeatureCvtFP8VOP1Bug,
1499+
FeatureXF32Insts
1500+
])>;
1501+
1502+
def FeatureISAVersion9_4_Generic : FeatureSet<
1503+
!listconcat(FeatureISAVersion9_4_Common.Features,
1504+
[FeatureRequiresCOV6])>;
14881505

14891506
def FeatureISAVersion10_Common : FeatureSet<
14901507
[FeatureGFX10,

llvm/lib/Target/AMDGPU/GCNProcessors.td

+5
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ def : ProcessorModel<"gfx9-generic", SIQuarterSpeedModel,
209209
FeatureISAVersion9_Generic.Features
210210
>;
211211

212+
// [gfx940, gfx941, gfx942]
213+
def : ProcessorModel<"gfx9-4-generic", SIDPGFX940FullSpeedModel,
214+
FeatureISAVersion9_4_Generic.Features
215+
>;
216+
212217
//===----------------------------------------------------------------------===//
213218
// GCN GFX10.
214219
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)