Poplar and PopLibs
GfloatExprUtil.hpp
1// Copyright (c) 2020 Graphcore Ltd. All rights reserved.
2
3#ifndef _popfloat_gfloat_expr_util_hpp_
4#define _popfloat_gfloat_expr_util_hpp_
5
6#include <popfloat/experimental/GfloatExpr.hpp>
7
9
10namespace popfloat {
11namespace experimental {
12
13std::string roundTypeToString(RoundType rmode);
14std::string formatTypeToString(FormatType fmt);
15std::string srDensityTypeToString(SRDensityType dist);
16std::string specTypeToString(SpecType specType);
17poplar::Type specTypeToPoplarType(SpecType specType);
18
19} // end namespace experimental
20} // end namespace popfloat
21
22// Specialize vertex template stringification for expr ops
23namespace poputil {
24template <> struct VertexTemplateToString<popfloat::experimental::RoundType> {
25 static std::string to_string(const popfloat::experimental::RoundType &rmode) {
26 return "popfloat::experimental::RoundType::" +
27 popfloat::experimental::roundTypeToString(rmode);
28 }
29};
30
31template <> struct VertexTemplateToString<popfloat::experimental::FormatType> {
32 static std::string to_string(const popfloat::experimental::FormatType &fmt) {
33 return "popfloat::experimental::FormatType::" +
34 popfloat::experimental::formatTypeToString(fmt);
35 }
36};
37
38template <>
39struct VertexTemplateToString<popfloat::experimental::SRDensityType> {
40 static std::string
41 to_string(const popfloat::experimental::SRDensityType &dist) {
42 return "popfloat::experimental::SRDensityType::" +
43 popfloat::experimental::srDensityTypeToString(dist);
44 }
45};
46
47template <> struct VertexTemplateToString<popfloat::experimental::SpecType> {
48 static std::string to_string(const popfloat::experimental::SpecType &spec) {
49 return "popfloat::experimental::SpecType::" +
50 popfloat::experimental::specTypeToString(spec);
51 }
52};
53} // end namespace poputil
54
55#endif // _popfloat_gfloat_expr_hpp_
Generate a string describing a vertex type.
Class representing device data types.
Definition: Type.hpp:42
General utility functions for building graphs.
Definition: GfloatExprUtil.hpp:23