forked from OSchip/llvm-project
AMDGPU: Add clamp bit to dot builtins
Differential Revision: https://reviews.llvm.org/D50011 llvm-svn: 338471
This commit is contained in:
parent
bb30ef7af4
commit
9057546c5b
|
@ -124,13 +124,13 @@ TARGET_BUILTIN(__builtin_amdgcn_fmed3h, "hhhh", "nc", "gfx9-insts")
|
|||
// Deep learning builtins.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
TARGET_BUILTIN(__builtin_amdgcn_fdot2, "fV2hV2hf", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot2, "SiV2SsV2SsSi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot2, "UiV2UsV2UsUi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot4, "SiSiSiSi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot4, "UiUiUiUi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot8, "SiSiSiSi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot8, "UiUiUiUi", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_fdot2, "fV2hV2hfIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot2, "SiV2SsV2SsSiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot2, "UiV2UsV2UsUiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot4, "SiSiSiSiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot4, "UiUiUiUiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_sdot8, "SiSiSiSiIb", "nc", "dl-insts")
|
||||
TARGET_BUILTIN(__builtin_amdgcn_udot8, "UiUiUiUiIb", "nc", "dl-insts")
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Special builtins.
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// REQUIRES: amdgpu-registered-target
|
||||
|
||||
// RUN: %clang_cc1 -triple amdgcn-unknown-unknown -target-cpu gfx906 -verify -S -emit-llvm -o - %s
|
||||
|
||||
typedef unsigned int uint;
|
||||
typedef half __attribute__((ext_vector_type(2))) half2;
|
||||
typedef short __attribute__((ext_vector_type(2))) short2;
|
||||
typedef unsigned short __attribute__((ext_vector_type(2))) ushort2;
|
||||
|
||||
kernel void builtins_amdgcn_dl_insts_err(
|
||||
global float *fOut, global int *siOut, global uint *uiOut,
|
||||
half2 v2hA, half2 v2hB, float fC,
|
||||
short2 v2ssA, short2 v2ssB, int siA, int siB, int siC,
|
||||
ushort2 v2usA, ushort2 v2usB, uint uiA, uint uiB, uint uiC, uint isClamp) {
|
||||
fOut[0] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_fdot2' must be a constant integer}}
|
||||
|
||||
siOut[0] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_sdot2' must be a constant integer}}
|
||||
uiOut[0] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_udot2' must be a constant integer}}
|
||||
|
||||
siOut[1] = __builtin_amdgcn_sdot4(siA, siB, siC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_sdot4' must be a constant integer}}
|
||||
uiOut[1] = __builtin_amdgcn_udot4(uiA, uiB, uiC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_udot4' must be a constant integer}}
|
||||
|
||||
siOut[2] = __builtin_amdgcn_sdot8(siA, siB, siC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_sdot8' must be a constant integer}}
|
||||
uiOut[2] = __builtin_amdgcn_udot8(uiA, uiB, uiC, isClamp == 0 ? false : true); // expected-error {{'__builtin_amdgcn_udot8' must be a constant integer}}
|
||||
}
|
|
@ -12,14 +12,24 @@ kernel void builtins_amdgcn_dl_insts_err(
|
|||
half2 v2hA, half2 v2hB, float fC,
|
||||
short2 v2ssA, short2 v2ssB, int siA, int siB, int siC,
|
||||
ushort2 v2usA, ushort2 v2usB, uint uiA, uint uiB, uint uiC) {
|
||||
fOut[0] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC); // expected-error {{'__builtin_amdgcn_fdot2' needs target feature dl-insts}}
|
||||
fOut[0] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC, false); // expected-error {{'__builtin_amdgcn_fdot2' needs target feature dl-insts}}
|
||||
fOut[1] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC, true); // expected-error {{'__builtin_amdgcn_fdot2' needs target feature dl-insts}}
|
||||
|
||||
siOut[0] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC); // expected-error {{'__builtin_amdgcn_sdot2' needs target feature dl-insts}}
|
||||
uiOut[0] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC); // expected-error {{'__builtin_amdgcn_udot2' needs target feature dl-insts}}
|
||||
siOut[0] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC, false); // expected-error {{'__builtin_amdgcn_sdot2' needs target feature dl-insts}}
|
||||
siOut[1] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC, true); // expected-error {{'__builtin_amdgcn_sdot2' needs target feature dl-insts}}
|
||||
|
||||
siOut[1] = __builtin_amdgcn_sdot4(siA, siB, siC); // expected-error {{'__builtin_amdgcn_sdot4' needs target feature dl-insts}}
|
||||
uiOut[1] = __builtin_amdgcn_udot4(uiA, uiB, uiC); // expected-error {{'__builtin_amdgcn_udot4' needs target feature dl-insts}}
|
||||
uiOut[0] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC, false); // expected-error {{'__builtin_amdgcn_udot2' needs target feature dl-insts}}
|
||||
uiOut[1] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC, true); // expected-error {{'__builtin_amdgcn_udot2' needs target feature dl-insts}}
|
||||
|
||||
siOut[2] = __builtin_amdgcn_sdot8(siA, siB, siC); // expected-error {{'__builtin_amdgcn_sdot8' needs target feature dl-insts}}
|
||||
uiOut[2] = __builtin_amdgcn_udot8(uiA, uiB, uiC); // expected-error {{'__builtin_amdgcn_udot8' needs target feature dl-insts}}
|
||||
siOut[2] = __builtin_amdgcn_sdot4(siA, siB, siC, false); // expected-error {{'__builtin_amdgcn_sdot4' needs target feature dl-insts}}
|
||||
siOut[3] = __builtin_amdgcn_sdot4(siA, siB, siC, true); // expected-error {{'__builtin_amdgcn_sdot4' needs target feature dl-insts}}
|
||||
|
||||
uiOut[2] = __builtin_amdgcn_udot4(uiA, uiB, uiC, false); // expected-error {{'__builtin_amdgcn_udot4' needs target feature dl-insts}}
|
||||
uiOut[3] = __builtin_amdgcn_udot4(uiA, uiB, uiC, true); // expected-error {{'__builtin_amdgcn_udot4' needs target feature dl-insts}}
|
||||
|
||||
siOut[4] = __builtin_amdgcn_sdot8(siA, siB, siC, false); // expected-error {{'__builtin_amdgcn_sdot8' needs target feature dl-insts}}
|
||||
siOut[5] = __builtin_amdgcn_sdot8(siA, siB, siC, true); // expected-error {{'__builtin_amdgcn_sdot8' needs target feature dl-insts}}
|
||||
|
||||
uiOut[4] = __builtin_amdgcn_udot8(uiA, uiB, uiC, false); // expected-error {{'__builtin_amdgcn_udot8' needs target feature dl-insts}}
|
||||
uiOut[5] = __builtin_amdgcn_udot8(uiA, uiB, uiC, true); // expected-error {{'__builtin_amdgcn_udot8' needs target feature dl-insts}}
|
||||
}
|
||||
|
|
|
@ -8,29 +8,49 @@ typedef short __attribute__((ext_vector_type(2))) short2;
|
|||
typedef unsigned short __attribute__((ext_vector_type(2))) ushort2;
|
||||
|
||||
// CHECK-LABEL: @builtins_amdgcn_dl_insts
|
||||
// CHECK: call float @llvm.amdgcn.fdot2
|
||||
// CHECK: call float @llvm.amdgcn.fdot2(<2 x half> %v2hA, <2 x half> %v2hB, float %fC, i1 false)
|
||||
// CHECK: call float @llvm.amdgcn.fdot2(<2 x half> %v2hA, <2 x half> %v2hB, float %fC, i1 true)
|
||||
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot2
|
||||
// CHECK: call i32 @llvm.amdgcn.udot2
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot2(<2 x i16> %v2ssA, <2 x i16> %v2ssB, i32 %siC, i1 false)
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot2(<2 x i16> %v2ssA, <2 x i16> %v2ssB, i32 %siC, i1 true)
|
||||
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot4
|
||||
// CHECK: call i32 @llvm.amdgcn.udot4
|
||||
// CHECK: call i32 @llvm.amdgcn.udot2(<2 x i16> %v2usA, <2 x i16> %v2usB, i32 %uiC, i1 false)
|
||||
// CHECK: call i32 @llvm.amdgcn.udot2(<2 x i16> %v2usA, <2 x i16> %v2usB, i32 %uiC, i1 true)
|
||||
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot8
|
||||
// CHECK: call i32 @llvm.amdgcn.udot8
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot4(i32 %siA, i32 %siB, i32 %siC, i1 false)
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot4(i32 %siA, i32 %siB, i32 %siC, i1 true)
|
||||
|
||||
// CHECK: call i32 @llvm.amdgcn.udot4(i32 %uiA, i32 %uiB, i32 %uiC, i1 false)
|
||||
// CHECK: call i32 @llvm.amdgcn.udot4(i32 %uiA, i32 %uiB, i32 %uiC, i1 true)
|
||||
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot8(i32 %siA, i32 %siB, i32 %siC, i1 false)
|
||||
// CHECK: call i32 @llvm.amdgcn.sdot8(i32 %siA, i32 %siB, i32 %siC, i1 true)
|
||||
|
||||
// CHECK: call i32 @llvm.amdgcn.udot8(i32 %uiA, i32 %uiB, i32 %uiC, i1 false)
|
||||
// CHECK: call i32 @llvm.amdgcn.udot8(i32 %uiA, i32 %uiB, i32 %uiC, i1 true)
|
||||
kernel void builtins_amdgcn_dl_insts(
|
||||
global float *fOut, global int *siOut, global uint *uiOut,
|
||||
half2 v2hA, half2 v2hB, float fC,
|
||||
short2 v2ssA, short2 v2ssB, int siA, int siB, int siC,
|
||||
ushort2 v2usA, ushort2 v2usB, uint uiA, uint uiB, uint uiC) {
|
||||
fOut[0] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC);
|
||||
fOut[0] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC, false);
|
||||
fOut[1] = __builtin_amdgcn_fdot2(v2hA, v2hB, fC, true);
|
||||
|
||||
siOut[0] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC);
|
||||
uiOut[0] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC);
|
||||
siOut[0] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC, false);
|
||||
siOut[1] = __builtin_amdgcn_sdot2(v2ssA, v2ssB, siC, true);
|
||||
|
||||
siOut[1] = __builtin_amdgcn_sdot4(siA, siB, siC);
|
||||
uiOut[1] = __builtin_amdgcn_udot4(uiA, uiB, uiC);
|
||||
uiOut[0] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC, false);
|
||||
uiOut[1] = __builtin_amdgcn_udot2(v2usA, v2usB, uiC, true);
|
||||
|
||||
siOut[2] = __builtin_amdgcn_sdot8(siA, siB, siC);
|
||||
uiOut[2] = __builtin_amdgcn_udot8(uiA, uiB, uiC);
|
||||
siOut[2] = __builtin_amdgcn_sdot4(siA, siB, siC, false);
|
||||
siOut[3] = __builtin_amdgcn_sdot4(siA, siB, siC, true);
|
||||
|
||||
uiOut[2] = __builtin_amdgcn_udot4(uiA, uiB, uiC, false);
|
||||
uiOut[3] = __builtin_amdgcn_udot4(uiA, uiB, uiC, true);
|
||||
|
||||
siOut[4] = __builtin_amdgcn_sdot8(siA, siB, siC, false);
|
||||
siOut[5] = __builtin_amdgcn_sdot8(siA, siB, siC, true);
|
||||
|
||||
uiOut[4] = __builtin_amdgcn_udot8(uiA, uiB, uiC, false);
|
||||
uiOut[5] = __builtin_amdgcn_udot8(uiA, uiB, uiC, true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue