Skip to content

Commit 1004496

Browse files
authored
[AMDGPU] New GFX11+ aliases v_dot4_i32_i8 and v_dot8_i32_i4 (#118997)
Previously we decided not to support these aliases because in other generations they are real instructions with different behavior. Now I am inclined to support them anyway for compatibility with SP3.
1 parent 20d4742 commit 1004496

File tree

5 files changed

+18
-28
lines changed

5 files changed

+18
-28
lines changed

llvm/lib/Target/AMDGPU/VOP3PInstructions.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,11 @@ defm V_DOT4_I32_IU8 : VOP3P_Real_gfx11_gfx12<0x16>;
18451845
defm V_DOT8_I32_IU4 : VOP3P_Real_gfx11_gfx12<0x18>;
18461846
defm V_DOT2_F32_BF16 : VOP3P_Real_gfx11_gfx12<0x1a>;
18471847

1848+
let AssemblerPredicate = isGFX11Plus in {
1849+
def : AMDGPUMnemonicAlias<"v_dot4_i32_i8", "v_dot4_i32_iu8">;
1850+
def : AMDGPUMnemonicAlias<"v_dot8_i32_i4", "v_dot8_i32_iu4">;
1851+
}
1852+
18481853
multiclass VOP3P_Real_WMMA <bits<7> op> {
18491854
let WaveSizePredicate = isWave32, DecoderNamespace = "GFX11" in {
18501855
defm _twoaddr_w32 : VOP3P_Real_Base <GFX11Gen, op>;

llvm/test/MC/AMDGPU/gfx11_asm_err.s

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,6 @@ v_cvt_f16_u16_e64_dpp v5, s1 row_shl:1 row_mask:0xf bank_mask:0xf
7575
v_dual_mul_f32 v0, v0, v2 : : v_dual_mul_f32 v1, v1, v3
7676
// GFX11: :[[@LINE-1]]:{{[0-9]+}}: error: unknown token in expression
7777

78-
// On GFX11, v_dot8_i32_i4 is a valid SP3 alias for v_dot8_i32_iu4.
79-
// However, we intentionally leave it unimplemented because on other
80-
// processors v_dot8_i32_i4 denotes an instruction of a different
81-
// behaviour, which is considered potentially dangerous.
82-
v_dot8_i32_i4 v0, v1, v2, v3
83-
// GFX11: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
84-
85-
// On GFX11, v_dot4_i32_i8 is a valid SP3 alias for v_dot4_i32_iu8.
86-
// However, we intentionally leave it unimplemented because on other
87-
// processors v_dot4_i32_i8 denotes an instruction of a different
88-
// behaviour, which is considered potentially dangerous.
89-
v_dot4_i32_i8 v0, v1, v2, v3
90-
// GFX11: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
91-
9278
v_dot4c_i32_i8 v0, v1, v2
9379
// GFX11: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
9480

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: llvm-mc -triple=amdgcn -mcpu=gfx1100 -show-encoding %s | FileCheck -check-prefix=GFX11 %s
2+
3+
v_dot4_i32_i8 v5, v1, v2, s3
4+
// GFX11: v_dot4_i32_iu8 v5, v1, v2, s3 ; encoding: [0x05,0x40,0x16,0xcc,0x01,0x05,0x0e,0x18]
5+
6+
v_dot8_i32_i4 v5, v1, v2, s3
7+
// GFX11: v_dot8_i32_iu4 v5, v1, v2, s3 ; encoding: [0x05,0x40,0x18,0xcc,0x01,0x05,0x0e,0x18]

llvm/test/MC/AMDGPU/gfx12_asm_vop3p_aliases.s

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ v_pk_min_f16 v0, v1, v2
55

66
v_pk_max_f16 v0, v1, v2
77
// GFX12: v_pk_max_num_f16 v0, v1, v2 ; encoding: [0x00,0x40,0x1c,0xcc,0x01,0x05,0x02,0x18]
8+
9+
v_dot4_i32_i8 v5, v1, v2, s3
10+
// GFX12: v_dot4_i32_iu8 v5, v1, v2, s3 ; encoding: [0x05,0x40,0x16,0xcc,0x01,0x05,0x0e,0x18]
11+
12+
v_dot8_i32_i4 v5, v1, v2, s3
13+
// GFX12: v_dot8_i32_iu4 v5, v1, v2, s3 ; encoding: [0x05,0x40,0x18,0xcc,0x01,0x05,0x0e,0x18]

llvm/test/MC/AMDGPU/gfx12_err.s

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@ v_cvt_f16_u16_e64_dpp v5, s1 row_shl:1 row_mask:0xf bank_mask:0xf
2222
v_dual_mul_f32 v0, v0, v2 : : v_dual_mul_f32 v1, v1, v3
2323
// GFX12-ERR: [[@LINE-1]]:{{[0-9]+}}: error: unknown token in expression
2424

25-
// On GFX12, v_dot8_i32_i4 is a valid SP3 alias for v_dot8_i32_iu4.
26-
// However, we intentionally leave it unimplemented because on other
27-
// processors v_dot8_i32_i4 denotes an instruction of a different
28-
// behaviour, which is considered potentially dangerous.
29-
v_dot8_i32_i4 v0, v1, v2, v3
30-
// GFX12-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
31-
32-
// On GFX12, v_dot4_i32_i8 is a valid SP3 alias for v_dot4_i32_iu8.
33-
// However, we intentionally leave it unimplemented because on other
34-
// processors v_dot4_i32_i8 denotes an instruction of a different
35-
// behaviour, which is considered potentially dangerous.
36-
v_dot4_i32_i8 v0, v1, v2, v3
37-
// GFX12-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
38-
3925
v_dot4c_i32_i8 v0, v1, v2
4026
// GFX12-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: instruction not supported on this GPU
4127

0 commit comments

Comments
 (0)