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

[SYCL][ESIMD] noinline functions tests #143

Merged
merged 34 commits into from
Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5d55ee2
ESIMD: add TPM tests
fveselov Dec 3, 2020
bb7498d
[SYCL][ESIMD] TPM tests stylecheck fix
fveselov Dec 3, 2020
59999ef
[SYCL][ESIMD] clang-format patch
fveselov Dec 4, 2020
68ee5ad
[SYCL][ESIMD] typo fix
fveselov Dec 8, 2020
7408568
[SYCL][ESIMD] improve TPM tests self-check
fveselov Dec 8, 2020
6c817ee
[SYCL][ESIMD] add description to TPM tests; cosmetic changes
fveselov Dec 16, 2020
8823c79
[SYCL][ESIMD] merged tests to one with 3 cases
fveselov Dec 17, 2020
f62acbc
clang-format patch
fveselov Dec 17, 2020
ad93c1a
cosmetic changes
fveselov Dec 17, 2020
51319c8
Update SYCL/ESIMD/tpm_tests.cpp
fveselov Dec 18, 2020
b14db07
reworked and renamed
fveselov Dec 18, 2020
9fe0151
clang-format patch
fveselov Dec 18, 2020
f019b28
[SYCL][ESIMD] evaluate condition on compile-time
fveselov Jan 12, 2021
d958a91
clang-format patch
fveselov Jan 12, 2021
3461c8a
Merge branch 'intel' into intel
vladimirlaz Jan 19, 2021
cdf0566
initial commit of ESIMD function pointer tests
fveselov Feb 8, 2021
0b58b9c
Merge branch 'intel' into func_pointer_tests
fveselov Feb 8, 2021
fb11440
clang-format patch
fveselov Feb 9, 2021
d176d94
remove some tests
fveselov Feb 9, 2021
fb1a807
handling synchronous SYCL exceptions
fveselov Feb 9, 2021
0c9aad6
minor fixes
fveselov Feb 9, 2021
43b80bd
cosmetic change
fveselov Feb 9, 2021
32be755
handle general exception
fveselov Feb 10, 2021
e978829
revert
fveselov Feb 10, 2021
96d3121
cosmetic fixes
fveselov Feb 10, 2021
117ae42
revert
fveselov Feb 11, 2021
ded60bd
improve fail message
fveselov Feb 12, 2021
b4ce67d
noinline function tests initial commit
fveselov Feb 12, 2021
9933741
clang-format patch
fveselov Feb 12, 2021
19079ad
clang-format patch 2
fveselov Feb 12, 2021
01b5703
remove erroneously added tests
fveselov Feb 12, 2021
54ff602
fix args size tests
fveselov Feb 12, 2021
4c5b252
rename and set UNSUPPORTED status
fveselov Feb 15, 2021
190a4b6
typo fix
fveselov Feb 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions SYCL/ESIMD/noinline_args_size/Inputs/noinline_args_size_common.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//===------ noinline_args_size_common.hpp - 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
//
//===----------------------------------------------------------------------===//
//
// The test checks that ESIMD kernels support call of noinline function from
// main function with different total arguments size and retval size. Cases:
// Total arguments size < %arg register size (32 GRFs)
// Total arguments size == %arg register size
// Total arguments size > %arg register size (i.e. stack mem is required)
// Return value size < %retval register size (12 GRFs)
// Return value size == %retval register size
// Return value size > %retval register size

#include "esimd_test_utils.hpp"

#include <CL/sycl.hpp>
#include <CL/sycl/INTEL/esimd.hpp>
#include <iostream>

static_assert(SIZE >= VL, "Size must greater than or equal to VL");
static_assert(SIZE % VL == 0, "Size must be multiple of VL");
constexpr unsigned ROWS = SIZE / VL;

using namespace cl::sycl;

class KernelID;

template <typename TA, typename TB, typename TC>
ESIMD_NOINLINE TC add(TA A, TB B) {
return (TC)A + (TC)B;
}

int main(void) {
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());

auto dev = q.get_device();
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
auto ctx = q.get_context();

a_data_t *A = static_cast<a_data_t *>(
sycl::malloc_shared(SIZE * sizeof(a_data_t), dev, ctx));
for (int i = 0; i < SIZE; i++)
A[i] = (a_data_t)1;

b_data_t *B = static_cast<b_data_t *>(
sycl::malloc_shared(SIZE * sizeof(b_data_t), dev, ctx));
for (int i = 0; i < SIZE; i++)
B[i] = (b_data_t)i;

c_data_t *C = static_cast<c_data_t *>(
sycl::malloc_shared(SIZE * sizeof(c_data_t), dev, ctx));
memset(C, 0, SIZE * sizeof(c_data_t));

try {
auto qq = q.submit([&](handler &cgh) {
cgh.parallel_for<KernelID>(
sycl::range<1>{1}, [=](id<1> i) SYCL_ESIMD_KERNEL {
using namespace sycl::INTEL::gpu;

simd<a_data_t, SIZE> va(0);
simd<b_data_t, SIZE> vb(0);
for (int j = 0; j < ROWS; j++) {
va.select<VL, 1>(j * VL) = block_load<a_data_t, VL>(A + j * VL);
vb.select<VL, 1>(j * VL) = block_load<b_data_t, VL>(B + j * VL);
}

auto vc = add<simd<a_data_t, SIZE>, simd<b_data_t, SIZE>,
simd<c_data_t, SIZE>>(va, vb);

for (int j = 0; j < ROWS; j++)
block_store<c_data_t, VL>(C + j * VL, vc.select<VL, 1>(j * VL));
});
});

qq.wait();
} catch (cl::sycl::exception const &e) {
std::cout << "SYCL exception caught: " << e.what() << std::endl;
sycl::free(A, ctx);
sycl::free(B, ctx);
sycl::free(C, ctx);
return e.get_cl_code();
}

unsigned err_cnt = 0;
for (int i = 0; i < SIZE; i++)
if (C[i] != A[i] + B[i])
err_cnt++;

sycl::free(A, ctx);
sycl::free(B, ctx);
sycl::free(C, ctx);

if (err_cnt > 0) {
std::cout << "FAILED" << std::endl;
return 1;
}

std::cout << "passed" << std::endl;
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- noinline_args_char_int_size_192.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 192;

using a_data_t = int8_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- noinline_args_char_int_size_256.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 256;

using a_data_t = int8_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- noinline_args_char_int_size_512.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 512;

using a_data_t = int8_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===--- noinline_args_char_int_size_64.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 64;

using a_data_t = int8_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===--- noinline_args_char_int_size_96.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 96;

using a_data_t = int8_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
22 changes: 22 additions & 0 deletions SYCL/ESIMD/noinline_args_size/noinline_args_int_size_192.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- noinline_args_char_int_size_192.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 192;

using a_data_t = int32_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
22 changes: 22 additions & 0 deletions SYCL/ESIMD/noinline_args_size/noinline_args_int_size_256.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- noinline_args_char_int_size_256.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 256;

using a_data_t = int32_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
22 changes: 22 additions & 0 deletions SYCL/ESIMD/noinline_args_size/noinline_args_int_size_512.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- noinline_args_char_int_size_512.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 512;

using a_data_t = int32_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
22 changes: 22 additions & 0 deletions SYCL/ESIMD/noinline_args_size/noinline_args_int_size_64.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===--- noinline_args_char_int_size_64.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 64;

using a_data_t = int32_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
22 changes: 22 additions & 0 deletions SYCL/ESIMD/noinline_args_size/noinline_args_int_size_96.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===--- noinline_args_char_int_size_96.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
// UNSUPPORTED: cuda
// RUN: %clangxx-esimd -fsycl -I%S/.. %s -o %t.out
// RUN: env IGC_FunctionControl=3 IGC_ForceInlineStackCallWithImplArg=1 %GPU_RUN_PLACEHOLDER %t.out

#include <cstdint>

constexpr unsigned VL = 16;
constexpr unsigned SIZE = 96;

using a_data_t = int32_t;
using b_data_t = int32_t;
using c_data_t = int32_t;

#include "Inputs/noinline_args_size_common.hpp"
Loading