Skip to content

Commit a55b0b8

Browse files
authored
[SYCL][ESIMD] Move/Refactor ESIMD device code checks not in check_device_code (#14218)
In the same vein as #14174, this PR: - Moves ESIMD device code checks that are not in the `check_device_code` folder into the `check_device_code/esimd` folder - Removed host code from tests that check only for device code using `SYCL_EXTERNAL` functions (as per #14173) ESIMD folks, I recognize this shuffles a large number of tests around: Please let me know if there's anything problematic about this change, and I will do my best to remedy the situation should it arise. Thanks in advance!
1 parent 2521c03 commit a55b0b8

28 files changed

+86
-105
lines changed
File renamed without changes.

sycl/test/esimd/dpas.cpp renamed to sycl/test/check_device_code/esimd/dpas.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void xmx_func() {
5656
// CHECK-LABEL: define dso_local spir_func void @_Z8xmx_funcv()
5757

5858
{ // ======= DPAS BF16 =======================================================
59-
simd<bfloat16, M_one *N_pvc> R_bf = 0;
60-
simd<float, M_one *N_pvc> R_f = 0;
59+
simd<bfloat16, M_one * N_pvc> R_bf = 0;
60+
simd<float, M_one * N_pvc> R_f = 0;
6161

62-
simd<bfloat16, M_one *N_pvc> C_bf = 0;
63-
simd<float, M_one *N_pvc> C_f = 0;
62+
simd<bfloat16, M_one * N_pvc> C_bf = 0;
63+
simd<float, M_one * N_pvc> C_f = 0;
6464

65-
simd<bfloat16, K_bf16 *N_pvc> B_bf = 0;
66-
simd<bfloat16, M_one *K_bf16> A_bf = 0;
65+
simd<bfloat16, K_bf16 * N_pvc> B_bf = 0;
66+
simd<bfloat16, M_one * K_bf16> A_bf = 0;
6767

6868
R_f = xmx::dpas<8, 1, float>(C_f, B_bf, A_bf);
6969
zoo(R_f);
@@ -91,14 +91,14 @@ SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void xmx_func() {
9191
}
9292

9393
{ // ======= DPAS FP16 =======================================================
94-
simd<half, M_one *N_pvc> R_hf = 0;
95-
simd<float, M_one *N_pvc> R_f = 0;
94+
simd<half, M_one * N_pvc> R_hf = 0;
95+
simd<float, M_one * N_pvc> R_f = 0;
9696

97-
simd<half, M_one *N_pvc> C_hf = 0;
98-
simd<float, M_one *N_pvc> C_f = 0;
97+
simd<half, M_one * N_pvc> C_hf = 0;
98+
simd<float, M_one * N_pvc> C_f = 0;
9999

100-
simd<half, K_half *N_pvc> B_hf = 0;
101-
simd<half, M_one *K_half> A_hf = 0;
100+
simd<half, K_half * N_pvc> B_hf = 0;
101+
simd<half, M_one * K_half> A_hf = 0;
102102

103103
// ------------------- FP16: WITH ACC OPERAND -----------------------
104104
R_f = xmx::dpas<8, 1, float>(C_f, B_hf, A_hf);
@@ -128,10 +128,10 @@ SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void xmx_func() {
128128
}
129129

130130
{ // ======= DPAS 8-BIT x 2-BIT INT ==========================================
131-
simd<int, M_one *N_pvc> R_d = 0;
132-
simd<int, M_one *N_pvc> C_d = 0;
133-
simd<int, K_int8x2 *N_pvc / 16> B_int2 = 0; // 16 2-bit integers per int32
134-
simd<signed char, M_one *K_int8x2> A_int8 = 0;
131+
simd<int, M_one * N_pvc> R_d = 0;
132+
simd<int, M_one * N_pvc> C_d = 0;
133+
simd<int, K_int8x2 * N_pvc / 16> B_int2 = 0; // 16 2-bit integers per int32
134+
simd<signed char, M_one * K_int8x2> A_int8 = 0;
135135

136136
// ------------ DPAS s8 x s2: WITH THE ACCUMULATOR OPERAND -----------------
137137
R_d = xmx::dpas<8, 1, int, int, int, signed char, s2, s8>(C_d, B_int2,
@@ -146,11 +146,11 @@ SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void xmx_func() {
146146
}
147147

148148
{ // ======= DPASW BF16 ======================================================
149-
simd<float, M_one *N_dg2> R_f = 0;
150-
simd<float, M_one *N_dg2> C_f = 0;
149+
simd<float, M_one * N_dg2> R_f = 0;
150+
simd<float, M_one * N_dg2> C_f = 0;
151151

152-
simd<bfloat16, K_bf16 *N_dg2> B_bf = 0;
153-
simd<bfloat16, M_one *K_bf16 / 2> A_bf = 0;
152+
simd<bfloat16, K_bf16 * N_dg2> B_bf = 0;
153+
simd<bfloat16, M_one * K_bf16 / 2> A_bf = 0;
154154

155155
// ------------ DPASW BF16: WITH THE ACCUMULATOR OPERAND -------------------
156156
R_f = xmx::dpasw<8, 1, float>(C_f, B_bf, A_bf);
@@ -164,8 +164,8 @@ SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void xmx_func() {
164164
}
165165

166166
{ // ======= DPASW FP16 ======================================================
167-
simd<float, M_one *N_dg2> R_f = 0;
168-
simd<float, M_one *N_dg2> C_f = 0;
167+
simd<float, M_one * N_dg2> R_f = 0;
168+
simd<float, M_one * N_dg2> C_f = 0;
169169

170170
simd<half, K_half * N_dg2> B_hf = 0;
171171
simd<half, M_one * K_half / 2> A_hf = 0;
@@ -182,12 +182,12 @@ SYCL_ESIMD_FUNCTION SYCL_EXTERNAL void xmx_func() {
182182
}
183183

184184
{ // ======= DPAS TFLOAT32 ===================================================
185-
simd<float, M_one *N_pvc> R_f = 0;
186-
simd<float, M_one *N_pvc> C_f = 0;
185+
simd<float, M_one * N_pvc> R_f = 0;
186+
simd<float, M_one * N_pvc> C_f = 0;
187187

188-
simd<sycl::ext::intel::experimental::esimd::tfloat32, K_tf32 *N_pvc> B_tf =
188+
simd<sycl::ext::intel::experimental::esimd::tfloat32, K_tf32 * N_pvc> B_tf =
189189
0;
190-
simd<sycl::ext::intel::experimental::esimd::tfloat32, M_one *K_tf32> A_tf =
190+
simd<sycl::ext::intel::experimental::esimd::tfloat32, M_one * K_tf32> A_tf =
191191
0;
192192

193193
// ------------------- TFLOAT32: WITH ACC OPERAND --------------------------
File renamed without changes.

sycl/test/esimd/lane_id.cpp renamed to sycl/test/check_device_code/esimd/lane_id.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ using namespace sycl::ext::intel::esimd;
1212
// Wrapper for designating a scalar region of code that will be
1313
// vectorized by the backend compiler.
1414
#define SIMT_BEGIN(N, lane) \
15-
[&]() SYCL_ESIMD_FUNCTION ESIMD_NOINLINE \
16-
[[intel::sycl_esimd_vectorize(N)]] { \
15+
[&]() SYCL_ESIMD_FUNCTION ESIMD_NOINLINE [[intel::sycl_esimd_vectorize(N)]] { \
1716
int lane = __esimd_lane_id();
1817
#define SIMT_END \
1918
} \
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import platform
2+
3+
config.substitutions.append(("%clang_O0", "-O0 -mllvm -esimd-allow-optnone-noinline"))
File renamed without changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %clangxx -fsycl -c -fsycl-device-only -Xclang -emit-llvm %s -o - 2>&1 | FileCheck %s
2+
3+
#include <sycl/ext/intel/esimd.hpp>
4+
#include <sycl/sycl.hpp>
5+
6+
using namespace sycl::ext::intel::esimd;
7+
using namespace sycl::ext::intel::experimental::esimd;
8+
9+
SYCL_ESIMD_KERNEL SYCL_EXTERNAL void kernel_esimd() {
10+
__ESIMD_NS::named_barrier_init<7>();
11+
__ESIMD_NS::named_barrier_wait(2);
12+
// CHECK: call spir_func void @_Z13__esimd_fenceh(i8 noundef zeroext 33)
13+
// CHECK-NEXT: call spir_func void @_Z23__esimd_nbarrier_arrive{{.*}}
14+
__ESIMD_NS::named_barrier_signal(0, 0, 4, 4);
15+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// RUN: %clangxx -fsycl -fsycl-device-only -S -emit-llvm -x c++ %s -o %t
2+
// RUN: sycl-post-link -split-esimd -lower-esimd -O0 -S %t -o %t.table
3+
// RUN: FileCheck %s -input-file=%t_esimd_0.ll
4+
5+
// This test checks that all LLVM-IR instructions that work with SPIR-V builtins
6+
// are correctly translated into GenX counterparts (implemented in
7+
// LowerESIMD.cpp)
8+
9+
#include <sycl/ext/intel/esimd.hpp>
10+
#include <sycl/sycl.hpp>
11+
12+
SYCL_ESIMD_KERNEL SYCL_EXTERNAL void
13+
kernel_SubgroupLocalInvocationId(size_t *DoNotOptimize,
14+
uint32_t *DoNotOptimize32) {
15+
DoNotOptimize[0] = __spirv_SubgroupLocalInvocationId();
16+
DoNotOptimize32[0] = __spirv_SubgroupLocalInvocationId() + 3;
17+
// CHECK-LABEL: @{{.*}}kernel_SubgroupLocalInvocationId
18+
// CHECK: [[ZEXT0:%.*]] = zext i32 0 to i64
19+
// CHECK: store i64 [[ZEXT0]]
20+
// CHECK: add i32 0, 3
21+
}
22+
23+
SYCL_ESIMD_KERNEL SYCL_EXTERNAL void
24+
kernel_SubgroupSize(size_t *DoNotOptimize, uint32_t *DoNotOptimize32) {
25+
DoNotOptimize[0] = __spirv_SubgroupSize();
26+
DoNotOptimize32[0] = __spirv_SubgroupSize() + 7;
27+
// CHECK-LABEL: @{{.*}}kernel_SubgroupSize
28+
// CHECK: [[ZEXT0:%.*]] = zext i32 1 to i64
29+
// CHECK: store i64 [[ZEXT0]]
30+
// CHECK: add i32 1, 7
31+
}
32+
33+
SYCL_ESIMD_KERNEL SYCL_EXTERNAL void
34+
kernel_SubgroupMaxSize(size_t *DoNotOptimize, uint32_t *DoNotOptimize32) {
35+
DoNotOptimize[0] = __spirv_SubgroupMaxSize();
36+
DoNotOptimize32[0] = __spirv_SubgroupMaxSize() + 9;
37+
// CHECK-LABEL: @{{.*}}kernel_SubgroupMaxSize
38+
// CHECK: [[ZEXT0:%.*]] = zext i32 1 to i64
39+
// CHECK: store i64 [[ZEXT0]]
40+
// CHECK: add i32 1, 9
41+
}
File renamed without changes.

sycl/test/esimd/nbarriers.cpp

Lines changed: 0 additions & 22 deletions
This file was deleted.

sycl/test/esimd/spirv_intrins_trans.cpp

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)