Unifying TBE API using List (Backend) #3563
Open
+508
−312
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
As the number of arguments in TBE keeps growing, some of the optimizers run into number of arguments limitation (i.e., 64) during pytorch operation registration.
For long-term growth and maintenance, we hence redesign TBE API by packing some of the arguments into list. Note that not all arguments are packed.
We pack the arguments as a list for each type.
For common arguments, we pack
Momentum
into TensorListaux_tensor
int
arguments intoaux_int
float
arguments intoaux_float
bool
arguments intoaux_bool
.Similarly for optimizer-specific arguments, we pack
Momentum
that are not optional into TensorListoptim_tensor
int
arguments intooptim_int
float
arguments intooptim_float
bool
arguments intooptim_bool
.We see issues with pytorch registration across packing SymInt in python-C++, so we unroll and pass SymInt arguments individually.
This significantly reduces number of arguments. For example,
split_embedding_codegen_lookup_rowwise_adagrad_with_counter_function
, which currently has 61 arguments only have 26 arguments with this API design.Please refer to the design doc on which arguments are packed and signature.
Design doc:
https://docs.google.com/document/d/1dCBg7dcf7Yq9FHVrvXsAmFtBxkDi9o6u0r-Ptd4UDPE/edit?tab=t.0#heading=h.6bip5pwqq8xb
Full signature for each optimizer lookup function will be provided shortly.
Differential Revision: D68054868