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

[next]: origin not supported with temporaries in gtfn #1539

Open
tehrengruber opened this issue Apr 25, 2024 · 0 comments
Open

[next]: origin not supported with temporaries in gtfn #1539

tehrengruber opened this issue Apr 25, 2024 · 0 comments

Comments

@tehrengruber
Copy link
Contributor

The test_hdiff test fails when using the gtfn backend with always_extract_heuristics heuristics. Most likely this is due to the origins and the negative domains that appear in the temporaries.

hdiff(inp, coeff, out, x, y) {
  _tmp_1 = temporary(
    domain=c⟨ IDim: [minimum(0, 0 + 1), maximum(x, x + 1)), JDim: [minimum(0 + 1, 0), maximum(y + 1, y)) ⟩,
    dtype=float64
  );
  _tmp_2 = temporary(domain=c⟨ IDim: [0 + -1, x + -1), JDim: [0, y) ⟩, dtype=float64);
  _tmp_3 = temporary(domain=c⟨ IDim: [0, x), JDim: [0 + -1, y + -1) ⟩, dtype=float64);
  _tmp_4 = temporary(domain=c⟨ IDim: [0, x), JDim: [0 + -1 + 1, y + -1 + 1) ⟩, dtype=float64);
  _tmp_5 = temporary(domain=c⟨ IDim: [0 + -1 + 1, x + -1 + 1), JDim: [0, y) ⟩, dtype=float64);
  hdiff(inp, coeff, out, x, y, _tmp_1, _tmp_2, _tmp_3, _tmp_4, _tmp_5) {
    _tmp_1 ← (
        λ(inp_) → -4.0 × ·inp_ + (·⟪Iₒ, 1ₒ⟫(inp_) + ·⟪Iₒ, -1ₒ⟫(inp_) + ·⟪Jₒ, 1ₒ⟫(inp_) + ·⟪Jₒ, -1ₒ⟫(inp_))
      )(inp) @ c⟨ IDim: [minimum(0, 0 + 1), maximum(x, x + 1)), JDim: [minimum(0 + 1, 0), maximum(y + 1, y)) ⟩;
    _tmp_5 ← (
        λ(inp) → -4.0 × ·inp + (·⟪Iₒ, 1ₒ⟫(inp) + ·⟪Iₒ, -1ₒ⟫(inp) + ·⟪Jₒ, 1ₒ⟫(inp) + ·⟪Jₒ, -1ₒ⟫(inp))
      )(inp) @ c⟨ IDim: [0 + -1 + 1, x + -1 + 1), JDim: [0, y) ⟩;
    _tmp_2 ← (
        λ(inp, _tmp_5) → 
          (λ(_cs_4, _cs_5) → 
             (λ(_cs_1) → if _cs_1 × (_cs_5 - _cs_4) > 0.0 then 0.0 else _cs_1)(
               -4.0 × _cs_4 + (_cs_5 + ·⟪Iₒ, -1ₒ⟫(inp) + ·⟪Jₒ, 1ₒ⟫(inp) + ·⟪Jₒ, -1ₒ⟫(inp)) - ·⟪Iₒ, 1ₒ⟫(_tmp_5)
             ))(·inp, ·⟪Iₒ, 1ₒ⟫(inp))
      )(inp, _tmp_5) @ c⟨ IDim: [0 + -1, x + -1), JDim: [0, y) ⟩;
    _tmp_4 ← (
        λ(inp) → -4.0 × ·inp + (·⟪Iₒ, 1ₒ⟫(inp) + ·⟪Iₒ, -1ₒ⟫(inp) + ·⟪Jₒ, 1ₒ⟫(inp) + ·⟪Jₒ, -1ₒ⟫(inp))
      )(inp) @ c⟨ IDim: [0, x), JDim: [0 + -1 + 1, y + -1 + 1) ⟩;
    _tmp_3 ← (
        λ(inp, _tmp_4) → 
          (λ(_cs_9, _cs_10) → 
             (λ(_cs_6) → if _cs_6 × (_cs_10 - _cs_9) > 0.0 then 0.0 else _cs_6)(
               -4.0 × _cs_9 + (·⟪Iₒ, 1ₒ⟫(inp) + ·⟪Iₒ, -1ₒ⟫(inp) + _cs_10 + ·⟪Jₒ, -1ₒ⟫(inp)) - ·⟪Jₒ, 1ₒ⟫(_tmp_4)
             ))(·inp, ·⟪Jₒ, 1ₒ⟫(inp))
      )(inp, _tmp_4) @ c⟨ IDim: [0, x), JDim: [0 + -1, y + -1) ⟩;
    out ← (
        λ(inp, coeff, _tmp_1, _tmp_2, _tmp_3) → 
          (λ(_cs_19, _cs_20, _cs_21) → 
             (λ(_cs_17) → 
                (λ(_cs_11, _cs_13) → 
                   _cs_19
                   - ·coeff × ((if _cs_13 × (_cs_21 - _cs_19) > 0.0 then 0.0 else _cs_13) - ·⟪Iₒ, -1ₒ⟫(_tmp_2)
                               + (if _cs_11 × (_cs_20 - _cs_19) > 0.0 then 0.0 else _cs_11) - ·⟪Jₒ, -1ₒ⟫(_tmp_3)))(
                  _cs_17 - ·⟪Jₒ, 1ₒ⟫(_tmp_1), _cs_17 - ·⟪Iₒ, 1ₒ⟫(_tmp_1)
                ))(-4.0 × _cs_19 + (_cs_21 + ·⟪Iₒ, -1ₒ⟫(inp) + _cs_20 + ·⟪Jₒ, -1ₒ⟫(inp))))(
            ·inp, ·⟪Jₒ, 1ₒ⟫(inp), ·⟪Iₒ, 1ₒ⟫(inp)
          )
      )(inp, coeff, _tmp_1, _tmp_2, _tmp_3) @ c⟨ IDim: [0, x), JDim: [0, y) ⟩;
  };
  hdiff(inp, coeff, out, x, y, _tmp_1, _tmp_2, _tmp_3, _tmp_4, _tmp_5);
}
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

No branches or pull requests

1 participant