From 38a1434afe754199299664ca1b67f60abb83df52 Mon Sep 17 00:00:00 2001 From: gregory Date: Fri, 9 Sep 2022 16:39:46 -0700 Subject: [PATCH 1/2] Add tests for lsc_block_load supporting 8/16 bit data --- SYCL/ESIMD/lsc/Inputs/lsc_surf_load.hpp | 2 -- SYCL/ESIMD/lsc/Inputs/lsc_surf_store.hpp | 2 -- SYCL/ESIMD/lsc/Inputs/lsc_usm_load.hpp | 2 -- SYCL/ESIMD/lsc/Inputs/lsc_usm_store.hpp | 2 -- SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp | 37 ++++++++++++++++++++++++ SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp | 37 ++++++++++++++++++++++++ SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp | 37 ++++++++++++++++++++++++ SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp | 37 ++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp create mode 100644 SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp create mode 100644 SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp create mode 100644 SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp diff --git a/SYCL/ESIMD/lsc/Inputs/lsc_surf_load.hpp b/SYCL/ESIMD/lsc/Inputs/lsc_surf_load.hpp index e1454ec6bc..523b04e05b 100644 --- a/SYCL/ESIMD/lsc/Inputs/lsc_surf_load.hpp +++ b/SYCL/ESIMD/lsc/Inputs/lsc_surf_load.hpp @@ -30,8 +30,6 @@ bool test(uint32_t pmask = 0xffffffff) { } static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW"); - static_assert(sizeof(T) >= 4, - "D8 and D16 are valid only in 2D block load/store"); if constexpr (!transpose && VS > 1) { static_assert(VL == 16 || VL == 32, diff --git a/SYCL/ESIMD/lsc/Inputs/lsc_surf_store.hpp b/SYCL/ESIMD/lsc/Inputs/lsc_surf_store.hpp index 142a42235a..8def84e688 100644 --- a/SYCL/ESIMD/lsc/Inputs/lsc_surf_store.hpp +++ b/SYCL/ESIMD/lsc/Inputs/lsc_surf_store.hpp @@ -29,8 +29,6 @@ bool test(uint32_t pmask = 0xffffffff) { } static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW"); - static_assert(sizeof(T) >= 4, - "D8 and D16 are valid only in 2D block load/store"); if constexpr (!transpose && VS > 1) { static_assert(VL == 16 || VL == 32, diff --git a/SYCL/ESIMD/lsc/Inputs/lsc_usm_load.hpp b/SYCL/ESIMD/lsc/Inputs/lsc_usm_load.hpp index b7896c5314..e9170fa6fe 100644 --- a/SYCL/ESIMD/lsc/Inputs/lsc_usm_load.hpp +++ b/SYCL/ESIMD/lsc/Inputs/lsc_usm_load.hpp @@ -30,8 +30,6 @@ bool test(uint32_t pmask = 0xffffffff) { } static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW"); - static_assert(sizeof(T) >= 4, - "D8 and D16 are valid only in 2D block load/store"); if constexpr (!transpose && VS > 1) { static_assert(VL == 16 || VL == 32, diff --git a/SYCL/ESIMD/lsc/Inputs/lsc_usm_store.hpp b/SYCL/ESIMD/lsc/Inputs/lsc_usm_store.hpp index 181bfe27a9..5be20237c9 100644 --- a/SYCL/ESIMD/lsc/Inputs/lsc_usm_store.hpp +++ b/SYCL/ESIMD/lsc/Inputs/lsc_usm_store.hpp @@ -29,8 +29,6 @@ bool test(uint32_t pmask = 0xffffffff) { } static_assert(DS != lsc_data_size::u16u32h, "D16U32h not supported in HW"); - static_assert(sizeof(T) >= 4, - "D8 and D16 are valid only in 2D block load/store"); if constexpr (!transpose && VS > 1) { static_assert(VL == 16 || VL == 32, diff --git a/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp new file mode 100644 index 0000000000..2eeb035b5d --- /dev/null +++ b/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp @@ -0,0 +1,37 @@ +//==------- lsc_surf_load_u8_u16.cpp - DPC++ ESIMD on-device test ---------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// REQUIRES: gpu-intel-pvc || esimd_emulator +// UNSUPPORTED: cuda || hip +// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %GPU_RUN_PLACEHOLDER %t.out + +#include "Inputs/lsc_surf_load.hpp" + +constexpr uint32_t seed = 199; + +template bool tests() { + bool passed = true; + passed &= test(); + passed &= test(); + passed &= test(); + + return passed; +} + +int main(void) { + srand(seed); + bool passed = true; + + passed &= tests<0, uint8_t>(); + passed &= tests<3, uint16_t>(); + passed &= tests<6, uint32_t>(); + passed &= tests<12, uint64_t>(); + + std::cout << (passed ? "Passed\n" : "FAILED\n"); + return passed ? 0 : 1; +} diff --git a/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp new file mode 100644 index 0000000000..c1660f0d7c --- /dev/null +++ b/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp @@ -0,0 +1,37 @@ +//==------- lsc_surf_store_u8_u16.cpp - DPC++ ESIMD on-device test ---------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// REQUIRES: gpu-intel-pvc || esimd_emulator +// UNSUPPORTED: cuda || hip +// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %GPU_RUN_PLACEHOLDER %t.out + +#include "Inputs/lsc_surf_store.hpp" + +constexpr uint32_t seed = 199; + +template bool tests() { + bool passed = true; + passed &= test(); + passed &= test(); + passed &= test(); + + return passed; +} + +int main(void) { + srand(seed); + bool passed = true; + + passed &= tests<0, uint8_t>(); + passed &= tests<3, uint16_t>(); + passed &= tests<6, uint32_t>(); + passed &= tests<12, uint64_t>(); + + std::cout << (passed ? "Passed\n" : "FAILED\n"); + return passed ? 0 : 1; +} diff --git a/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp new file mode 100644 index 0000000000..14b6971fd9 --- /dev/null +++ b/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp @@ -0,0 +1,37 @@ +//==------- lsc_usm_load_u8_u16.cpp - DPC++ ESIMD on-device test ---------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// REQUIRES: gpu-intel-pvc || esimd_emulator +// UNSUPPORTED: cuda || hip +// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %GPU_RUN_PLACEHOLDER %t.out + +#include "Inputs/lsc_usm_load.hpp" + +constexpr uint32_t seed = 199; + +template bool tests() { + bool passed = true; + passed &= test(); + passed &= test(); + passed &= test(); + + return passed; +} + +int main(void) { + srand(seed); + bool passed = true; + + passed &= tests<0, uint8_t>(); + passed &= tests<3, uint16_t>(); + passed &= tests<6, uint32_t>(); + passed &= tests<12, uint64_t>(); + + std::cout << (passed ? "Passed\n" : "FAILED\n"); + return passed ? 0 : 1; +} diff --git a/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp new file mode 100644 index 0000000000..92a7267b7f --- /dev/null +++ b/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp @@ -0,0 +1,37 @@ +//==------- lsc_usm_store_u8_u16.cpp - DPC++ ESIMD on-device test ---------==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// REQUIRES: gpu-intel-pvc || esimd_emulator +// UNSUPPORTED: cuda || hip +// RUN: %clangxx -fsycl %s -o %t.out +// RUN: %GPU_RUN_PLACEHOLDER %t.out + +#include "Inputs/lsc_usm_store.hpp" + +constexpr uint32_t seed = 199; + +template bool tests() { + bool passed = true; + passed &= test(); + passed &= test(); + passed &= test(); + + return passed; +} + +int main(void) { + srand(seed); + bool passed = true; + + passed &= tests<0, uint8_t>(); + passed &= tests<3, uint16_t>(); + passed &= tests<6, uint32_t>(); + passed &= tests<12, uint64_t>(); + + std::cout << (passed ? "Passed\n" : "FAILED\n"); + return passed ? 0 : 1; +} From fb98f0e28913a1430f96e5720721d53e35d77b18 Mon Sep 17 00:00:00 2001 From: fineg74 <61437305+fineg74@users.noreply.github.com> Date: Tue, 27 Sep 2022 10:32:19 -0700 Subject: [PATCH 2/2] Remove duplicate tests --- SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp | 2 -- SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp | 2 -- SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp | 2 -- SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp | 2 -- 4 files changed, 8 deletions(-) diff --git a/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp index 2eeb035b5d..767a1648e2 100644 --- a/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp +++ b/SYCL/ESIMD/lsc/lsc_surf_load_u8_u16.cpp @@ -29,8 +29,6 @@ int main(void) { passed &= tests<0, uint8_t>(); passed &= tests<3, uint16_t>(); - passed &= tests<6, uint32_t>(); - passed &= tests<12, uint64_t>(); std::cout << (passed ? "Passed\n" : "FAILED\n"); return passed ? 0 : 1; diff --git a/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp index c1660f0d7c..74d66bd3da 100644 --- a/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp +++ b/SYCL/ESIMD/lsc/lsc_surf_store_u8_u16.cpp @@ -29,8 +29,6 @@ int main(void) { passed &= tests<0, uint8_t>(); passed &= tests<3, uint16_t>(); - passed &= tests<6, uint32_t>(); - passed &= tests<12, uint64_t>(); std::cout << (passed ? "Passed\n" : "FAILED\n"); return passed ? 0 : 1; diff --git a/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp index 14b6971fd9..112e6f28eb 100644 --- a/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp +++ b/SYCL/ESIMD/lsc/lsc_usm_load_u8_u16.cpp @@ -29,8 +29,6 @@ int main(void) { passed &= tests<0, uint8_t>(); passed &= tests<3, uint16_t>(); - passed &= tests<6, uint32_t>(); - passed &= tests<12, uint64_t>(); std::cout << (passed ? "Passed\n" : "FAILED\n"); return passed ? 0 : 1; diff --git a/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp b/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp index 92a7267b7f..5cfc841c11 100644 --- a/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp +++ b/SYCL/ESIMD/lsc/lsc_usm_store_u8_u16.cpp @@ -29,8 +29,6 @@ int main(void) { passed &= tests<0, uint8_t>(); passed &= tests<3, uint16_t>(); - passed &= tests<6, uint32_t>(); - passed &= tests<12, uint64_t>(); std::cout << (passed ? "Passed\n" : "FAILED\n"); return passed ? 0 : 1;