Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit be408a8

Browse files
authored
[SYCL][ESIMD]Add tests for lsc_block_load supporting 8/16 bit data (#1249)
* Add tests for lsc_block_load supporting 8/16 bit data
1 parent 42cd6d3 commit be408a8

File tree

8 files changed

+140
-8
lines changed

8 files changed

+140
-8
lines changed

SYCL/ESIMD/lsc/Inputs/lsc_surf_load.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ bool test(uint32_t pmask = 0xffffffff) {
3030
}
3131

3232
static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW");
33-
static_assert(sizeof(T) >= 4,
34-
"D8 and D16 are valid only in 2D block load/store");
3533

3634
if constexpr (!transpose && VS > 1) {
3735
static_assert(VL == 16 || VL == 32,

SYCL/ESIMD/lsc/Inputs/lsc_surf_store.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ bool test(uint32_t pmask = 0xffffffff) {
2929
}
3030

3131
static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW");
32-
static_assert(sizeof(T) >= 4,
33-
"D8 and D16 are valid only in 2D block load/store");
3432

3533
if constexpr (!transpose && VS > 1) {
3634
static_assert(VL == 16 || VL == 32,

SYCL/ESIMD/lsc/Inputs/lsc_usm_load.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ bool test(uint32_t pmask = 0xffffffff) {
3030
}
3131

3232
static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW");
33-
static_assert(sizeof(T) >= 4,
34-
"D8 and D16 are valid only in 2D block load/store");
3533

3634
if constexpr (!transpose && VS > 1) {
3735
static_assert(VL == 16 || VL == 32,

SYCL/ESIMD/lsc/Inputs/lsc_usm_store.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ bool test(uint32_t pmask = 0xffffffff) {
2929
}
3030

3131
static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW");
32-
static_assert(sizeof(T) >= 4,
33-
"D8 and D16 are valid only in 2D block load/store");
3432

3533
if constexpr (!transpose && VS > 1) {
3634
static_assert(VL == 16 || VL == 32,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//==------- lsc_surf_load_u8_u16.cpp - DPC++ ESIMD on-device test ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// REQUIRES: gpu-intel-pvc || esimd_emulator
9+
// UNSUPPORTED: cuda || hip
10+
// RUN: %clangxx -fsycl %s -o %t.out
11+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
12+
13+
#include "Inputs/lsc_surf_load.hpp"
14+
15+
constexpr uint32_t seed = 199;
16+
17+
template <int TestCastNum, typename T> bool tests() {
18+
bool passed = true;
19+
passed &= test<TestCastNum, T, 1, 4, 1, 32, true>();
20+
passed &= test<TestCastNum + 1, T, 2, 2, 1, 16, true>();
21+
passed &= test<TestCastNum + 2, T, 4, 4, 1, 4, true>();
22+
23+
return passed;
24+
}
25+
26+
int main(void) {
27+
srand(seed);
28+
bool passed = true;
29+
30+
passed &= tests<0, uint8_t>();
31+
passed &= tests<3, uint16_t>();
32+
33+
std::cout << (passed ? "Passed\n" : "FAILED\n");
34+
return passed ? 0 : 1;
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//==------- lsc_surf_store_u8_u16.cpp - DPC++ ESIMD on-device test ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// REQUIRES: gpu-intel-pvc || esimd_emulator
9+
// UNSUPPORTED: cuda || hip
10+
// RUN: %clangxx -fsycl %s -o %t.out
11+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
12+
13+
#include "Inputs/lsc_surf_store.hpp"
14+
15+
constexpr uint32_t seed = 199;
16+
17+
template <int TestCastNum, typename T> bool tests() {
18+
bool passed = true;
19+
passed &= test<TestCastNum, T, 1, 4, 1, 32, true>();
20+
passed &= test<TestCastNum + 1, T, 2, 2, 1, 16, true>();
21+
passed &= test<TestCastNum + 2, T, 4, 4, 1, 4, true>();
22+
23+
return passed;
24+
}
25+
26+
int main(void) {
27+
srand(seed);
28+
bool passed = true;
29+
30+
passed &= tests<0, uint8_t>();
31+
passed &= tests<3, uint16_t>();
32+
33+
std::cout << (passed ? "Passed\n" : "FAILED\n");
34+
return passed ? 0 : 1;
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//==------- lsc_usm_load_u8_u16.cpp - DPC++ ESIMD on-device test ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// REQUIRES: gpu-intel-pvc || esimd_emulator
9+
// UNSUPPORTED: cuda || hip
10+
// RUN: %clangxx -fsycl %s -o %t.out
11+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
12+
13+
#include "Inputs/lsc_usm_load.hpp"
14+
15+
constexpr uint32_t seed = 199;
16+
17+
template <int TestCastNum, typename T> bool tests() {
18+
bool passed = true;
19+
passed &= test<TestCastNum, T, 1, 4, 1, 32, true>();
20+
passed &= test<TestCastNum + 1, T, 2, 2, 1, 16, true>();
21+
passed &= test<TestCastNum + 2, T, 4, 4, 1, 4, true>();
22+
23+
return passed;
24+
}
25+
26+
int main(void) {
27+
srand(seed);
28+
bool passed = true;
29+
30+
passed &= tests<0, uint8_t>();
31+
passed &= tests<3, uint16_t>();
32+
33+
std::cout << (passed ? "Passed\n" : "FAILED\n");
34+
return passed ? 0 : 1;
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//==------- lsc_usm_store_u8_u16.cpp - DPC++ ESIMD on-device test ---------==//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
// REQUIRES: gpu-intel-pvc || esimd_emulator
9+
// UNSUPPORTED: cuda || hip
10+
// RUN: %clangxx -fsycl %s -o %t.out
11+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
12+
13+
#include "Inputs/lsc_usm_store.hpp"
14+
15+
constexpr uint32_t seed = 199;
16+
17+
template <int TestCastNum, typename T> bool tests() {
18+
bool passed = true;
19+
passed &= test<TestCastNum, T, 1, 4, 1, 32, true>();
20+
passed &= test<TestCastNum + 1, T, 2, 2, 1, 16, true>();
21+
passed &= test<TestCastNum + 2, T, 4, 4, 1, 4, true>();
22+
23+
return passed;
24+
}
25+
26+
int main(void) {
27+
srand(seed);
28+
bool passed = true;
29+
30+
passed &= tests<0, uint8_t>();
31+
passed &= tests<3, uint16_t>();
32+
33+
std::cout << (passed ? "Passed\n" : "FAILED\n");
34+
return passed ? 0 : 1;
35+
}

0 commit comments

Comments
 (0)