-
Notifications
You must be signed in to change notification settings - Fork 770
[SYCL] Add Experimental Range Rounding #12690
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 all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2515d72
Make some changes for range rounding
hdelan 4815f02
Preserve the dimensionality of ranges
hdelan 9649797
Add documentation for exp range rounding
hdelan e324b36
Add combined range rounding flags to test
hdelan 6f850d0
Fix lint
hdelan bf66eb5
Add test to PerformanceTests
hdelan 7e4082b
Update docs
hdelan b0d5765
Remove a.out
hdelan 17de821
Add clang test
hdelan 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
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
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
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
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
66 changes: 66 additions & 0 deletions
66
sycl/test-e2e/PerformanceTests/ParallelFor/parallel_for_range_roundup.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,66 @@ | ||
// RUN: echo "Running parallel_for benchmark without range rounding" | ||
// RUN: %{build} -fsycl-range-rounding=disable -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// RUN: echo "Running parallel_for benchmark with normal range rounding" | ||
// RUN: %{build} -fsycl-range-rounding=force -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
// RUN: echo "Running parallel_for benchmark with experimental range rounding" | ||
// RUN: %{build} -fsycl-exp-range-rounding -fsycl-range-rounding=force -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
#include <chrono> | ||
#include <iostream> | ||
#include <sycl/sycl.hpp> | ||
|
||
class FillData; | ||
class Compute; | ||
|
||
int main() { | ||
constexpr static size_t width{788}; | ||
constexpr static size_t height{1888}; | ||
constexpr static size_t N{width * height}; | ||
constexpr static size_t iterations{1000}; | ||
|
||
sycl::queue q{}; | ||
float *A{sycl::malloc_device<float>(N, q)}; | ||
float *B{sycl::malloc_device<float>(N, q)}; | ||
float *C{sycl::malloc_device<float>(N, q)}; | ||
|
||
q.submit([&](sycl::handler &cgh) { | ||
cgh.parallel_for<FillData>( | ||
sycl::range<2>{height, width}, [=](sycl::id<2> id) { | ||
unsigned int row{static_cast<unsigned int>(id[0])}; | ||
unsigned int col{static_cast<unsigned int>(id[1])}; | ||
unsigned int ix{row * static_cast<unsigned int>(width) + col}; | ||
A[ix] = id[0]; | ||
B[ix] = id[1]; | ||
}); | ||
}).wait_and_throw(); | ||
|
||
auto start{std::chrono::steady_clock::now()}; | ||
for (size_t i{0}; i < iterations; ++i) { | ||
q.submit([&](sycl::handler &cgh) { | ||
cgh.parallel_for<Compute>( | ||
sycl::range<2>{height, width}, [=](sycl::id<2> id) { | ||
unsigned int row{static_cast<unsigned int>(id[0])}; | ||
unsigned int col{static_cast<unsigned int>(id[1])}; | ||
unsigned int ix{row * static_cast<unsigned int>(width) + col}; | ||
if (ix >= static_cast<unsigned int>(N)) { | ||
return; | ||
} | ||
if (A[ix] > B[ix]) { | ||
C[ix] = A[ix]; | ||
} else { | ||
C[ix] = B[ix]; | ||
} | ||
}); | ||
}).wait_and_throw(); | ||
} | ||
auto end{std::chrono::steady_clock::now()}; | ||
std::cout << std::chrono::duration_cast<std::chrono::milliseconds>(end - | ||
start) | ||
.count() | ||
<< " ms" << std::endl; | ||
} |
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.