Skip to content
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
merged 19 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ See [LICENSE.txt](sycl/LICENSE.TXT) for details.
See [CONTRIBUTING.md](CONTRIBUTING.md) for details.

## Sub-projects Documentation

* oneAPI Data Parallel C++ compiler - See
[GetStartedGuide.md](sycl/doc/GetStartedGuide.md)
* oneAPI Data Parallel C++ compiler - See [DPC++ Documentation](https://intel.github.io/llvm-docs/)
bader marked this conversation as resolved.
Show resolved Hide resolved

## DPC++ extensions

Expand Down
2 changes: 1 addition & 1 deletion sycl/doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# -- General configuration ---------------------------------------------------

master_doc = 'contents'
master_doc = 'index'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
Expand Down
16 changes: 9 additions & 7 deletions sycl/doc/doxygen.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.

PROJECT_NAME = "SYCL Runtime"
PROJECT_NAME = "DPC++ Runtime"

# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
Expand All @@ -44,7 +44,7 @@ PROJECT_NUMBER = @PACKAGE_VERSION@
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.

PROJECT_BRIEF = "Runtime libraries for SYCL"
PROJECT_BRIEF = "Runtime libraries for oneAPI Data Parallel C++"

# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
Expand Down Expand Up @@ -437,7 +437,7 @@ LOOKUP_CACHE_SIZE = 2
# normally produced when WARNINGS is set to YES.
# The default value is: NO.

EXTRACT_ALL = NO
EXTRACT_ALL = YES

# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation.
Expand Down Expand Up @@ -911,7 +911,7 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH =
EXAMPLE_PATH = @abs_srcdir@/../examples/

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
Expand Down Expand Up @@ -1466,7 +1466,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

DISABLE_INDEX = NO
DISABLE_INDEX = YES

# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information. If the tag
Expand All @@ -1483,7 +1483,7 @@ DISABLE_INDEX = NO
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.

GENERATE_TREEVIEW = NO
GENERATE_TREEVIEW = YES

# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
Expand Down Expand Up @@ -2104,7 +2104,9 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED = "__SYCL_INLINE_NAMESPACE(X)=namespace X"
PREDEFINED = "__SYCL_INLINE_NAMESPACE(X)=namespace X" \
"__SYCL_EXPORT" \
"__SYCL_EXPORT_DEPRECATED(x)="

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
1 change: 1 addition & 0 deletions sycl/doc/contents.rst → sycl/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Using oneAPI DPC++ for Application Development
cuda/contents
Extensions <https://github.com/intel/llvm/tree/sycl/sycl/doc/extensions>
FAQ
User API Reference <https://intel.github.io/llvm-docs/doxygen/group__sycl__api.html>

Developing oneAPI DPC++ Compiler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
54 changes: 54 additions & 0 deletions sycl/examples/simple-dpcpp-app.cpp
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;
}
Loading