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

[Arith] Inverse affine map #8384

Merged
merged 3 commits into from
Jul 4, 2021
Merged

[Arith] Inverse affine map #8384

merged 3 commits into from
Jul 4, 2021

Conversation

vinx13
Copy link
Member

@vinx13 vinx13 commented Jul 1, 2021

This PR added a utility function to perform inverse transformation for the bijective affine map. This will be helpful for tensorization in the future.

@tqchen

* [Arith] Inverse affine map

* Update iter_affine_map.h

* Update iter_affine_map.h

* Update iter_affine_map.py

* Topology order visit

* doc

* fix

* address comments
@vinx13 vinx13 force-pushed the feat/inv_affine branch 2 times, most recently from 0e9cdb4 to 8002518 Compare July 1, 2021 18:56
iter_map = tvm.arith.detect_iter_map([l0_1_l1_1_fused[0], l0_0[0], l1_0[0]], var_dom([l0, l1]))
outputs = [tvm.tir.Var("output_{}".format(i), "int32") for i in range(len(iter_map))]
res = tvm.arith.inverse_affine_iter_map(iter_map, outputs)
print(res)
Copy link
Contributor

Choose a reason for hiding this comment

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

this line can be removed

ICHECK(base_scale.defined());
std::vector<IterSplitExpr> iters;
std::vector<bool> visited(sum_expr->args.size(), false);
PrimExpr expected_scale = base_scale;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can expect the sum expression has its children in descending order, so to search for base scale is not necessary

Copy link
Member Author

Choose a reason for hiding this comment

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

if the sum expression is produced by DetectIterMap this is true, can we can simply this whole function, I can add some assertions to check this assumption @tqchen

Copy link
Member

Choose a reason for hiding this comment

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

sorry I've just merged it...

@masahi masahi merged commit e32d47e into apache:main Jul 4, 2021
@tqchen
Copy link
Member

tqchen commented Jul 4, 2021

@vinx13 let us followup with another PR to address the last comment @spectrometerHBH bought up

ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* [Arith] Inverse affine map

* [Arith] Inverse affine map

* Update iter_affine_map.h

* Update iter_affine_map.h

* Update iter_affine_map.py

* Topology order visit

* doc

* fix

* address comments

* lint

* remove print
zxy844288792 pushed a commit to zxy844288792/tvm that referenced this pull request Mar 4, 2022
* [Arith] Inverse affine map

* [Arith] Inverse affine map

* Update iter_affine_map.h

* Update iter_affine_map.h

* Update iter_affine_map.py

* Topology order visit

* doc

* fix

* address comments

* lint

* remove print
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.

4 participants