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

[TIR][CompactBufferAllocation] Improve upperbound estimation of buffer compaction #12527

Conversation

wrongtest-intellif
Copy link
Contributor

@wrongtest-intellif wrongtest-intellif commented Aug 22, 2022

Hi, this change wants to add some minor updation to region estimator used by buffer compaction:

  • Add and clearify among EstimateRegionStrictBound, EstimateRegionLowerBound and EstimateRegionUpperBound

    Originally we have EstimateRegionLowerBound, actually it implements strict bound estimation IMO. Now add upper and strict version for where we actually want them.

  • When estimating upperbounds (eg. in buffer compaction), try estimate each dimension independently when they are dependent accesses where EstimateRegionLowerBound is expected to fail.

    Eg, A[i, i], 3 < i < 16 fails via EstimateRegionLowerBound who check indices be independent. But we can still try best to invoke strict bound analysis on each dimension individually.

  • If range->extent == 1 for EvalSet(range, dom), invoke EvalSet(range->min, dom) instead.

    Eg, EvalSet([k*k, k*k+1), dom_k) results to [-inf, +inf] due to current algorithm limitation but EvalSet(k*k, dom_k) results to a range which makes more sense.

cc @Hzfengsy @junrushao @junrushao1994 @spectrometerHBH

@wrongtest-intellif wrongtest-intellif force-pushed the improve_upperbound_estimation_of_buffer_compaction branch from d76c1eb to 41a1615 Compare August 22, 2022 08:25
Copy link
Member

@Hzfengsy Hzfengsy left a comment

Choose a reason for hiding this comment

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

LGTM

@Hzfengsy Hzfengsy merged commit 1ec2c36 into apache:main Aug 24, 2022
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
…r compaction (apache#12527)

Hi, this change wants to add some minor updation to region estimator used by buffer compaction:
- Add and clearify among `EstimateRegionStrictBound`, `EstimateRegionLowerBound` and `EstimateRegionUpperBound`
   
  Originally we have `EstimateRegionLowerBound`, actually it implements strict bound estimation IMO. Now add `upper` and `strict` version for where we actually want them.

- When estimating upperbounds (eg. in buffer compaction), try estimate each dimension independently when they are dependent accesses where `EstimateRegionLowerBound` is expected to fail. 

  Eg, `A[i, i], 3 < i < 16`  fails via `EstimateRegionLowerBound` who check indices be independent. But we can still try best to invoke strict bound analysis on each dimension individually.

- If range->extent == 1 for `EvalSet(range, dom)`, invoke `EvalSet(range->min, dom)` instead.
  
  Eg, `EvalSet([k*k, k*k+1), dom_k)` results to [-inf, +inf] due to current algorithm limitation but  `EvalSet(k*k, dom_k)` results to a range which makes more sense.
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.

2 participants