mbrookhart commented on a change in pull request #6978: URL: https://github.com/apache/tvm/pull/6978#discussion_r530658429
########## File path: python/tvm/topi/cuda/sort.py ########## @@ -593,3 +694,76 @@ def schedule_topk(outs): The computation schedule for the op. """ return _schedule_sort(outs) + + +def _dyn_topk_legalize(attrs, inputs, arg_types): + """Legalizes dyn.topk op. + + Parameters + ---------- + attrs : tvm.ir.Attrs + Attributes of current convolution + inputs : list of tvm.relay.Expr + The args of the Relay expr to be legalized + types : list of types + List of input and output types + + Returns + ------- + result : tvm.relay.Expr Review comment: This is how the other legalization functions are structured, which admittedly seems odd to me, but they have functions in topi implementing relay passes and calling relay, see cuda conv2d here: https://github.com/apache/tvm/blob/c58b20bbd8e6ac7128e82994624d922ee6b8a069/python/tvm/topi/cuda/conv2d_alter_op.py#L271-L348 I did attempt to do this more directly in the relay files, and got a lot of circular imports, so I decided to follow the example of the other ops. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org