aboutsummaryrefslogtreecommitdiff
path: root/include/armnn
diff options
context:
space:
mode:
Diffstat (limited to 'include/armnn')
-rw-r--r--include/armnn/Exceptions.hpp9
-rw-r--r--include/armnn/backends/IBackendInternal.hpp9
2 files changed, 16 insertions, 2 deletions
diff --git a/include/armnn/Exceptions.hpp b/include/armnn/Exceptions.hpp
index e21e974fc7..066f59f792 100644
--- a/include/armnn/Exceptions.hpp
+++ b/include/armnn/Exceptions.hpp
@@ -64,12 +64,19 @@ private:
std::string m_Message;
};
-class ClRuntimeUnavailableException : public Exception
+/// Class for non-fatal exceptions raised while initialising a backend
+class BackendUnavailableException : public Exception
{
public:
using Exception::Exception;
};
+class ClRuntimeUnavailableException : public BackendUnavailableException
+{
+public:
+ using BackendUnavailableException::BackendUnavailableException;
+};
+
class InvalidArgumentException : public Exception
{
public:
diff --git a/include/armnn/backends/IBackendInternal.hpp b/include/armnn/backends/IBackendInternal.hpp
index 29097b4ae7..6c919ee5d4 100644
--- a/include/armnn/backends/IBackendInternal.hpp
+++ b/include/armnn/backends/IBackendInternal.hpp
@@ -115,9 +115,16 @@ public:
virtual IWorkloadFactoryPtr CreateWorkloadFactory(
class TensorHandleFactoryRegistry& tensorHandleFactoryRegistry) const;
+ /// Create the runtime context of the backend
+ ///
+ /// Implementations may return a default-constructed IBackendContextPtr if
+ /// no context is needed at runtime.
+ /// Implementations must throw BackendUnavailableException if the backend
+ /// cannot be used (for example, necessary accelerator hardware is not present).
+ /// The default implementation always returns a default-constructed pointer.
virtual IBackendContextPtr CreateBackendContext(const IRuntime::CreationOptions&) const;
- // Context specifically used for profiling interaction from backends.
+ /// Create context specifically used for profiling interaction from backends.
virtual IBackendProfilingContextPtr CreateBackendProfilingContext(const IRuntime::CreationOptions& creationOptions,
armnn::profiling::IBackendProfiling& backendProfiling) const;