Skip to content

Commit 6314bef

Browse files
author
Alexander Batashev
authored
[SYCL][Doc] Deploy documentation for PI (#1318)
Signed-off-by: Alexander Batashev <[email protected]>
1 parent 1588535 commit 6314bef

File tree

8 files changed

+74
-27
lines changed

8 files changed

+74
-27
lines changed

sycl/doc/doxygen.cfg.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ STRIP_FROM_PATH = @abs_srcdir@/..
171171
# specify the list of include paths that are normally passed to the compiler
172172
# using the -I flag.
173173

174-
STRIP_FROM_INC_PATH = @abs_srcdir@/../include
174+
STRIP_FROM_INC_PATH = @abs_srcdir@/../include \
175+
@abs_srcdir@/../source \
176+
@abs_srcdir@/../plugins
175177

176178
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
177179
# less readable) file names. This can be useful is your file systems doesn't
@@ -791,7 +793,8 @@ WARN_LOGFILE =
791793
# Note: If this tag is empty the current directory is searched.
792794

793795
INPUT = @abs_srcdir@/../include \
794-
@abs_srcdir@/../source
796+
@abs_srcdir@/../source \
797+
@abs_srcdir@/../plugins
795798

796799
# This tag can be used to specify the character encoding of the source files
797800
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -1062,7 +1065,7 @@ SOURCE_TOOLTIPS = YES
10621065
# The default value is: NO.
10631066
# This tag requires that the tag SOURCE_BROWSER is set to YES.
10641067

1065-
USE_HTAGS = YES
1068+
USE_HTAGS = NO
10661069

10671070
# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
10681071
# verbatim copy of the header file for each class for which an include is

sycl/include/CL/sycl/detail/pi.h

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
//
9-
// This is the definition of a generic offload Plugin Interface (PI), which is
10-
// used by the SYCL implementation to connect to multiple device back-ends,
11-
// e.g. to OpenCL. The interface is intentionally kept C-only for the
12-
// purpose of having full flexibility and interoperability with different
13-
// environments.
14-
//
8+
9+
/// \defgroup sycl_pi The Plugin Interface
10+
// TODO: link to sphinx page
11+
12+
/// \file Main Plugin Interface header file.
13+
///
14+
/// This is the definition of a generic offload Plugin Interface (PI), which is
15+
/// used by the SYCL implementation to connect to multiple device back-ends,
16+
/// e.g. to OpenCL. The interface is intentionally kept C-only for the
17+
/// purpose of having full flexibility and interoperability with different
18+
/// environments.
19+
///
20+
/// \ingroup sycl_pi
21+
1522
#ifndef _PI_H_
1623
#define _PI_H_
1724

sycl/include/CL/sycl/detail/pi.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// C++ wrapper of extern "C" PI interfaces
10-
//
9+
/// \file pi.hpp
10+
/// C++ wrapper of extern "C" PI interfaces
11+
///
12+
/// \ingroup sycl_pi
13+
1114
#pragma once
1215

1316
#include <CL/sycl/detail/common.hpp>

sycl/plugins/cuda/pi_cuda.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
/// \file pi_cuda.cpp
10+
/// Implementation of CUDA Plugin.
11+
///
12+
/// \ingroup sycl_pi_cuda
13+
914
#include <CL/sycl/backend/cuda.hpp>
1015
#include <CL/sycl/detail/pi.hpp>
1116
#include <pi_cuda.hpp>

sycl/plugins/cuda/pi_cuda.hpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
/// This source is the definition of the SYCL Plugin Interface
10-
/// (PI). It is the interface between the device-agnostic SYCL runtime layer
11-
/// and underlying "native" runtimes such as OpenCL.
9+
/// \defgroup sycl_pi_cuda CUDA Plugin
10+
/// \ingroup sycl_pi
11+
12+
/// \file pi_cuda.hpp
13+
/// Definition of CUDA Plugin. It is the interface between the device-agnostic
14+
/// SYCL runtime layer and underlying CUDA runtime.
15+
///
16+
/// \ingroup sycl_pi_cuda
1217

1318
#ifndef PI_CUDA_HPP
1419
#define PI_CUDA_HPP

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
9+
/// \defgroup sycl_pi_ocl OpenCL Plugin
10+
/// \ingroup sycl_pi
11+
12+
/// \file pi_opencl.cpp
13+
/// Implementation of OpenCL Plugin. It is the interface between device-agnostic
14+
/// SYCL runtime layer and underlying OpenCL runtime.
15+
///
16+
/// \ingroup sycl_pi_ocl
17+
818
#include "CL/opencl.h"
919
#include <CL/sycl/detail/pi.h>
1020

sycl/source/detail/pi.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8+
9+
/// \file pi.cpp
10+
/// Implementation of C++ wrappers for PI interface.
11+
///
12+
/// \ingroup sycl_pi
13+
814
#include <CL/sycl/detail/common.hpp>
915
#include <CL/sycl/detail/pi.hpp>
1016
#include <detail/plugin.hpp>

sycl/source/detail/plugin.hpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ __SYCL_INLINE_NAMESPACE(cl) {
1515
namespace sycl {
1616
namespace detail {
1717

18+
/// The plugin class provides a unified interface to the underlying low-level
19+
/// runtimes for the device-agnostic SYCL runtime.
20+
///
21+
/// \ingroup sycl_pi
1822
class plugin {
1923
public:
2024
plugin() = delete;
@@ -25,21 +29,24 @@ class plugin {
2529

2630
~plugin() = default;
2731

28-
// Utility function to check return from PI calls.
29-
// Throws if pi_result is not a PI_SUCCESS.
30-
// Exception - The type of exception to throw if PiResult of a call is not
31-
// PI_SUCCESS. Default value is cl::sycl::runtime_error.
32+
/// Checks return value from PI calls.
33+
///
34+
/// \throw Exception if pi_result is not a PI_SUCCESS.
3235
template <typename Exception = cl::sycl::runtime_error>
3336
void checkPiResult(RT::PiResult pi_result) const {
3437
CHECK_OCL_CODE_THROW(pi_result, Exception);
3538
}
3639

37-
// Call the PiApi, trace the call and return the result.
38-
// To check the result use checkPiResult.
39-
// Usage:
40-
// PiResult Err = plugin.call<PiApiKind::pi>(Args);
41-
// Plugin.checkPiResult(Err); <- Checks Result and throws a runtime_error
42-
// exception.
40+
/// Calls the PiApi, traces the call, and returns the result.
41+
///
42+
/// Usage:
43+
/// \code{cpp}
44+
/// PiResult Err = plugin.call<PiApiKind::pi>(Args);
45+
/// Plugin.checkPiResult(Err); // Checks Result and throws a runtime_error
46+
/// // exception.
47+
/// \endcode
48+
///
49+
/// \sa plugin::checkPiResult
4350
template <PiApiKind PiApiOffset, typename... ArgsT>
4451
RT::PiResult call_nocheck(ArgsT... Args) const {
4552
RT::PiFuncInfo<PiApiOffset> PiCallInfo;
@@ -56,8 +63,9 @@ class plugin {
5663
return R;
5764
}
5865

59-
// Call the API, trace the call, check the result and throw
60-
// a runtime_error Exception
66+
/// Calls the API, traces the call, checks the result
67+
///
68+
/// \throw cl::sycl::runtime_exception if the call was not successful.
6169
template <PiApiKind PiApiOffset, typename... ArgsT>
6270
void call(ArgsT... Args) const {
6371
RT::PiResult Err = call_nocheck<PiApiOffset>(Args...);

0 commit comments

Comments
 (0)