Skip to content

Is Operator Regsitration badly used?

Problem

Current registration of operator is done as:

Registrar<ConvOp<2>>("backend", OpImpl)

This look intuitive, until we meet the MetaOperator and GenericOperatorcase which are register as:

Registrar<MetaOperatorOp>(("backend", "type"), OpImpl)

This create a discrepency in the way we register operators.

Another issue this create is if we create a FC as a MetaOperator, using fuse_to_metaop, then we have to register again the OperatorImplementations.

This is also particulary annoying for python binding as we have to bind every specification of the template.

register_ConvOp2D(...)
register_FC(...)

Proposed solution

My proposed solution is to change the way we register Operator by using a simple:

Registrar<Operator>(("backend", "type"), OpImpl)

With this design, an FcOp or a MetaOperator with type "FC" will use the same registred values.

Python binding will be eased by binding one function register_operator(type, backend, op_impl).