@@ -43,3 +43,63 @@ def get_quant_attrs(
4343
4444 quant_attrs [QCOM_ENCODING ] = quant_node .target
4545 return quant_attrs
46+
47+
48+ def get_passes_dependency_for_capture_program ():
49+ """
50+ This function records the dependencies for passes used in the capture_program.
51+
52+ It returns a dictionary where the keys are pass classes and the values are lists of
53+ dependencies required by each pass. This helps in managing and organizing the sequence
54+ of passes needed for the capture_program to function correctly.
55+
56+ Returns:
57+ dict: A dictionary mapping each pass to its corresponding list of dependencies.
58+ """
59+ from executorch .backends .qualcomm ._passes import (
60+ AnnotateAndQuantScalar ,
61+ AnnotateDecomposed ,
62+ AnnotateQuantAttrs ,
63+ ConvertBmmToMatmul ,
64+ ConvertInterpolateWithUpsample2D ,
65+ ConvertPReLU ,
66+ ConvertToLinear ,
67+ ExpandBroadcastTensorShape ,
68+ FoldQDQ ,
69+ I64toI32 ,
70+ LayoutTransform ,
71+ RecomposePixelUnshuffle ,
72+ RecomposeRmsNorm ,
73+ RemoveRedundancy ,
74+ ReplaceIndexPutInput ,
75+ )
76+
77+ return {
78+ RecomposePixelUnshuffle : [RemoveRedundancy ],
79+ RecomposeRmsNorm : [RemoveRedundancy ],
80+ ConvertToLinear : [RecomposePixelUnshuffle ],
81+ ConvertPReLU : [RemoveRedundancy ],
82+ ConvertBmmToMatmul : [ConvertToLinear ],
83+ ConvertInterpolateWithUpsample2D : [RemoveRedundancy ],
84+ I64toI32 : [RemoveRedundancy ],
85+ AnnotateQuantAttrs : [
86+ RecomposePixelUnshuffle ,
87+ RecomposeRmsNorm ,
88+ ConvertToLinear ,
89+ ConvertPReLU ,
90+ ConvertBmmToMatmul ,
91+ ConvertInterpolateWithUpsample2D ,
92+ ],
93+ AnnotateAndQuantScalar : [
94+ AnnotateQuantAttrs ,
95+ ],
96+ AnnotateDecomposed : [RemoveRedundancy ],
97+ FoldQDQ : [AnnotateQuantAttrs , AnnotateAndQuantScalar , AnnotateDecomposed ],
98+ ExpandBroadcastTensorShape : [RemoveRedundancy ],
99+ LayoutTransform : [
100+ AnnotateQuantAttrs ,
101+ AnnotateAndQuantScalar ,
102+ ExpandBroadcastTensorShape ,
103+ ],
104+ ReplaceIndexPutInput : [LayoutTransform ],
105+ }
0 commit comments