Poplar and PopLibs
exceptions.hpp
1// Copyright (c) 2015 Graphcore Ltd. All rights reserved.
2
3#ifndef poplar_exceptions_hpp
4#define poplar_exceptions_hpp
5
6#include <poplar/DebugContext.hpp>
7#include <poplar/Error.hpp>
8
9#include <iosfwd>
10#include <stdexcept>
11#include <string>
12
13namespace poplar {
14
16struct poplar_error : std::runtime_error {
17private:
18 std::string msg;
19
20public:
21 std::string type;
22 explicit poplar_error(const std::string &s);
23 explicit poplar_error(const char *s);
24
25 // Internal use only
26 void attachSourceLocation(const DebugContext &context);
27
28 const char *what() const noexcept override;
29 ~poplar_error() override;
30};
31
36 explicit graph_program_compilation_error(const std::string &s);
37 explicit graph_program_compilation_error(const char *s);
39};
40
45 explicit graph_object_creation_error(const std::string &s);
46 explicit graph_object_creation_error(const char *s);
48};
49
54 explicit graph_object_load_error(const std::string &path,
55 const std::string &error);
56 ~graph_object_load_error() override;
57};
58
65 explicit no_environment(const std::string &s);
66 explicit no_environment(const char *s);
67 ~no_environment() override;
68};
69
74 explicit unknown_vertex_type(const std::string &name);
75 ~unknown_vertex_type() override;
76};
77
82 explicit unknown_field(const std::string &s);
83 explicit unknown_field(const char *s);
84 unknown_field(const std::string &fieldName,
85 const std::string &vertexTypeName);
86 ~unknown_field() override;
87};
88
93 explicit control_program_error(const std::string &msg);
94 ~control_program_error() override;
95};
96
103 explicit type_error(const std::string &s);
104 explicit type_error(const char *s);
105 ~type_error() override;
106};
107
112 explicit index_error(const std::string &s);
113 explicit index_error(const char *s);
114 index_error(const std::string &vertexDotField, std::size_t index);
115 ~index_error() override;
116};
117
122 explicit no_size_specified(const std::string &s);
123 explicit no_size_specified(const char *s);
124 no_size_specified(const std::string &fieldName,
125 const std::string &vertexName);
126 ~no_size_specified() override;
127};
128
134 explicit graph_connection_error(const std::string &s);
135 explicit graph_connection_error(const char *s);
136 ~graph_connection_error() override;
137};
138
143 explicit graph_cycle_error(const std::string &s);
144 explicit graph_cycle_error(const char *s);
145 ~graph_cycle_error() override;
146};
147
152 explicit graph_recursion_error(const std::string &s);
153 explicit graph_recursion_error(const char *s);
154 ~graph_recursion_error() override;
155};
156
162 explicit graph_replication_error(const std::string &s);
163 explicit graph_replication_error(const char *s);
164 ~graph_replication_error() override;
165};
166
172 ~profiling_disabled() override;
173};
174
180 explicit missing_graph_profile(const std::string &s);
181 explicit missing_graph_profile(const char *s);
182 ~missing_graph_profile() override;
183};
184
189 explicit missing_perf_estimate(const std::string &vertexName);
190 ~missing_perf_estimate() override;
191};
192
197 explicit invalid_tile_mapping(const std::string &s);
198 explicit invalid_tile_mapping(const char *s);
199 ~invalid_tile_mapping() override;
200};
201
206 explicit tensor_creation_error(const std::string &s);
207 explicit tensor_creation_error(const char *s);
208 ~tensor_creation_error() override;
209};
210
216 explicit tensor_io_state_error(const std::string &s);
217 explicit tensor_io_state_error(const char *s);
218 ~tensor_io_state_error() override;
219};
220
225 explicit tensor_metadata_error(const std::string &s);
226 explicit tensor_metadata_error(const char *s);
227 ~tensor_metadata_error() override;
228};
229
234 explicit stream_connection_error(const std::string &s);
235 explicit stream_connection_error(const char *s);
236 ~stream_connection_error() override;
237};
238
243 explicit overflow_error(const std::string &s);
244 explicit overflow_error(const char *s);
245 ~overflow_error() override;
246};
247
252 explicit memory_elem_constraints_error(const std::string &s);
253 explicit memory_elem_constraints_error(const char *s);
255};
256
260
265 std::string profilePath;
266
267 explicit graph_memory_allocation_error(const std::string &s);
268 explicit graph_memory_allocation_error(const char *s);
270};
271
275 explicit stream_memory_allocation_error(const std::string &s);
276 explicit stream_memory_allocation_error(const char *s);
278};
279
284 explicit invalid_machine_model(const std::string &s);
285 explicit invalid_machine_model(const char *s);
286 ~invalid_machine_model() override;
287};
288
293 explicit invalid_option(const std::string &s);
294 explicit invalid_option(const char *s);
295 ~invalid_option() override;
296};
297
302 std::string output;
303 explicit link_error(const std::string &s, const std::string &out = "");
304 explicit link_error(const char *s, const char *out = "");
305 ~link_error() override;
306};
307
311 struct ErrorInfo {
313 ErrorCode code;
316 ErrorLocation location;
318 bool isSimulated;
319 };
320
323 std::vector<ErrorInfo> errors;
324
325 explicit runtime_error(const std::string &s);
326 explicit runtime_error(const char *s);
327 ~runtime_error() override;
328};
329
334 explicit application_runtime_error(const std::string &s);
335 explicit application_runtime_error(const char *s);
337};
338
343 explicit system_runtime_error(const std::string &s);
344 explicit system_runtime_error(const char *s);
345 ~system_runtime_error() override;
346};
347
351enum class RecoveryAction {
353 IPU_RESET,
358};
359
361std::string toString(RecoveryAction recoveryAction);
362
363std::ostream &operator<<(std::ostream &os, RecoveryAction recoveryAction);
364
369private:
370 RecoveryAction recoveryAction;
371
372public:
374 RecoveryAction getRecoveryAction() const { return recoveryAction; }
375 explicit recoverable_runtime_error(RecoveryAction recoveryAction,
376 const std::string &s);
377 explicit recoverable_runtime_error(RecoveryAction recoveryAction,
378 const char *s);
380};
381
386 explicit unrecoverable_runtime_error(const std::string &s);
387 explicit unrecoverable_runtime_error(const char *s);
389};
390
395 explicit unknown_runtime_error(const std::string &s);
396 explicit unknown_runtime_error(const char *s);
397 ~unknown_runtime_error() override;
398};
399
400struct symbol_error : poplar_error {
401 explicit symbol_error(const std::string &name, const unsigned tile);
402 ~symbol_error() override;
403};
404
405struct file_load_error : poplar_error {
406 explicit file_load_error(const std::string &path);
407 ~file_load_error() override;
408};
409
414 explicit parse_error(const std::string &s);
415 explicit parse_error(const char *s);
416 ~parse_error() override;
417};
418} // End namespace poplar.
419
420#endif // poplar_exceptions_hpp
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
Poplar classes and functions.
Definition: ArrayRef.hpp:14
std::ostream & operator<<(std::ostream &os, const DebugNameAndId &dnai)
Display the path name of the DebugNameAndId.
std::string toString(RecoveryAction recoveryAction)
Convert the recovery action to a string.
RecoveryAction
An enumeration that specifies how to recover from a recoverable_runtime_error.
Definition: exceptions.hpp:351
@ PARTITION_RESET
Reset the IPU partition. This retrains the IPU-links between IPUs.
@ IPU_RESET
Reset the IPU and reload IPU memory.
@ FULL_RESET
Power cycle the system.
ErrorCode
Unique error codes for all the possible errors.
Definition: Error.hpp:31
Uniquely identify the location of an error within a Poplar Device.
Definition: Error.hpp:97
This exception is thrown when running a program fails due to an error in the program or a misuse of a...
Definition: exceptions.hpp:333
This exception is thrown when the construction of a graph program is invalid.
Definition: exceptions.hpp:92
This exception is thrown during construction of an Engine object if there is an error in the structur...
Definition: exceptions.hpp:133
This exception is thrown during the construction of an Engine object if there are any cycles in the g...
Definition: exceptions.hpp:142
This exception is thrown when an memory allocation fails.
Definition: exceptions.hpp:259
std::string profilePath
Holds the absolute path to the profile.pop file that was produced when this error occurred.
Definition: exceptions.hpp:265
This exception is thrown in the construction of a GraphProgEnv object if there was an error in the cr...
Definition: exceptions.hpp:44
This exception is thrown in the construction of a GraphProgEnv object if there was an error in loadin...
Definition: exceptions.hpp:53
This exception is thrown in the construction of a GraphProgEnv object if there are any compilation er...
Definition: exceptions.hpp:35
This exception is thrown during the construction of an Engine object if there are recursive calls.
Definition: exceptions.hpp:151
This exception is thrown when an invalid operation is carried out on a replicated graph.
Definition: exceptions.hpp:161
This exception is thrown if the index of a subscript is out of the bounds of the field it is accessin...
Definition: exceptions.hpp:111
This exception is thrown when an invalid model of the IPU (for performance model profiling) has been ...
Definition: exceptions.hpp:283
This exception is thrown when an unrecognised or invalid option is passed to a Poplar API.
Definition: exceptions.hpp:292
This exception is thrown when the tile mapping passed to the UserTilePartitioner is invalid.
Definition: exceptions.hpp:196
This exception is thrown when an invalid memory element constraint has been provided in a codelet.
Definition: exceptions.hpp:251
This exception is thrown if the graph and/or execution profile is required but the graph profile that...
Definition: exceptions.hpp:179
This exception is thrown when an Engine is constructed with profiling enabled but a vertex does not h...
Definition: exceptions.hpp:188
This exception is thrown, in the construction of a GraphProgEnv object, in mixed-mode compilation,...
Definition: exceptions.hpp:64
This exception is thrown if the size of a field is not specified in a Graph object when an EngineBuil...
Definition: exceptions.hpp:121
This exception is thrown when an arithmetic overflow occurs within Poplar.
Definition: exceptions.hpp:242
This exception is thrown when an input file or string cannot be parsed.
Definition: exceptions.hpp:413
Base class for Poplar exceptions.
Definition: exceptions.hpp:16
This exception is thrown if profiling information is requested from an Engine but that Engine has not...
Definition: exceptions.hpp:170
This exception is thrown when when running a program fails due to a system error that is likely to be...
Definition: exceptions.hpp:368
RecoveryAction getRecoveryAction() const
Return the action required to recover from error.
Definition: exceptions.hpp:374
This exception is thrown when running a program on a system fails.
Definition: exceptions.hpp:310
std::vector< ErrorInfo > errors
Additional information about why the exception was thrown.
Definition: exceptions.hpp:323
This exception is thrown when an invalid attempt is made to connect a data stream.
Definition: exceptions.hpp:233
This exception is thrown when allocation of stream buffers fails.
Definition: exceptions.hpp:274
This exception is thrown when running a program fails due to an error in the system it is running on.
Definition: exceptions.hpp:342
This exception is thrown in the construction of a tensor if invalid arguments are provided to the ten...
Definition: exceptions.hpp:205
This exception is thrown when an attempt is made to mark a tensor as an input or output,...
Definition: exceptions.hpp:215
This exception is thrown if a tensor uses a type that requires metadata and the metadata is not acces...
Definition: exceptions.hpp:224
This exception is thrown when there is an error related to the field types of vertices,...
Definition: exceptions.hpp:102
This exception is thrown when a field name is specified that does not exist in the graph-programming ...
Definition: exceptions.hpp:81
This exception is throw when execution fails due to a system error where the cause cannot be automati...
Definition: exceptions.hpp:394
This exception is thrown when a vertex type name is specified that does not exist in the graph progra...
Definition: exceptions.hpp:73
This exception is thrown when execution fails due to a system error that is likely to persist.
Definition: exceptions.hpp:385