You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "masahi (via GitHub)" <gi...@apache.org> on 2023/10/01 19:45:11 UTC
[GitHub] [tvm] masahi opened a new issue, #15851: [Bug][Unity] Legalization of cumsum op is broken
masahi opened a new issue, #15851:
URL: https://github.com/apache/tvm/issues/15851
`R.cumsum` is legalized to `topi.cumsum` according to
https://github.com/apache/tvm/blob/unity/python/tvm/relax/transform/legalize_ops/statistical.py#L90-L92
But this is broken on GPU. `topi.cumsum` is one of topi ops that cannot be defined by `te.compute` and thus they are written using IR builder by hand, for CPU and GPU targets separately. Since `topi.cumsum` is meant to be used only for CPU targets, after legalization we get TIR that has a for loop with `parallel` kind, for example, even on GPU. Other common ops that would have the same issue include sorting etc.
So in this case, it would be more correct to use `topi.cuda.cumsum` for legalizing `relax.cumsum`, meaning the `LegalizeOp` pass needs to be target dependent. But I think that would break the original semantics of `LegalizeOp`. `DefaultGPUSchedule` pass also needs to ignore such legalized ops carefully since they are already scheduled for GPU by hand.
I think we need to discuss what the Relax compilation story is going to be for such ops that were previously implemented using `te.extern`.
cc @tqchen @MasterJH5574 @Hzfengsy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Unity] Legalization of cumsum op is broken [tvm]
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on issue #15851:
URL: https://github.com/apache/tvm/issues/15851#issuecomment-1742938886
In this particular case, we should build up a tensor ir of cumsum, and then bring dlight schedule for them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug][Unity] Legalization of cumsum op is broken [tvm]
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen commented on issue #15851:
URL: https://github.com/apache/tvm/issues/15851#issuecomment-1798618247
opens up a discussion thread in https://discuss.tvm.apache.org/t/discuss-default-compilation-flow-for-scan-and-sort/15949
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org