executorch 0.3.0__cp312-cp312-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1134) hide show
  1. executorch/backends/apple/coreml/compiler/__init__.py +9 -0
  2. executorch/backends/apple/coreml/compiler/coreml_preprocess.py +377 -0
  3. executorch/backends/apple/coreml/executorchcoreml.pyi +10 -0
  4. executorch/backends/apple/coreml/partition/__init__.py +9 -0
  5. executorch/backends/apple/coreml/partition/coreml_partitioner.py +95 -0
  6. executorch/backends/apple/coreml/quantizer/__init__.py +9 -0
  7. executorch/backends/apple/coreml/quantizer/coreml_quantizer.py +7 -0
  8. executorch/backends/apple/coreml/runtime/inmemoryfs/setup.py +52 -0
  9. executorch/backends/apple/coreml/test/test_coreml_partitioner.py +85 -0
  10. executorch/backends/apple/coreml/test/test_coreml_quantizer.py +114 -0
  11. executorch/backends/apple/mps/__init__.py +10 -0
  12. executorch/backends/apple/mps/mps_preprocess.py +195 -0
  13. executorch/backends/apple/mps/operators/__init__.py +70 -0
  14. executorch/backends/apple/mps/operators/activation_ops.py +99 -0
  15. executorch/backends/apple/mps/operators/binary_ops.py +156 -0
  16. executorch/backends/apple/mps/operators/clamp_ops.py +60 -0
  17. executorch/backends/apple/mps/operators/constant_ops.py +109 -0
  18. executorch/backends/apple/mps/operators/convolution_ops.py +70 -0
  19. executorch/backends/apple/mps/operators/indexing_ops.py +225 -0
  20. executorch/backends/apple/mps/operators/linear_algebra_ops.py +52 -0
  21. executorch/backends/apple/mps/operators/node_visitor.py +439 -0
  22. executorch/backends/apple/mps/operators/normalization_ops.py +97 -0
  23. executorch/backends/apple/mps/operators/op_clone.py +35 -0
  24. executorch/backends/apple/mps/operators/op_getitem.py +29 -0
  25. executorch/backends/apple/mps/operators/pad_ops.py +37 -0
  26. executorch/backends/apple/mps/operators/pooling_ops.py +142 -0
  27. executorch/backends/apple/mps/operators/range_ops.py +53 -0
  28. executorch/backends/apple/mps/operators/reduce_ops.py +39 -0
  29. executorch/backends/apple/mps/operators/shape_ops.py +260 -0
  30. executorch/backends/apple/mps/operators/unary_ops.py +130 -0
  31. executorch/backends/apple/mps/partition/__init__.py +10 -0
  32. executorch/backends/apple/mps/partition/mps_partitioner.py +134 -0
  33. executorch/backends/apple/mps/serialization/mps_graph_schema.py +777 -0
  34. executorch/backends/apple/mps/serialization/mps_graph_serialize.py +30 -0
  35. executorch/backends/apple/mps/serialization/schema.fbs +478 -0
  36. executorch/backends/apple/mps/test/test_mps.py +2492 -0
  37. executorch/backends/apple/mps/test/test_mps_binary_ops.py +296 -0
  38. executorch/backends/apple/mps/test/test_mps_indexing_ops.py +264 -0
  39. executorch/backends/apple/mps/test/test_mps_models.py +416 -0
  40. executorch/backends/apple/mps/test/test_mps_unary_ops.py +26 -0
  41. executorch/backends/apple/mps/test/test_mps_utils.py +318 -0
  42. executorch/backends/apple/mps/utils/mps_utils.py +81 -0
  43. executorch/backends/arm/arm_backend.py +342 -0
  44. executorch/backends/arm/arm_partitioner.py +157 -0
  45. executorch/backends/arm/arm_vela.py +102 -0
  46. executorch/backends/arm/operators/__init__.py +23 -0
  47. executorch/backends/arm/operators/node_visitor.py +46 -0
  48. executorch/backends/arm/operators/op_add.py +107 -0
  49. executorch/backends/arm/operators/op_addmm.py +161 -0
  50. executorch/backends/arm/operators/op_avg_pool2d.py +49 -0
  51. executorch/backends/arm/operators/op_batch_norm.py +201 -0
  52. executorch/backends/arm/operators/op_clone.py +34 -0
  53. executorch/backends/arm/operators/op_common.py +52 -0
  54. executorch/backends/arm/operators/op_conv2d.py +169 -0
  55. executorch/backends/arm/operators/op_dequant.py +34 -0
  56. executorch/backends/arm/operators/op_div.py +40 -0
  57. executorch/backends/arm/operators/op_get_item.py +34 -0
  58. executorch/backends/arm/operators/op_hardtanh.py +62 -0
  59. executorch/backends/arm/operators/op_mean_dim.py +58 -0
  60. executorch/backends/arm/operators/op_permute.py +45 -0
  61. executorch/backends/arm/operators/op_placeholder.py +173 -0
  62. executorch/backends/arm/operators/op_quant.py +34 -0
  63. executorch/backends/arm/operators/op_softmax.py +95 -0
  64. executorch/backends/arm/operators/op_view.py +38 -0
  65. executorch/backends/arm/quantizer/__init__.py +4 -0
  66. executorch/backends/arm/quantizer/arm_quantizer.py +390 -0
  67. executorch/backends/arm/quantizer/arm_quantizer_utils.py +175 -0
  68. executorch/backends/arm/quantizer/quantization_annotation/__init__.py +56 -0
  69. executorch/backends/arm/quantizer/quantization_annotation/adaptive_ang_pool2d_annotator.py +70 -0
  70. executorch/backends/arm/quantizer/quantization_annotation/add_annotator.py +68 -0
  71. executorch/backends/arm/quantizer/quantization_annotation/conv_annotator.py +63 -0
  72. executorch/backends/arm/quantizer/quantization_annotation/linear_annotator.py +66 -0
  73. executorch/backends/arm/quantizer/quantization_annotation/max_pool2d_annotator.py +70 -0
  74. executorch/backends/arm/quantizer/quantization_annotation/mul_annotator.py +62 -0
  75. executorch/backends/arm/quantizer/quantization_config.py +58 -0
  76. executorch/backends/arm/test/common.py +45 -0
  77. executorch/backends/arm/test/misc/test_debug_feats.py +122 -0
  78. executorch/backends/arm/test/models/test_mobilenet_v2_arm.py +98 -0
  79. executorch/backends/arm/test/ops/test_add.py +144 -0
  80. executorch/backends/arm/test/ops/test_avg_pool.py +144 -0
  81. executorch/backends/arm/test/ops/test_batch_norm.py +725 -0
  82. executorch/backends/arm/test/ops/test_clone.py +106 -0
  83. executorch/backends/arm/test/ops/test_conv.py +311 -0
  84. executorch/backends/arm/test/ops/test_conv_combos.py +282 -0
  85. executorch/backends/arm/test/ops/test_depthwise_conv.py +195 -0
  86. executorch/backends/arm/test/ops/test_div.py +206 -0
  87. executorch/backends/arm/test/ops/test_linear.py +219 -0
  88. executorch/backends/arm/test/ops/test_mean_dim.py +134 -0
  89. executorch/backends/arm/test/ops/test_softmax.py +131 -0
  90. executorch/backends/arm/test/ops/test_view.py +103 -0
  91. executorch/backends/arm/test/tester/__init__.py +6 -0
  92. executorch/backends/arm/test/tester/arm_tester.py +348 -0
  93. executorch/backends/arm/test/tosautil/__init__.py +6 -0
  94. executorch/backends/arm/test/tosautil/tosa_test_utils.py +239 -0
  95. executorch/backends/arm/third-party/serialization_lib/python/serializer/__init__.py +3 -0
  96. executorch/backends/arm/third-party/serialization_lib/python/serializer/tosa_serializer.py +965 -0
  97. executorch/backends/arm/third-party/serialization_lib/python/tosa/ArithmeticRightShiftAttribute.py +54 -0
  98. executorch/backends/arm/third-party/serialization_lib/python/tosa/Attribute.py +29 -0
  99. executorch/backends/arm/third-party/serialization_lib/python/tosa/AxisAttribute.py +54 -0
  100. executorch/backends/arm/third-party/serialization_lib/python/tosa/ClampAttribute.py +145 -0
  101. executorch/backends/arm/third-party/serialization_lib/python/tosa/CondIfAttribute.py +67 -0
  102. executorch/backends/arm/third-party/serialization_lib/python/tosa/ConvAttribute.py +197 -0
  103. executorch/backends/arm/third-party/serialization_lib/python/tosa/CustomAttribute.py +106 -0
  104. executorch/backends/arm/third-party/serialization_lib/python/tosa/DType.py +18 -0
  105. executorch/backends/arm/third-party/serialization_lib/python/tosa/FFTAttribute.py +67 -0
  106. executorch/backends/arm/third-party/serialization_lib/python/tosa/FullyConnectedAttribute.py +67 -0
  107. executorch/backends/arm/third-party/serialization_lib/python/tosa/MatMulAttribute.py +67 -0
  108. executorch/backends/arm/third-party/serialization_lib/python/tosa/MulAttribute.py +54 -0
  109. executorch/backends/arm/third-party/serialization_lib/python/tosa/NegateAttribute.py +67 -0
  110. executorch/backends/arm/third-party/serialization_lib/python/tosa/Op.py +78 -0
  111. executorch/backends/arm/third-party/serialization_lib/python/tosa/PadAttribute.py +132 -0
  112. executorch/backends/arm/third-party/serialization_lib/python/tosa/PoolAttribute.py +197 -0
  113. executorch/backends/arm/third-party/serialization_lib/python/tosa/RFFTAttribute.py +54 -0
  114. executorch/backends/arm/third-party/serialization_lib/python/tosa/RescaleAttribute.py +210 -0
  115. executorch/backends/arm/third-party/serialization_lib/python/tosa/ReshapeAttribute.py +80 -0
  116. executorch/backends/arm/third-party/serialization_lib/python/tosa/ResizeAttribute.py +171 -0
  117. executorch/backends/arm/third-party/serialization_lib/python/tosa/ResizeMode.py +8 -0
  118. executorch/backends/arm/third-party/serialization_lib/python/tosa/SliceAttribute.py +119 -0
  119. executorch/backends/arm/third-party/serialization_lib/python/tosa/TableAttribute.py +80 -0
  120. executorch/backends/arm/third-party/serialization_lib/python/tosa/TileAttribute.py +80 -0
  121. executorch/backends/arm/third-party/serialization_lib/python/tosa/TosaBasicBlock.py +192 -0
  122. executorch/backends/arm/third-party/serialization_lib/python/tosa/TosaGraph.py +95 -0
  123. executorch/backends/arm/third-party/serialization_lib/python/tosa/TosaOperator.py +147 -0
  124. executorch/backends/arm/third-party/serialization_lib/python/tosa/TosaRegion.py +91 -0
  125. executorch/backends/arm/third-party/serialization_lib/python/tosa/TosaTensor.py +184 -0
  126. executorch/backends/arm/third-party/serialization_lib/python/tosa/TransposeAttribute.py +80 -0
  127. executorch/backends/arm/third-party/serialization_lib/python/tosa/TransposeConvAttribute.py +197 -0
  128. executorch/backends/arm/third-party/serialization_lib/python/tosa/Version.py +93 -0
  129. executorch/backends/arm/third-party/serialization_lib/python/tosa/WhileLoopAttribute.py +67 -0
  130. executorch/backends/arm/third-party/serialization_lib/python/tosa/__init__.py +0 -0
  131. executorch/backends/arm/third-party/serialization_lib/schema/tosa.fbs +324 -0
  132. executorch/backends/arm/third-party/serialization_lib/setup.py +18 -0
  133. executorch/backends/arm/third-party/serialization_lib/test/scripts/test_npy_fileio.py +152 -0
  134. executorch/backends/arm/third-party/serialization_lib/test/scripts/xunit/xunit.py +109 -0
  135. executorch/backends/arm/tosa_mapping.py +109 -0
  136. executorch/backends/arm/tosa_quant_utils.py +238 -0
  137. executorch/backends/arm/tosa_utils.py +191 -0
  138. executorch/backends/cadence/aot/__init__.py +5 -0
  139. executorch/backends/cadence/aot/compiler.py +108 -0
  140. executorch/backends/cadence/aot/export_example.py +87 -0
  141. executorch/backends/cadence/aot/functions.yaml +136 -0
  142. executorch/backends/cadence/aot/ops_registrations.py +160 -0
  143. executorch/backends/cadence/aot/passes.py +136 -0
  144. executorch/backends/cadence/aot/quantizer/fusion_pass.py +437 -0
  145. executorch/backends/cadence/aot/quantizer/patterns.py +343 -0
  146. executorch/backends/cadence/aot/quantizer/quantizer.py +145 -0
  147. executorch/backends/cadence/aot/quantizer/utils.py +129 -0
  148. executorch/backends/cadence/aot/utils.py +150 -0
  149. executorch/backends/cadence/utils/gen_header.py +49 -0
  150. executorch/backends/cadence/utils/post_compilation.py +173 -0
  151. executorch/backends/example/example_backend.py +41 -0
  152. executorch/backends/example/example_backend_delegate_passes/merge_to_dim_pass.py +79 -0
  153. executorch/backends/example/example_backend_delegate_passes/permute_memory_formats_pass.py +143 -0
  154. executorch/backends/example/example_operators/adaptive_avg_pool2d.py +47 -0
  155. executorch/backends/example/example_operators/add.py +44 -0
  156. executorch/backends/example/example_operators/conv2d.py +52 -0
  157. executorch/backends/example/example_operators/conv_relu.py +49 -0
  158. executorch/backends/example/example_operators/dropout.py +44 -0
  159. executorch/backends/example/example_operators/flatten.py +40 -0
  160. executorch/backends/example/example_operators/linear.py +62 -0
  161. executorch/backends/example/example_operators/op_base.py +15 -0
  162. executorch/backends/example/example_operators/ops.py +32 -0
  163. executorch/backends/example/example_operators/utils.py +33 -0
  164. executorch/backends/example/example_partitioner.py +88 -0
  165. executorch/backends/example/example_quantizer.py +102 -0
  166. executorch/backends/example/test_example_delegate.py +112 -0
  167. executorch/backends/qualcomm/aot/ir/qcir.fbs +97 -0
  168. executorch/backends/qualcomm/builders/__init__.py +109 -0
  169. executorch/backends/qualcomm/builders/node_visitor.py +395 -0
  170. executorch/backends/qualcomm/builders/op_add.py +61 -0
  171. executorch/backends/qualcomm/builders/op_avg_pool2d.py +143 -0
  172. executorch/backends/qualcomm/builders/op_batch_norm.py +92 -0
  173. executorch/backends/qualcomm/builders/op_bmm.py +58 -0
  174. executorch/backends/qualcomm/builders/op_cast.py +57 -0
  175. executorch/backends/qualcomm/builders/op_cat.py +84 -0
  176. executorch/backends/qualcomm/builders/op_ceil.py +55 -0
  177. executorch/backends/qualcomm/builders/op_clamp.py +78 -0
  178. executorch/backends/qualcomm/builders/op_conv2d.py +363 -0
  179. executorch/backends/qualcomm/builders/op_depth_to_space.py +76 -0
  180. executorch/backends/qualcomm/builders/op_dequantize.py +71 -0
  181. executorch/backends/qualcomm/builders/op_div.py +61 -0
  182. executorch/backends/qualcomm/builders/op_embedding.py +77 -0
  183. executorch/backends/qualcomm/builders/op_expand.py +81 -0
  184. executorch/backends/qualcomm/builders/op_gelu.py +56 -0
  185. executorch/backends/qualcomm/builders/op_hardsigmoid.py +76 -0
  186. executorch/backends/qualcomm/builders/op_hardswish.py +56 -0
  187. executorch/backends/qualcomm/builders/op_hardtanh.py +77 -0
  188. executorch/backends/qualcomm/builders/op_layer_norm.py +105 -0
  189. executorch/backends/qualcomm/builders/op_linear.py +96 -0
  190. executorch/backends/qualcomm/builders/op_log_softmax.py +75 -0
  191. executorch/backends/qualcomm/builders/op_matmul.py +58 -0
  192. executorch/backends/qualcomm/builders/op_max_pool2d.py +140 -0
  193. executorch/backends/qualcomm/builders/op_mean_dim.py +83 -0
  194. executorch/backends/qualcomm/builders/op_mul.py +61 -0
  195. executorch/backends/qualcomm/builders/op_pad.py +95 -0
  196. executorch/backends/qualcomm/builders/op_pow.py +95 -0
  197. executorch/backends/qualcomm/builders/op_prelu.py +105 -0
  198. executorch/backends/qualcomm/builders/op_quantize.py +71 -0
  199. executorch/backends/qualcomm/builders/op_relu.py +57 -0
  200. executorch/backends/qualcomm/builders/op_reshape.py +54 -0
  201. executorch/backends/qualcomm/builders/op_rsqrt.py +57 -0
  202. executorch/backends/qualcomm/builders/op_select_copy.py +87 -0
  203. executorch/backends/qualcomm/builders/op_sigmoid.py +57 -0
  204. executorch/backends/qualcomm/builders/op_skip_ops.py +54 -0
  205. executorch/backends/qualcomm/builders/op_slice_copy.py +87 -0
  206. executorch/backends/qualcomm/builders/op_softmax.py +74 -0
  207. executorch/backends/qualcomm/builders/op_space_to_depth.py +76 -0
  208. executorch/backends/qualcomm/builders/op_split_with_sizes.py +94 -0
  209. executorch/backends/qualcomm/builders/op_sqrt.py +59 -0
  210. executorch/backends/qualcomm/builders/op_squeeze.py +56 -0
  211. executorch/backends/qualcomm/builders/op_sub.py +61 -0
  212. executorch/backends/qualcomm/builders/op_sum_int_list.py +80 -0
  213. executorch/backends/qualcomm/builders/op_tanh.py +56 -0
  214. executorch/backends/qualcomm/builders/op_transpose.py +72 -0
  215. executorch/backends/qualcomm/builders/op_unsqueeze.py +56 -0
  216. executorch/backends/qualcomm/builders/op_upsample_bilinear2d.py +66 -0
  217. executorch/backends/qualcomm/builders/op_upsample_nearest2d.py +66 -0
  218. executorch/backends/qualcomm/builders/qnn_constants.py +328 -0
  219. executorch/backends/qualcomm/builders/utils.py +102 -0
  220. executorch/backends/qualcomm/partition/common_defs.py +22 -0
  221. executorch/backends/qualcomm/partition/qnn_partitioner.py +150 -0
  222. executorch/backends/qualcomm/passes/annotate_and_quant_scalar.py +120 -0
  223. executorch/backends/qualcomm/passes/annotate_decomposed.py +49 -0
  224. executorch/backends/qualcomm/passes/annotate_quant_attrs.py +110 -0
  225. executorch/backends/qualcomm/passes/convert_binary_op_with_scalar.py +41 -0
  226. executorch/backends/qualcomm/passes/convert_bmm_to_matmul.py +73 -0
  227. executorch/backends/qualcomm/passes/convert_interpolate_with_upsample2d.py +56 -0
  228. executorch/backends/qualcomm/passes/convert_prelu.py +44 -0
  229. executorch/backends/qualcomm/passes/convert_to_linear.py +226 -0
  230. executorch/backends/qualcomm/passes/decompose_scaled_dot_product_attention.py +87 -0
  231. executorch/backends/qualcomm/passes/decompose_silu.py +40 -0
  232. executorch/backends/qualcomm/passes/fold_qdq.py +63 -0
  233. executorch/backends/qualcomm/passes/i64_to_i32.py +47 -0
  234. executorch/backends/qualcomm/passes/insert_io_qdq.py +168 -0
  235. executorch/backends/qualcomm/passes/insert_requantize.py +61 -0
  236. executorch/backends/qualcomm/passes/layout_transform.py +250 -0
  237. executorch/backends/qualcomm/passes/recompose_pixel_shuffle.py +46 -0
  238. executorch/backends/qualcomm/passes/recompose_pixel_unshuffle.py +106 -0
  239. executorch/backends/qualcomm/passes/reduce_dynamic_range.py +60 -0
  240. executorch/backends/qualcomm/passes/remove_clone.py +40 -0
  241. executorch/backends/qualcomm/passes/replace_inf_buffer.py +22 -0
  242. executorch/backends/qualcomm/passes/utils.py +44 -0
  243. executorch/backends/qualcomm/qnn_preprocess.py +95 -0
  244. executorch/backends/qualcomm/quantizer/quantizer.py +396 -0
  245. executorch/backends/qualcomm/quantizer/utils.py +686 -0
  246. executorch/backends/qualcomm/serialization/qnn_compile_spec_schema.py +134 -0
  247. executorch/backends/qualcomm/serialization/qnn_compile_spec_serialize.py +49 -0
  248. executorch/backends/qualcomm/serialization/schema.fbs +180 -0
  249. executorch/backends/qualcomm/tests/models.py +908 -0
  250. executorch/backends/qualcomm/tests/test_qnn_delegate.py +2200 -0
  251. executorch/backends/qualcomm/tests/utils.py +304 -0
  252. executorch/backends/qualcomm/utils/utils.py +288 -0
  253. executorch/backends/transforms/__init__.py +12 -0
  254. executorch/backends/transforms/addmm_mm_to_linear.py +170 -0
  255. executorch/backends/transforms/duplicate_dynamic_quant_chain.py +196 -0
  256. executorch/backends/transforms/fuse_batch_norm_with_conv.py +161 -0
  257. executorch/backends/transforms/fuse_conv_with_clamp.py +76 -0
  258. executorch/backends/transforms/i64_to_i32.py +86 -0
  259. executorch/backends/transforms/mean_to_sum_div.py +41 -0
  260. executorch/backends/transforms/test/test_duplicate_dynamic_quant_chain.py +188 -0
  261. executorch/backends/transforms/utils.py +55 -0
  262. executorch/backends/vulkan/__init__.py +14 -0
  263. executorch/backends/vulkan/partitioner/supported_ops.py +163 -0
  264. executorch/backends/vulkan/partitioner/vulkan_partitioner.py +164 -0
  265. executorch/backends/vulkan/passes/custom_ops_defs.py +47 -0
  266. executorch/backends/vulkan/passes/test_custom_ops.py +93 -0
  267. executorch/backends/vulkan/runtime/api/gen_vulkan_spv.py +968 -0
  268. executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_naive.yaml +24 -0
  269. executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_optimized.yaml +20 -0
  270. executorch/backends/vulkan/runtime/graph/ops/glsl/arange.yaml +19 -0
  271. executorch/backends/vulkan/runtime/graph/ops/glsl/avg_pool2d.yaml +18 -0
  272. executorch/backends/vulkan/runtime/graph/ops/glsl/batchnorm.yaml +10 -0
  273. executorch/backends/vulkan/runtime/graph/ops/glsl/binary_op.yaml +30 -0
  274. executorch/backends/vulkan/runtime/graph/ops/glsl/clone.yaml +10 -0
  275. executorch/backends/vulkan/runtime/graph/ops/glsl/conv1d.yaml +20 -0
  276. executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d.yaml +19 -0
  277. executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw.yaml +19 -0
  278. executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_output_tile.yaml +25 -0
  279. executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_prepack_weights.yaml +15 -0
  280. executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_prepack_weights.yaml +15 -0
  281. executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw.yaml +20 -0
  282. executorch/backends/vulkan/runtime/graph/ops/glsl/conv_transpose2d.yaml +19 -0
  283. executorch/backends/vulkan/runtime/graph/ops/glsl/conv_transpose2d_prepack_weights.yaml +16 -0
  284. executorch/backends/vulkan/runtime/graph/ops/glsl/copy_channel_offset.yaml +10 -0
  285. executorch/backends/vulkan/runtime/graph/ops/glsl/copy_offset.yaml +10 -0
  286. executorch/backends/vulkan/runtime/graph/ops/glsl/embedding.yaml +12 -0
  287. executorch/backends/vulkan/runtime/graph/ops/glsl/full.yaml +17 -0
  288. executorch/backends/vulkan/runtime/graph/ops/glsl/index_select.yaml +12 -0
  289. executorch/backends/vulkan/runtime/graph/ops/glsl/index_select_channel.yaml +12 -0
  290. executorch/backends/vulkan/runtime/graph/ops/glsl/matmul_naive.yaml +24 -0
  291. executorch/backends/vulkan/runtime/graph/ops/glsl/matmul_optimized.yaml +20 -0
  292. executorch/backends/vulkan/runtime/graph/ops/glsl/max_pool2d.yaml +16 -0
  293. executorch/backends/vulkan/runtime/graph/ops/glsl/native_layer_norm.yaml +17 -0
  294. executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_tensor.yaml +22 -0
  295. executorch/backends/vulkan/runtime/graph/ops/glsl/no_op.yaml +22 -0
  296. executorch/backends/vulkan/runtime/graph/ops/glsl/permute.yaml +11 -0
  297. executorch/backends/vulkan/runtime/graph/ops/glsl/q_8w_linear.yaml +23 -0
  298. executorch/backends/vulkan/runtime/graph/ops/glsl/repeat_channel.yaml +10 -0
  299. executorch/backends/vulkan/runtime/graph/ops/glsl/select_batch_4d.yaml +10 -0
  300. executorch/backends/vulkan/runtime/graph/ops/glsl/select_channel_3d.yaml +10 -0
  301. executorch/backends/vulkan/runtime/graph/ops/glsl/select_channel_4d.yaml +10 -0
  302. executorch/backends/vulkan/runtime/graph/ops/glsl/select_height_3d.yaml +10 -0
  303. executorch/backends/vulkan/runtime/graph/ops/glsl/select_height_4d.yaml +10 -0
  304. executorch/backends/vulkan/runtime/graph/ops/glsl/select_width_3d.yaml +10 -0
  305. executorch/backends/vulkan/runtime/graph/ops/glsl/select_width_4d.yaml +10 -0
  306. executorch/backends/vulkan/runtime/graph/ops/glsl/slice_batch_height_width.yaml +10 -0
  307. executorch/backends/vulkan/runtime/graph/ops/glsl/slice_channel.yaml +9 -0
  308. executorch/backends/vulkan/runtime/graph/ops/glsl/softmax_batch_height_width.yaml +21 -0
  309. executorch/backends/vulkan/runtime/graph/ops/glsl/softmax_channel.yaml +21 -0
  310. executorch/backends/vulkan/runtime/graph/ops/glsl/sum_dim.yaml +16 -0
  311. executorch/backends/vulkan/runtime/graph/ops/glsl/sum_dim_keepdim.yaml +16 -0
  312. executorch/backends/vulkan/runtime/graph/ops/glsl/tensor_to_nchw.yaml +22 -0
  313. executorch/backends/vulkan/runtime/graph/ops/glsl/unary_op.yaml +38 -0
  314. executorch/backends/vulkan/runtime/graph/ops/glsl/upsample_nearest2d.yaml +18 -0
  315. executorch/backends/vulkan/runtime/graph/ops/glsl/view.yaml +12 -0
  316. executorch/backends/vulkan/serialization/schema.fbs +144 -0
  317. executorch/backends/vulkan/serialization/vulkan_graph_builder.py +363 -0
  318. executorch/backends/vulkan/serialization/vulkan_graph_schema.py +142 -0
  319. executorch/backends/vulkan/serialization/vulkan_graph_serialize.py +222 -0
  320. executorch/backends/vulkan/test/glsl/all_shaders.yaml +77 -0
  321. executorch/backends/vulkan/test/op_tests/cases.py +991 -0
  322. executorch/backends/vulkan/test/op_tests/generate_op_tests.py +83 -0
  323. executorch/backends/vulkan/test/op_tests/utils/codegen.py +752 -0
  324. executorch/backends/vulkan/test/op_tests/utils/codegen_base.py +401 -0
  325. executorch/backends/vulkan/test/test_serialization.py +95 -0
  326. executorch/backends/vulkan/test/test_vulkan_delegate.py +1566 -0
  327. executorch/backends/vulkan/test/test_vulkan_delegate_header.py +104 -0
  328. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/apiconventions.py +11 -0
  329. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/cgenerator.py +424 -0
  330. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/conventions.py +358 -0
  331. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/generator.py +1225 -0
  332. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/genvk.py +817 -0
  333. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/reg.py +1575 -0
  334. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/spec_tools/util.py +58 -0
  335. executorch/backends/vulkan/third-party/Vulkan-Headers/registry/vkconventions.py +275 -0
  336. executorch/backends/vulkan/third-party/VulkanMemoryAllocator/tools/GpuMemDumpVis/GpuMemDumpVis.py +333 -0
  337. executorch/backends/vulkan/third-party/volk/generate.py +194 -0
  338. executorch/backends/vulkan/vulkan_preprocess.py +80 -0
  339. executorch/backends/xnnpack/__init__.py +35 -0
  340. executorch/backends/xnnpack/operators/__init__.py +51 -0
  341. executorch/backends/xnnpack/operators/node_visitor.py +673 -0
  342. executorch/backends/xnnpack/operators/op_abs.py +52 -0
  343. executorch/backends/xnnpack/operators/op_add.py +77 -0
  344. executorch/backends/xnnpack/operators/op_addmm.py +70 -0
  345. executorch/backends/xnnpack/operators/op_avg_pooling2d.py +75 -0
  346. executorch/backends/xnnpack/operators/op_cat.py +104 -0
  347. executorch/backends/xnnpack/operators/op_ceiling.py +52 -0
  348. executorch/backends/xnnpack/operators/op_clamp.py +64 -0
  349. executorch/backends/xnnpack/operators/op_conv2d.py +168 -0
  350. executorch/backends/xnnpack/operators/op_dequantize_per_tensor.py +68 -0
  351. executorch/backends/xnnpack/operators/op_div.py +56 -0
  352. executorch/backends/xnnpack/operators/op_dynamic_dequantize_ops.py +67 -0
  353. executorch/backends/xnnpack/operators/op_dynamic_quantize_ops.py +120 -0
  354. executorch/backends/xnnpack/operators/op_elu.py +56 -0
  355. executorch/backends/xnnpack/operators/op_floor.py +48 -0
  356. executorch/backends/xnnpack/operators/op_hardswish.py +52 -0
  357. executorch/backends/xnnpack/operators/op_hardtanh.py +67 -0
  358. executorch/backends/xnnpack/operators/op_leaky_relu.py +65 -0
  359. executorch/backends/xnnpack/operators/op_linear.py +105 -0
  360. executorch/backends/xnnpack/operators/op_matrix_multiplication.py +66 -0
  361. executorch/backends/xnnpack/operators/op_max_dim.py +206 -0
  362. executorch/backends/xnnpack/operators/op_max_pool2d.py +92 -0
  363. executorch/backends/xnnpack/operators/op_maximum.py +55 -0
  364. executorch/backends/xnnpack/operators/op_mean_dim.py +78 -0
  365. executorch/backends/xnnpack/operators/op_minimum.py +54 -0
  366. executorch/backends/xnnpack/operators/op_multiply.py +84 -0
  367. executorch/backends/xnnpack/operators/op_negate.py +51 -0
  368. executorch/backends/xnnpack/operators/op_permute.py +80 -0
  369. executorch/backends/xnnpack/operators/op_prelu.py +56 -0
  370. executorch/backends/xnnpack/operators/op_quantize_per_tensor.py +68 -0
  371. executorch/backends/xnnpack/operators/op_relu.py +61 -0
  372. executorch/backends/xnnpack/operators/op_sdpa.py +108 -0
  373. executorch/backends/xnnpack/operators/op_sigmoid.py +48 -0
  374. executorch/backends/xnnpack/operators/op_skip_ops.py +124 -0
  375. executorch/backends/xnnpack/operators/op_slice_copy.py +98 -0
  376. executorch/backends/xnnpack/operators/op_softmax.py +58 -0
  377. executorch/backends/xnnpack/operators/op_square.py +52 -0
  378. executorch/backends/xnnpack/operators/op_square_root.py +52 -0
  379. executorch/backends/xnnpack/operators/op_squeeze.py +143 -0
  380. executorch/backends/xnnpack/operators/op_static_constant_pad.py +130 -0
  381. executorch/backends/xnnpack/operators/op_static_resize_bilinear_2d.py +61 -0
  382. executorch/backends/xnnpack/operators/op_sub.py +77 -0
  383. executorch/backends/xnnpack/operators/op_to_copy.py +91 -0
  384. executorch/backends/xnnpack/operators/quant_params.py +346 -0
  385. executorch/backends/xnnpack/partition/configs.py +155 -0
  386. executorch/backends/xnnpack/partition/graphs/bilinear_2d.py +54 -0
  387. executorch/backends/xnnpack/partition/graphs/sdpa.py +85 -0
  388. executorch/backends/xnnpack/partition/xnnpack_partitioner.py +1184 -0
  389. executorch/backends/xnnpack/passes/__init__.py +87 -0
  390. executorch/backends/xnnpack/passes/channels_last_tagged_reshape_pass.py +408 -0
  391. executorch/backends/xnnpack/passes/conv1d_unsqueeze_pass.py +183 -0
  392. executorch/backends/xnnpack/passes/convert_to_linear.py +203 -0
  393. executorch/backends/xnnpack/passes/convert_to_sdpa.py +114 -0
  394. executorch/backends/xnnpack/passes/convert_to_upsample_bilinear2d.py +59 -0
  395. executorch/backends/xnnpack/passes/fuse_activation_pass.py +83 -0
  396. executorch/backends/xnnpack/passes/fuse_batch_norm_with_conv.py +159 -0
  397. executorch/backends/xnnpack/passes/prelu_reshape_pass.py +75 -0
  398. executorch/backends/xnnpack/passes/remove_getitem_op.py +90 -0
  399. executorch/backends/xnnpack/passes/tag_implicit_q_dq_pass.py +216 -0
  400. executorch/backends/xnnpack/passes/xnnpack_pass.py +22 -0
  401. executorch/backends/xnnpack/serialization/runtime_schema.fbs +354 -0
  402. executorch/backends/xnnpack/serialization/schema.fbs +346 -0
  403. executorch/backends/xnnpack/serialization/xnnpack_graph_schema.py +460 -0
  404. executorch/backends/xnnpack/serialization/xnnpack_graph_serialize.py +342 -0
  405. executorch/backends/xnnpack/test/models/deeplab_v3.py +40 -0
  406. executorch/backends/xnnpack/test/models/edsr.py +55 -0
  407. executorch/backends/xnnpack/test/models/emformer_rnnt.py +98 -0
  408. executorch/backends/xnnpack/test/models/inception_v3.py +87 -0
  409. executorch/backends/xnnpack/test/models/inception_v4.py +63 -0
  410. executorch/backends/xnnpack/test/models/llama2_et_example.py +49 -0
  411. executorch/backends/xnnpack/test/models/mobilebert.py +42 -0
  412. executorch/backends/xnnpack/test/models/mobilenet_v2.py +106 -0
  413. executorch/backends/xnnpack/test/models/mobilenet_v3.py +94 -0
  414. executorch/backends/xnnpack/test/models/resnet.py +88 -0
  415. executorch/backends/xnnpack/test/models/torchvision_vit.py +104 -0
  416. executorch/backends/xnnpack/test/models/very_big_model.py +43 -0
  417. executorch/backends/xnnpack/test/models/w2l.py +59 -0
  418. executorch/backends/xnnpack/test/ops/abs.py +57 -0
  419. executorch/backends/xnnpack/test/ops/add.py +257 -0
  420. executorch/backends/xnnpack/test/ops/avgpool2d.py +105 -0
  421. executorch/backends/xnnpack/test/ops/bilinear2d.py +127 -0
  422. executorch/backends/xnnpack/test/ops/cat.py +216 -0
  423. executorch/backends/xnnpack/test/ops/ceil.py +57 -0
  424. executorch/backends/xnnpack/test/ops/clamp.py +80 -0
  425. executorch/backends/xnnpack/test/ops/conv1d.py +147 -0
  426. executorch/backends/xnnpack/test/ops/conv2d.py +397 -0
  427. executorch/backends/xnnpack/test/ops/div.py +73 -0
  428. executorch/backends/xnnpack/test/ops/elu.py +101 -0
  429. executorch/backends/xnnpack/test/ops/floor.py +57 -0
  430. executorch/backends/xnnpack/test/ops/hardswish.py +78 -0
  431. executorch/backends/xnnpack/test/ops/hardtanh.py +92 -0
  432. executorch/backends/xnnpack/test/ops/leaky_relu.py +144 -0
  433. executorch/backends/xnnpack/test/ops/linear.py +898 -0
  434. executorch/backends/xnnpack/test/ops/max_dim.py +68 -0
  435. executorch/backends/xnnpack/test/ops/maximum.py +67 -0
  436. executorch/backends/xnnpack/test/ops/maxpool2d.py +174 -0
  437. executorch/backends/xnnpack/test/ops/mean_dim.py +88 -0
  438. executorch/backends/xnnpack/test/ops/minimum.py +48 -0
  439. executorch/backends/xnnpack/test/ops/multiply.py +156 -0
  440. executorch/backends/xnnpack/test/ops/negate.py +57 -0
  441. executorch/backends/xnnpack/test/ops/permute.py +133 -0
  442. executorch/backends/xnnpack/test/ops/pow.py +67 -0
  443. executorch/backends/xnnpack/test/ops/prelu.py +52 -0
  444. executorch/backends/xnnpack/test/ops/quantize_per_tensor.py +79 -0
  445. executorch/backends/xnnpack/test/ops/relu.py +37 -0
  446. executorch/backends/xnnpack/test/ops/sdpa.py +124 -0
  447. executorch/backends/xnnpack/test/ops/sigmoid.py +44 -0
  448. executorch/backends/xnnpack/test/ops/slice_copy.py +167 -0
  449. executorch/backends/xnnpack/test/ops/softmax.py +73 -0
  450. executorch/backends/xnnpack/test/ops/sqrt.py +44 -0
  451. executorch/backends/xnnpack/test/ops/square.py +49 -0
  452. executorch/backends/xnnpack/test/ops/static_constant_pad.py +182 -0
  453. executorch/backends/xnnpack/test/ops/sub.py +166 -0
  454. executorch/backends/xnnpack/test/passes/test_activation_fusion.py +197 -0
  455. executorch/backends/xnnpack/test/passes/test_batch_norm_fusion.py +79 -0
  456. executorch/backends/xnnpack/test/passes/test_channels_last_tagged_reshape.py +175 -0
  457. executorch/backends/xnnpack/test/passes/test_convert_to_linear.py +39 -0
  458. executorch/backends/xnnpack/test/passes/test_remove_get_item_pass.py +96 -0
  459. executorch/backends/xnnpack/test/passes/test_tag_implicit_q_dq_pass.py +80 -0
  460. executorch/backends/xnnpack/test/serialization/test_serialization.py +50 -0
  461. executorch/backends/xnnpack/test/serialization/test_xnnheader.py +104 -0
  462. executorch/backends/xnnpack/test/test_xnnpack_utils.py +533 -0
  463. executorch/backends/xnnpack/test/test_xnnpack_utils_classes.py +42 -0
  464. executorch/backends/xnnpack/test/tester/__init__.py +28 -0
  465. executorch/backends/xnnpack/test/tester/tester.py +691 -0
  466. executorch/backends/xnnpack/third-party/FP16/configure.py +65 -0
  467. executorch/backends/xnnpack/third-party/FP16/confu.yaml +8 -0
  468. executorch/backends/xnnpack/third-party/FP16/include/fp16/__init__.py +0 -0
  469. executorch/backends/xnnpack/third-party/FP16/include/fp16/avx.py +50 -0
  470. executorch/backends/xnnpack/third-party/FP16/include/fp16/avx2.py +53 -0
  471. executorch/backends/xnnpack/third-party/FP16/test/peachpy/stubs.py +38 -0
  472. executorch/backends/xnnpack/third-party/FXdiv/configure.py +30 -0
  473. executorch/backends/xnnpack/third-party/FXdiv/confu.yaml +6 -0
  474. executorch/backends/xnnpack/third-party/XNNPACK/eval/f16-tanh.yaml +38 -0
  475. executorch/backends/xnnpack/third-party/XNNPACK/eval/f32-tanh.yaml +253 -0
  476. executorch/backends/xnnpack/third-party/XNNPACK/scripts/convert-assembly-to-jit.py +1443 -0
  477. executorch/backends/xnnpack/third-party/XNNPACK/scripts/sort-filenames.py +137 -0
  478. executorch/backends/xnnpack/third-party/XNNPACK/src/enums/microkernel-type.yaml +35 -0
  479. executorch/backends/xnnpack/third-party/XNNPACK/src/enums/node-type.yaml +125 -0
  480. executorch/backends/xnnpack/third-party/XNNPACK/src/enums/operator-type.yaml +325 -0
  481. executorch/backends/xnnpack/third-party/XNNPACK/test/bf16-gemm-minmax.yaml +106 -0
  482. executorch/backends/xnnpack/third-party/XNNPACK/test/cs16-bfly4.yaml +22 -0
  483. executorch/backends/xnnpack/third-party/XNNPACK/test/cs16-fftr.yaml +15 -0
  484. executorch/backends/xnnpack/third-party/XNNPACK/test/cs16-vsquareabs.yaml +24 -0
  485. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-avgpool-minmax.yaml +16 -0
  486. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-conv-hwc2chw.yaml +8 -0
  487. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-dwconv-minmax-multipass.yaml +80 -0
  488. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-dwconv-minmax-unipass.yaml +104 -0
  489. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-dwconv2d-chw.yaml +88 -0
  490. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32-vcvt.yaml +123 -0
  491. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-gemm-minmax.yaml +42 -0
  492. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-igemm-minmax.yaml +42 -0
  493. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-rsum.yaml +30 -0
  494. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-gavgpool-cw.yaml +8 -0
  495. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-gavgpool-minmax.yaml +40 -0
  496. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-gemm-jit.yaml +36 -0
  497. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-gemm-minmax.yaml +130 -0
  498. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-ibilinear-chw.yaml +9 -0
  499. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-ibilinear.yaml +12 -0
  500. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-igemm-jit.yaml +36 -0
  501. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-igemm-minmax.yaml +114 -0
  502. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-maxpool-minmax.yaml +12 -0
  503. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-pavgpool-minmax.yaml +16 -0
  504. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-prelu.yaml +12 -0
  505. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-qs8-vcvt.yaml +34 -0
  506. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-raddstoreexpminusmax.yaml +92 -0
  507. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-rmax.yaml +28 -0
  508. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-rmin.yaml +25 -0
  509. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-rminmax.yaml +25 -0
  510. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-rsum.yaml +16 -0
  511. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-spmm-minmax.yaml +42 -0
  512. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vabs.yaml +14 -0
  513. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vadd-minmax.yaml +24 -0
  514. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vaddc-minmax.yaml +24 -0
  515. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vclamp.yaml +26 -0
  516. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vcmul.yaml +9 -0
  517. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vdiv-minmax.yaml +24 -0
  518. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vdivc-minmax.yaml +24 -0
  519. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-velu.yaml +16 -0
  520. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vhswish.yaml +16 -0
  521. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vlrelu.yaml +16 -0
  522. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vmax.yaml +17 -0
  523. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vmaxc.yaml +17 -0
  524. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vmin.yaml +17 -0
  525. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vminc.yaml +17 -0
  526. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vmul-minmax.yaml +24 -0
  527. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vmulc-minmax.yaml +24 -0
  528. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vmulcaddc-minmax.yaml +16 -0
  529. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vneg.yaml +14 -0
  530. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vrdivc-minmax.yaml +24 -0
  531. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vrndd.yaml +12 -0
  532. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vrndne.yaml +12 -0
  533. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vrndu.yaml +12 -0
  534. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vrndz.yaml +12 -0
  535. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vrsubc-minmax.yaml +24 -0
  536. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsigmoid.yaml +88 -0
  537. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsqr.yaml +12 -0
  538. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsqrdiff.yaml +17 -0
  539. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsqrdiffc.yaml +17 -0
  540. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsqrt.yaml +28 -0
  541. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsub-minmax.yaml +24 -0
  542. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vsubc-minmax.yaml +24 -0
  543. executorch/backends/xnnpack/third-party/XNNPACK/test/f16-vtanh.yaml +214 -0
  544. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-argmaxpool.yaml +29 -0
  545. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-avgpool-minmax.yaml +39 -0
  546. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-conv-hwc.yaml +44 -0
  547. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-conv-hwc2chw.yaml +24 -0
  548. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv-minmax-multipass.yaml +190 -0
  549. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv-minmax-unipass.yaml +436 -0
  550. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv-multipass.yaml +24 -0
  551. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv-unipass.yaml +42 -0
  552. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv2d-chw.yaml +679 -0
  553. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-f16-vcvt.yaml +85 -0
  554. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gavgpool-cw.yaml +22 -0
  555. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gavgpool-minmax.yaml +39 -0
  556. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-goi-minmax.yaml +15 -0
  557. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-jit.yaml +317 -0
  558. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-minmax.yaml +953 -0
  559. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-relu.yaml +129 -0
  560. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm.yaml +120 -0
  561. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemminc-minmax.yaml +673 -0
  562. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ibilinear-chw.yaml +22 -0
  563. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ibilinear.yaml +23 -0
  564. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-jit.yaml +315 -0
  565. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-minmax.yaml +891 -0
  566. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-relu.yaml +129 -0
  567. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm.yaml +116 -0
  568. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-maxpool-minmax.yaml +22 -0
  569. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-pavgpool-minmax.yaml +39 -0
  570. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ppmm-minmax.yaml +122 -0
  571. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-prelu.yaml +72 -0
  572. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc4w-gemm-minmax.yaml +314 -0
  573. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm-minmax.yaml +836 -0
  574. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm-relu.yaml +80 -0
  575. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm.yaml +115 -0
  576. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qs8-vcvt.yaml +116 -0
  577. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qu8-vcvt.yaml +108 -0
  578. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddexpminusmax.yaml +31 -0
  579. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddextexp.yaml +31 -0
  580. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddstoreexpminusmax.yaml +257 -0
  581. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-rmax.yaml +69 -0
  582. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-rmin.yaml +69 -0
  583. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-rminmax.yaml +69 -0
  584. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-rsum.yaml +76 -0
  585. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-spmm-minmax.yaml +400 -0
  586. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vabs.yaml +37 -0
  587. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vadd-minmax.yaml +56 -0
  588. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vadd-relu.yaml +19 -0
  589. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vadd.yaml +14 -0
  590. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vaddc-minmax.yaml +61 -0
  591. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vaddc-relu.yaml +19 -0
  592. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vaddc.yaml +14 -0
  593. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vclamp.yaml +66 -0
  594. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vcmul.yaml +28 -0
  595. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vdiv-minmax.yaml +56 -0
  596. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vdiv-relu.yaml +19 -0
  597. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vdiv.yaml +14 -0
  598. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vdivc-minmax.yaml +61 -0
  599. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vdivc-relu.yaml +19 -0
  600. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vdivc.yaml +14 -0
  601. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-velu.yaml +401 -0
  602. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vhswish.yaml +62 -0
  603. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vlrelu.yaml +65 -0
  604. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmax.yaml +36 -0
  605. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmaxc.yaml +39 -0
  606. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmin.yaml +36 -0
  607. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vminc.yaml +39 -0
  608. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmul-minmax.yaml +56 -0
  609. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmul-relu.yaml +19 -0
  610. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmul.yaml +14 -0
  611. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmulc-minmax.yaml +61 -0
  612. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmulc-relu.yaml +19 -0
  613. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmulc.yaml +17 -0
  614. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vmulcaddc-minmax.yaml +51 -0
  615. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vneg.yaml +37 -0
  616. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrdivc-minmax.yaml +61 -0
  617. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrdivc-relu.yaml +19 -0
  618. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrdivc.yaml +14 -0
  619. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrelu.yaml +34 -0
  620. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrndd.yaml +32 -0
  621. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrndne.yaml +32 -0
  622. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrndu.yaml +32 -0
  623. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrndz.yaml +32 -0
  624. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrsqrt.yaml +41 -0
  625. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrsubc-minmax.yaml +61 -0
  626. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrsubc-relu.yaml +19 -0
  627. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vrsubc.yaml +14 -0
  628. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vscaleexpminusmax.yaml +31 -0
  629. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vscaleextexp.yaml +31 -0
  630. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsigmoid.yaml +550 -0
  631. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsqr.yaml +31 -0
  632. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsqrdiff.yaml +28 -0
  633. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsqrdiffc.yaml +31 -0
  634. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsqrt.yaml +60 -0
  635. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsub-minmax.yaml +56 -0
  636. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsub-relu.yaml +19 -0
  637. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsub.yaml +14 -0
  638. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsubc-minmax.yaml +61 -0
  639. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsubc-relu.yaml +19 -0
  640. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vsubc.yaml +14 -0
  641. executorch/backends/xnnpack/third-party/XNNPACK/test/f32-vtanh.yaml +815 -0
  642. executorch/backends/xnnpack/third-party/XNNPACK/test/i16-vlshift.yaml +17 -0
  643. executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc4w-gemm-minmax.yaml +447 -0
  644. executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc8w-gemm-minmax.yaml +362 -0
  645. executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc8w-igemm-minmax.yaml +326 -0
  646. executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc4w-gemm-minmax.yaml +990 -0
  647. executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc8w-gemm-minmax.yaml +1035 -0
  648. executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc8w-igemm-minmax.yaml +920 -0
  649. executorch/backends/xnnpack/third-party/XNNPACK/test/qs16-qs8-vcvt.yaml +62 -0
  650. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-dwconv-minmax-multipass-fp32.yaml +300 -0
  651. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-dwconv-minmax-multipass-rndnu.yaml +60 -0
  652. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-dwconv-minmax-unipass-fp32.yaml +224 -0
  653. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-dwconv-minmax-unipass-rndnu.yaml +49 -0
  654. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-f16-vcvt.yaml +24 -0
  655. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-f32-vcvt.yaml +66 -0
  656. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-gavgpool-minmax-fp32.yaml +117 -0
  657. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-gavgpool-minmax-rndnu.yaml +22 -0
  658. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-dwconv-minmax-multipass-fp32.yaml +372 -0
  659. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-dwconv-minmax-unipass-fp32.yaml +314 -0
  660. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-gemm-jit-fp32.yaml +21 -0
  661. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-gemm-minmax-fp32.yaml +1576 -0
  662. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-igemm-jit-fp32.yaml +21 -0
  663. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-igemm-minmax-fp32.yaml +1538 -0
  664. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vadd-minmax.yaml +100 -0
  665. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vaddc-minmax.yaml +100 -0
  666. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vcvt.yaml +76 -0
  667. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vhswish.yaml +56 -0
  668. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vlrelu.yaml +98 -0
  669. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vmul-minmax-fp32.yaml +49 -0
  670. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vmul-minmax-rndnu.yaml +12 -0
  671. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vmulc-minmax-fp32.yaml +49 -0
  672. executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-vmulc-minmax-rndnu.yaml +12 -0
  673. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-avgpool-minmax-fp32.yaml +23 -0
  674. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-dwconv-minmax-multipass-fp32.yaml +228 -0
  675. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-dwconv-minmax-multipass-rndnu.yaml +42 -0
  676. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-dwconv-minmax-unipass-fp32.yaml +160 -0
  677. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-dwconv-minmax-unipass-rndnu.yaml +37 -0
  678. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-f32-vcvt.yaml +66 -0
  679. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gavgpool-minmax-fp32.yaml +117 -0
  680. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gavgpool-minmax-rndnu.yaml +22 -0
  681. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gemm-minmax-fp32.yaml +821 -0
  682. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gemm-minmax-rndnu.yaml +274 -0
  683. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-igemm-minmax-fp32.yaml +818 -0
  684. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-igemm-minmax-rndnu.yaml +232 -0
  685. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vadd-minmax.yaml +66 -0
  686. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vaddc-minmax.yaml +66 -0
  687. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vcvt.yaml +76 -0
  688. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vhswish.yaml +56 -0
  689. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vlrelu.yaml +98 -0
  690. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vmul-minmax-fp32.yaml +49 -0
  691. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vmul-minmax-rndnu.yaml +12 -0
  692. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vmulc-minmax-fp32.yaml +49 -0
  693. executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-vmulc-minmax-rndnu.yaml +12 -0
  694. executorch/backends/xnnpack/third-party/XNNPACK/test/s16-rmaxabs.yaml +17 -0
  695. executorch/backends/xnnpack/third-party/XNNPACK/test/s16-window.yaml +25 -0
  696. executorch/backends/xnnpack/third-party/XNNPACK/test/s8-ibilinear.yaml +22 -0
  697. executorch/backends/xnnpack/third-party/XNNPACK/test/s8-maxpool-minmax.yaml +23 -0
  698. executorch/backends/xnnpack/third-party/XNNPACK/test/s8-vclamp.yaml +19 -0
  699. executorch/backends/xnnpack/third-party/XNNPACK/test/u32-filterbank-accumulate.yaml +17 -0
  700. executorch/backends/xnnpack/third-party/XNNPACK/test/u32-filterbank-subtract.yaml +8 -0
  701. executorch/backends/xnnpack/third-party/XNNPACK/test/u32-vlog.yaml +11 -0
  702. executorch/backends/xnnpack/third-party/XNNPACK/test/u64-u32-vsqrtshift.yaml +7 -0
  703. executorch/backends/xnnpack/third-party/XNNPACK/test/u8-ibilinear.yaml +22 -0
  704. executorch/backends/xnnpack/third-party/XNNPACK/test/u8-lut32norm.yaml +7 -0
  705. executorch/backends/xnnpack/third-party/XNNPACK/test/u8-maxpool-minmax.yaml +17 -0
  706. executorch/backends/xnnpack/third-party/XNNPACK/test/u8-rmax.yaml +13 -0
  707. executorch/backends/xnnpack/third-party/XNNPACK/test/u8-vclamp.yaml +17 -0
  708. executorch/backends/xnnpack/third-party/XNNPACK/test/x16-packw.yaml +33 -0
  709. executorch/backends/xnnpack/third-party/XNNPACK/test/x16-transpose.yaml +47 -0
  710. executorch/backends/xnnpack/third-party/XNNPACK/test/x24-transpose.yaml +26 -0
  711. executorch/backends/xnnpack/third-party/XNNPACK/test/x32-packb.yaml +14 -0
  712. executorch/backends/xnnpack/third-party/XNNPACK/test/x32-packw.yaml +76 -0
  713. executorch/backends/xnnpack/third-party/XNNPACK/test/x32-packx.yaml +38 -0
  714. executorch/backends/xnnpack/third-party/XNNPACK/test/x32-transpose.yaml +68 -0
  715. executorch/backends/xnnpack/third-party/XNNPACK/test/x32-zerob.yaml +14 -0
  716. executorch/backends/xnnpack/third-party/XNNPACK/test/x64-transpose.yaml +45 -0
  717. executorch/backends/xnnpack/third-party/XNNPACK/test/x8-lut.yaml +47 -0
  718. executorch/backends/xnnpack/third-party/XNNPACK/test/x8-packw.yaml +18 -0
  719. executorch/backends/xnnpack/third-party/XNNPACK/test/x8-transpose.yaml +36 -0
  720. executorch/backends/xnnpack/third-party/XNNPACK/test/xx-fill.yaml +16 -0
  721. executorch/backends/xnnpack/third-party/XNNPACK/test/xx-pad.yaml +16 -0
  722. executorch/backends/xnnpack/third-party/XNNPACK/test/xx-transposev.yaml +7 -0
  723. executorch/backends/xnnpack/third-party/XNNPACK/tools/check-assembly-and-jit-microkernels-in-sync.py +88 -0
  724. executorch/backends/xnnpack/third-party/XNNPACK/tools/dump-jit-output.py +84 -0
  725. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-argmaxpool-test.py +739 -0
  726. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-avgpool-test.py +2481 -0
  727. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-bfly4-test.py +190 -0
  728. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-conv-hwc-test.py +543 -0
  729. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-conv-hwc2chw-test.py +497 -0
  730. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv-multipass-test.py +465 -0
  731. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv-unipass-test.py +392 -0
  732. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv2d-chw-test.py +333 -0
  733. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-enum.py +193 -0
  734. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-fftr-test.py +114 -0
  735. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-fill-test.py +169 -0
  736. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-filterbank-accumulate-test.py +129 -0
  737. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-filterbank-subtract-test.py +155 -0
  738. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-gavgpool-cw-test.py +189 -0
  739. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-gavgpool-test.py +594 -0
  740. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-gemm-test.py +1318 -0
  741. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-ibilinear-chw-test.py +220 -0
  742. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-ibilinear-test.py +222 -0
  743. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-lut-norm-test.py +157 -0
  744. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-lut-test.py +153 -0
  745. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-maxpool-test.py +1268 -0
  746. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-pack-test.py +224 -0
  747. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-packb-test.py +188 -0
  748. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-packw-test.py +340 -0
  749. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-pad-test.py +353 -0
  750. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-prelu-test.py +237 -0
  751. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddexpminusmax-test.py +144 -0
  752. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddextexp-test.py +144 -0
  753. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddstoreexpminusmax-test.py +188 -0
  754. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-reduce-test.py +225 -0
  755. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-rmaxabs-test.py +145 -0
  756. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-spmm-test.py +538 -0
  757. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-tanh-eval.py +123 -0
  758. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-transpose-test.py +369 -0
  759. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vbinary-test.py +529 -0
  760. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vcvt-test.py +450 -0
  761. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vhswish-test.py +228 -0
  762. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vlog-test.py +178 -0
  763. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vlrelu-test.py +226 -0
  764. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vlshift-test.py +168 -0
  765. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vmulcaddc-test.py +281 -0
  766. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vscaleexpminusmax-test.py +159 -0
  767. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vscaleextexp-test.py +144 -0
  768. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vsquareabs-test.py +145 -0
  769. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vunary-benchmark.py +282 -0
  770. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vunary-test.py +294 -0
  771. executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-window-test.py +230 -0
  772. executorch/backends/xnnpack/third-party/XNNPACK/tools/primes.py +115 -0
  773. executorch/backends/xnnpack/third-party/XNNPACK/tools/update-microkernels.py +391 -0
  774. executorch/backends/xnnpack/third-party/XNNPACK/tools/xngen.py +148 -0
  775. executorch/backends/xnnpack/third-party/XNNPACK/tools/xnncommon.py +253 -0
  776. executorch/backends/xnnpack/third-party/cpuinfo/configure.py +104 -0
  777. executorch/backends/xnnpack/third-party/cpuinfo/confu.yaml +9 -0
  778. executorch/backends/xnnpack/third-party/cpuinfo/deps/clog/configure.py +26 -0
  779. executorch/backends/xnnpack/third-party/cpuinfo/deps/clog/confu.yaml +5 -0
  780. executorch/backends/xnnpack/third-party/cpuinfo/scripts/android-device-dump.py +400 -0
  781. executorch/backends/xnnpack/third-party/cpuinfo/scripts/arm-linux-filesystem-dump.py +107 -0
  782. executorch/backends/xnnpack/third-party/cpuinfo/scripts/parse-x86-cpuid-dump.py +47 -0
  783. executorch/backends/xnnpack/third-party/generate-cpuinfo-wrappers.py +93 -0
  784. executorch/backends/xnnpack/third-party/generate-xnnpack-wrappers.py +198 -0
  785. executorch/backends/xnnpack/third-party/pthreadpool/configure.py +38 -0
  786. executorch/backends/xnnpack/third-party/pthreadpool/confu.yaml +8 -0
  787. executorch/backends/xnnpack/utils/configs.py +49 -0
  788. executorch/backends/xnnpack/utils/quant_utils.py +32 -0
  789. executorch/backends/xnnpack/utils/utils.py +130 -0
  790. executorch/backends/xnnpack/utils/xnnpack_constants.py +33 -0
  791. executorch/backends/xnnpack/xnnpack_preprocess.py +171 -0
  792. executorch/data/bin/__init__.py +42 -0
  793. executorch/data/bin/flatc +0 -0
  794. executorch/examples/models/__init__.py +34 -0
  795. executorch/examples/models/deeplab_v3/__init__.py +9 -0
  796. executorch/examples/models/deeplab_v3/model.py +50 -0
  797. executorch/examples/models/edsr/__init__.py +11 -0
  798. executorch/examples/models/edsr/model.py +28 -0
  799. executorch/examples/models/emformer_rnnt/__init__.py +17 -0
  800. executorch/examples/models/emformer_rnnt/model.py +132 -0
  801. executorch/examples/models/inception_v3/__init__.py +11 -0
  802. executorch/examples/models/inception_v3/model.py +28 -0
  803. executorch/examples/models/inception_v4/__init__.py +11 -0
  804. executorch/examples/models/inception_v4/model.py +26 -0
  805. executorch/examples/models/llama2/__init__.py +11 -0
  806. executorch/examples/models/llama2/builder.py +406 -0
  807. executorch/examples/models/llama2/custom_ops/__init__.py +0 -0
  808. executorch/examples/models/llama2/custom_ops/libcustom_ops_aot_lib.dylib +0 -0
  809. executorch/examples/models/llama2/custom_ops/sdpa_with_kv_cache.py +128 -0
  810. executorch/examples/models/llama2/custom_ops/test_sdpa_with_kv_cache.py +205 -0
  811. executorch/examples/models/llama2/eval_llama.py +29 -0
  812. executorch/examples/models/llama2/eval_llama_lib.py +209 -0
  813. executorch/examples/models/llama2/evaluate/__init__.py +12 -0
  814. executorch/examples/models/llama2/evaluate/eager_eval.py +125 -0
  815. executorch/examples/models/llama2/experimental/generate.py +190 -0
  816. executorch/examples/models/llama2/experimental/load_gguf_q4_0.py +183 -0
  817. executorch/examples/models/llama2/experimental/subclass.py +242 -0
  818. executorch/examples/models/llama2/experimental/test_subclass.py +28 -0
  819. executorch/examples/models/llama2/export_llama.py +30 -0
  820. executorch/examples/models/llama2/export_llama_lib.py +479 -0
  821. executorch/examples/models/llama2/fairseq2.py +63 -0
  822. executorch/examples/models/llama2/install_requirement_helper.py +29 -0
  823. executorch/examples/models/llama2/lib/__init__.py +0 -0
  824. executorch/examples/models/llama2/lib/partitioner_lib.py +134 -0
  825. executorch/examples/models/llama2/lib/quant_lib.py +189 -0
  826. executorch/examples/models/llama2/llama_test.py +36 -0
  827. executorch/examples/models/llama2/llama_transformer.py +497 -0
  828. executorch/examples/models/llama2/model.py +230 -0
  829. executorch/examples/models/llama2/runner/generation.py +370 -0
  830. executorch/examples/models/llama2/source_transformation/__init__.py +0 -0
  831. executorch/examples/models/llama2/source_transformation/quantize.py +598 -0
  832. executorch/examples/models/llama2/source_transformation/rope.py +35 -0
  833. executorch/examples/models/llama2/source_transformation/sdpa.py +138 -0
  834. executorch/examples/models/llama2/tests/test_simple_sdpa.py +54 -0
  835. executorch/examples/models/llama2/third-party/abseil-cpp/absl/abseil.podspec.gen.py +243 -0
  836. executorch/examples/models/llama2/third-party/abseil-cpp/absl/copts/copts.py +195 -0
  837. executorch/examples/models/llama2/third-party/abseil-cpp/absl/copts/generate_copts.py +109 -0
  838. executorch/examples/models/llama2/third-party/abseil-cpp/conanfile.py +51 -0
  839. executorch/examples/models/llama2/third-party/abseil-cpp/create_lts.py +138 -0
  840. executorch/examples/models/llama2/third-party/re2/benchlog/benchplot.py +98 -0
  841. executorch/examples/models/llama2/third-party/re2/python/re2.py +583 -0
  842. executorch/examples/models/llama2/third-party/re2/python/re2_test.py +489 -0
  843. executorch/examples/models/llama2/third-party/re2/python/setup.py +214 -0
  844. executorch/examples/models/llama2/third-party/re2/re2/make_unicode_casefold.py +151 -0
  845. executorch/examples/models/llama2/third-party/re2/re2/make_unicode_groups.py +117 -0
  846. executorch/examples/models/llama2/third-party/re2/re2/unicode.py +284 -0
  847. executorch/examples/models/llama2/tokenizer/__init__.py +0 -0
  848. executorch/examples/models/llama2/tokenizer/test/__init__.py +0 -0
  849. executorch/examples/models/llama2/tokenizer/test/test_tokenizer.py +39 -0
  850. executorch/examples/models/llama2/tokenizer/tiktoken.py +233 -0
  851. executorch/examples/models/llama2/tokenizer/tokenizer.py +141 -0
  852. executorch/examples/models/llava_encoder/__init__.py +11 -0
  853. executorch/examples/models/llava_encoder/model.py +52 -0
  854. executorch/examples/models/mobilebert/__init__.py +11 -0
  855. executorch/examples/models/mobilebert/model.py +31 -0
  856. executorch/examples/models/mobilenet_v2/__init__.py +12 -0
  857. executorch/examples/models/mobilenet_v2/model.py +42 -0
  858. executorch/examples/models/mobilenet_v3/__init__.py +11 -0
  859. executorch/examples/models/mobilenet_v3/model.py +30 -0
  860. executorch/examples/models/model_base.py +47 -0
  861. executorch/examples/models/model_factory.py +56 -0
  862. executorch/examples/models/phi-3-mini/export_model.py +65 -0
  863. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/setup.py +201 -0
  864. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/src/sentencepiece/__init__.py +1224 -0
  865. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/src/sentencepiece/_version.py +1 -0
  866. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/src/sentencepiece/sentencepiece_model_pb2.py +44 -0
  867. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/src/sentencepiece/sentencepiece_pb2.py +30 -0
  868. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/test/__init__.py +0 -0
  869. executorch/examples/models/phi-3-mini/third-party/sentencepiece/python/test/sentencepiece_test.py +934 -0
  870. executorch/examples/models/resnet/__init__.py +12 -0
  871. executorch/examples/models/resnet/model.py +48 -0
  872. executorch/examples/models/torchvision_vit/__init__.py +11 -0
  873. executorch/examples/models/torchvision_vit/model.py +28 -0
  874. executorch/examples/models/toy_model/__init__.py +15 -0
  875. executorch/examples/models/toy_model/model.py +90 -0
  876. executorch/examples/models/wav2letter/__init__.py +11 -0
  877. executorch/examples/models/wav2letter/model.py +29 -0
  878. executorch/exir/__init__.py +55 -0
  879. executorch/exir/_serialize/__init__.py +18 -0
  880. executorch/exir/_serialize/_cord.py +49 -0
  881. executorch/exir/_serialize/_dataclass.py +138 -0
  882. executorch/exir/_serialize/_flatbuffer.py +351 -0
  883. executorch/exir/_serialize/_program.py +563 -0
  884. executorch/exir/_serialize/program.fbs +407 -0
  885. executorch/exir/_serialize/scalar_type.fbs +32 -0
  886. executorch/exir/_serialize/test/__init__.py +0 -0
  887. executorch/exir/_serialize/test/test_cord.py +63 -0
  888. executorch/exir/_serialize/test/test_flatbuffer.py +331 -0
  889. executorch/exir/_serialize/test/test_program.py +938 -0
  890. executorch/exir/backend/backend_api.py +404 -0
  891. executorch/exir/backend/backend_details.py +68 -0
  892. executorch/exir/backend/canonical_partitioners/duplicate_constant_node_pass.py +152 -0
  893. executorch/exir/backend/canonical_partitioners/duplicate_dequant_node_pass.py +111 -0
  894. executorch/exir/backend/canonical_partitioners/pattern_op_partitioner.py +137 -0
  895. executorch/exir/backend/compile_spec_schema.py +17 -0
  896. executorch/exir/backend/partitioner.py +113 -0
  897. executorch/exir/backend/test/backend_with_compiler_demo.py +134 -0
  898. executorch/exir/backend/test/backend_with_delegate_mapping_demo.py +210 -0
  899. executorch/exir/backend/test/demos/rpc/executor_backend_partitioner.py +74 -0
  900. executorch/exir/backend/test/demos/rpc/executor_backend_preprocess.py +33 -0
  901. executorch/exir/backend/test/demos/rpc/test_rpc.py +187 -0
  902. executorch/exir/backend/test/demos/test_delegate_aten_mode.py +70 -0
  903. executorch/exir/backend/test/demos/test_xnnpack_qnnpack.py +134 -0
  904. executorch/exir/backend/test/hta_partitioner_demo.py +288 -0
  905. executorch/exir/backend/test/op_partitioner_demo.py +195 -0
  906. executorch/exir/backend/test/qnn_backend_demo.py +33 -0
  907. executorch/exir/backend/test/test_backends.py +1290 -0
  908. executorch/exir/backend/test/test_backends_lifted.py +1260 -0
  909. executorch/exir/backend/test/test_backends_nested.py +255 -0
  910. executorch/exir/backend/test/test_debug_handle_map.py +131 -0
  911. executorch/exir/backend/test/test_delegate_map_builder.py +243 -0
  912. executorch/exir/backend/test/test_graph_partition.py +249 -0
  913. executorch/exir/backend/test/test_lowered_backend_module.py +217 -0
  914. executorch/exir/backend/test/test_partitioner.py +607 -0
  915. executorch/exir/backend/test/test_passes.py +47 -0
  916. executorch/exir/backend/test/test_utils.py +341 -0
  917. executorch/exir/backend/utils.py +668 -0
  918. executorch/exir/capture/__init__.py +28 -0
  919. executorch/exir/capture/_capture.py +374 -0
  920. executorch/exir/capture/_config.py +89 -0
  921. executorch/exir/capture/_unlift.py +159 -0
  922. executorch/exir/common.py +140 -0
  923. executorch/exir/control_flow.py +203 -0
  924. executorch/exir/delegate.py +161 -0
  925. executorch/exir/dialects/__init__.py +0 -0
  926. executorch/exir/dialects/_ops.py +166 -0
  927. executorch/exir/dialects/backend/_ops.py +123 -0
  928. executorch/exir/dialects/backend/test/test_backend_ops.py +88 -0
  929. executorch/exir/dialects/edge/_ops.py +406 -0
  930. executorch/exir/dialects/edge/arg/model.py +238 -0
  931. executorch/exir/dialects/edge/arg/type.py +46 -0
  932. executorch/exir/dialects/edge/dtype/runner.py +120 -0
  933. executorch/exir/dialects/edge/dtype/supported.py +45 -0
  934. executorch/exir/dialects/edge/dtype/utils.py +36 -0
  935. executorch/exir/dialects/edge/edge.yaml +7623 -0
  936. executorch/exir/dialects/edge/op/api.py +86 -0
  937. executorch/exir/dialects/edge/op/sample_input.py +1274 -0
  938. executorch/exir/dialects/edge/op/test/test_api.py +51 -0
  939. executorch/exir/dialects/edge/spec/gen.py +542 -0
  940. executorch/exir/dialects/edge/spec/utils.py +328 -0
  941. executorch/exir/dialects/edge/test/test_edge_ops.py +441 -0
  942. executorch/exir/dialects/edge/test/test_edge_yaml.py +224 -0
  943. executorch/exir/dialects/test/test_exir_dialect_ops.py +22 -0
  944. executorch/exir/dim_order_utils.py +85 -0
  945. executorch/exir/dynamic_shape.py +12 -0
  946. executorch/exir/emit/__init__.py +11 -0
  947. executorch/exir/emit/_emit_program.py +160 -0
  948. executorch/exir/emit/_emitter.py +1602 -0
  949. executorch/exir/emit/test/test_emit.py +1545 -0
  950. executorch/exir/error.py +55 -0
  951. executorch/exir/graph.py +86 -0
  952. executorch/exir/graph_module.py +70 -0
  953. executorch/exir/lowered_backend_module.py +737 -0
  954. executorch/exir/memory.py +50 -0
  955. executorch/exir/memory_planning.py +799 -0
  956. executorch/exir/operator/convert.py +307 -0
  957. executorch/exir/operator/manip.py +89 -0
  958. executorch/exir/operator/test/test_operator.py +84 -0
  959. executorch/exir/operator/util.py +41 -0
  960. executorch/exir/pass_base.py +731 -0
  961. executorch/exir/pass_manager.py +78 -0
  962. executorch/exir/passes/__init__.py +510 -0
  963. executorch/exir/passes/_quant_patterns_and_replacements.py +1007 -0
  964. executorch/exir/passes/const_prop_pass.py +84 -0
  965. executorch/exir/passes/constant_prop_pass.py +311 -0
  966. executorch/exir/passes/debug_handle_generator_pass.py +32 -0
  967. executorch/exir/passes/dim_order_ops_registry.py +47 -0
  968. executorch/exir/passes/dynamic_shape_prop_pass.py +301 -0
  969. executorch/exir/passes/executorch_prim_ops_registry.py +118 -0
  970. executorch/exir/passes/insert_write_back_for_buffers_pass.py +134 -0
  971. executorch/exir/passes/memory_format_ops_pass.py +63 -0
  972. executorch/exir/passes/memory_planning_pass.py +131 -0
  973. executorch/exir/passes/normalize_transpose_pass.py +24 -0
  974. executorch/exir/passes/normalize_view_copy_base_pass.py +62 -0
  975. executorch/exir/passes/pass_registry.py +89 -0
  976. executorch/exir/passes/quant_fusion_pass.py +128 -0
  977. executorch/exir/passes/remove_graph_asserts_pass.py +39 -0
  978. executorch/exir/passes/remove_mixed_type_operators.py +85 -0
  979. executorch/exir/passes/remove_noop_pass.py +123 -0
  980. executorch/exir/passes/replace_aten_with_edge_pass.py +57 -0
  981. executorch/exir/passes/replace_broken_ops_with_function_ops_pass.py +44 -0
  982. executorch/exir/passes/replace_edge_with_backend_pass.py +56 -0
  983. executorch/exir/passes/replace_sym_size_op_pass.py +35 -0
  984. executorch/exir/passes/replace_view_copy_with_view_pass.py +324 -0
  985. executorch/exir/passes/scalar_to_tensor_pass.py +32 -0
  986. executorch/exir/passes/spec_prop_pass.py +151 -0
  987. executorch/exir/passes/sym_shape_eval_pass.py +264 -0
  988. executorch/exir/passes/sym_to_tensor_pass.py +64 -0
  989. executorch/exir/print_program.py +420 -0
  990. executorch/exir/program/__init__.py +32 -0
  991. executorch/exir/program/_fake_program.py +64 -0
  992. executorch/exir/program/_program.py +1372 -0
  993. executorch/exir/program/test/__init__.py +0 -0
  994. executorch/exir/program/test/test_fake_program.py +76 -0
  995. executorch/exir/program/test/test_program.py +607 -0
  996. executorch/exir/scalar_type.py +28 -0
  997. executorch/exir/schema.py +267 -0
  998. executorch/exir/serde/__init__.py +0 -0
  999. executorch/exir/serde/export_serialize.py +1858 -0
  1000. executorch/exir/serde/schema.py +31 -0
  1001. executorch/exir/serde/serialize.py +849 -0
  1002. executorch/exir/sym_util.py +89 -0
  1003. executorch/exir/tensor.py +363 -0
  1004. executorch/exir/tests/asr_joiner.py +82 -0
  1005. executorch/exir/tests/common.py +97 -0
  1006. executorch/exir/tests/control_flow_models.py +110 -0
  1007. executorch/exir/tests/dynamic_shape_models.py +51 -0
  1008. executorch/exir/tests/models.py +562 -0
  1009. executorch/exir/tests/test_arg_validator.py +72 -0
  1010. executorch/exir/tests/test_capture.py +27 -0
  1011. executorch/exir/tests/test_common.py +81 -0
  1012. executorch/exir/tests/test_delegate.py +311 -0
  1013. executorch/exir/tests/test_dim_order_utils.py +29 -0
  1014. executorch/exir/tests/test_dynamic_shape_propagation.py +39 -0
  1015. executorch/exir/tests/test_error.py +19 -0
  1016. executorch/exir/tests/test_memory_format_ops_pass.py +79 -0
  1017. executorch/exir/tests/test_memory_format_ops_pass_aten.py +79 -0
  1018. executorch/exir/tests/test_memory_format_ops_pass_utils.py +112 -0
  1019. executorch/exir/tests/test_memory_planning.py +593 -0
  1020. executorch/exir/tests/test_op_convert.py +88 -0
  1021. executorch/exir/tests/test_pass_infra.py +179 -0
  1022. executorch/exir/tests/test_passes.py +1678 -0
  1023. executorch/exir/tests/test_print_program.py +54 -0
  1024. executorch/exir/tests/test_quant_fusion_pass.py +371 -0
  1025. executorch/exir/tests/test_quantization.py +120 -0
  1026. executorch/exir/tests/test_remove_view_copy.py +227 -0
  1027. executorch/exir/tests/test_serde.py +242 -0
  1028. executorch/exir/tests/test_tensor.py +341 -0
  1029. executorch/exir/tests/test_tracer.py +553 -0
  1030. executorch/exir/tests/test_verification.py +272 -0
  1031. executorch/exir/tests/transformer.py +122 -0
  1032. executorch/exir/tracer.py +785 -0
  1033. executorch/exir/types.py +18 -0
  1034. executorch/exir/verification/arg_validator.py +129 -0
  1035. executorch/exir/verification/dev_html.py +68 -0
  1036. executorch/exir/verification/interpreter.py +425 -0
  1037. executorch/exir/verification/test/test_verifier.py +158 -0
  1038. executorch/exir/verification/verifier.py +290 -0
  1039. executorch/exir/version.py +9 -0
  1040. executorch/exir/wrap.py +32 -0
  1041. executorch/extension/gguf_util/convert_main.py +53 -0
  1042. executorch/extension/gguf_util/converter.py +27 -0
  1043. executorch/extension/gguf_util/converters/llama_converter.py +123 -0
  1044. executorch/extension/gguf_util/load_gguf.py +103 -0
  1045. executorch/extension/pybindings/_portable_lib.cpython-312-darwin.so +0 -0
  1046. executorch/extension/pybindings/portable_lib.py +34 -0
  1047. executorch/extension/pybindings/pybindings.pyi +49 -0
  1048. executorch/extension/pybindings/test/make_test.py +221 -0
  1049. executorch/extension/pybindings/test/test_pybindings.py +38 -0
  1050. executorch/extension/pytree/__init__.py +54 -0
  1051. executorch/extension/pytree/test/test.py +331 -0
  1052. executorch/schema/program.fbs +407 -0
  1053. executorch/schema/scalar_type.fbs +32 -0
  1054. executorch/sdk/__init__.py +19 -0
  1055. executorch/sdk/bundled_program/config.py +120 -0
  1056. executorch/sdk/bundled_program/core.py +372 -0
  1057. executorch/sdk/bundled_program/schema/__init__.py +9 -0
  1058. executorch/sdk/bundled_program/schema/bundled_program_schema.fbs +97 -0
  1059. executorch/sdk/bundled_program/schema/bundled_program_schema.py +99 -0
  1060. executorch/sdk/bundled_program/schema/scalar_type.fbs +32 -0
  1061. executorch/sdk/bundled_program/schema/test/test_schema.py +27 -0
  1062. executorch/sdk/bundled_program/serialize/__init__.py +122 -0
  1063. executorch/sdk/bundled_program/serialize/bundled_program_schema.fbs +97 -0
  1064. executorch/sdk/bundled_program/serialize/scalar_type.fbs +32 -0
  1065. executorch/sdk/bundled_program/serialize/test/test_serialize.py +35 -0
  1066. executorch/sdk/bundled_program/test/test_bundle_data.py +118 -0
  1067. executorch/sdk/bundled_program/test/test_config.py +131 -0
  1068. executorch/sdk/bundled_program/test/test_end2end.py +93 -0
  1069. executorch/sdk/bundled_program/util/test_util.py +288 -0
  1070. executorch/sdk/bundled_program/version.py +13 -0
  1071. executorch/sdk/debug_format/base_schema.py +59 -0
  1072. executorch/sdk/debug_format/et_schema.py +419 -0
  1073. executorch/sdk/etdump/etdump_schema_flatcc.fbs +171 -0
  1074. executorch/sdk/etdump/scalar_type.fbs +32 -0
  1075. executorch/sdk/etdump/schema_flatcc.py +151 -0
  1076. executorch/sdk/etdump/serialize.py +110 -0
  1077. executorch/sdk/etdump/tests/serialize_test.py +139 -0
  1078. executorch/sdk/etrecord/__init__.py +13 -0
  1079. executorch/sdk/etrecord/_etrecord.py +328 -0
  1080. executorch/sdk/etrecord/tests/etrecord_test.py +187 -0
  1081. executorch/sdk/inspector/__init__.py +10 -0
  1082. executorch/sdk/inspector/_inspector.py +1196 -0
  1083. executorch/sdk/inspector/_inspector_utils.py +417 -0
  1084. executorch/sdk/inspector/inspector_cli.py +67 -0
  1085. executorch/sdk/inspector/tests/event_blocks_test.py +370 -0
  1086. executorch/sdk/inspector/tests/inspector_test.py +289 -0
  1087. executorch/sdk/inspector/tests/inspector_utils_test.py +194 -0
  1088. executorch/sdk/size_analysis_tool/size_analysis_tool.py +180 -0
  1089. executorch/sdk/size_analysis_tool/size_analysis_tool_test.py +115 -0
  1090. executorch/util/activation_memory_profiler.py +146 -0
  1091. executorch/util/python_profiler.py +88 -0
  1092. executorch/version.py +4 -0
  1093. executorch-0.3.0.dist-info/LICENSE +33 -0
  1094. executorch-0.3.0.dist-info/METADATA +109 -0
  1095. executorch-0.3.0.dist-info/RECORD +1134 -0
  1096. executorch-0.3.0.dist-info/WHEEL +5 -0
  1097. executorch-0.3.0.dist-info/entry_points.txt +2 -0
  1098. executorch-0.3.0.dist-info/top_level.txt +13 -0
  1099. serializer/__init__.py +3 -0
  1100. serializer/tosa_serializer.py +965 -0
  1101. tosa/ArithmeticRightShiftAttribute.py +54 -0
  1102. tosa/Attribute.py +29 -0
  1103. tosa/AxisAttribute.py +54 -0
  1104. tosa/ClampAttribute.py +145 -0
  1105. tosa/CondIfAttribute.py +67 -0
  1106. tosa/ConvAttribute.py +197 -0
  1107. tosa/CustomAttribute.py +106 -0
  1108. tosa/DType.py +18 -0
  1109. tosa/FFTAttribute.py +67 -0
  1110. tosa/FullyConnectedAttribute.py +67 -0
  1111. tosa/MatMulAttribute.py +67 -0
  1112. tosa/MulAttribute.py +54 -0
  1113. tosa/NegateAttribute.py +67 -0
  1114. tosa/Op.py +78 -0
  1115. tosa/PadAttribute.py +132 -0
  1116. tosa/PoolAttribute.py +197 -0
  1117. tosa/RFFTAttribute.py +54 -0
  1118. tosa/RescaleAttribute.py +210 -0
  1119. tosa/ReshapeAttribute.py +80 -0
  1120. tosa/ResizeAttribute.py +171 -0
  1121. tosa/ResizeMode.py +8 -0
  1122. tosa/SliceAttribute.py +119 -0
  1123. tosa/TableAttribute.py +80 -0
  1124. tosa/TileAttribute.py +80 -0
  1125. tosa/TosaBasicBlock.py +192 -0
  1126. tosa/TosaGraph.py +95 -0
  1127. tosa/TosaOperator.py +147 -0
  1128. tosa/TosaRegion.py +91 -0
  1129. tosa/TosaTensor.py +184 -0
  1130. tosa/TransposeAttribute.py +80 -0
  1131. tosa/TransposeConvAttribute.py +197 -0
  1132. tosa/Version.py +93 -0
  1133. tosa/WhileLoopAttribute.py +67 -0
  1134. tosa/__init__.py +0 -0
@@ -0,0 +1,9 @@
1
+ # Copyright © 2023 Apple Inc. All rights reserved.
2
+ #
3
+ # Please refer to the license found in the LICENSE file in the root directory of the source tree.
4
+
5
+ from .coreml_preprocess import CoreMLBackend
6
+
7
+ __all__ = [
8
+ CoreMLBackend,
9
+ ]
@@ -0,0 +1,377 @@
1
+ # Copyright © 2023 Apple Inc. All rights reserved.
2
+
3
+ # CoreML backend for delegating a EdgeProgram to CoreML.
4
+
5
+ import json
6
+
7
+ import shutil
8
+ import uuid
9
+ from dataclasses import asdict, dataclass
10
+ from enum import Enum
11
+
12
+ from pathlib import Path
13
+
14
+ from typing import Any, Dict, final, List, Optional, Tuple
15
+
16
+ import coremltools as ct
17
+ import executorchcoreml
18
+
19
+ from executorch.exir.backend.backend_details import (
20
+ BackendDetails,
21
+ ExportedProgram,
22
+ PreprocessResult,
23
+ )
24
+ from executorch.exir.backend.compile_spec_schema import CompileSpec
25
+
26
+
27
+ class COMPILE_SPEC_KEYS(Enum):
28
+ COMPUTE_UNITS = "compute_units"
29
+ MODEL_TYPE = "model_type"
30
+ MIN_DEPLOYMENT_TARGET = "min_deployment_target"
31
+ MODEL_COMPUTE_PRECISION = "model_compute_precision"
32
+
33
+
34
+ class MODEL_PATHS(Enum):
35
+ MODEL = "model.mlpackage"
36
+ COMPILED_MODEL = "model.mlmodelc"
37
+ METADATA = "metadata.json"
38
+ DEBUG_INFO = "debug_info.json"
39
+
40
+
41
+ @dataclass
42
+ class ModelMetadata:
43
+ # The model input names.
44
+ inputNames: List[str]
45
+ # The model output names.
46
+ outputNames: List[str]
47
+ # The model identifier.
48
+ identifier: str
49
+
50
+
51
+ @dataclass
52
+ class ModelDebugInfo:
53
+ # Version info.
54
+ versionInfo: Dict[str, str]
55
+ # Mapping from debug symbol to operation path.
56
+ debugSymbolToOperationPath: Dict[str, List[Dict[str, str]]]
57
+ # Mapping from debug symbol to handle.
58
+ debugSymbolToHandles: Dict[str, List[int]]
59
+
60
+
61
+ @final
62
+ class CoreMLBackend(BackendDetails):
63
+ class MODEL_TYPE(Enum):
64
+ MODEL = "model"
65
+ COMPILED_MODEL = "compiled_model"
66
+
67
+ @staticmethod
68
+ def generate_model_type_compile_spec(model_type: MODEL_TYPE) -> CompileSpec:
69
+ """
70
+ Returns the compile spec representing the given model type.
71
+
72
+ If the model type is ``MODEL_TYPE.Model`` then the ``CoreMLBackend`` returns
73
+ the in-memory representation of the ``mlpackage`` contents.
74
+
75
+ If the model type is ``MODEL_TYPE.COMPILED_MODEL`` then the ``CoreMLBackend`` compiles the model
76
+ and returns the in-memory representation of ``mlmodelc`` (compiled model) contents.
77
+ """
78
+ return CompileSpec(
79
+ COMPILE_SPEC_KEYS.MODEL_TYPE.value, model_type.value.encode("utf-8")
80
+ )
81
+
82
+ @staticmethod
83
+ def model_type_from_compile_specs(compile_specs: List[CompileSpec]) -> MODEL_TYPE:
84
+ """
85
+ Returns the model type by parsing the list of compile specs.
86
+ """
87
+ for compile_spec in compile_specs:
88
+ if compile_spec.key == COMPILE_SPEC_KEYS.MODEL_TYPE.value:
89
+ return CoreMLBackend.MODEL_TYPE(compile_spec.value.decode("utf-8"))
90
+
91
+ return CoreMLBackend.MODEL_TYPE.MODEL
92
+
93
+ @staticmethod
94
+ def generate_compute_precision_compile_spec(
95
+ compute_precision: ct.precision,
96
+ ) -> CompileSpec:
97
+ """
98
+ Returns the compile spec representing the model compute precision, for additional details
99
+ please refer to the documentation for ``coremltools.precision``.
100
+ """
101
+ return CompileSpec(
102
+ COMPILE_SPEC_KEYS.MODEL_COMPUTE_PRECISION.value,
103
+ compute_precision.value.encode("utf-8"),
104
+ )
105
+
106
+ @staticmethod
107
+ def model_compute_precision_from_compile_specs(
108
+ compile_specs: List[CompileSpec],
109
+ ) -> ct.precision:
110
+ """
111
+ Returns the model's compute precision by parsing the list of compile specs.
112
+ """
113
+ for compile_spec in compile_specs:
114
+ if compile_spec.key == COMPILE_SPEC_KEYS.MODEL_COMPUTE_PRECISION.value:
115
+ return ct.precision(compile_spec.value.decode("utf-8"))
116
+
117
+ return ct.precision.FLOAT16
118
+
119
+ @staticmethod
120
+ def generate_minimum_deployment_target_compile_spec(
121
+ min_deployment_target: ct.target,
122
+ ) -> CompileSpec:
123
+ """
124
+ Returns the compile spec representing the minimum deployment target on which the model can run,
125
+ for additional details please refer to the documentation for ``coremltools.target``.
126
+ """
127
+ return CompileSpec(
128
+ COMPILE_SPEC_KEYS.MIN_DEPLOYMENT_TARGET.value,
129
+ str(min_deployment_target.value).encode("utf-8"),
130
+ )
131
+
132
+ @staticmethod
133
+ def min_deployment_target_from_compile_specs(
134
+ compile_specs: List[CompileSpec],
135
+ ) -> ct.target:
136
+ """
137
+ Returns the minimum deployment target by parsing the list of compile specs.
138
+ """
139
+ for compile_spec in compile_specs:
140
+ if compile_spec.key == COMPILE_SPEC_KEYS.MIN_DEPLOYMENT_TARGET.value:
141
+ compile_spec_value: int = int(compile_spec.value.decode("utf-8"))
142
+ return ct.target(compile_spec_value)
143
+
144
+ return ct.target.iOS15
145
+
146
+ @staticmethod
147
+ def generate_compute_unit_compile_spec(
148
+ compute_unit: ct.ComputeUnit,
149
+ ) -> CompileSpec:
150
+ """
151
+ Returns the compile spec representing the compute units on which the model can run, for additional details
152
+ please refer to the documentation for ``coremltools.ComputeUnit`.
153
+ """
154
+ return CompileSpec(
155
+ COMPILE_SPEC_KEYS.COMPUTE_UNITS.value,
156
+ compute_unit.name.lower().encode("utf-8"),
157
+ )
158
+
159
+ @staticmethod
160
+ def generate_compile_specs(
161
+ compute_unit: ct.ComputeUnit = ct.ComputeUnit.ALL,
162
+ minimum_deployment_target: ct.target = ct.target.iOS15,
163
+ compute_precision: ct.precision = ct.precision.FLOAT16,
164
+ model_type: MODEL_TYPE = MODEL_TYPE.MODEL,
165
+ ) -> List[CompileSpec]:
166
+ """
167
+ Returns the list of compile specs that's used by CoreMLBackend to lower the module.
168
+ """
169
+ compile_specs: List[CompileSpec] = []
170
+ compile_specs.append(
171
+ CoreMLBackend.generate_compute_unit_compile_spec(compute_unit)
172
+ )
173
+ compile_specs.append(
174
+ CoreMLBackend.generate_minimum_deployment_target_compile_spec(
175
+ minimum_deployment_target
176
+ )
177
+ )
178
+ compile_specs.append(
179
+ CoreMLBackend.generate_compute_precision_compile_spec(compute_precision)
180
+ )
181
+ compile_specs.append(CoreMLBackend.generate_model_type_compile_spec(model_type))
182
+
183
+ return compile_specs
184
+
185
+ @staticmethod
186
+ def model_metadata_from_spec(
187
+ model_spec: ct.proto.Model_pb2, identifier: str # pyre-ignore
188
+ ) -> ModelMetadata:
189
+ input_names: List[str] = [input.name for input in model_spec.description.input]
190
+ output_names = [output.name for output in model_spec.description.output]
191
+
192
+ return ModelMetadata(
193
+ inputNames=input_names, outputNames=output_names, identifier=identifier
194
+ )
195
+
196
+ @staticmethod
197
+ def get_debug_symbol(operation_path: List[Dict[str, str]]) -> Optional[str]:
198
+ if len(operation_path) == 0:
199
+ return None
200
+
201
+ operator_name: Optional[str] = operation_path[-1].get("Operator", None)
202
+ output_name: Optional[str] = operation_path[-1].get("Output", None)
203
+ if output_name is None or operator_name is None:
204
+ return None
205
+
206
+ return output_name + ":" + operator_name
207
+
208
+ @staticmethod
209
+ def get_model_debug_info(model_package_dir: Path) -> Optional[ModelDebugInfo]:
210
+ delegate_info_file = model_package_dir / "executorch_debug_handle_mapping.json"
211
+
212
+ if not delegate_info_file.is_file():
213
+ return None
214
+
215
+ delegate_info: Optional[Dict[str, Any]] = None
216
+
217
+ try:
218
+ with open(delegate_info_file) as f:
219
+ delegate_info = json.load(f)
220
+ except ValueError:
221
+ return None
222
+
223
+ if delegate_info is None:
224
+ return None
225
+
226
+ debug_handle_to_operation_path_mapping: Optional[Dict[str, Any]] = (
227
+ delegate_info.get("mapping", None)
228
+ )
229
+
230
+ if debug_handle_to_operation_path_mapping is None:
231
+ return None
232
+
233
+ debug_symbol_to_operation_path: Dict[str, List[Dict[str, str]]] = {}
234
+ debug_symbol_to_handles: Dict[str, List[int]] = {}
235
+ for (
236
+ debug_handle,
237
+ operation_paths,
238
+ ) in debug_handle_to_operation_path_mapping.items():
239
+ debug_handle_value: Optional[int] = None
240
+ try:
241
+ debug_handle_value = int(debug_handle)
242
+ except ValueError:
243
+ debug_handle_value = None
244
+
245
+ if debug_handle_value is None:
246
+ continue
247
+
248
+ for operation_path in operation_paths:
249
+ debug_symbol: Optional[str] = CoreMLBackend.get_debug_symbol(
250
+ operation_path=operation_path
251
+ )
252
+
253
+ if debug_symbol is None:
254
+ continue
255
+
256
+ debug_handle_values: List[int] = debug_symbol_to_handles.get(
257
+ debug_symbol, []
258
+ )
259
+ debug_handle_values.append(debug_handle_value)
260
+ debug_symbol_to_handles[debug_symbol] = debug_handle_values
261
+
262
+ debug_symbol_to_operation_path[debug_symbol] = operation_path
263
+
264
+ version_info: Dict[str, str] = delegate_info.get("version", {})
265
+
266
+ return ModelDebugInfo(
267
+ versionInfo=version_info,
268
+ debugSymbolToOperationPath=debug_symbol_to_operation_path,
269
+ debugSymbolToHandles=debug_symbol_to_handles,
270
+ )
271
+
272
+ @staticmethod
273
+ def save_model_metadata(model_metadata: ModelMetadata, model_dir_path: Path):
274
+ # Store model metadata.
275
+ model_metadata_path = Path(model_dir_path) / MODEL_PATHS.METADATA.value
276
+ model_metadata_json = json.dumps(asdict(model_metadata))
277
+ with open(model_metadata_path, "w") as outfile:
278
+ outfile.write(model_metadata_json)
279
+
280
+ @staticmethod
281
+ def save_model_debug_info(model_debug_info: ModelDebugInfo, model_dir_path: Path):
282
+ # Store model debug info.
283
+ model_debug_info_path = Path(model_dir_path) / MODEL_PATHS.DEBUG_INFO.value
284
+ model_debug_info_json = json.dumps(asdict(model_debug_info))
285
+ with open(model_debug_info_path, "w") as outfile:
286
+ outfile.write(model_debug_info_json)
287
+
288
+ @staticmethod
289
+ def preprocess_model(
290
+ mlmodel: ct.models.MLModel, model_type: MODEL_TYPE
291
+ ) -> PreprocessResult:
292
+ identifier = "executorch_" + str(uuid.uuid4())
293
+ dir_path: Path = Path("tmp") / identifier
294
+ model_dir_path: Path = dir_path / "lowered_module"
295
+ model_spec: ct.proto.Model_pb2 = mlmodel.get_spec()
296
+ model_metadata: ModelMetadata = CoreMLBackend.model_metadata_from_spec(
297
+ model_spec=model_spec,
298
+ identifier=identifier,
299
+ )
300
+
301
+ # Save model.
302
+ model_path = model_dir_path / MODEL_PATHS.MODEL.value
303
+ mlmodel.save(str(model_path))
304
+ # Extract delegate mapping file.
305
+ model_debug_info: Optional[ModelDebugInfo] = CoreMLBackend.get_model_debug_info(
306
+ model_path
307
+ )
308
+
309
+ match model_type:
310
+ case CoreMLBackend.MODEL_TYPE.COMPILED_MODEL:
311
+ shutil.rmtree(str(model_path.resolve()))
312
+ model_path = model_dir_path / MODEL_PATHS.COMPILED_MODEL.value
313
+ compiled_model_path = mlmodel.get_compiled_model_path()
314
+ shutil.move(
315
+ compiled_model_path,
316
+ str(model_path.resolve()),
317
+ )
318
+
319
+ case _:
320
+ pass
321
+
322
+ CoreMLBackend.save_model_metadata(
323
+ model_metadata=model_metadata, model_dir_path=model_dir_path
324
+ )
325
+ if model_debug_info is not None:
326
+ CoreMLBackend.save_model_debug_info(
327
+ model_debug_info=model_debug_info, model_dir_path=model_dir_path
328
+ )
329
+
330
+ processed_bytes: bytes = (
331
+ executorchcoreml.flatten_directory_contents(str(model_dir_path.resolve()))
332
+ or b""
333
+ )
334
+
335
+ debug_handle_map: Optional[Dict[str, Tuple[int]]] = None
336
+ if model_debug_info is not None:
337
+ debug_handle_map = {
338
+ key: tuple(value)
339
+ for key, value in model_debug_info.debugSymbolToHandles.items()
340
+ }
341
+
342
+ shutil.rmtree(str(dir_path.resolve()))
343
+ return PreprocessResult(
344
+ processed_bytes=processed_bytes,
345
+ debug_handle_map=debug_handle_map,
346
+ )
347
+
348
+ @staticmethod
349
+ def preprocess(
350
+ edge_program: ExportedProgram,
351
+ compile_specs: List[CompileSpec],
352
+ ) -> PreprocessResult:
353
+ model_type: CoreMLBackend.MODEL_TYPE = (
354
+ CoreMLBackend.model_type_from_compile_specs(
355
+ compile_specs,
356
+ )
357
+ )
358
+
359
+ model_compute_precision: ct.precision = (
360
+ CoreMLBackend.model_compute_precision_from_compile_specs(compile_specs)
361
+ )
362
+
363
+ minimum_deployment_target: ct.target = (
364
+ CoreMLBackend.min_deployment_target_from_compile_specs(compile_specs)
365
+ )
366
+
367
+ mlmodel = ct.convert(
368
+ model=edge_program,
369
+ source="pytorch",
370
+ convert_to="mlprogram",
371
+ pass_pipeline=ct.PassPipeline.DEFAULT,
372
+ skip_model_load=False,
373
+ compute_precision=model_compute_precision,
374
+ minimum_deployment_target=minimum_deployment_target,
375
+ )
376
+
377
+ return CoreMLBackend.preprocess_model(mlmodel, model_type=model_type)
@@ -0,0 +1,10 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ # All rights reserved.
3
+ #
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ from typing import Optional
8
+
9
+ def flatten_directory_contents(path: str) -> Optional[bytes]: ...
10
+ def unflatten_directory_contents(bytes: bytes, path: str) -> bool: ...
@@ -0,0 +1,9 @@
1
+ # Copyright © 2023 Apple Inc. All rights reserved.
2
+ #
3
+ # Please refer to the license found in the LICENSE file in the root directory of the source tree.
4
+
5
+ from .coreml_partitioner import CoreMLPartitioner
6
+
7
+ __all__ = [
8
+ CoreMLPartitioner,
9
+ ]
@@ -0,0 +1,95 @@
1
+ # Copyright © 2023 Apple Inc. All rights reserved.
2
+ #
3
+ # Please refer to the license found in the LICENSE file in the root directory of the source tree.
4
+
5
+ import logging
6
+ from typing import List, Optional
7
+
8
+ import coremltools as ct
9
+
10
+ import torch
11
+
12
+ from executorch.backends.apple.coreml.compiler import CoreMLBackend
13
+ from executorch.exir.backend.compile_spec_schema import CompileSpec
14
+
15
+ from executorch.exir.backend.partitioner import (
16
+ DelegationSpec,
17
+ Partitioner,
18
+ PartitionResult,
19
+ )
20
+ from executorch.exir.backend.utils import tag_constant_data
21
+ from torch.export.exported_program import ExportedProgram
22
+ from torch.fx.passes.infra.partitioner import CapabilityBasedPartitioner
23
+ from torch.fx.passes.operator_support import OperatorSupportBase
24
+
25
+ logger = logging.getLogger(__name__)
26
+ logger.setLevel(logging.WARNING)
27
+
28
+
29
+ class OperatorsSupportedForCoreMLBackend(OperatorSupportBase):
30
+ def __init__(
31
+ self, skip_ops_for_coreml_delegation: Optional[List[str]] = None
32
+ ) -> None:
33
+ if skip_ops_for_coreml_delegation is None:
34
+ skip_ops_for_coreml_delegation = []
35
+ super().__init__()
36
+ self.skip_ops_for_coreml_delegation = skip_ops_for_coreml_delegation
37
+
38
+ def is_node_supported(self, submodules, node: torch.fx.Node) -> bool:
39
+ # get_attr node can always be supported on any backend
40
+ if node.op == "get_attr":
41
+ return True
42
+ # check if the PyTorch op get called is supported in Core ML
43
+ elif node.op == "call_function":
44
+ # skip ops if specified by user
45
+ node_target_name = getattr(node.target, "__name__", "").lower()
46
+ if node_target_name in (self.skip_ops_for_coreml_delegation or []):
47
+ return False
48
+ # query coremltools to see if node is supported
49
+ return ct.converters.mil.frontend.torch.is_torch_fx_node_supported(node)
50
+ # cowardly refuse to support all other types of node:
51
+ # 1. placeholder / output nodes should not be tagged
52
+ # reference: https://github.com/pytorch/executorch/pull/1398
53
+ # 2. call_module / call_method should have been replaced with call_function?
54
+ else:
55
+ return False
56
+
57
+
58
+ class CoreMLPartitioner(Partitioner):
59
+
60
+ def __init__(
61
+ self,
62
+ skip_ops_for_coreml_delegation: Optional[List[str]] = None,
63
+ compile_specs: Optional[List[CompileSpec]] = None,
64
+ ) -> None:
65
+ if skip_ops_for_coreml_delegation is None:
66
+ skip_ops_for_coreml_delegation = []
67
+ self.skip_ops_for_coreml_delegation = skip_ops_for_coreml_delegation
68
+ self.delegation_spec = DelegationSpec(
69
+ backend_id=CoreMLBackend.__name__,
70
+ compile_specs=compile_specs if compile_specs is not None else [],
71
+ )
72
+
73
+ def partition(self, exported_program: ExportedProgram) -> PartitionResult:
74
+ # Run the CapabilityBasedPartitioner to return the largest possible
75
+ # subgraphs containing the nodes with the tags
76
+ logger.info("CoreMLPartitioner::partition")
77
+ partition_tags = {}
78
+
79
+ capability_partitioner = CapabilityBasedPartitioner(
80
+ exported_program.graph_module,
81
+ OperatorsSupportedForCoreMLBackend(self.skip_ops_for_coreml_delegation),
82
+ allows_single_node_partition=True,
83
+ )
84
+ partition_list = capability_partitioner.propose_partitions()
85
+ for partition in partition_list:
86
+ for node in partition.nodes:
87
+ tag = f"tag{partition.id}"
88
+ node.meta["delegation_tag"] = tag
89
+ partition_tags[tag] = self.delegation_spec
90
+
91
+ tag_constant_data(exported_program)
92
+
93
+ return PartitionResult(
94
+ tagged_exported_program=exported_program, partition_tags=partition_tags
95
+ )
@@ -0,0 +1,9 @@
1
+ # Copyright © 2023 Apple Inc. All rights reserved.
2
+ #
3
+ # Please refer to the license found in the LICENSE file in the root directory of the source tree.
4
+
5
+ from .coreml_quantizer import CoreMLQuantizer
6
+
7
+ __all__ = [
8
+ CoreMLQuantizer,
9
+ ]
@@ -0,0 +1,7 @@
1
+ # Copyright © 2024 Apple Inc. All rights reserved.
2
+ #
3
+ # Please refer to the license found in the LICENSE file in the root directory of the source tree.
4
+
5
+ from coremltools.optimize.torch.quantization._coreml_quantizer import ( # noqa: FLAKE8 F401
6
+ CoreMLQuantizer,
7
+ )
@@ -0,0 +1,52 @@
1
+ import os
2
+
3
+ import pathlib
4
+ import sys
5
+
6
+ REPO_ROOT = pathlib.Path(__file__).resolve().parent.parent.parent.parent.parent.parent
7
+ PYBIND11_DIR_PATH = REPO_ROOT / "third-party" / "pybind11"
8
+ sys.path.append(str(PYBIND11_DIR_PATH.absolute()))
9
+
10
+ from pybind11.setup_helpers import build_ext, Pybind11Extension
11
+ from setuptools import setup
12
+
13
+ __version__ = "0.0.1"
14
+
15
+ cxx_std = int(os.environ.get("CMAKE_CXX_STANDARD", "17"))
16
+
17
+ ext_modules = [
18
+ Pybind11Extension(
19
+ "executorchcoreml",
20
+ [
21
+ "../util/json_util.cpp",
22
+ "inmemory_filesystem.cpp",
23
+ "inmemory_filesystem_py.cpp",
24
+ "inmemory_filesystem_utils.cpp",
25
+ "memory_buffer.cpp",
26
+ "memory_stream.cpp",
27
+ "reversed_memory_stream.cpp",
28
+ ],
29
+ define_macros=[("VERSION_INFO", __version__)],
30
+ cxx_std=cxx_std,
31
+ extra_compile_args=["-mmacosx-version-min=10.15", "-g"],
32
+ include_dirs=[
33
+ "../../third-party/nlohmann_json/single_include",
34
+ ".",
35
+ "../util",
36
+ ],
37
+ ),
38
+ ]
39
+
40
+ setup(
41
+ name="executorchcoreml",
42
+ version=__version__,
43
+ description="CoreML extension for executorch",
44
+ long_description="",
45
+ author="Apple Inc.",
46
+ ext_modules=ext_modules,
47
+ extras_require={"test": "pytest"},
48
+ cmdclass={"build_ext": build_ext},
49
+ include_package_data=True,
50
+ zip_safe=False,
51
+ python_requires=">=3.9",
52
+ )
@@ -0,0 +1,85 @@
1
+ # Copyright © 2023 Apple Inc. All rights reserved.
2
+ #
3
+ # Please refer to the license found in the LICENSE file in the root directory of the source tree.
4
+
5
+ import unittest
6
+
7
+ import executorch.exir
8
+
9
+ import torch
10
+ import torchvision
11
+
12
+ from executorch.backends.apple.coreml.partition import CoreMLPartitioner
13
+
14
+
15
+ class TestCoreMLPartitioner(unittest.TestCase):
16
+
17
+ # TODO(T182928844): Delegate dim order op to backend.
18
+ edge_compile_config = executorch.exir.EdgeCompileConfig(_skip_dim_order=True)
19
+
20
+ def test_add_sub_skip_mm(self):
21
+ class Model(torch.nn.Module):
22
+ def forward(self, a, x, b):
23
+ y = torch.mm(a, x)
24
+ z = y + b
25
+ a = z - a
26
+ y = torch.mm(a, x)
27
+ z = y + b
28
+ return z
29
+
30
+ model = Model()
31
+ model.eval()
32
+
33
+ example_inputs = (torch.randn(2, 2), torch.randn(2, 2), torch.randn(2, 2))
34
+ exir_program_aten = torch.export.export(model, example_inputs)
35
+
36
+ edge_program_manager = executorch.exir.to_edge(
37
+ exir_program_aten, compile_config=self.edge_compile_config
38
+ )
39
+ delegated_program_manager = edge_program_manager.to_backend(
40
+ CoreMLPartitioner(skip_ops_for_coreml_delegation=["aten.mm.default"])
41
+ )
42
+
43
+ assert [
44
+ node.target.__name__
45
+ for node in delegated_program_manager.exported_program().graph.nodes
46
+ if node.op == "call_function"
47
+ ] == [
48
+ "aten.mm.default",
49
+ "executorch_call_delegate",
50
+ "getitem",
51
+ "aten.mm.default",
52
+ "executorch_call_delegate",
53
+ "getitem",
54
+ ]
55
+
56
+ def test_vit_skip_conv(self):
57
+ model = torchvision.models.vit_b_16(weights="IMAGENET1K_V1")
58
+ model.eval()
59
+
60
+ example_inputs = (torch.randn(1, 3, 224, 224),)
61
+ exir_program_aten = torch.export.export(model, example_inputs)
62
+ edge_program_manager = executorch.exir.to_edge(
63
+ exir_program_aten, compile_config=self.edge_compile_config
64
+ )
65
+ delegated_program_manager = edge_program_manager.to_backend(
66
+ CoreMLPartitioner(
67
+ skip_ops_for_coreml_delegation=["aten.convolution.default"]
68
+ )
69
+ )
70
+
71
+ assert [
72
+ node.target.__name__
73
+ for node in delegated_program_manager.exported_program().graph.nodes
74
+ if node.op == "call_function"
75
+ ] == [
76
+ "aten.convolution.default",
77
+ "executorch_call_delegate",
78
+ "getitem",
79
+ ]
80
+
81
+
82
+ if __name__ == "__main__":
83
+ test_runner = TestCoreMLPartitioner()
84
+ test_runner.test_add_sub_skip_mm()
85
+ test_runner.test_vit_skip_conv()