[Bug][Unity] Legalization of cumsum op is broken #15851
Labels
branch: unity
needs-triage
PRs or issues that need to be investigated by maintainers to find the right assignees to address it
type: bug
R.cumsum
is legalized totopi.cumsum
according tohttps://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 byte.compute
and thus they are written using IR builder by hand, for CPU and GPU targets separately. Sincetopi.cumsum
is meant to be used only for CPU targets, after legalization we get TIR that has a for loop withparallel
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 legalizingrelax.cumsum
, meaning theLegalizeOp
pass needs to be target dependent. But I think that would break the original semantics ofLegalizeOp
.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 @Hzfengsy @MasterJH5574 @quic-sanirudh @tqchen
The text was updated successfully, but these errors were encountered: