Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraint violated: f.stride.0 (2) == 1 (1) #3109

9cvele3 opened this Issue Jul 9, 2018 · 1 comment


None yet
3 participants
Copy link

9cvele3 commented Jul 9, 2018

I use Tuple to get multiple outputs,

combinedOutput(x, y) = {
            outputFunc00(x, y),
            outputFunc01(x, y),
            outputFunc02(x, y),
            outputFunc03(x, y),
            outputFunc04(x, y),
            outputFunc05(x, y)

combinedOutput.realize({out00, out01, out02, out03, out04, out05});

I have set strides for Halide::Runtime::Buffer s out00 ... out05 to fit my problem. This included changing the stride over dimension 0. However, I get an error:

Constraint violated: combinedOutput.0.stride.0 (2) == 1 (1)

After looking in the stmt html output, I see that the loop nest is generated just as I need it, but I also see the assert:
assert((combinedOutput.0.stride.0 == 1), halide_error_constraint_violated("combinedOutput.0.stride.0", combinedOutput.0.stride.0, "1", 1))
Similar asserts are there for combinedOutput.1.stride.0, combinedOutput.2.stride.0 etc. I don't see this kind of assert for other dimensions, just for stride.0.

Since combinedOutput is a Func, I can't (or at least I don't know to) set its stride manually.

Can this assert be removed or circumvented?


This comment has been minimized.

Copy link

abadams commented Jul 9, 2018

We have a default constraint of stride==1 on the innermost dimension, so that vectorization works out well. Otherwise Halide would be slow by default. To unset the stride constraint on a Func, use:

combinedOutput.output_buffers()[0].set_stride(0, Expr());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.