You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update base for Update on "[ET-VK] Replace Uniform buffers with push constants for permute op"
This diff replaces uniform buffers with push constants for permute op in the Vulkan backend of Executorch. The changes include updating the GLSL code to use push constants instead of uniform buffers and updating the C++ code to pass the sizes as push constants to the shader.
Differential Revision: [D66890825](https://our.internmc.facebook.com/intern/diff/D66890825/)
[ghstack-poisoned]
Reshape operations are not equivalent in NCHW and NHWC.
124
-
To get around this, transposes need to be added if the previous or new shape
125
-
fulfil the following condition:
126
-
C > 1 and (H or W > 1)
127
-
128
-
This is relevant for the following operations;
129
-
squeeze: 4D -> 3D
130
-
unsqueeze: <4D -> 4D
131
-
view: <4D -> 4D
132
-
view: 4D -> <4D
133
-
view: 4D -> 4D
134
-
"""
135
-
136
-
deftranspose_condition(shape):
137
-
iflen(shape) !=4:
138
-
returnFalse
139
-
C=shape[1]
140
-
H=shape[2]
141
-
W=shape[3]
142
-
returnC>1and (H>1orW>1)
203
+
Transposes are needed for operators transforming the input to a different rank, as 4D-tensors are assumed to be in NHWC-format, whereas all other are in NCHW format.
204
+
This is relevant for the following cases:
205
+
- squeeze: 4D -> <4D
206
+
- unsqueeze: 3D -> 4D
207
+
- view: <4D -> 4D
208
+
- view: 4D -> <4D
209
+
Additionally, a 4D->4D view operation acting on the channel dimension currently needs to be performed in NCHW format, leadning to one extra input and output transpose for this case.
143
210
211
+
Transposes can be avoided for shapes where there is no difference in actual memory, e.g for
0 commit comments