Module

#include <poplar/Module.hpp>
namespace poplar

Poplar classes and functions.

class Module
#include <Module.hpp>

An instance of poplar::Module contains all of the information needed to run a program on an IPU device.

It can be saved to or loaded from disk.

Public Functions

~Module()
Module()
Module(Module &&other) noexcept
Module &operator=(Module &&other) noexcept
explicit Module(std::shared_ptr<const core::Executable> impl)
void serialize(std::ostream &out) const

Serialize a module to a stream.

All of the binary files and metadata needed to run a Poplar module will be written to the stream. Currently the format is opaque, and compatibility between different versions of Poplar is not guaranteed.

Parameters

out – The stream to write to. It must be seekable.

Throws

poplar_error – if the target is not an IPU. This class cannot be used to serialise CPU or IPU_MODEL modules.

inline const core::Executable &getImpl() const
void forEachSegment(std::function<void(size_t tile, size_t address, size_t fileSize, size_t memorySize, const char *data)> f) const

A method for iterating over all segments of the executable image for each tile, with a callback that takes the address, size, and pointer to the data of each one.

Parameters

f – The callback to run on each segment of the executable image. Note that the tile argument is the Poplar tile index, not the physical tile index.

Throws

poplar_error – if the target is not an IPU.

void forEachLoadableSegment(std::function<void(size_t tile, size_t address, size_t size, const char *data)> f) const

A method for iterating over all segments of the executable image for each tile.

With a callback that takes the address, size, and pointer to the data of each one. Empty segments are skipped.

Parameters

f – The callback to run on each segment of the executable image. Note that the tile argument is the Poplar tile index, not the physical tile index.

Throws

poplar_error – if the target is not an IPU.

Public Static Functions

static Module deserialize(std::istream &in, bool checkPackageHash = true)

Load a module from a stream.

Parameters
  • in – The stream to read from. It must be seekable.

  • checkPackageHash – Flag to enable package hash checking (true by default).

Private Members

std::shared_ptr<const core::Executable> impl
namespace core