refactor tryMatchSchema (#26499)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26499
We've changed how these functions are used over time, so I cleaned up
the header file API to match. In particular:
* tryMatchSchemas was added since the overload logic got copy/pasted
into three separate locations.
* With this change, tryMatchSchema is no longer public, as it is not needed
outside of tryMatchSchemas
* emitBuiltinFunction no longer needs a requires argument (it was always true)
* Argument order for all the schema matching stuff now puts the 'self'
builtin override last. This is only rarely used and was inconsistent with
matchSchema
Test Plan: Imported from OSS
Differential Revision: D17488297
Pulled By: zdevito
fbshipit-source-id: a32d838ce35544972fa8767557acc22149081b55