Skip to content

Conversation

@steven-johnson
Copy link
Contributor

The existing code will emit something like halide_dimension_t foo_buffer_shape[] = {}; for these, which is a zero-length array, which some compilers will (justifiably) say has no effect. We should be able to just use nullptr for the shape in these cases.

The existing code will emit something like `halide_dimension_t foo_buffer_shape[] = {};` for these, which is a zero-length array, which some compilers will (justifiably) say has no effect. We should be able to just use nullptr for the shape in these cases.
@steven-johnson steven-johnson requested a review from vksnk November 23, 2021 02:05
stream << "halide_dimension_t(" << buffer.dim(i).min()
<< ", " << buffer.dim(i).extent()
<< ", " << buffer.dim(i).stride() << ")";
if (i < buffer.dimensions() - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An alternative (maybe simpler) solution is to just emit a dummy default constructed halide_dimension_t, i.e. {{}}.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, but then we need to allocate a (trivial) amount of extra space for dimensions that shouldn't ever be used.

@steven-johnson steven-johnson merged commit d12fbd1 into master Nov 23, 2021
@steven-johnson steven-johnson deleted the srj/scalar-c-buffers branch November 23, 2021 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants