Skip to content

Commit

Permalink
extend design for fpmath mode
Browse files Browse the repository at this point in the history
  • Loading branch information
wzt1997 committed Aug 21, 2024
1 parent 83217a2 commit 1d5e1d2
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions rfcs/20240808-graph-api-int-compression-for-sdpa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,26 @@ the design of floating point math mode also helps to maintain a consistent API
semantics between graph API and primitive API.
Currently, oneDNN Graph API supports setting floating-point math mode during the
construction of graph object, which will affect the whole graph. The API is
like:
construction of graph object, which will affect the whole graph.
As primitive API has supported a second argument for enforcing an integral
primitive to comply with the floating-point math mode, oneDNN Graph API need to
accommodate to the change. The new API will be like:
```cpp
/// @param engine_kind Engine kind.
/// @param mode Floating-point math mode.
/// @param apply_to_int Use of floating-point arithmetic for integer primitives.
graph(engine::kind engine_kind, fpmath_mode mode, bool apply_to_int = false);
```

Users can use the new API like:

```cpp
using namespace dnnl::graph;

// Specify math_mode while constructing the graph
graph g(kind, math_mode);
graph g(kind, math_mode, /*apply_to_int=*/true);
op foo(id, kind, "foo"); g.add_op(foo);
op bar(id, kind, "bar"); g.add_op(bar);
g.finalize();
Expand Down

0 comments on commit 1d5e1d2

Please sign in to comment.