-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL] Enable E2E test of fp64 conversion emulation #15923
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
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4248b44
[SYCL] Enable E2E test of fp64 conversion emulation
jzc e67ffa7
Merge remote-tracking branch 'intel/sycl' into fp64-conv-emu-e2e
jzc b939aeb
Add additional test
jzc f6e2e79
Address review comments
jzc 93eb97b
Merge remote-tracking branch 'intel/sycl' into fp64-conv-emu-e2e
jzc 59f8cb2
Add unsupported reason
jzc 0ce6b8c
Merge remote-tracking branch 'intel/sycl' into fp64-conv-emu-e2e
jzc 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,43 @@ | ||
| // REQUIRES: ocloc, linux, arch-intel_gpu_dg2_g10 | ||
|
|
||
| // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| #include <sycl/detail/core.hpp> | ||
| using namespace sycl; | ||
|
|
||
| template <typename T> T op(T x) { return x + 1; } | ||
|
|
||
| template <typename T> int test(queue &q) { | ||
| double res[] = {1.}; | ||
| { | ||
| buffer<double, 1> buf(res, 1); | ||
| q.submit([&](handler &cgh) { | ||
| accessor acc(buf, cgh); | ||
| cgh.single_task([=] { acc[0] = op<T>(acc[0]); }); | ||
| }).wait(); | ||
| } | ||
| double ref = 1.; | ||
| ref = op<T>(ref); | ||
| if (res[0] != ref) { | ||
| std::cout << typeid(T).name() << " fail: got " << res[0] << ", expected " | ||
| << ref << "\n"; | ||
| return 1; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| int main() { | ||
| int nfail = 0; | ||
| queue q; | ||
|
|
||
| nfail += test<int>(q); | ||
| nfail += test<long>(q); | ||
| nfail += test<float>(q); | ||
| if (q.get_device().has(aspect::fp64)) | ||
| nfail += test<double>(q); | ||
|
|
||
| if (nfail == 0) | ||
| std::cout << "success\n"; | ||
| return nfail; | ||
| } | ||
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
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.
Let's also have
test_convor something, which would use a differentop. Right now theopyou have performs an operation directly onT. The newopshould dostatic_cast<int>(x) + 1.test_conv<double>should be launched regardless ofdoublesupport on a device and it should always work. For simplicity,opcould be made a template argument oftest, I guess.