This repository was archived by the owner on Mar 28, 2023. It is now read-only.
forked from llvm/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL][ESIMD] Test for a fix of error when a scalar offset is provided as a parameter to the API #1534
Merged
Merged
[SYCL][ESIMD] Test for a fix of error when a scalar offset is provided as a parameter to the API #1534
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
933d364
Initial tests
fineg74 01a06c6
Merge remote-tracking branch 'origin/intel' into scalarOffsetTest
fineg74 4afc497
Add more tests
fineg74 bf3e3d6
Fix test failure
fineg74 7c1b5fb
fix test failure
fineg74 3f23b9e
Fix clang-format issue
fineg74 5dffe46
Fix clang-format issues
fineg74 fe3d503
Fix clang-format issue
fineg74 e35d2ea
Fix clang-format issue
fineg74 2ccacf8
Disable esimd_emulator for the test that fails on atomic xchg operation
fineg74 ce2420d
Disable specific store test on ESIMD emulator
fineg74 e318ab8
Merge remote-tracking branch 'origin/intel' into scalarOffsetTest
fineg74 91df7e8
Address PR comments
fineg74 6d6c983
Update tests
fineg74 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//==------ svm_gather_scatter_scalar_off.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 && !gpu-intel-pvc | ||
// UNSUPPORTED: cuda || hip | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
|
||
// Regression test for gather/scatter API. | ||
// scalar offset variant of the test - uses scalar offset. | ||
|
||
#define USE_SCALAR_OFFSET | ||
|
||
#include "svm_gather_scatter.cpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//==-- dword_atomic_cmpxchg_scalar_off.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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// This test checks LSC atomic operations. | ||
//===----------------------------------------------------------------------===// | ||
// REQUIRES: gpu | ||
// UNSUPPORTED: cuda || hip | ||
// TODO: esimd_emulator fails due to random timeouts (_XFAIL_: esimd_emulator) | ||
// UNSUPPORTED: esimd_emulator | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
|
||
// This macro enables only cmpxch tests. They may require more time to execute, | ||
// and have higher probablity to hit kernel execution time limit, so they are | ||
// separated. | ||
#define CMPXCHG_TEST | ||
|
||
// This macro enforces usage of dword atomics in the included test. | ||
#define USE_DWORD_ATOMICS | ||
// This macro enforces scalar offset variant of the test - uses scalar offsets. | ||
#define USE_SCALAR_OFFSET | ||
|
||
#include "lsc/atomic_smoke.cpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//==--- dword_atomic_smoke_scalar_off.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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// This test checks LSC atomic operations. | ||
//===----------------------------------------------------------------------===// | ||
// REQUIRES: gpu | ||
// TODO: esimd_emulator fails due to random timeouts (_XFAIL_: esimd_emulator) | ||
// UNSUPPORTED: esimd_emulator | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
// | ||
// scalar offset variant of the test - uses scalar offsets. | ||
|
||
#define USE_DWORD_ATOMICS | ||
#define USE_SCALAR_OFFSET | ||
|
||
#include "lsc/atomic_smoke.cpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//==---- atomic_cmpxchg_scalar_off.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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// This test checks LSC compare-and-exchange atomic operations. | ||
//===----------------------------------------------------------------------===// | ||
// REQUIRES: gpu-intel-pvc | ||
// TODO: esimd_emulator fails due to random timeouts (_XFAIL_: esimd_emulator) | ||
// UNSUPPORTED: esimd_emulator | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
|
||
// This macro enables only cmpxch tests. They may require more time to execute, | ||
// and have higher probablity to hit kernel execution time limit, so they are | ||
// separated. | ||
#define CMPXCHG_TEST | ||
// This macro enforces scalar offset variant of the test - uses scalar offsets. | ||
#define USE_SCALAR_OFFSET | ||
|
||
#include "atomic_smoke.cpp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||||
//===----------------------------------------------------------------------===// | ||||||
// REQUIRES: gpu-intel-pvc | ||||||
// TODO: esimd_emulator fails due to random timeouts (_XFAIL_: esimd_emulator) | ||||||
// TODO: esimd_emulator doesn't support xchg operation | ||||||
// UNSUPPORTED: esimd_emulator | ||||||
// RUN: %clangxx -fsycl %s -o %t.out | ||||||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||||||
|
@@ -216,8 +217,12 @@ bool test(queue q, const Config &cfg) { | |||||
cgh.parallel_for<TestID<T, N, ImplF>>( | ||||||
rng, [=](id<1> ii) SYCL_ESIMD_KERNEL { | ||||||
int i = ii; | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
simd<Toffset, N> offsets(cfg.start_ind * sizeof(T), | ||||||
cfg.stride * sizeof(T)); | ||||||
#else | ||||||
Toffset offsets = 0; | ||||||
#endif | ||||||
simd_mask<N> m = 1; | ||||||
m[cfg.masked_lane] = 0; | ||||||
// barrier to achieve better contention: | ||||||
|
@@ -318,8 +323,14 @@ template <class T, int N> struct ImplInc { | |||||
static T init(int i, const Config &cfg) { return (T)0; } | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) | ||||||
? (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups) | ||||||
#else | ||||||
T gold = | ||||||
i == 0 | ||||||
? (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups * (N - 1)) | ||||||
#endif | ||||||
: init(i, cfg); | ||||||
return gold; | ||||||
} | ||||||
|
@@ -331,11 +342,20 @@ template <class T, int N> struct ImplDec { | |||||
static constexpr int base = 5; | ||||||
|
||||||
static T init(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
return (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups + base); | ||||||
#else | ||||||
return (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups * (N - 1) + | ||||||
base); | ||||||
#endif | ||||||
} | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) ? (T)base : init(i, cfg); | ||||||
#else | ||||||
T gold = i == 0 ? (T)base : init(i, cfg); | ||||||
#endif | ||||||
return gold; | ||||||
} | ||||||
}; | ||||||
|
@@ -364,7 +384,11 @@ template <class T, int N> struct ImplStore { | |||||
static T init(int i, const Config &cfg) { return 0; } | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) ? base : init(i, cfg); | ||||||
#else | ||||||
T gold = i == 0 ? base : init(i, cfg); | ||||||
#endif | ||||||
return gold; | ||||||
} | ||||||
|
||||||
|
@@ -378,9 +402,15 @@ template <class T, int N, class C, C Op> struct ImplAdd { | |||||
static T init(int i, const Config &cfg) { return 0; } | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) ? (T)(cfg.repeat * cfg.threads_per_group * | ||||||
cfg.n_groups * (T)(1 + FPDELTA)) | ||||||
: init(i, cfg); | ||||||
#else | ||||||
T gold = i == 0 ? (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups * | ||||||
(N - 1) * (T)(1 + FPDELTA)) | ||||||
: init(i, cfg); | ||||||
#endif | ||||||
return gold; | ||||||
} | ||||||
|
||||||
|
@@ -393,13 +423,23 @@ template <class T, int N, class C, C Op> struct ImplSub { | |||||
static constexpr T base = (T)(5 + FPDELTA); | ||||||
|
||||||
static T init(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
return (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups * | ||||||
(T)(1 + FPDELTA) + | ||||||
base); | ||||||
#else | ||||||
return (T)(cfg.repeat * cfg.threads_per_group * cfg.n_groups * (N - 1) * | ||||||
(T)(1 + FPDELTA) + | ||||||
base); | ||||||
#endif | ||||||
} | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) ? base : init(i, cfg); | ||||||
#else | ||||||
T gold = i == 0 ? base : init(i, cfg); | ||||||
#endif | ||||||
return gold; | ||||||
} | ||||||
|
||||||
|
@@ -416,7 +456,11 @@ template <class T, int N, class C, C Op> struct ImplMin { | |||||
} | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) ? (T)MIN : init(i, cfg); | ||||||
#else | ||||||
T gold = i == 0 ? (T)MIN : init(i, cfg); | ||||||
#endif | ||||||
return gold; | ||||||
} | ||||||
|
||||||
|
@@ -431,7 +475,11 @@ template <class T, int N, class C, C Op> struct ImplMax { | |||||
static T init(int i, const Config &cfg) { return (T)FPDELTA; } | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) | ||||||
#else | ||||||
T gold = i == 0 | ||||||
#endif | ||||||
? (T)(cfg.threads_per_group * cfg.n_groups - 1 + FPDELTA) | ||||||
: init(i, cfg); | ||||||
return gold; | ||||||
|
@@ -482,7 +530,11 @@ template <class T, int N, class C, C Op> struct ImplCmpxchgBase { | |||||
static T init(int i, const Config &cfg) { return base - 1; } | ||||||
|
||||||
static T gold(int i, const Config &cfg) { | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
T gold = is_updated(i, N, cfg) | ||||||
#else | ||||||
T gold = i == 0 | ||||||
#endif | ||||||
? (T)(cfg.threads_per_group * cfg.n_groups - 1 + base) | ||||||
: init(i, cfg); | ||||||
return gold; | ||||||
|
@@ -606,12 +658,14 @@ int main(void) { | |||||
|
||||||
// Check load/store operations | ||||||
passed &= test_int_types<8, ImplLoad>(q, cfg); | ||||||
#ifndef USE_SCALAR_OFFSET | ||||||
if (q.get_backend() != sycl::backend::ext_intel_esimd_emulator) | ||||||
passed &= test_int_types<8, ImplStore>(q, cfg); | ||||||
#ifndef USE_DWORD_ATOMICS | ||||||
if (q.get_backend() != sycl::backend::ext_intel_esimd_emulator) | ||||||
passed &= test<float, 8, ImplStore>(q, cfg); | ||||||
#endif // USE_DWORD_ATOMICS | ||||||
#endif | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit (here and in few other places):
Suggested change
|
||||||
// TODO: check double other vector lengths in LSC mode. | ||||||
|
||||||
std::cout << (passed ? "Passed\n" : "FAILED\n"); | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//==---------------- atomic_smoke_scalar_off.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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// This test checks LSC atomic operations. | ||
//===----------------------------------------------------------------------===// | ||
// REQUIRES: gpu-intel-pvc | ||
// TODO: esimd_emulator fails due to random timeouts (_XFAIL_: esimd_emulator) | ||
// UNSUPPORTED: esimd_emulator | ||
// RUN: %clangxx -fsycl %s -o %t.out | ||
// RUN: %GPU_RUN_PLACEHOLDER %t.out | ||
// | ||
// scalar offset variant of the test - uses scalar offsets. | ||
|
||
#define USE_SCALAR_OFFSET | ||
|
||
#include "atomic_smoke.cpp" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: This situation reveals that this test is written in a bad way: gather and scatter are used in one kernel and gather is input for gather. This makes it impossible to test gather with scalar offset and N>1 and it creates opportunity for double-error (1 in gather, 1 in scatter) giving a pass.
I had some changes in my local ws splitting this test to gather and scatter.