Poplar and PopLibs
LateInitCallback.hpp
1// Copyright (c) 2019 Graphcore Ltd. All rights reserved.
2
3#ifndef poplar_LateInitCallback_hpp
4#define poplar_LateInitCallback_hpp
5
6#include <cstdint>
7#include <functional>
8#include <map>
9#include <string>
10#include <vector>
11
12#include <poplar/GraphElements.hpp>
13
14namespace poplar {
15
22 struct StorageInfo {
23 std::uint64_t startOffs; // Start addr in dev memory (offs from 0x40000)
24 std::uint32_t len; // Length in bytes
25 };
26 // A map from field name => StorageInfo[] for all (edge) fields of the vertex.
27 // For a 1D field, the std::vector, value for the map entry, will have a
28 // single element, describing that field.
29 // For a 2D field, it will have as many entries as there are 'rows' in the
30 // field.
31 // Note that this will not discriminate between a 1D vector and a 2D with a
32 // single row, but this should not matter in any case, because the callback
33 // must be aware of the type of the field.
34 std::map<std::string, std::vector<StorageInfo>> storage;
35};
36
43template <typename T>
44using LateInitCallback = std::function<T(const VertexEdgeInfo &)>;
45
46} // End namespace poplar.
47#endif // poplar_LateInitCallback_hpp
Poplar classes and functions.
Definition: ArrayRef.hpp:14
std::function< T(const VertexEdgeInfo &)> LateInitCallback
A callback function of this type can be specified for a field of a vertex, instead of specifying an i...
Definition: LateInitCallback.hpp:44
Data structure that will be passed to the callback used for 'late initialisation' for vertex fields.
Definition: LateInitCallback.hpp:21