8#ifndef popops_DynamicSlice_hpp
9#define popops_DynamicSlice_hpp
10#include <poplar/Graph.hpp>
11#include <poplar/Program.hpp>
22class SlicePlanInternal;
36 friend std::ostream &operator<<(std::ostream &o,
const SlicePlan &p);
42 SlicePlan(std::unique_ptr<SlicePlanInternal> internal);
43 SlicePlanInternal &getImpl()
const {
return *internal; }
46 std::unique_ptr<SlicePlanInternal> internal;
70 const std::vector<size_t> &shape,
const std::vector<size_t> &dims,
71 const std::vector<size_t> &sizes, std::size_t minGrainSize = 0,
91 const std::vector<size_t> &shape,
92 const std::vector<size_t> &dims,
93 const std::vector<size_t> &sizes,
const SlicePlan &plan,
124 const std::vector<std::size_t> &shape,
const std::vector<std::size_t> &dims,
125 const std::vector<std::size_t> &sizes,
const SlicePlan &plan,
151 const std::vector<size_t> &dims,
152 const std::vector<size_t> &sizes,
153 std::size_t numIndices,
178 const std::vector<std::size_t> &shape,
179 const std::vector<std::size_t> &dims,
180 const std::vector<std::size_t> &sizes,
181 std::size_t numIndices,
const SlicePlan &plan,
217 const std::vector<std::size_t> &shape,
const std::vector<std::size_t> &dims,
218 const std::vector<std::size_t> &sizes,
const std::size_t numIndices,
240 std::size_t numIndices,
const SlicePlan &plan,
274 const std::vector<std::size_t> &dims,
275 const std::size_t numIndices,
const SlicePlan &plan,
298 const std::vector<std::size_t> &dims,
299 const std::vector<std::size_t> &numSlices,
329 const std::vector<std::size_t> &dims,
330 const std::vector<std::size_t> &sizes,
357 const std::vector<std::size_t> &dims,
358 const std::vector<std::size_t> &sizes,
372poplar::Graph::TileToTensorMapping
374 const std::vector<std::size_t> &dims,
375 const std::vector<std::size_t> &sizes);
399 const std::vector<std::size_t> &dims,
400 const std::vector<std::size_t> &sizes,
426 const std::vector<std::size_t> &dims,
427 const std::vector<std::size_t> &sizes,
461 const std::vector<std::size_t> &dims,
462 const std::vector<std::size_t> &sizes,
481 poplar::ArrayRef<unsigned> offsets, std::size_t dim,
501 const std::vector<std::size_t> &dims,
502 const std::vector<std::size_t> &sizes,
524 const std::vector<std::size_t> &dims,
525 const std::vector<std::size_t> &sizes,
552 const std::vector<std::size_t> &dims,
553 const std::vector<std::size_t> &sizes,
582 const std::vector<std::size_t> &dims,
const std::vector<std::size_t> &sizes,
629 const std::vector<std::size_t> &dims,
630 const std::vector<std::size_t> &sizes,
655 const poplar::Tensor &offsets,
const std::vector<std::size_t> &dims,
743 const std::size_t numEntries,
const std::size_t outputSize,
744 const std::vector<std::size_t> &numLookups,
750 const std::size_t groupSize,
const std::size_t numEntries,
751 const std::size_t outputSize,
752 const std::vector<std::size_t> &numLookups,
Poplibs generic debug info structure.
DebugContext gathers the common external parameters of the context of an operation.
Definition: DebugContext.hpp:221
This class represents a graph program to be executed on the IPU.
Definition: Graph.hpp:52
A set of option/value string flags to be used in various APIs.
Definition: OptionFlags.hpp:24
ProfileValue represents a read-only JSON-like tree of values that are used to store the output of the...
Definition: ProfileValue.hpp:39
A reference to a subset of tensor elements.
Definition: Tensor.hpp:38
Class representing device data types.
Definition: Type.hpp:42
Program that executes a sequence of programs.
Definition: Program.hpp:77
An object representing a plan that describes how to implement a slice or update.
Definition: DynamicSlice.hpp:27
Poplar classes and functions.
Definition: ArrayRef.hpp:14
Common functions, such as elementwise and reductions.
Definition: AllTrue.hpp:15
poplar::Tensor createGroupedIndicesTensor(poplar::Graph &graph, const std::size_t groupSize, const std::vector< std::size_t > &dims, const std::size_t numIndices, const SlicePlan &plan, const poplar::OptionFlags &, const poplar::DebugContext &debugContext={})
Create and map a tensor with a group dimension to contain indices for slicing or updating a tensor ef...
poplar::Graph::TileToTensorMapping getSliceMapping(poplar::Graph &graph, const poplar::Tensor &t, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes)
Get the tile mapping for a slice of a tensor.
void groupedMultiUpdateMax(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Find maximum over multiple slices in a tensor with a group dimension.
void multiUpdateAdd(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const poplar::Tensor &scale, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Accumulate multiple slices in a tensor.
poplar::Tensor createSliceableTensor(poplar::Graph &graph, const poplar::Type &type, const std::vector< size_t > &shape, const std::vector< size_t > &dims, const std::vector< size_t > &sizes, std::size_t minGrainSize=0, const poplar::DebugContext &debugContext={})
Create and map a tensor to be sliced/updated efficiently.
void groupedMultiUpdateAdd(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const poplar::Tensor &scale, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Accumulate multiple slices in a tensor where the first dimension of the tensors t,...
poplar::Tensor createIndicesTensor(poplar::Graph &graph, const std::vector< std::size_t > &dims, std::size_t numIndices, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Create and map a tensor to contain indices for slicing or updating a tensor efficiently.
poplar::Tensor createGroupedSliceTensor(poplar::Graph &graph, const poplar::Type &type, const std::size_t groupSize, const std::vector< std::size_t > &shape, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, const std::size_t numIndices, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Create and map a tensor with a group dimension that is used as a result of slicing,...
void groupedMultiUpdate(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Update multiple slices in a tensor with a group dimension.
void multiUpdateMax(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Find maximum over multiple slices in a tensor.
poplar::Tensor dynamicSlice(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &offset, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
Slice a tensor based on offsets specified by a tensor.
void dynamicSliceWithOutput(poplar::Graph &graph, const poplar::Tensor &output, const poplar::Tensor &t, const poplar::Tensor &offset, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
Slice a tensor based on offsets specified by a tensor.
poplar::Tensor multiSlice(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &offsets, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Take multiple slices from a base tensor.
poplar::Tensor createSliceableTensorFromSlice(poplar::Graph &graph, const poplar::Tensor &s, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &numSlices, const poplar::DebugContext &debugContext={})
Create and map a tensor to be sliced/updated.
poplar::Tensor createGroupedSliceableTensor(poplar::Graph &graph, const poplar::Type &type, const std::size_t groupSize, const std::vector< std::size_t > &shape, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Create and map a tensor with a group dimension to be sliced/updated efficiently.
poplar::Tensor createSliceTensor(poplar::Graph &graph, const poplar::Tensor &t, const std::vector< size_t > &dims, const std::vector< size_t > &sizes, std::size_t numIndices, const poplar::DebugContext &debugContext={})
Create and map a tensor that is used as a result of slicing, or as an input to an update.
poplar::Tensor groupedMultiSlice(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &offsets, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Take multiple slices from a base tensor where the base tensor and the offsets tensor have the group d...
void dynamicUpdate(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offset, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext={})
Update a subtensor at offsets read from a tensor.
void multiUpdate(poplar::Graph &graph, const poplar::Tensor &t, const poplar::Tensor &s, const poplar::Tensor &offsets, const std::vector< std::size_t > &dims, const std::vector< std::size_t > &sizes, poplar::program::Sequence &prog, const SlicePlan &plan, const poplar::OptionFlags &options, const poplar::DebugContext &debugContext={})
Update multiple slices in a tensor.