-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][NFC] Drop Gen9 detection from E2E tests #14452
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
steffenlarsen
merged 9 commits into
intel:sycl
from
AlexeySachkov:private/asachkov/drop-gen9-e2e-tests
Sep 24, 2024
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ce18b54
[SYCL][NFC] Drop Gen9 detection from E2E tests
AlexeySachkov 6be1581
Merge remote-tracking branch 'origin/sycl' into private/asachkov/drop…
AlexeySachkov 5d244cb
An attempt to fix bfloat16 example test
AlexeySachkov c1283bf
Fix missed gen12 -> gen12lp
AlexeySachkov 915e9c9
Merge branch 'sycl' into private/asachkov/drop-gen9-e2e-tests
steffenlarsen 3e50079
Merge remote-tracking branch 'intel/sycl' into private/asachkov/drop-…
steffenlarsen 1326e5d
Split bfloat16_example
steffenlarsen 625c4a7
Change restrictions on bfloat16_example
steffenlarsen 4c8a400
Redisable for CUDA and fix if statements
steffenlarsen 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 |
|---|---|---|
| @@ -1,80 +1,24 @@ | ||
| /// | ||
| /// Check if bfloat16 example works using fallback libraries | ||
| /// Check if bfloat16 example works using fallback libraries AOT compiled for | ||
| /// both GPU and CPU. | ||
| /// | ||
|
|
||
| // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12 | ||
|
|
||
| // CUDA is not compatible with SPIR. | ||
| // UNSUPPORTED: cuda | ||
|
|
||
| // RUN: %clangxx -fsycl %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64 %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device gen12lp" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device *" %s -o %t.out | ||
| // RUN: %if gpu %{ %{run} %t.out %} | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device gen12lp" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen "-device gen12lp" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s -o %t.out | ||
| // RUN: %if cpu %{ %{run} %t.out %} | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s -o %t.out | ||
| // RUN: %if cpu %{ %{run} %t.out %} | ||
|
|
||
| #include <sycl/detail/core.hpp> | ||
| #include <sycl/ext/oneapi/bfloat16.hpp> | ||
|
|
||
| using namespace sycl; | ||
| using sycl::ext::oneapi::bfloat16; | ||
|
|
||
| float foo(float a, float b) { | ||
| // Convert from float to bfloat16. | ||
| bfloat16 A{a}; | ||
| bfloat16 B{b}; | ||
|
|
||
| // Convert A and B from bfloat16 to float, do addition on floating-point | ||
| // numbers, then convert the result to bfloat16 and store it in C. | ||
| bfloat16 C = A + B; | ||
|
|
||
| // Return the result converted from bfloat16 to float. | ||
| return C; | ||
| } | ||
|
|
||
| int main(int argc, char *argv[]) { | ||
| float data[3] = {7.0f, 8.1f, 0.0f}; | ||
|
|
||
| float result_host = foo(7.0f, 8.1f); | ||
| std::cout << "CPU Result = " << result_host << std::endl; | ||
| if (std::abs(15.1f - result_host) > 0.1f) { | ||
| std::cout << "Test failed. Expected CPU Result ~= 15.1" << std::endl; | ||
| return 1; | ||
| } | ||
|
|
||
| queue deviceQueue; | ||
| buffer<float, 1> buf{data, 3}; | ||
|
|
||
| deviceQueue.submit([&](handler &cgh) { | ||
| accessor numbers{buf, cgh, read_write}; | ||
| cgh.single_task([=]() { numbers[2] = foo(numbers[0], numbers[1]); }); | ||
| }); | ||
|
|
||
| host_accessor hostOutAcc{buf, read_only}; | ||
| float result_device = hostOutAcc[2]; | ||
| std::cout << "GPU Result = " << result_device << std::endl; | ||
| if (std::abs(result_host - result_device) > 0.1f) { | ||
| std::cout << "Test failed. CPU Result !~= GPU result" << std::endl; | ||
| return 1; | ||
| } | ||
| #include "bfloat16_example.hpp" | ||
|
|
||
| return 0; | ||
| int main() { | ||
| return runTest(); | ||
| } |
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,47 @@ | ||
| #include <sycl/detail/core.hpp> | ||
| #include <sycl/ext/oneapi/bfloat16.hpp> | ||
|
|
||
| using namespace sycl; | ||
| using sycl::ext::oneapi::bfloat16; | ||
|
|
||
| float foo(float a, float b) { | ||
| // Convert from float to bfloat16. | ||
| bfloat16 A{a}; | ||
| bfloat16 B{b}; | ||
|
|
||
| // Convert A and B from bfloat16 to float, do addition on floating-point | ||
| // numbers, then convert the result to bfloat16 and store it in C. | ||
| bfloat16 C = A + B; | ||
|
|
||
| // Return the result converted from bfloat16 to float. | ||
| return C; | ||
| } | ||
|
|
||
| int runTest() { | ||
| float data[3] = {7.0f, 8.1f, 0.0f}; | ||
|
|
||
| float result_host = foo(7.0f, 8.1f); | ||
| std::cout << "Host Result = " << result_host << std::endl; | ||
| if (std::abs(15.1f - result_host) > 0.1f) { | ||
| std::cout << "Test failed. Expected Host Result ~= 15.1" << std::endl; | ||
| return 1; | ||
| } | ||
|
|
||
| queue deviceQueue; | ||
| buffer<float, 1> buf{data, 3}; | ||
|
|
||
| deviceQueue.submit([&](handler &cgh) { | ||
| accessor numbers{buf, cgh, read_write}; | ||
| cgh.single_task([=]() { numbers[2] = foo(numbers[0], numbers[1]); }); | ||
| }); | ||
|
|
||
| host_accessor hostOutAcc{buf, read_only}; | ||
| float result_device = hostOutAcc[2]; | ||
| std::cout << "Device Result = " << result_device << std::endl; | ||
| if (std::abs(result_host - result_device) > 0.1f) { | ||
| std::cout << "Test failed. Host Result !~= Device result" << std::endl; | ||
| return 1; | ||
| } | ||
|
|
||
| return 0; | ||
| } |
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 @@ | ||
| /// | ||
| /// Check if bfloat16 example works using fallback libraries AOT compiled for | ||
| /// CPU. | ||
| /// | ||
|
|
||
| // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12, cpu | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64,spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen -Xsycl-target-backend=spir64_gen "-device pvc" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
AlexeySachkov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #include "bfloat16_example.hpp" | ||
|
|
||
| int main() { | ||
| return runTest(); | ||
| } | ||
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 @@ | ||
| /// | ||
| /// Check if bfloat16 example works using fallback libraries AOT compiled for | ||
| /// GPU. | ||
| /// | ||
|
|
||
| // REQUIRES: opencl-aot, ocloc, gpu-intel-gen12, gpu | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device gen12lp" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device *" %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| #include "bfloat16_example.hpp" | ||
|
|
||
| int main() { | ||
| return runTest(); | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.