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

[DISCUSS] Tensor Expr AutoDiff for TIR #46

Open
tqchen opened this issue Mar 16, 2020 · 5 comments
Open

[DISCUSS] Tensor Expr AutoDiff for TIR #46

tqchen opened this issue Mar 16, 2020 · 5 comments

Comments

@tqchen
Copy link
Contributor

tqchen commented Mar 16, 2020

This is something for fruit of thought as a possible future work. Not necessarily actionable right now.
https://discuss.tvm.ai/t/rfc-bring-in-tensor-expression-autodiff/5987

Discusses how can we introduce tensor expr level AD to the te.compute. It would be interesting to think about how can we generalize to the TIR level. In particular, if we place restrictions, such as making sure all blocks are complete, would we be able to run autodiff on the TIR directly written in hybrid script.

It would be useful to discuss and align possible designs right now so we can prepared for such as change, if it is possible.

cc @yzhliu @Hzfengsy @spectrometerHBH

@yzhliu
Copy link
Contributor

yzhliu commented Mar 18, 2020

Does our new tir allow user to modify index variables freely?

@tqchen
Copy link
Contributor Author

tqchen commented Mar 18, 2020

@yzhliu can you elaborate what do you mean?

@yzhliu
Copy link
Contributor

yzhliu commented Mar 19, 2020

For example, can user use %free_var as index like following ?

for %i = 0 to 15 {
  block(%v0[0:15]=%i) [W:[B[%v0:(%v0 + 1)]], R:[A[%v0:(%v0 + 1)]]] {
    %free_var = %v0 > 10 ? 0 : %v0
    %B[%free_var] = %A[%v0] * 2;
  }
}

and does it support index like %B[%A[%v0]]?

@tqchen
Copy link
Contributor Author

tqchen commented Mar 19, 2020

I don't think we could diff wrt to indirect indices, that is a restriction. If a variable is bound once, and its input are pure, i think it might be possible to diff wrt to that

@tqchen
Copy link
Contributor Author

tqchen commented Apr 22, 2020

had a discussion with @yzhliu about this, a high level summary is that we can do it, as long as all blocks are complete and we ignore the loops

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

2 participants