You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce codegen time spent resolving builtin overloads #2186
Every builtin call in a kernel is resolved against all overloads of the builtin until one accepts the argument types. Arithmetic builtins have many overloads (mul has 179, add and sub 72 each), and most attempts are rejected on argument types, so overload resolution is the largest single cost of the Python half of a module build. Each rejected attempt also bound the argument types with inspect.Signature.bind().
This affects every build and, for kernels whose wp.static() expressions depend on loop variables, every module="unique" declaration, since those modules are built when their hash is computed. In mujoco_warp's narrowphase factory, which unrolls collision functions through wp.static(), one declaration makes about 8,700 calls and resolution takes about 40% of the time.
Planned:
Avoid Signature.bind() when matching plain positional calls (in review).
Reduce the number of overloads tried per call, for example by prefiltering overloads on argument types while keeping the existing matching order and rules authoritative.
Activity
@wp.kernel(module="unique")Python-side decoration cost makes factory-pattern kernels expensive #1486