Skip to content

Commit

Permalink
Support more ops for recompute (microsoft#20234)
Browse files Browse the repository at this point in the history
### Support more ops for recompute

To cover Mistral model, and support padding elimination ops.

### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
  • Loading branch information
pengwa authored Apr 9, 2024
1 parent 22a61a3 commit 41acd8c
Showing 1 changed file with 59 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ const InlinedHashMap<std::string, OpsetToIgnorableIndicesMap>& GetAllowedRecompu
{20, {0}},
},
},
{
utils::GetFullQualifiedOpName("Cos", kOnnxDomain),
{
{7, {}},
},
},
{
utils::GetFullQualifiedOpName("CumSum", kOnnxDomain),
{
// The axis input is trivial
{11, {1}},
{14, {1}},
},
},
{
utils::GetFullQualifiedOpName("Dropout", kOnnxDomain),
{
Expand All @@ -162,27 +176,6 @@ const InlinedHashMap<std::string, OpsetToIgnorableIndicesMap>& GetAllowedRecompu
{14, {}},
},
},
{
utils::GetFullQualifiedOpName("Expand", kOnnxDomain),
{
{8, {1}}, // Ignore the shape.
{13, {1}},
},
},
{
utils::GetFullQualifiedOpName("Cos", kOnnxDomain),
{
{7, {}},
},
},
{
utils::GetFullQualifiedOpName("CumSum", kOnnxDomain),
{
// The axis input is trivial
{11, {1}},
{14, {1}},
},
},
{
utils::GetFullQualifiedOpName("Einsum", kOnnxDomain),
{
Expand All @@ -199,12 +192,25 @@ const InlinedHashMap<std::string, OpsetToIgnorableIndicesMap>& GetAllowedRecompu
{19, {}},
},
},
{
utils::GetFullQualifiedOpName("Expand", kOnnxDomain),
{
{8, {1}}, // Ignore the shape.
{13, {1}},
},
},
{
utils::GetFullQualifiedOpName("FastGelu", kMSDomain),
{
{1, {}},
},
},
{
utils::GetFullQualifiedOpName("FlattenAndUnpad", kMSDomain),
{
{1, {1}}, // ignore the indices
},
},
{
utils::GetFullQualifiedOpName("Gather", kOnnxDomain),
{
Expand All @@ -225,6 +231,17 @@ const InlinedHashMap<std::string, OpsetToIgnorableIndicesMap>& GetAllowedRecompu
{1, {}},
},
},
{
utils::GetFullQualifiedOpName("Gemm", kOnnxDomain),
{
{1, {}},
{6, {}},
{7, {}},
{9, {}},
{11, {}},
{13, {}},
},
},
{
utils::GetFullQualifiedOpName("Less", kOnnxDomain),
{
Expand All @@ -244,6 +261,27 @@ const InlinedHashMap<std::string, OpsetToIgnorableIndicesMap>& GetAllowedRecompu
{14, {}},
},
},
{
utils::GetFullQualifiedOpName("Neg", kOnnxDomain),
{
{1, {}},
{6, {}},
{13, {}},
},
},
{
utils::GetFullQualifiedOpName("NonZero", kOnnxDomain),
{
{9, {}},
{13, {}},
},
},
{
utils::GetFullQualifiedOpName("PadAndUnflatten", kMSDomain),
{
{1, {1, 2}}, // ignore the indices and unflatten_dims
},
},
{
utils::GetFullQualifiedOpName("Range", kOnnxDomain),
{
Expand Down

0 comments on commit 41acd8c

Please sign in to comment.