Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ Parameter::Parameter(const Type &t, int dimensions, const std::string &name,
const Buffer<void> &buffer, int host_alignment, const std::vector<BufferConstraint> &buffer_constraints,
MemoryType memory_type)
: contents(new Internal::ParameterContents(t, /*is_buffer*/ true, dimensions, name)) {
// Every other constructor keeps buffer_constraints sized to the
// dimensionality, and check_dim_ok() relies on that when indexing it. This
// reconstruction path takes the vector verbatim, so a serialized pipeline
// claiming more dimensions than it carries constraints for would let the
// constraint accessors read past the vector.
user_assert(buffer_constraints.size() == (size_t)std::max(0, dimensions))
<< "Buffer Parameter " << name << " has " << dimensions
<< " dimensions but " << buffer_constraints.size() << " dimension constraints\n";
contents->buffer = buffer;
contents->host_alignment = host_alignment;
contents->buffer_constraints = buffer_constraints;
Expand Down
Loading