Support selector for functions.yaml and custom_ops.yaml targets in et_operator_library (#5957)
Summary:
Pull Request resolved: https://github.com/pytorch/executorch/pull/5957
executorch_generated_library accepts
functions_yaml_target: A Buck target pointing to the `functions.yaml`
file to use. Optional, but at least one of `functions_yaml_target`
and `custom_ops_yaml_target` must be specified.
custom_ops_yaml_target: A Buck target pointing to the `custom_ops.yaml`
file to use. Optional, but at least one of `functions_yaml_target`
and `custom_ops_yaml_target` must be specified.
However the rule expects these targets to be the string of the exact target "//xplat/..../functions_yaml:functions.yaml"
and had issues with the parameter being of type 'selector'
select({"//arvr:my_constraint": "//xplat/..../functions_yaml:functions.yaml", ....})
Selectively providing this target based off of config/constraint can be helpful, and it seems like the limitation was the formatting done on the strings prior to calling genrules inside of the rule.
What this enables:
Building the same et_operator_library target while specifying the functions.yaml and custom_ops.yaml targets as a function of a constraint, like processor type.
Example: D64004596
Reviewed By: tarun292, larryliu0820
Differential Revision: D63043331
fbshipit-source-id: 9ef00f2a7625b0b29ae860513d1044923d0a4a34 C
Chris Thompson committed
0d1250a79040b67cb0bb8b61f8a3e6df7b888acb
Parent: ed9f50f
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 10/8/2024, 11:09:32 PM