halide/Halide — pull request #471 by kree-colemcalughlin (2014-09-17 00:21:24+00:00)
Title: Tuple constraints

This is a small change to fix an issue Clay found with adding constraints to functions that spit out Tuples. To demonstrate, consider the Halide code:

```
Func out("out");
out(x) = Tuple(i_(x,0), i_(x,1), i_(x,2), i_(x,3));
out.output_buffers()[0].set_min(0, 0).set_min(1, 0);
```

This was producing a stmt like:

```
produce out {
for (out.s0.x, 0, out.0.extent.0) {
let out.0.value = input[out.s0.x]
let out.1.value = input[(out.s0.x + input.stride.1)]
let out.2.value = input[(out.s0.x + (input.stride.1*2))]
let out.3.value = input[(out.s0.x + (input.stride.1*3))]
out.0[out.s0.x] = out.0.value
out.1[(out.s0.x - out.0.min.0)] = out.1.value
out.2[(out.s0.x - out.0.min.0)] = out.2.value
out.3[(out.s0.x - out.0.min.0)] = out.3.value
}
}
```

With this change we can get rid of the extraneous out.0.min.0 variables, and get a stmt like:

```
produce out {
for (out.s0.x, 0, out.0.extent.0) {
let out.0.value = input[out.s0.x]
let out.1.value = input[(out.s0.x + input.stride.1)]
let out.2.value = input[(out.s0.x + (input.stride.1*2))]
let out.3.value = input[(out.s0.x + (input.stride.1*3))]
out.0[out.s0.x] = out.0.value
out.1[out.s0.x] = out.1.value
out.2[out.s0.x] = out.2.value
out.3[out.s0.x] = out.3.value
}
}
```