-
Notifications
You must be signed in to change notification settings - Fork 842
[SYCL][NFC] Move ESIMD tests in-tree #7417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
AlexeySachkov
merged 2 commits into
intel:sycl
from
AlexeySachkov:private/asachkov/move-esimd-test-in-tree
Nov 17, 2022
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // RUN: %clangxx -fsycl -Xclang -opaque-pointers -fsycl-device-only -c -Xclang -emit-llvm -o %t.comp.ll %s | ||
| // RUN: sycl-post-link -ir-output-only -lower-esimd -S %t.comp.ll -o %t.out.ll | ||
| // RUN: FileCheck --input-file=%t.out.ll %s | ||
|
|
||
| // Checks that ESIMDOptimizeVecArgCallConv does the right job as | ||
| // a part of sycl-post-link. | ||
|
|
||
| #include <sycl/ext/intel/esimd.hpp> | ||
|
|
||
| using namespace sycl::ext::intel::esimd; | ||
|
|
||
| // clang-format off | ||
|
|
||
| //------------------------ | ||
| // Test1: Optimized parameter interleaves non - optimizeable ones. | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<int, 8> callee__sret__x_param_x(int i, simd<int, 8> x, int j) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <8 x i32> @_Z23callee__sret__x_param_x{{.*}}(i32 noundef %{{.*}}, <8 x i32> %{{.*}}, i32 noundef %{{.*}}) | ||
| return x + (i + j); | ||
| } | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<int, 8> test__sret__x_param_x(simd<int, 8> x) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <8 x i32> @_Z21test__sret__x_param_x{{.*}}(<8 x i32> %{{.*}}) | ||
| return callee__sret__x_param_x(2, x, 1); | ||
| // CHECK: %{{.*}} = call spir_func <8 x i32> @_Z23callee__sret__x_param_x{{.*}}(i32 2, <8 x i32> %{{.*}}, i32 1) | ||
| } | ||
|
|
||
| //------------------------ | ||
| // Test2: "2-level fall through" | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<double, 32> callee__all_fall_through0(simd<double, 32> x) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <32 x double> @_Z25callee__all_fall_through0{{.*}}(<32 x double> %{{.*}}) | ||
| return x; | ||
| } | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<double, 32> callee__all_fall_through1(simd<double, 32> x) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <32 x double> @_Z25callee__all_fall_through1{{.*}}(<32 x double> %{{.*}}) | ||
| return callee__all_fall_through0(x); | ||
| // CHECK: %{{.*}} = call spir_func <32 x double> @_Z25callee__all_fall_through0{{.*}}(<32 x double> %{{.*}}) | ||
| } | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<double, 32> test__all_fall_through(simd<double, 32> x) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <32 x double> @_Z22test__all_fall_through{{.*}}(<32 x double> %{{.*}}) | ||
| return callee__all_fall_through1(x); | ||
| // CHECK: %{{.*}} = call spir_func <32 x double> @_Z25callee__all_fall_through1{{.*}}(<32 x double> %{{.*}}) | ||
| } | ||
|
|
||
| //------------------------ | ||
| // Test3. First argument is passed by reference and updated in the callee, | ||
| // must not be optimized. | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL void callee_void__noopt_opt(simd<int, 8>& x, simd<int, 8> y) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func void @_Z22callee_void__noopt_opt{{.*}}(ptr {{.*}} %{{.*}}, <8 x i32> %{{.*}}) | ||
| x = x + y; | ||
| } | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<int, 8> test__sret__noopt_opt(simd<int, 8> x) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <8 x i32> @_Z21test__sret__noopt_opt{{.*}}(ptr noundef %{{.*}}) | ||
| callee_void__noopt_opt(x, x); | ||
| // CHECK: call spir_func void @_Z22callee_void__noopt_opt{{.*}}(ptr addrspace(4) %{{.*}}, <8 x i32> %{{.*}}) | ||
| return x; | ||
| } | ||
|
|
||
| //------------------------ | ||
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,40 @@ | ||
| // RUN: %clangxx -fsycl -Xclang -opaque-pointers -fsycl-device-only -c -Xclang -emit-llvm -o %t.comp.ll %s | ||
|
AlexeySachkov marked this conversation as resolved.
Outdated
|
||
| // RUN: sycl-post-link -ir-output-only -lower-esimd -S %t.comp.ll -o %t.out.ll | ||
| // RUN: FileCheck --input-file=%t.out.ll %s | ||
|
|
||
| // Performs a basic check that ESIMDOptimizeVecArgCallConv does the right job as | ||
| // a part of sycl-post-link. | ||
|
|
||
| #include <sycl/ext/intel/esimd.hpp> | ||
|
|
||
| using namespace sycl::ext::intel::esimd; | ||
|
|
||
| ESIMD_PRIVATE simd<float, 3 * 32 * 4> GRF; | ||
| #define V(x, w, i) (x).template select<w, 1>(i) | ||
|
|
||
| // clang-format off | ||
|
|
||
| // "Fall-through case", incoming optimizeable parameter is just returned | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<float, 16> callee__sret__param(simd<float, 16> x) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <16 x float> @_Z19callee__sret__param{{.*}}(<16 x float> %[[PARAM:.+]]) | ||
| return x; | ||
| } | ||
|
|
||
| // * Caller 1: simd object is read from array | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<float, 16> test__sret__fall_through__arr(simd<float, 16> *x, int i) SYCL_ESIMD_FUNCTION { | ||
| // CHECK: define dso_local spir_func <16 x float> @_Z29test__sret__fall_through__arr{{.*}}(ptr addrspace(4) noundef %[[PARAM0:.+]], i32 noundef %{{.*}}) | ||
| return callee__sret__param(x[i]); | ||
| // CHECK: %{{.*}} = call spir_func <16 x float> @_Z19callee__sret__param{{.*}}(<16 x float> %{{.*}}) | ||
| } | ||
|
|
||
| // * Caller 2 : simd object is read from a global | ||
|
|
||
| __attribute__((noinline)) | ||
| SYCL_EXTERNAL simd<float, 16> test__sret__fall_through__glob() SYCL_ESIMD_FUNCTION { | ||
| return callee__sret__param(V(GRF, 16, 0)); | ||
| // CHECK: %{{.*}} = call spir_func <16 x float> @_Z19callee__sret__param{{.*}}(<16 x float> %{{.*}}) | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.