Skip to content

Commit f1e81ee

Browse files
oneDNN: introduce graph API to the spec. (#451)
* oneDNN: move constructors with data_desc to src/dst desc * oneDNN: introduce graph extension headers * oneDNN: future-proofing by increasing argument index base value * oneDNN: introduce Graph extension * oneDNN: various typo and rephrasing * oneDNN: style alignment of graph extension * fix engine paragraph rendering Co-authored-by: Wuxun Zhang <[email protected]> * fix stream paragraph rendering Co-authored-by: Wuxun Zhang <[email protected]> * oneDNN: fix some latex issues * oneDNN: more rendering fixups * oneDNN: more rendering fixups (2) * oneDNN: add doxygen symbols in Common definition section for graph Co-authored-by: Wuxun Zhang <[email protected]>
1 parent ce02f81 commit f1e81ee

File tree

103 files changed

+9442
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+9442
-195
lines changed

.reuse/dep5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Files: source/elements/oneDNN/source/_static/*.jpg source/elements/oneDNN/source
2323
Copyright: 2020 Intel Corporation
2424
License: CC-BY-4.0
2525

26+
Files: source/elements/oneDNN/source/graph/resources/*.jpg source/elements/oneDNN/source/graph/resources/*.png
27+
Copyright: 2020 Intel Corporation
28+
License: CC-BY-4.0
29+
2630
Files: source/elements/oneDNN/source/*.cpp
2731
Copyright: 2020 Intel Corporation
2832
License: MIT

source/elements/oneDNN/include/dnnl.hpp

Lines changed: 78 additions & 155 deletions
Large diffs are not rendered by default.
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
// Copyright 2022 Intel Corporation
2+
// SPDX-FileCopyrightText: 2022 Intel Corporation
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
/// @file
7+
/// oneDNN common API between primitive and graph extension
8+
9+
#ifndef DNNL_COMMON_HPP
10+
#define DNNL_COMMON_HPP
11+
12+
/// @cond DO_NOT_DOCUMENT_THIS
13+
#include <algorithm>
14+
#include <iterator>
15+
#include <memory>
16+
17+
/// @endcond
18+
19+
/// @addtogroup dnnl_api oneDNN API
20+
/// @{
21+
22+
/// oneDNN namespace
23+
namespace dnnl {
24+
25+
/// @addtogroup dnnl_api_common Common API
26+
/// @{
27+
28+
/// @addtogroup dnnl_api_utils Utilities
29+
/// Utility types and definitions.
30+
/// @{
31+
32+
/// oneDNN exception class.
33+
///
34+
/// This class captures the status returned by a failed function call
35+
struct error : public std::exception {};
36+
37+
/// @} dnnl_api_utils
38+
39+
/// @addtogroup dnnl_api_engine Engine
40+
///
41+
/// An abstraction of a computational device: a CPU, a specific GPU
42+
/// card in the system, etc. Most primitives are created to execute
43+
/// computations on one specific engine. The only exceptions are reorder
44+
/// primitives that transfer data between two different engines.
45+
///
46+
/// @{
47+
48+
/// An execution engine.
49+
struct engine {
50+
/// Kinds of engines.
51+
enum class kind {
52+
/// An unspecified engine
53+
any,
54+
/// CPU engine
55+
cpu,
56+
/// GPU engine
57+
gpu,
58+
};
59+
60+
/// Constructs an empty engine. An empty engine cannot be used in any
61+
/// operations.
62+
engine() = default;
63+
64+
/// Returns the number of engines of a certain kind.
65+
///
66+
/// @param akind The kind of engines to count.
67+
/// @returns The number of engines of the specified kind.
68+
static size_t get_count(kind akind);
69+
70+
/// Constructs an engine.
71+
///
72+
/// @param akind The kind of engine to construct.
73+
/// @param index The index of the engine. Must be less than the value
74+
/// returned by #get_count() for this particular kind of engine.
75+
engine(kind akind, size_t index);
76+
77+
/// Returns the kind of the engine.
78+
/// @returns The kind of the engine.
79+
kind get_kind() const;
80+
};
81+
82+
/// @} dnnl_api_engine
83+
84+
/// @addtogroup dnnl_api_stream Stream
85+
///
86+
/// An encapsulation of execution context tied to a particular engine.
87+
///
88+
/// @{
89+
90+
91+
/// An execution stream.
92+
struct stream {
93+
/// Stream flags. Can be combined using the bitwise OR operator.
94+
enum class flags : unsigned {
95+
/// In-order execution.
96+
in_order,
97+
/// Out-of-order execution.
98+
out_of_order,
99+
/// Default stream configuration.
100+
default_flags,
101+
};
102+
103+
/// Constructs an empty stream. An empty stream cannot be used in any
104+
/// operations.
105+
stream();
106+
107+
/// Constructs a stream for the specified engine and with behavior
108+
/// controlled by the specified flags.
109+
///
110+
/// @param aengine Engine to create the stream on.
111+
/// @param aflags Flags controlling stream behavior.
112+
stream(const engine &aengine, flags aflags = flags::default_flags);
113+
114+
/// @returns The associated engine.
115+
engine get_engine() const;
116+
117+
/// Waits for all primitives executing in the stream to finish.
118+
/// @returns The stream itself.
119+
stream &wait();
120+
121+
};
122+
123+
/// @} dnnl_api_stream
124+
125+
/// @addtogroup dnnl_api_fpmath_mode Floating-point Math Mode
126+
/// @{
127+
128+
/// Floating-point math mode
129+
enum class fpmath_mode {
130+
/// Default behavior, no downconversions allowed
131+
strict,
132+
/// Implicit f32->bf16 conversions allowed
133+
bf16,
134+
/// Implicit f32->f16 conversions allowed
135+
f16,
136+
/// Implicit f32->tf32 conversions allowed
137+
tf32,
138+
/// Implicit f32->f16 or f32->bf16 conversions allowed
139+
any
140+
};
141+
142+
/// @} dnnl_api_fpmath_mode
143+
144+
/// @} dnnl_api_common
145+
146+
} // namespace dnnl
147+
148+
/// @} dnnl_api
149+
150+
#endif

0 commit comments

Comments
 (0)