-
Notifications
You must be signed in to change notification settings - Fork 745
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
[SYCL][Doc] Render user API classes on a dedicated page #1578
Merged
+379
−87
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
59757ec
[SYCL][Doc] Render most commonnly used classes on a dedicated page
3df80d2
Restructure docs
365359f
Merge remote-tracking branch 'origin/sycl' into private/abatashe/user…
5680e74
Minor updates
fab13a4
Address example comments
175777c
Fix config
23b06d7
Merge remote-tracking branch 'origin/sycl' into private/abatashe/user…
6ce877d
Remove repeated link
2bc4535
React to comments
d120b47
Merge remote-tracking branch 'origin/sycl' into private/abatashe/user…
df3658b
Resolve comments
b952a76
Merge remote-tracking branch 'origin/sycl' into private/abatashe/user…
49e49c7
Merge remote-tracking branch 'origin/sycl' into private/abatashe/user…
8007710
Merge remote-tracking branch 'origin/sycl' into private/abatashe/user…
1caa683
Cleanup merge leftovers
37c6596
Address review comments
fdf6d93
Merge branch 'sycl' into private/abatashe/user_docs
ca9ed9f
Return blank line to README
1b40d54
More fixes
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 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 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 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 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 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,54 @@ | ||
#include <CL/sycl.hpp> | ||
|
||
using namespace cl::sycl; | ||
|
||
int main() { | ||
// Create a buffer of 4 ints to be used inside the kernel code. | ||
buffer<int, 1> Buffer(4); | ||
|
||
// Create a simple asynchronous exception handler. | ||
auto AsyncHandler = [](exception_list ExceptionList) { | ||
for (auto &Exception : ExceptionList) { | ||
std::rethrow_exception(Exception); | ||
alexbatashev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
}; | ||
|
||
// Create a SYCL queue. | ||
queue Queue(AsyncHandler); | ||
|
||
// Size of index space for kernel. | ||
range<1> NumOfWorkItems{Buffer.get_count()}; | ||
|
||
// Submit command group(work) to queue. | ||
Queue.submit([&](handler &cgh) { | ||
// Get write only access to the buffer on a device. | ||
auto Accessor = Buffer.get_access<access::mode::write>(cgh); | ||
// Execute kernel. | ||
cgh.parallel_for<class FillBuffer>(NumOfWorkItems, [=](id<1> WIid) { | ||
// Fill buffer with indices. | ||
Accessor[WIid] = static_cast<int>(WIid.get(0)); | ||
}); | ||
}); | ||
|
||
// Get read only access to the buffer on the host. | ||
// This introduces an implicit barrier which blocks execution until the | ||
// command group above completes. | ||
const auto HostAccessor = Buffer.get_access<access::mode::read>(); | ||
|
||
// Check the results. | ||
bool MismatchFound = false; | ||
for (size_t I = 0; I < Buffer.get_count(); ++I) { | ||
if (HostAccessor[I] != I) { | ||
std::cout << "The result is incorrect for element: " << I | ||
<< " , expected: " << I << " , got: " << HostAccessor[I] | ||
<< std::endl; | ||
MismatchFound = true; | ||
} | ||
} | ||
|
||
if (!MismatchFound) { | ||
std::cout << "The results are correct!" << std::endl; | ||
} | ||
|
||
return MismatchFound; | ||
} |
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.
Link doesn't work now. Is it expected?
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.
Yes, this patch also renames contents.html to index.html, so the link will work.