executorch 1.1.0__cp313-cp313-win_amd64.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.
- executorch/backends/__init__.py +0 -0
- executorch/backends/aoti/aoti_backend.py +271 -0
- executorch/backends/aoti/aoti_partitioner.py +109 -0
- executorch/backends/aoti/passes/replace_view_copy_with_view.py +118 -0
- executorch/backends/apple/coreml/compiler/__init__.py +9 -0
- executorch/backends/apple/coreml/compiler/coreml_preprocess.py +588 -0
- executorch/backends/apple/coreml/compiler/enumerated_shape_utils.py +244 -0
- executorch/backends/apple/coreml/compiler/torch_ops.py +219 -0
- executorch/backends/apple/coreml/executorchcoreml.pyi +10 -0
- executorch/backends/apple/coreml/logging.py +24 -0
- executorch/backends/apple/coreml/partition/__init__.py +9 -0
- executorch/backends/apple/coreml/partition/coreml_partitioner.py +307 -0
- executorch/backends/apple/coreml/quantizer/__init__.py +9 -0
- executorch/backends/apple/coreml/quantizer/_annotation_config.py +130 -0
- executorch/backends/apple/coreml/quantizer/_coreml_quantizer.py +628 -0
- executorch/backends/apple/coreml/quantizer/_coreml_quantizer_utils.py +800 -0
- executorch/backends/apple/coreml/quantizer/coreml_quantizer.py +7 -0
- executorch/backends/apple/coreml/recipes/__init__.py +17 -0
- executorch/backends/apple/coreml/recipes/coreml_recipe_provider.py +413 -0
- executorch/backends/apple/coreml/recipes/coreml_recipe_types.py +53 -0
- executorch/backends/apple/coreml/runtime/test/export_stateful_model.py +77 -0
- executorch/backends/apple/coreml/test/test_coreml_partitioner.py +348 -0
- executorch/backends/apple/coreml/test/test_coreml_quantizer.py +172 -0
- executorch/backends/apple/coreml/test/test_coreml_recipes.py +552 -0
- executorch/backends/apple/coreml/test/test_coreml_utils.py +19 -0
- executorch/backends/apple/coreml/test/test_enumerated_shapes.py +112 -0
- executorch/backends/apple/coreml/test/test_torch_ops.py +333 -0
- executorch/backends/apple/coreml/test/tester.py +121 -0
- executorch/backends/apple/metal/metal_backend.py +67 -0
- executorch/backends/apple/metal/metal_partitioner.py +25 -0
- executorch/backends/apple/metal/tests/__init__.py +5 -0
- executorch/backends/apple/metal/tests/test_metal_backend.py +79 -0
- executorch/backends/apple/metal/tests/test_metal_partitioner.py +172 -0
- executorch/backends/apple/mps/__init__.py +10 -0
- executorch/backends/apple/mps/mps_preprocess.py +301 -0
- executorch/backends/apple/mps/operators/__init__.py +77 -0
- executorch/backends/apple/mps/operators/activation_ops.py +99 -0
- executorch/backends/apple/mps/operators/binary_ops.py +156 -0
- executorch/backends/apple/mps/operators/clamp_ops.py +60 -0
- executorch/backends/apple/mps/operators/constant_ops.py +128 -0
- executorch/backends/apple/mps/operators/convolution_ops.py +70 -0
- executorch/backends/apple/mps/operators/indexing_ops.py +225 -0
- executorch/backends/apple/mps/operators/linear_algebra_ops.py +52 -0
- executorch/backends/apple/mps/operators/node_visitor.py +473 -0
- executorch/backends/apple/mps/operators/normalization_ops.py +97 -0
- executorch/backends/apple/mps/operators/op_clone.py +54 -0
- executorch/backends/apple/mps/operators/op_getitem.py +29 -0
- executorch/backends/apple/mps/operators/op_quant_dequant.py +142 -0
- executorch/backends/apple/mps/operators/op_skip_ops.py +24 -0
- executorch/backends/apple/mps/operators/pad_ops.py +37 -0
- executorch/backends/apple/mps/operators/pooling_ops.py +142 -0
- executorch/backends/apple/mps/operators/range_ops.py +53 -0
- executorch/backends/apple/mps/operators/reduce_ops.py +39 -0
- executorch/backends/apple/mps/operators/shape_ops.py +263 -0
- executorch/backends/apple/mps/operators/unary_ops.py +130 -0
- executorch/backends/apple/mps/partition/__init__.py +10 -0
- executorch/backends/apple/mps/partition/mps_partitioner.py +133 -0
- executorch/backends/apple/mps/serialization/mps_graph_schema.py +817 -0
- executorch/backends/apple/mps/serialization/mps_graph_serialize.py +34 -0
- executorch/backends/apple/mps/serialization/schema.fbs +523 -0
- executorch/backends/apple/mps/test/test_mps.py +2507 -0
- executorch/backends/apple/mps/test/test_mps_binary_ops.py +296 -0
- executorch/backends/apple/mps/test/test_mps_indexing_ops.py +264 -0
- executorch/backends/apple/mps/test/test_mps_linear.py +523 -0
- executorch/backends/apple/mps/test/test_mps_models.py +416 -0
- executorch/backends/apple/mps/test/test_mps_unary_ops.py +26 -0
- executorch/backends/apple/mps/test/test_mps_utils.py +326 -0
- executorch/backends/apple/mps/utils/mps_utils.py +82 -0
- executorch/backends/apple/mps/utils/quant_utils.py +41 -0
- executorch/backends/arm/_passes/__init__.py +134 -0
- executorch/backends/arm/_passes/_debug_passes.py +58 -0
- executorch/backends/arm/_passes/annotate_decomposed_matmul.py +127 -0
- executorch/backends/arm/_passes/annotate_output_dim_order_pass.py +26 -0
- executorch/backends/arm/_passes/arm_pass.py +95 -0
- executorch/backends/arm/_passes/arm_pass_manager.py +462 -0
- executorch/backends/arm/_passes/arm_pass_utils.py +281 -0
- executorch/backends/arm/_passes/broadcast_args_pass.py +72 -0
- executorch/backends/arm/_passes/cast_int64_pass.py +70 -0
- executorch/backends/arm/_passes/cast_to_int32_pass.py +67 -0
- executorch/backends/arm/_passes/conv1d_unsqueeze_pass.py +98 -0
- executorch/backends/arm/_passes/convert_elu_params.py +67 -0
- executorch/backends/arm/_passes/convert_expand_copy_to_repeat.py +77 -0
- executorch/backends/arm/_passes/convert_full_like_to_full_pass.py +42 -0
- executorch/backends/arm/_passes/convert_int64_const_ops_to_int32.py +81 -0
- executorch/backends/arm/_passes/convert_int64_output_ops_to_int32.py +155 -0
- executorch/backends/arm/_passes/convert_minmax_pass.py +166 -0
- executorch/backends/arm/_passes/convert_permute_singleton_to_view_pass.py +64 -0
- executorch/backends/arm/_passes/convert_split_to_slice.py +132 -0
- executorch/backends/arm/_passes/convert_squeezes_to_view.py +36 -0
- executorch/backends/arm/_passes/convert_to_clamp_pass.py +45 -0
- executorch/backends/arm/_passes/decompose_acosh_pass.py +77 -0
- executorch/backends/arm/_passes/decompose_adaptive_avg_pool2d_pass.py +112 -0
- executorch/backends/arm/_passes/decompose_add_sub_alpha_pass.py +98 -0
- executorch/backends/arm/_passes/decompose_addmm_pass.py +72 -0
- executorch/backends/arm/_passes/decompose_any_pass.py +114 -0
- executorch/backends/arm/_passes/decompose_asin_and_acos_pass.py +236 -0
- executorch/backends/arm/_passes/decompose_asinh_pass.py +74 -0
- executorch/backends/arm/_passes/decompose_atan_pass.py +142 -0
- executorch/backends/arm/_passes/decompose_atanh_pass.py +86 -0
- executorch/backends/arm/_passes/decompose_avg_pool2d_pass.py +154 -0
- executorch/backends/arm/_passes/decompose_batch_norm_no_stats.py +233 -0
- executorch/backends/arm/_passes/decompose_cosh_pass.py +72 -0
- executorch/backends/arm/_passes/decompose_cosine_similarity_pass.py +92 -0
- executorch/backends/arm/_passes/decompose_cumsum_pass.py +167 -0
- executorch/backends/arm/_passes/decompose_div_pass.py +61 -0
- executorch/backends/arm/_passes/decompose_div_tensor_mode.py +94 -0
- executorch/backends/arm/_passes/decompose_elu_pass.py +107 -0
- executorch/backends/arm/_passes/decompose_embedding_pass.py +126 -0
- executorch/backends/arm/_passes/decompose_expm1_pass.py +163 -0
- executorch/backends/arm/_passes/decompose_floor_divide_pass.py +75 -0
- executorch/backends/arm/_passes/decompose_gelu_pass.py +172 -0
- executorch/backends/arm/_passes/decompose_glu_pass.py +81 -0
- executorch/backends/arm/_passes/decompose_grouped_conv_pass.py +185 -0
- executorch/backends/arm/_passes/decompose_groupnorm_pass.py +227 -0
- executorch/backends/arm/_passes/decompose_int16_activation_conv_pass.py +137 -0
- executorch/backends/arm/_passes/decompose_int_pow_pass.py +64 -0
- executorch/backends/arm/_passes/decompose_layernorm_pass.py +203 -0
- executorch/backends/arm/_passes/decompose_leaky_relu_pass.py +76 -0
- executorch/backends/arm/_passes/decompose_linalg_vector_norm_pass.py +92 -0
- executorch/backends/arm/_passes/decompose_linear_pass.py +109 -0
- executorch/backends/arm/_passes/decompose_log1p_pass.py +97 -0
- executorch/backends/arm/_passes/decompose_logit_pass.py +119 -0
- executorch/backends/arm/_passes/decompose_masked_fill_pass.py +58 -0
- executorch/backends/arm/_passes/decompose_maxpool2d_with_dilation_pass.py +218 -0
- executorch/backends/arm/_passes/decompose_meandim_pass.py +283 -0
- executorch/backends/arm/_passes/decompose_ne_pass.py +74 -0
- executorch/backends/arm/_passes/decompose_quant_nodes.py +156 -0
- executorch/backends/arm/_passes/decompose_remainder_pass.py +70 -0
- executorch/backends/arm/_passes/decompose_round_pass.py +96 -0
- executorch/backends/arm/_passes/decompose_sdpa_pass.py +36 -0
- executorch/backends/arm/_passes/decompose_select.py +75 -0
- executorch/backends/arm/_passes/decompose_select_scatter_pass.py +143 -0
- executorch/backends/arm/_passes/decompose_sign_pass.py +78 -0
- executorch/backends/arm/_passes/decompose_silu_pass.py +41 -0
- executorch/backends/arm/_passes/decompose_sinh_pass.py +77 -0
- executorch/backends/arm/_passes/decompose_softmax_pass.py +93 -0
- executorch/backends/arm/_passes/decompose_softmax_unstable_pass.py +86 -0
- executorch/backends/arm/_passes/decompose_sqrt_pass.py +53 -0
- executorch/backends/arm/_passes/decompose_sum_pass.py +93 -0
- executorch/backends/arm/_passes/decompose_tan_pass.py +51 -0
- executorch/backends/arm/_passes/decompose_tosa_unsupported_clamp_pass.py +97 -0
- executorch/backends/arm/_passes/decompose_var_pass.py +109 -0
- executorch/backends/arm/_passes/decorate_fp32_to_int32_casting_pass.py +88 -0
- executorch/backends/arm/_passes/fold_qdq_with_annotated_qparams_pass.py +394 -0
- executorch/backends/arm/_passes/fuse_batch_norm2d_pass.py +241 -0
- executorch/backends/arm/_passes/fuse_constant_ops_pass.py +272 -0
- executorch/backends/arm/_passes/fuse_duplicate_users_pass.py +165 -0
- executorch/backends/arm/_passes/fuse_equal_placeholders_pass.py +104 -0
- executorch/backends/arm/_passes/fuse_quantized_activation_pass.py +80 -0
- executorch/backends/arm/_passes/fuse_view_copy_transform_pass.py +14 -0
- executorch/backends/arm/_passes/insert_int32_casts_after_int64_placeholders.py +130 -0
- executorch/backends/arm/_passes/insert_rescales_pass.py +584 -0
- executorch/backends/arm/_passes/insert_table_ops.py +305 -0
- executorch/backends/arm/_passes/match_arg_dtype_pass.py +104 -0
- executorch/backends/arm/_passes/match_arg_ranks_pass.py +114 -0
- executorch/backends/arm/_passes/mm_to_bmm_pass.py +104 -0
- executorch/backends/arm/_passes/normalize_while_initial_args_pass.py +113 -0
- executorch/backends/arm/_passes/promote_bool_operands_pass.py +88 -0
- executorch/backends/arm/_passes/quant_args.py +125 -0
- executorch/backends/arm/_passes/remove_getitem_pass.py +14 -0
- executorch/backends/arm/_passes/remove_graph_asserts_pass.py +18 -0
- executorch/backends/arm/_passes/remove_noop_pass.py +40 -0
- executorch/backends/arm/_passes/replace_inf_and_limit_values_pass.py +73 -0
- executorch/backends/arm/_passes/replace_scalar_with_tensor_pass.py +121 -0
- executorch/backends/arm/_passes/rewrite_bool_bitwise_not_to_logical_not_pass.py +43 -0
- executorch/backends/arm/_passes/rewrite_bool_to_fp32_cast_via_int8_pass.py +77 -0
- executorch/backends/arm/_passes/rewrite_conv_pass.py +336 -0
- executorch/backends/arm/_passes/rewrite_matmul.py +98 -0
- executorch/backends/arm/_passes/rewrite_upsample.py +93 -0
- executorch/backends/arm/_passes/scalars_to_attribute_pass.py +97 -0
- executorch/backends/arm/_passes/size_adjust_input_pass.py +227 -0
- executorch/backends/arm/_passes/to_tosa_memory_format_pass.py +454 -0
- executorch/backends/arm/_passes/unsqueeze_before_repeat_pass.py +66 -0
- executorch/backends/arm/_passes/unsqueeze_scalar_placeholders_pass.py +85 -0
- executorch/backends/arm/arm_vela.py +137 -0
- executorch/backends/arm/common/__init__.py +4 -0
- executorch/backends/arm/common/annotation_meta.py +39 -0
- executorch/backends/arm/common/arm_compile_spec.py +271 -0
- executorch/backends/arm/common/debug.py +79 -0
- executorch/backends/arm/common/pipeline_config.py +59 -0
- executorch/backends/arm/common/type.py +28 -0
- executorch/backends/arm/constants.py +48 -0
- executorch/backends/arm/debug/__init__.py +4 -0
- executorch/backends/arm/debug/schema.py +145 -0
- executorch/backends/arm/ethosu/__init__.py +11 -0
- executorch/backends/arm/ethosu/backend.py +115 -0
- executorch/backends/arm/ethosu/compile_spec.py +117 -0
- executorch/backends/arm/ethosu/partitioner.py +35 -0
- executorch/backends/arm/operator_support/__init__.py +23 -0
- executorch/backends/arm/operator_support/clone_dim_order_support.py +82 -0
- executorch/backends/arm/operator_support/control_flow_support.py +162 -0
- executorch/backends/arm/operator_support/convolution_support.py +160 -0
- executorch/backends/arm/operator_support/embedding_support.py +61 -0
- executorch/backends/arm/operator_support/ethos_u55_support.py +598 -0
- executorch/backends/arm/operator_support/index_select_support.py +60 -0
- executorch/backends/arm/operator_support/index_tensor_support.py +160 -0
- executorch/backends/arm/operator_support/minmax_support.py +61 -0
- executorch/backends/arm/operator_support/pool_2d_support.py +214 -0
- executorch/backends/arm/operator_support/reduce_sum_support.py +76 -0
- executorch/backends/arm/operator_support/right_shift_support.py +52 -0
- executorch/backends/arm/operator_support/slice_copy_support.py +48 -0
- executorch/backends/arm/operator_support/to_dim_order_copy_support.py +200 -0
- executorch/backends/arm/operator_support/tosa_profile_supported_op_lists.py +251 -0
- executorch/backends/arm/operator_support/tosa_supported_operators.py +748 -0
- executorch/backends/arm/operator_support/where_support.py +77 -0
- executorch/backends/arm/operators/__init__.py +71 -0
- executorch/backends/arm/operators/node_visitor.py +177 -0
- executorch/backends/arm/operators/op_abs.py +59 -0
- executorch/backends/arm/operators/op_add.py +60 -0
- executorch/backends/arm/operators/op_amax.py +72 -0
- executorch/backends/arm/operators/op_amin.py +73 -0
- executorch/backends/arm/operators/op_any.py +61 -0
- executorch/backends/arm/operators/op_avg_pool2d.py +142 -0
- executorch/backends/arm/operators/op_bitwise_not.py +62 -0
- executorch/backends/arm/operators/op_cat.py +68 -0
- executorch/backends/arm/operators/op_ceil.py +56 -0
- executorch/backends/arm/operators/op_clamp.py +118 -0
- executorch/backends/arm/operators/op_cond_if.py +56 -0
- executorch/backends/arm/operators/op_constant_pad_nd.py +117 -0
- executorch/backends/arm/operators/op_cos.py +49 -0
- executorch/backends/arm/operators/op_eq.py +64 -0
- executorch/backends/arm/operators/op_erf.py +54 -0
- executorch/backends/arm/operators/op_exp.py +54 -0
- executorch/backends/arm/operators/op_floor.py +56 -0
- executorch/backends/arm/operators/op_ge.py +64 -0
- executorch/backends/arm/operators/op_gt.py +64 -0
- executorch/backends/arm/operators/op_index_select.py +109 -0
- executorch/backends/arm/operators/op_index_tensor.py +247 -0
- executorch/backends/arm/operators/op_le.py +64 -0
- executorch/backends/arm/operators/op_log.py +50 -0
- executorch/backends/arm/operators/op_logical_not.py +62 -0
- executorch/backends/arm/operators/op_lt.py +64 -0
- executorch/backends/arm/operators/op_max_pool2d.py +108 -0
- executorch/backends/arm/operators/op_maximum.py +66 -0
- executorch/backends/arm/operators/op_minimum.py +67 -0
- executorch/backends/arm/operators/op_mul.py +61 -0
- executorch/backends/arm/operators/op_neg.py +92 -0
- executorch/backends/arm/operators/op_permute.py +150 -0
- executorch/backends/arm/operators/op_pow.py +63 -0
- executorch/backends/arm/operators/op_reciprocal.py +51 -0
- executorch/backends/arm/operators/op_repeat.py +77 -0
- executorch/backends/arm/operators/op_rshift_tensor.py +62 -0
- executorch/backends/arm/operators/op_rsqrt.py +51 -0
- executorch/backends/arm/operators/op_sigmoid.py +50 -0
- executorch/backends/arm/operators/op_sin.py +49 -0
- executorch/backends/arm/operators/op_slice.py +151 -0
- executorch/backends/arm/operators/op_sub.py +63 -0
- executorch/backends/arm/operators/op_sum.py +64 -0
- executorch/backends/arm/operators/op_tanh.py +51 -0
- executorch/backends/arm/operators/op_to_dim_order_copy.py +49 -0
- executorch/backends/arm/operators/op_tosa_conv2d.py +139 -0
- executorch/backends/arm/operators/op_tosa_conv3d.py +24 -0
- executorch/backends/arm/operators/op_tosa_depthwise_conv2d.py +32 -0
- executorch/backends/arm/operators/op_tosa_matmul.py +102 -0
- executorch/backends/arm/operators/op_tosa_rescale.py +261 -0
- executorch/backends/arm/operators/op_tosa_resize.py +124 -0
- executorch/backends/arm/operators/op_tosa_table.py +72 -0
- executorch/backends/arm/operators/op_tosa_transpose.py +71 -0
- executorch/backends/arm/operators/op_view.py +81 -0
- executorch/backends/arm/operators/op_where.py +75 -0
- executorch/backends/arm/operators/op_while.py +103 -0
- executorch/backends/arm/operators/operator_validation_utils.py +201 -0
- executorch/backends/arm/operators/ops_binary.py +112 -0
- executorch/backends/arm/operators/ops_identity.py +80 -0
- executorch/backends/arm/process_node.py +230 -0
- executorch/backends/arm/quantizer/__init__.py +35 -0
- executorch/backends/arm/quantizer/arm_quantizer.py +710 -0
- executorch/backends/arm/quantizer/arm_quantizer_utils.py +76 -0
- executorch/backends/arm/quantizer/quantization_annotator.py +815 -0
- executorch/backends/arm/quantizer/quantization_config.py +228 -0
- executorch/backends/arm/scripts/collect_testname_resources.py +194 -0
- executorch/backends/arm/scripts/parse_test_names.py +271 -0
- executorch/backends/arm/test/common.py +302 -0
- executorch/backends/arm/test/conftest.py +134 -0
- executorch/backends/arm/test/misc/test_bn_relu_folding_qat.py +124 -0
- executorch/backends/arm/test/misc/test_call_operator_submodule.py +72 -0
- executorch/backends/arm/test/misc/test_compile_spec.py +55 -0
- executorch/backends/arm/test/misc/test_conv_relu_residual_add.py +108 -0
- executorch/backends/arm/test/misc/test_custom_partition.py +183 -0
- executorch/backends/arm/test/misc/test_debug_feats.py +316 -0
- executorch/backends/arm/test/misc/test_debug_hook.py +186 -0
- executorch/backends/arm/test/misc/test_dim_order.py +127 -0
- executorch/backends/arm/test/misc/test_dw_convs_with_shared_weights.py +46 -0
- executorch/backends/arm/test/misc/test_extract_io_params_tosa.py +92 -0
- executorch/backends/arm/test/misc/test_int64.py +112 -0
- executorch/backends/arm/test/misc/test_lifted_tensor.py +146 -0
- executorch/backends/arm/test/misc/test_mixed_type_lowering.py +83 -0
- executorch/backends/arm/test/misc/test_model_evaluator.py +58 -0
- executorch/backends/arm/test/misc/test_multiple_delegates.py +53 -0
- executorch/backends/arm/test/misc/test_multiple_outputs.py +70 -0
- executorch/backends/arm/test/misc/test_non_persistent_buffers.py +49 -0
- executorch/backends/arm/test/misc/test_outputs_order.py +122 -0
- executorch/backends/arm/test/misc/test_partition_decomposed_quantized_ops.py +181 -0
- executorch/backends/arm/test/misc/test_pass_pipeline_config.py +35 -0
- executorch/backends/arm/test/misc/test_pass_required_order.py +97 -0
- executorch/backends/arm/test/misc/test_qat_training_loop.py +100 -0
- executorch/backends/arm/test/misc/test_quant_custom_meta.py +105 -0
- executorch/backends/arm/test/misc/test_rescale_range.py +130 -0
- executorch/backends/arm/test/misc/test_save_exported_model.py +64 -0
- executorch/backends/arm/test/misc/test_tosa_dialect_conv2d.py +220 -0
- executorch/backends/arm/test/misc/test_tosa_dialect_dw_conv2d.py +227 -0
- executorch/backends/arm/test/misc/test_tosa_spec.py +169 -0
- executorch/backends/arm/test/models/stable_diffusion/stable_diffusion_module_test_configs.py +114 -0
- executorch/backends/arm/test/models/stable_diffusion/test_CLIPTextModelWithProjection.py +168 -0
- executorch/backends/arm/test/models/stable_diffusion/test_SD3Transformer2DModel.py +193 -0
- executorch/backends/arm/test/models/stable_diffusion/test_T5EncoderModel.py +161 -0
- executorch/backends/arm/test/models/stable_diffusion/test_vae_AutoencoderKL.py +118 -0
- executorch/backends/arm/test/models/test_conformer.py +138 -0
- executorch/backends/arm/test/models/test_deit_tiny_arm.py +120 -0
- executorch/backends/arm/test/models/test_dl3_arm.py +118 -0
- executorch/backends/arm/test/models/test_inception_v3_arm.py +120 -0
- executorch/backends/arm/test/models/test_llama.py +227 -0
- executorch/backends/arm/test/models/test_lstm_arm.py +194 -0
- executorch/backends/arm/test/models/test_mobilenet_v2_arm.py +179 -0
- executorch/backends/arm/test/models/test_mobilenet_v3_arm.py +113 -0
- executorch/backends/arm/test/models/test_nn_functional.py +124 -0
- executorch/backends/arm/test/models/test_nn_modules.py +161 -0
- executorch/backends/arm/test/models/test_nss.py +146 -0
- executorch/backends/arm/test/models/test_resnet18.py +98 -0
- executorch/backends/arm/test/models/test_torch_functions.py +151 -0
- executorch/backends/arm/test/models/test_w2l_arm.py +136 -0
- executorch/backends/arm/test/ops/test_abs.py +101 -0
- executorch/backends/arm/test/ops/test_acos.py +121 -0
- executorch/backends/arm/test/ops/test_acosh.py +137 -0
- executorch/backends/arm/test/ops/test_adaptive_avg_pool2d.py +242 -0
- executorch/backends/arm/test/ops/test_add.py +291 -0
- executorch/backends/arm/test/ops/test_addmm.py +285 -0
- executorch/backends/arm/test/ops/test_alias_copy.py +114 -0
- executorch/backends/arm/test/ops/test_amax.py +191 -0
- executorch/backends/arm/test/ops/test_amin.py +205 -0
- executorch/backends/arm/test/ops/test_any.py +210 -0
- executorch/backends/arm/test/ops/test_arange.py +258 -0
- executorch/backends/arm/test/ops/test_asin.py +105 -0
- executorch/backends/arm/test/ops/test_asinh.py +104 -0
- executorch/backends/arm/test/ops/test_at.py +256 -0
- executorch/backends/arm/test/ops/test_atan.py +111 -0
- executorch/backends/arm/test/ops/test_atanh.py +112 -0
- executorch/backends/arm/test/ops/test_avg_pool2d.py +295 -0
- executorch/backends/arm/test/ops/test_batch_norm.py +385 -0
- executorch/backends/arm/test/ops/test_bitwise.py +672 -0
- executorch/backends/arm/test/ops/test_bitwise_not.py +115 -0
- executorch/backends/arm/test/ops/test_bmm.py +193 -0
- executorch/backends/arm/test/ops/test_cat.py +219 -0
- executorch/backends/arm/test/ops/test_ceil.py +125 -0
- executorch/backends/arm/test/ops/test_clamp.py +474 -0
- executorch/backends/arm/test/ops/test_clone.py +150 -0
- executorch/backends/arm/test/ops/test_cond.py +338 -0
- executorch/backends/arm/test/ops/test_constant_pad_nd.py +119 -0
- executorch/backends/arm/test/ops/test_conv1d.py +356 -0
- executorch/backends/arm/test/ops/test_conv2d.py +592 -0
- executorch/backends/arm/test/ops/test_conv3d.py +711 -0
- executorch/backends/arm/test/ops/test_conv_combos.py +668 -0
- executorch/backends/arm/test/ops/test_conv_constant_pad_nd.py +145 -0
- executorch/backends/arm/test/ops/test_copy.py +171 -0
- executorch/backends/arm/test/ops/test_cos.py +115 -0
- executorch/backends/arm/test/ops/test_cosh.py +111 -0
- executorch/backends/arm/test/ops/test_cumsum.py +122 -0
- executorch/backends/arm/test/ops/test_depthwise_conv.py +404 -0
- executorch/backends/arm/test/ops/test_div.py +151 -0
- executorch/backends/arm/test/ops/test_div_tensor_mode.py +151 -0
- executorch/backends/arm/test/ops/test_elu.py +133 -0
- executorch/backends/arm/test/ops/test_embedding.py +146 -0
- executorch/backends/arm/test/ops/test_eq.py +286 -0
- executorch/backends/arm/test/ops/test_erf.py +96 -0
- executorch/backends/arm/test/ops/test_exp.py +110 -0
- executorch/backends/arm/test/ops/test_expand.py +153 -0
- executorch/backends/arm/test/ops/test_expm1.py +113 -0
- executorch/backends/arm/test/ops/test_eye.py +156 -0
- executorch/backends/arm/test/ops/test_fill_scalar.py +108 -0
- executorch/backends/arm/test/ops/test_floor.py +125 -0
- executorch/backends/arm/test/ops/test_floor_div.py +156 -0
- executorch/backends/arm/test/ops/test_full.py +255 -0
- executorch/backends/arm/test/ops/test_ge.py +292 -0
- executorch/backends/arm/test/ops/test_gelu.py +156 -0
- executorch/backends/arm/test/ops/test_glu.py +130 -0
- executorch/backends/arm/test/ops/test_group_norm.py +200 -0
- executorch/backends/arm/test/ops/test_gt.py +293 -0
- executorch/backends/arm/test/ops/test_hardsigmoid.py +114 -0
- executorch/backends/arm/test/ops/test_hardswish.py +104 -0
- executorch/backends/arm/test/ops/test_hardtanh.py +113 -0
- executorch/backends/arm/test/ops/test_index_select.py +177 -0
- executorch/backends/arm/test/ops/test_index_tensor.py +467 -0
- executorch/backends/arm/test/ops/test_layer_norm.py +186 -0
- executorch/backends/arm/test/ops/test_le.py +296 -0
- executorch/backends/arm/test/ops/test_leaky_relu.py +125 -0
- executorch/backends/arm/test/ops/test_linalg_vector_norm.py +160 -0
- executorch/backends/arm/test/ops/test_linear.py +389 -0
- executorch/backends/arm/test/ops/test_log.py +100 -0
- executorch/backends/arm/test/ops/test_log1p.py +78 -0
- executorch/backends/arm/test/ops/test_logical.py +429 -0
- executorch/backends/arm/test/ops/test_logit.py +119 -0
- executorch/backends/arm/test/ops/test_logsoftmax.py +124 -0
- executorch/backends/arm/test/ops/test_lshift.py +220 -0
- executorch/backends/arm/test/ops/test_lt.py +293 -0
- executorch/backends/arm/test/ops/test_masked_fill.py +171 -0
- executorch/backends/arm/test/ops/test_matmul.py +289 -0
- executorch/backends/arm/test/ops/test_max_pool.py +329 -0
- executorch/backends/arm/test/ops/test_maximum.py +98 -0
- executorch/backends/arm/test/ops/test_mean_dim.py +388 -0
- executorch/backends/arm/test/ops/test_minimum.py +98 -0
- executorch/backends/arm/test/ops/test_mm.py +93 -0
- executorch/backends/arm/test/ops/test_mul.py +376 -0
- executorch/backends/arm/test/ops/test_multihead_attention.py +138 -0
- executorch/backends/arm/test/ops/test_ne.py +243 -0
- executorch/backends/arm/test/ops/test_neg.py +99 -0
- executorch/backends/arm/test/ops/test_ones.py +152 -0
- executorch/backends/arm/test/ops/test_permute.py +256 -0
- executorch/backends/arm/test/ops/test_pixel_shuffling.py +237 -0
- executorch/backends/arm/test/ops/test_pow.py +204 -0
- executorch/backends/arm/test/ops/test_reciprocal.py +112 -0
- executorch/backends/arm/test/ops/test_relu.py +166 -0
- executorch/backends/arm/test/ops/test_remainder.py +199 -0
- executorch/backends/arm/test/ops/test_repeat.py +162 -0
- executorch/backends/arm/test/ops/test_round.py +111 -0
- executorch/backends/arm/test/ops/test_rshift.py +226 -0
- executorch/backends/arm/test/ops/test_rsqrt.py +153 -0
- executorch/backends/arm/test/ops/test_rsub.py +126 -0
- executorch/backends/arm/test/ops/test_scalar_tensor.py +135 -0
- executorch/backends/arm/test/ops/test_scalars.py +438 -0
- executorch/backends/arm/test/ops/test_sdpa.py +73 -0
- executorch/backends/arm/test/ops/test_select.py +219 -0
- executorch/backends/arm/test/ops/test_select_scatter.py +173 -0
- executorch/backends/arm/test/ops/test_sigmoid.py +357 -0
- executorch/backends/arm/test/ops/test_sigmoid_32bit.py +177 -0
- executorch/backends/arm/test/ops/test_sign.py +113 -0
- executorch/backends/arm/test/ops/test_silu.py +174 -0
- executorch/backends/arm/test/ops/test_sin.py +108 -0
- executorch/backends/arm/test/ops/test_sinh.py +103 -0
- executorch/backends/arm/test/ops/test_slice.py +217 -0
- executorch/backends/arm/test/ops/test_softmax.py +121 -0
- executorch/backends/arm/test/ops/test_split.py +312 -0
- executorch/backends/arm/test/ops/test_sqrt.py +112 -0
- executorch/backends/arm/test/ops/test_squeeze.py +291 -0
- executorch/backends/arm/test/ops/test_stack.py +150 -0
- executorch/backends/arm/test/ops/test_sub.py +366 -0
- executorch/backends/arm/test/ops/test_sum.py +161 -0
- executorch/backends/arm/test/ops/test_t_copy.py +115 -0
- executorch/backends/arm/test/ops/test_tan.py +146 -0
- executorch/backends/arm/test/ops/test_tanh.py +169 -0
- executorch/backends/arm/test/ops/test_to_copy.py +296 -0
- executorch/backends/arm/test/ops/test_transpose_copy.py +114 -0
- executorch/backends/arm/test/ops/test_unary_combos.py +144 -0
- executorch/backends/arm/test/ops/test_unbind.py +82 -0
- executorch/backends/arm/test/ops/test_unflatten.py +107 -0
- executorch/backends/arm/test/ops/test_unsqueeze.py +107 -0
- executorch/backends/arm/test/ops/test_upsample_bilinear2d.py +443 -0
- executorch/backends/arm/test/ops/test_upsample_nearest2d.py +520 -0
- executorch/backends/arm/test/ops/test_var.py +394 -0
- executorch/backends/arm/test/ops/test_view.py +253 -0
- executorch/backends/arm/test/ops/test_where.py +285 -0
- executorch/backends/arm/test/ops/test_while.py +264 -0
- executorch/backends/arm/test/ops/test_zeros.py +158 -0
- executorch/backends/arm/test/passes/test_broadcast_args_pass.py +57 -0
- executorch/backends/arm/test/passes/test_cast_int64_pass.py +49 -0
- executorch/backends/arm/test/passes/test_convert_expand_copy_to_repeat.py +51 -0
- executorch/backends/arm/test/passes/test_convert_int64_const_ops_to_int32.py +529 -0
- executorch/backends/arm/test/passes/test_convert_int64_output_ops_to_int32.py +129 -0
- executorch/backends/arm/test/passes/test_convert_permute_singleton_to_view_pass.py +100 -0
- executorch/backends/arm/test/passes/test_convert_split_to_slice.py +75 -0
- executorch/backends/arm/test/passes/test_convert_to_clamp.py +92 -0
- executorch/backends/arm/test/passes/test_decompose_avg_pool2d_pass.py +82 -0
- executorch/backends/arm/test/passes/test_decompose_cosine_similarity_pass.py +58 -0
- executorch/backends/arm/test/passes/test_decompose_div_pass.py +70 -0
- executorch/backends/arm/test/passes/test_decompose_int_pow_pass.py +80 -0
- executorch/backends/arm/test/passes/test_decompose_layernorm_pass.py +69 -0
- executorch/backends/arm/test/passes/test_decompose_linalg_vector_norm_pass.py +107 -0
- executorch/backends/arm/test/passes/test_decompose_meandim_pass.py +137 -0
- executorch/backends/arm/test/passes/test_decompose_quant_nodes.py +44 -0
- executorch/backends/arm/test/passes/test_decompose_softmax_pass.py +103 -0
- executorch/backends/arm/test/passes/test_decompose_tosa_unsupported_clamp_pass.py +73 -0
- executorch/backends/arm/test/passes/test_decompose_var_pass.py +89 -0
- executorch/backends/arm/test/passes/test_decorate_fp32_to_int32_casting_pass.py +85 -0
- executorch/backends/arm/test/passes/test_fold_qdq_pass.py +51 -0
- executorch/backends/arm/test/passes/test_fuse_batchnorm_pass.py +164 -0
- executorch/backends/arm/test/passes/test_fuse_constant_ops_pass.py +177 -0
- executorch/backends/arm/test/passes/test_fuse_duplicate_users_pass.py +70 -0
- executorch/backends/arm/test/passes/test_fuse_equal_placeholders_ops_pass.py +170 -0
- executorch/backends/arm/test/passes/test_fuse_view_copy.py +82 -0
- executorch/backends/arm/test/passes/test_insert_int32_casts_after_int64_placeholders_pass.py +114 -0
- executorch/backends/arm/test/passes/test_insert_rescale_i32_pass.py +107 -0
- executorch/backends/arm/test/passes/test_insert_table_ops_pass.py +47 -0
- executorch/backends/arm/test/passes/test_int32_cast_embedding_pass.py +46 -0
- executorch/backends/arm/test/passes/test_ioquantization_pass.py +48 -0
- executorch/backends/arm/test/passes/test_promote_bool_operands_pass.py +103 -0
- executorch/backends/arm/test/passes/test_remove_clone_pass.py +45 -0
- executorch/backends/arm/test/passes/test_replace_inf_values_pass.py +96 -0
- executorch/backends/arm/test/passes/test_rescale_pass.py +81 -0
- executorch/backends/arm/test/passes/test_rewrite_conv_pass.py +20 -0
- executorch/backends/arm/test/passes/test_to_tosa_memory_format.py +213 -0
- executorch/backends/arm/test/passes/test_unsqueeze_before_repeat_pass.py +62 -0
- executorch/backends/arm/test/quantizer/test_conv_relu_fusing.py +118 -0
- executorch/backends/arm/test/quantizer/test_generic_annotater.py +109 -0
- executorch/backends/arm/test/quantizer/test_partial_quantization.py +104 -0
- executorch/backends/arm/test/quantizer/test_selective_quantization.py +212 -0
- executorch/backends/arm/test/quantizer/test_set_module_name.py +158 -0
- executorch/backends/arm/test/quantizer/test_tosa_quantizer_validate.py +55 -0
- executorch/backends/arm/test/runner_utils.py +840 -0
- executorch/backends/arm/test/test_memory_allocator_log.py +170 -0
- executorch/backends/arm/test/test_model.py +345 -0
- executorch/backends/arm/test/tester/__init__.py +6 -0
- executorch/backends/arm/test/tester/analyze_output_utils.py +346 -0
- executorch/backends/arm/test/tester/arm_tester.py +1149 -0
- executorch/backends/arm/test/tester/quantize.py +43 -0
- executorch/backends/arm/test/tester/serialize.py +78 -0
- executorch/backends/arm/test/tester/test_pipeline.py +1190 -0
- executorch/backends/arm/tosa/__init__.py +9 -0
- executorch/backends/arm/tosa/backend.py +443 -0
- executorch/backends/arm/tosa/compile_spec.py +48 -0
- executorch/backends/arm/tosa/dialect/__init__.py +15 -0
- executorch/backends/arm/tosa/dialect/lib.py +85 -0
- executorch/backends/arm/tosa/dialect/ops/conv2d.py +111 -0
- executorch/backends/arm/tosa/dialect/ops/conv3d.py +74 -0
- executorch/backends/arm/tosa/dialect/ops/depthwise_conv2d.py +56 -0
- executorch/backends/arm/tosa/dialect/ops/matmul.py +56 -0
- executorch/backends/arm/tosa/dialect/ops/rescale.py +53 -0
- executorch/backends/arm/tosa/dialect/ops/resize.py +66 -0
- executorch/backends/arm/tosa/dialect/ops/table.py +53 -0
- executorch/backends/arm/tosa/dialect/ops/transpose.py +35 -0
- executorch/backends/arm/tosa/dialect/ops_registration.py +68 -0
- executorch/backends/arm/tosa/mapping.py +309 -0
- executorch/backends/arm/tosa/partitioner.py +486 -0
- executorch/backends/arm/tosa/schemas/__init__.py +4 -0
- executorch/backends/arm/tosa/schemas/tosa_1.0.fbs +559 -0
- executorch/backends/arm/tosa/specification.py +406 -0
- executorch/backends/arm/tosa/utils.py +304 -0
- executorch/backends/arm/util/_factory.py +59 -0
- executorch/backends/arm/util/arm_model_evaluator.py +388 -0
- executorch/backends/arm/vgf/__init__.py +11 -0
- executorch/backends/arm/vgf/backend.py +172 -0
- executorch/backends/arm/vgf/compile_spec.py +73 -0
- executorch/backends/arm/vgf/model_converter.py +34 -0
- executorch/backends/arm/vgf/partitioner.py +35 -0
- executorch/backends/cadence/aot/__init__.py +5 -0
- executorch/backends/cadence/aot/compiler.py +484 -0
- executorch/backends/cadence/aot/compiler_funcs.py +203 -0
- executorch/backends/cadence/aot/compiler_utils.py +293 -0
- executorch/backends/cadence/aot/decompose_ops.py +120 -0
- executorch/backends/cadence/aot/export_example.py +117 -0
- executorch/backends/cadence/aot/functions.yaml +470 -0
- executorch/backends/cadence/aot/functions_fusion_g3.yaml +191 -0
- executorch/backends/cadence/aot/functions_hifi.yaml +565 -0
- executorch/backends/cadence/aot/functions_vision.yaml +275 -0
- executorch/backends/cadence/aot/fuse_ops.py +1138 -0
- executorch/backends/cadence/aot/graph_builder.py +142 -0
- executorch/backends/cadence/aot/memory_constraints.py +731 -0
- executorch/backends/cadence/aot/memory_planning.py +469 -0
- executorch/backends/cadence/aot/memory_planning_algo.py +341 -0
- executorch/backends/cadence/aot/ops_registrations.py +2841 -0
- executorch/backends/cadence/aot/pass_utils.py +274 -0
- executorch/backends/cadence/aot/passes.py +132 -0
- executorch/backends/cadence/aot/program_builder.py +138 -0
- executorch/backends/cadence/aot/quantizer/fusion_pass.py +743 -0
- executorch/backends/cadence/aot/quantizer/patterns.py +738 -0
- executorch/backends/cadence/aot/quantizer/quantizer.py +409 -0
- executorch/backends/cadence/aot/quantizer/utils.py +288 -0
- executorch/backends/cadence/aot/ref_implementations.py +2210 -0
- executorch/backends/cadence/aot/remove_ops.py +936 -0
- executorch/backends/cadence/aot/reorder_ops.py +843 -0
- executorch/backends/cadence/aot/replace_ops.py +2526 -0
- executorch/backends/cadence/aot/simplify_ops.py +221 -0
- executorch/backends/cadence/aot/tests/test_decompose_ops_passes.py +80 -0
- executorch/backends/cadence/aot/tests/test_fusion_ops_passes.py +1023 -0
- executorch/backends/cadence/aot/tests/test_graph_builder.py +104 -0
- executorch/backends/cadence/aot/tests/test_idma_ops.py +31 -0
- executorch/backends/cadence/aot/tests/test_memory_passes.py +1367 -0
- executorch/backends/cadence/aot/tests/test_pass_filter.py +167 -0
- executorch/backends/cadence/aot/tests/test_program_builder.py +222 -0
- executorch/backends/cadence/aot/tests/test_quantizer_ops.py +649 -0
- executorch/backends/cadence/aot/tests/test_ref_implementations.py +3151 -0
- executorch/backends/cadence/aot/tests/test_remove_ops_passes.py +977 -0
- executorch/backends/cadence/aot/tests/test_reorder_ops_passes.py +635 -0
- executorch/backends/cadence/aot/tests/test_replace_ops_passes.py +2777 -0
- executorch/backends/cadence/aot/tests/test_simplify_ops_passes.py +160 -0
- executorch/backends/cadence/aot/tests/test_type_dispatch_passes.py +481 -0
- executorch/backends/cadence/aot/type_dispatch.py +190 -0
- executorch/backends/cadence/aot/typing_stubs.py +22 -0
- executorch/backends/cadence/aot/utils.py +363 -0
- executorch/backends/cadence/runtime/__init__.py +13 -0
- executorch/backends/cadence/runtime/etdump.py +173 -0
- executorch/backends/cadence/runtime/executor.py +202 -0
- executorch/backends/cadence/runtime/runtime.py +156 -0
- executorch/backends/cadence/runtime/utils.py +100 -0
- executorch/backends/cadence/utils/FACTO/calibrator/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/calibrator/runner.py +190 -0
- executorch/backends/cadence/utils/FACTO/examples/example.py +59 -0
- executorch/backends/cadence/utils/FACTO/examples/minimal_example.py +21 -0
- executorch/backends/cadence/utils/FACTO/examples/random_seed.py +35 -0
- executorch/backends/cadence/utils/FACTO/facto/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argtuple/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argtuple/engine.py +129 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argtuple/gen.py +47 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/engine.py +291 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/gen.py +139 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/argument/type.py +134 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/engine.py +54 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/model.py +133 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/attribute/solve.py +125 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/specs/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/specs/model.py +149 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/utils/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/utils/random_manager.py +33 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/__init__.py +0 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/constants.py +9 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/gen.py +283 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/solve.py +142 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/space.py +450 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/type.py +105 -0
- executorch/backends/cadence/utils/FACTO/facto/inputgen/variable/utils.py +30 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/db.py +4361 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/default.py +36 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/dtypes.py +25 -0
- executorch/backends/cadence/utils/FACTO/facto/specdb/function.py +537 -0
- executorch/backends/cadence/utils/FACTO/setup.py +19 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argtuple_engine.py +53 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argtuple_generator.py +58 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argument_attributes.py +78 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argument_generator.py +98 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_argument_types.py +28 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_attribute_engine.py +62 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_attribute_solver.py +83 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_constraints.py +27 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_meta_arg_engine.py +70 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_specs.py +48 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_structural_engine.py +32 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_generation.py +80 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_solving.py +193 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_space.py +231 -0
- executorch/backends/cadence/utils/FACTO/test/inputgen/test_variable_types.py +71 -0
- executorch/backends/cadence/utils/facto_util.py +611 -0
- executorch/backends/cadence/utils/gen_header.py +49 -0
- executorch/backends/cadence/utils/post_compilation.py +173 -0
- executorch/backends/cortex_m/ops/operators.py +890 -0
- executorch/backends/cortex_m/ops/operators.yaml +78 -0
- executorch/backends/cortex_m/passes/__init__.py +12 -0
- executorch/backends/cortex_m/passes/activation_fusion_pass.py +181 -0
- executorch/backends/cortex_m/passes/clamp_hardswish_pass.py +37 -0
- executorch/backends/cortex_m/passes/convert_to_cortex_m_pass.py +318 -0
- executorch/backends/cortex_m/passes/cortex_m_pass_manager.py +73 -0
- executorch/backends/cortex_m/passes/decompose_hardswish_pass.py +127 -0
- executorch/backends/cortex_m/passes/passes_utils.py +226 -0
- executorch/backends/cortex_m/passes/quantized_op_fusion_pass.py +255 -0
- executorch/backends/cortex_m/passes/replace_quant_nodes_pass.py +67 -0
- executorch/backends/cortex_m/quantizer/__init__.py +18 -0
- executorch/backends/cortex_m/quantizer/operator_configs.py +74 -0
- executorch/backends/cortex_m/quantizer/quantization_configs.py +121 -0
- executorch/backends/cortex_m/quantizer/quantizer.py +500 -0
- executorch/backends/cortex_m/test/misc/test_quantization.py +359 -0
- executorch/backends/cortex_m/test/models/__init__.py +4 -0
- executorch/backends/cortex_m/test/models/test_mobilenet_v3.py +74 -0
- executorch/backends/cortex_m/test/ops/__init__.py +4 -0
- executorch/backends/cortex_m/test/ops/test_activation.py +528 -0
- executorch/backends/cortex_m/test/ops/test_add.py +182 -0
- executorch/backends/cortex_m/test/ops/test_avg_pool2d.py +99 -0
- executorch/backends/cortex_m/test/ops/test_conv.py +342 -0
- executorch/backends/cortex_m/test/ops/test_linear.py +130 -0
- executorch/backends/cortex_m/test/ops/test_lstm.py +98 -0
- executorch/backends/cortex_m/test/ops/test_maximum.py +83 -0
- executorch/backends/cortex_m/test/ops/test_minimum.py +104 -0
- executorch/backends/cortex_m/test/ops/test_mul.py +156 -0
- executorch/backends/cortex_m/test/ops/test_softmax.py +84 -0
- executorch/backends/cortex_m/test/ops/test_transpose.py +102 -0
- executorch/backends/cortex_m/test/test_helpers_passes_utils.py +103 -0
- executorch/backends/cortex_m/test/test_replace_quant_nodes.py +134 -0
- executorch/backends/cortex_m/test/tester.py +113 -0
- executorch/backends/cuda/__init__.py +5 -0
- executorch/backends/cuda/cuda_backend.py +250 -0
- executorch/backends/cuda/cuda_partitioner.py +25 -0
- executorch/backends/cuda/passes/__init__.py +0 -0
- executorch/backends/cuda/passes/move_cond_predicate_to_cpu.py +90 -0
- executorch/backends/cuda/passes/tests/__init__.py +0 -0
- executorch/backends/cuda/passes/tests/test_move_cond_predicate_to_cpu.py +553 -0
- executorch/backends/cuda/tests/__init__.py +5 -0
- executorch/backends/cuda/tests/test_cuda_export.py +327 -0
- executorch/backends/cuda/tests/test_cuda_partitioner.py +224 -0
- executorch/backends/cuda/triton/__init__.py +17 -0
- executorch/backends/cuda/triton/kernels/__init__.py +11 -0
- executorch/backends/cuda/triton/kernels/sdpa.py +827 -0
- executorch/backends/cuda/triton/replacement_pass.py +130 -0
- executorch/backends/example/example_backend.py +41 -0
- executorch/backends/example/example_backend_delegate_passes/merge_to_dim_pass.py +83 -0
- executorch/backends/example/example_backend_delegate_passes/permute_memory_formats_pass.py +143 -0
- executorch/backends/example/example_operators/adaptive_avg_pool2d.py +47 -0
- executorch/backends/example/example_operators/add.py +44 -0
- executorch/backends/example/example_operators/conv2d.py +52 -0
- executorch/backends/example/example_operators/conv_relu.py +49 -0
- executorch/backends/example/example_operators/dropout.py +44 -0
- executorch/backends/example/example_operators/flatten.py +40 -0
- executorch/backends/example/example_operators/linear.py +62 -0
- executorch/backends/example/example_operators/op_base.py +15 -0
- executorch/backends/example/example_operators/ops.py +32 -0
- executorch/backends/example/example_operators/utils.py +34 -0
- executorch/backends/example/example_partitioner.py +88 -0
- executorch/backends/example/example_quantizer.py +108 -0
- executorch/backends/example/test_example_delegate.py +112 -0
- executorch/backends/mediatek/__init__.py +5 -0
- executorch/backends/mediatek/_passes/__init__.py +0 -0
- executorch/backends/mediatek/_passes/decompose_scaled_dot_product_attention.py +79 -0
- executorch/backends/mediatek/partitioner.py +107 -0
- executorch/backends/mediatek/preprocess.py +214 -0
- executorch/backends/mediatek/quantizer/__init__.py +4 -0
- executorch/backends/mediatek/quantizer/annotator.py +263 -0
- executorch/backends/mediatek/quantizer/qconfig.py +174 -0
- executorch/backends/mediatek/quantizer/quantizer.py +45 -0
- executorch/backends/nxp/_passes/remove_getitem_pass.py +105 -0
- executorch/backends/nxp/aten_passes/convert_unsqueeze_to_view.py +79 -0
- executorch/backends/nxp/aten_passes/decompose_split_to_slices_pass.py +193 -0
- executorch/backends/nxp/aten_passes/fuse_batch_norm_with_conv_pass.py +146 -0
- executorch/backends/nxp/aten_passes/fuse_batch_norm_with_linear_pass.py +150 -0
- executorch/backends/nxp/aten_passes/fuse_linear_and_add_pass.py +204 -0
- executorch/backends/nxp/aten_passes/move_activation_before_concat.py +102 -0
- executorch/backends/nxp/aten_passes/neutron_aten_pass_manager.py +80 -0
- executorch/backends/nxp/aten_passes/remove_nodes_with_known_outputs.py +196 -0
- executorch/backends/nxp/aten_passes/split_group_convolution.py +281 -0
- executorch/backends/nxp/aten_passes/split_gru_based_on_num_layers.py +307 -0
- executorch/backends/nxp/backend/custom_delegation_options.py +19 -0
- executorch/backends/nxp/backend/edge_helper.py +222 -0
- executorch/backends/nxp/backend/edge_program_converter.py +247 -0
- executorch/backends/nxp/backend/ir/conversion_config.py +54 -0
- executorch/backends/nxp/backend/ir/conversion_context.py +38 -0
- executorch/backends/nxp/backend/ir/converter/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/builder/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/builder/aten_model_builder_director.py +142 -0
- executorch/backends/nxp/backend/ir/converter/builder/model_builder.py +1720 -0
- executorch/backends/nxp/backend/ir/converter/builder/quantization_verification.py +377 -0
- executorch/backends/nxp/backend/ir/converter/conversion/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/conversion/aten_translator.py +71 -0
- executorch/backends/nxp/backend/ir/converter/conversion/common.py +207 -0
- executorch/backends/nxp/backend/ir/converter/conversion/translator.py +689 -0
- executorch/backends/nxp/backend/ir/converter/node_converter.py +234 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/__init__.py +4 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/__init__.py +101 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/abs_converter.py +35 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/adaptive_avg_pool_2d_converter.py +68 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/add_tensor_converter.py +57 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/addmm_converter.py +62 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/avg_pool_2d_converter.py +101 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/cat_converter.py +209 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/clone_converter.py +118 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/constant_pad_nd_converter.py +160 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/convolution_converter.py +535 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/hardtanh_converter.py +47 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/max_pool_2d_converter.py +104 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/mean_dim_converter.py +112 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/mm_converter.py +59 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/mul_tensor_converter.py +61 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/permute_copy_converter.py +468 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/qdq_dequantize_converter.py +116 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/qdq_quantize_converter.py +46 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/relu_converter.py +33 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/sigmoid_converter.py +35 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/slice_tensor_converter.py +158 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/softmax_converter.py +62 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/sub_tensor_converter.py +59 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/tanh_converter.py +33 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/ops_converters/view_copy_converter.py +220 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/conv_utils.py +105 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/recurrent_utils.py +64 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/reduce_utils.py +97 -0
- executorch/backends/nxp/backend/ir/converter/node_converters/shared/reshape_transposition.py +233 -0
- executorch/backends/nxp/backend/ir/converter/quantization_utils.py +149 -0
- executorch/backends/nxp/backend/ir/converter/tensor_utils.py +50 -0
- executorch/backends/nxp/backend/ir/lib/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ATan2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AbsOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ActivationFunctionType.py +12 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AddNOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AddOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ArgMaxOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ArgMinOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/AssignVariableOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BatchMatMulOptions.py +101 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BatchToSpaceNDOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BidirectionalSequenceLSTMOptions.py +160 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BidirectionalSequenceRNNOptions.py +126 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BitcastOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BitwiseXorOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BroadcastToOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BucketizeOptions.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Buffer.py +132 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BuiltinOperator.py +212 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BuiltinOptions.py +133 -0
- executorch/backends/nxp/backend/ir/lib/tflite/BuiltinOptions2.py +27 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CallOnceOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CallOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CastOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CombinerType.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ConcatEmbeddingsOptions.py +163 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ConcatenationOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Conv2DOptions.py +155 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Conv3DOptions.py +170 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CosOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CumsumOptions.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CustomOptionsFormat.py +7 -0
- executorch/backends/nxp/backend/ir/lib/tflite/CustomQuantization.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DensifyOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DepthToSpaceOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DepthwiseConv2DOptions.py +157 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DequantizeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DilateOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DimensionMetadata.py +152 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DimensionType.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DivOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/DynamicUpdateSliceOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/EmbeddingLookupSparseOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/EqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ExpOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ExpandDimsOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FakeQuantOptions.py +116 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FillOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FloorDivOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FloorModOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FullyConnectedOptions.py +129 -0
- executorch/backends/nxp/backend/ir/lib/tflite/FullyConnectedOptionsWeightsFormat.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GatherNdOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GatherOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GeluOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GreaterEqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/GreaterOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HardSwishOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableFindOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableImportOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableOptions.py +95 -0
- executorch/backends/nxp/backend/ir/lib/tflite/HashtableSizeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/IfOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Int32Vector.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/L2NormOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSHProjectionOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSHProjectionType.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSTMKernelType.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LSTMOptions.py +131 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LeakyReluOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LessEqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LessOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LocalResponseNormalizationOptions.py +118 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogSoftmaxOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogicalAndOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogicalNotOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/LogicalOrOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MatrixDiagOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MatrixSetDiagOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MaximumMinimumOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Metadata.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MirrorPadMode.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MirrorPadOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Model.py +352 -0
- executorch/backends/nxp/backend/ir/lib/tflite/MulOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NegOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NonMaxSuppressionV4Options.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NonMaxSuppressionV5Options.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/NotEqualOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/OneHotOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Operator.py +428 -0
- executorch/backends/nxp/backend/ir/lib/tflite/OperatorCode.py +112 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PackOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PadOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PadV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Padding.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Pool2DOptions.py +140 -0
- executorch/backends/nxp/backend/ir/lib/tflite/PowOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/QuantizationDetails.py +8 -0
- executorch/backends/nxp/backend/ir/lib/tflite/QuantizationParameters.py +295 -0
- executorch/backends/nxp/backend/ir/lib/tflite/QuantizeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RNNOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RandomOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RangeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RankOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReadVariableOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReduceWindowFunction.py +13 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReduceWindowOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReducerOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReshapeOptions.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ResizeBilinearOptions.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ResizeNearestNeighborOptions.py +86 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReverseSequenceOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ReverseV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Rfft2dOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RightShiftOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/RngAlgorithm.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SVDFOptions.py +97 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ScatterNdOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SegmentSumOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SelectOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SelectV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SequenceRNNOptions.py +99 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ShapeOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SignOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SignatureDef.py +172 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SkipGramOptions.py +97 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SliceOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SoftmaxOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SpaceToBatchNDOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SpaceToDepthOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SparseIndexVector.py +10 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SparseToDenseOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SparsityParameters.py +190 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SplitOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SplitVOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SquareOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SquaredDifferenceOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SqueezeOptions.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloBroadcastInDimOptions.py +102 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloCompareOptions.py +86 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloComparisonDirection.py +12 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloComparisonType.py +11 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloConcatenateOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloConvolutionOptions.py +634 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloCustomCallOptions.py +214 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloDotGeneralOptions.py +304 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloDynamicSliceOptions.py +100 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloGatherOptions.py +276 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloIotaOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloPadOptions.py +194 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloPrecisionConfig.py +9 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloReduceOptions.py +115 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloReduceWindowOptions.py +307 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloRngBitGeneratorOptions.py +67 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloScatterOptions.py +268 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloSliceOptions.py +194 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloSortOptions.py +97 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloTransposeOptions.py +100 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StablehloWhileOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/StridedSliceOptions.py +142 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SubGraph.py +251 -0
- executorch/backends/nxp/backend/ir/lib/tflite/SubOptions.py +82 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Tensor.py +317 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TensorMap.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TensorType.py +24 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TileOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TopKV2Options.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TransposeConvOptions.py +125 -0
- executorch/backends/nxp/backend/ir/lib/tflite/TransposeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Uint16Vector.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/Uint8Vector.py +98 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnidirectionalSequenceLSTMOptions.py +164 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UniqueOptions.py +65 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnpackOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentMaxOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentMinOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentProdOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/UnsortedSegmentSumOptions.py +52 -0
- executorch/backends/nxp/backend/ir/lib/tflite/VarHandleOptions.py +84 -0
- executorch/backends/nxp/backend/ir/lib/tflite/VariantSubType.py +130 -0
- executorch/backends/nxp/backend/ir/lib/tflite/WhereOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/WhileOptions.py +80 -0
- executorch/backends/nxp/backend/ir/lib/tflite/ZerosLikeOptions.py +50 -0
- executorch/backends/nxp/backend/ir/lib/tflite/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/logger.py +341 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/graph_utils.py +115 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/operator_rules.py +102 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/base_optimization.py +41 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/permute_fully_connected_weights_after_reshape.py +121 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizations/prune_transpose_operators.py +174 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/optimizer.py +127 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/pattern_matcher.py +925 -0
- executorch/backends/nxp/backend/ir/neutron_ir_post_processing/tensor_rules.py +710 -0
- executorch/backends/nxp/backend/ir/tensor_formatting.py +69 -0
- executorch/backends/nxp/backend/ir/tflite_generator/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/abs_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/add_n_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/add_options.py +46 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/arg_max_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/arg_min_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/average_pool_2d_options.py +63 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/batch_mat_mul_options.py +45 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/bidirectional_sequence_lstm_options.py +65 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/bidirectional_sequence_rnn_options.py +53 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/bitwise_xor_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/broadcast_to_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/cast_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/concatenation_options.py +38 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/conv_2d_options.py +59 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/conv_3d_options.py +67 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/cum_sum_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/depth_to_space_options.py +29 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/depthwise_conv_2d_options.py +69 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/dequantize_options.py +24 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/div_options.py +43 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/equal_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/exp_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/floor_mod_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/fully_connected_options.py +57 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/gather_nd_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/gather_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/gelu_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/greater_equal_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/greater_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/hard_swish_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/leaky_relu_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/less_equal_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/less_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/log_softmax_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/logical_and_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/logical_not_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/logical_or_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/lrn_options.py +45 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/lstm_options.py +60 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/max_pool_2d_options.py +63 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/maximum_options.py +21 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/mean_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/minimum_options.py +21 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/mirror_pad_options.py +60 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/mul_options.py +36 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/multinomial_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/neg_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/not_equal_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/one_hot_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/pad_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/pad_v2_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/pow_options.py +24 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/quantize_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/range_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reduce_max_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reduce_min_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reduce_prod_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reshape_options.py +53 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/resize_bilinear_options.py +34 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/resize_nearest_neighbor_options.py +37 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/reverse_sequence_options.py +32 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/scatter_nd_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/select_v2_options.py +24 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/shape_options.py +34 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/sign_options.py +22 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/slice_options.py +29 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/softmax_options.py +36 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/space_to_depth_options.py +29 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/split_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/split_v_options.py +27 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/square_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/squared_difference_options.py +25 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/squeeze_options.py +42 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/strided_slice_options.py +35 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/sub_options.py +46 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/sum_options.py +28 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/tile_options.py +23 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/transpose_conv_options.py +50 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/transpose_options.py +30 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/unidirectional_sequence_lstm_options.py +67 -0
- executorch/backends/nxp/backend/ir/tflite_generator/builtin_options/unidirectional_sequence_rnn_options.py +49 -0
- executorch/backends/nxp/backend/ir/tflite_generator/custom_options/flex_transpose_options.py +78 -0
- executorch/backends/nxp/backend/ir/tflite_generator/meta/__init__.py +0 -0
- executorch/backends/nxp/backend/ir/tflite_generator/meta/meta.py +255 -0
- executorch/backends/nxp/backend/ir/tflite_generator/meta/types.py +198 -0
- executorch/backends/nxp/backend/ir/tflite_generator/tflite_model.py +814 -0
- executorch/backends/nxp/backend/neutron_converter_manager.py +117 -0
- executorch/backends/nxp/backend/neutron_operator_support.py +79 -0
- executorch/backends/nxp/backend/neutron_target_spec.py +143 -0
- executorch/backends/nxp/backend/node_format.py +26 -0
- executorch/backends/nxp/backend/node_format_inference.py +294 -0
- executorch/backends/nxp/edge_passes/move_auxiliary_operator_into_separate_qdq_cluster_pass.py +254 -0
- executorch/backends/nxp/edge_passes/neutron_edge_pass.py +55 -0
- executorch/backends/nxp/edge_passes/neutron_edge_pass_manager.py +29 -0
- executorch/backends/nxp/edge_passes/remove_additional_quantize_dequantize_nodes_pass.py +111 -0
- executorch/backends/nxp/edge_passes/remove_as_strided_copy_nodes.py +66 -0
- executorch/backends/nxp/edge_passes/remove_io_quant_ops_pass.py +79 -0
- executorch/backends/nxp/neutron_node_extraction.py +152 -0
- executorch/backends/nxp/neutron_partitioner.py +421 -0
- executorch/backends/nxp/neutron_pass_manager.py +50 -0
- executorch/backends/nxp/nxp_backend.py +391 -0
- executorch/backends/nxp/quantizer/neutron_quantizer.py +353 -0
- executorch/backends/nxp/quantizer/patterns.py +1089 -0
- executorch/backends/nxp/quantizer/utils.py +195 -0
- executorch/backends/nxp/tests/executorch_pipeline.py +184 -0
- executorch/backends/nxp/tests/executors.py +401 -0
- executorch/backends/nxp/tests/ir/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/converter/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_abs_converter.py +91 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_adaptive_avg_pool2d_converter.py +148 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_add_tensor_converter.py +161 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_addmm_converter.py +96 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_avg_pool2d_converter.py +221 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_cat_converter.py +495 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_clone_converter.py +344 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_constant_pad_nd_converter.py +188 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_conv_converter.py +680 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_hardtanh_converter.py +107 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_max_pool_2d_converter.py +132 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_mean_dim_converter.py +280 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_mm_converter.py +96 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_mul_tensor_converter.py +212 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_permute_copy_converter.py +426 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_relu_converter.py +114 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_sigmoid_converter.py +78 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_slice_tensor_converter.py +244 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_softmax_converter.py +115 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_sub_tensor_converter.py +181 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_tanh_converter.py +90 -0
- executorch/backends/nxp/tests/ir/converter/node_converter/test_view_copy_converter.py +509 -0
- executorch/backends/nxp/tests/ir/edge_passes/__init__.py +0 -0
- executorch/backends/nxp/tests/ir/edge_passes/test_remove_io_quant_ops_pass.py +127 -0
- executorch/backends/nxp/tests/models.py +737 -0
- executorch/backends/nxp/tests/test_batch_norm_fusion.py +233 -0
- executorch/backends/nxp/tests/test_context_sensitive_delegation.py +71 -0
- executorch/backends/nxp/tests/test_convert_unsqueeze_to_view.py +143 -0
- executorch/backends/nxp/tests/test_decompose_split_to_slices.py +315 -0
- executorch/backends/nxp/tests/test_edge_passes.py +382 -0
- executorch/backends/nxp/tests/test_gru_splitting.py +267 -0
- executorch/backends/nxp/tests/test_integration.py +53 -0
- executorch/backends/nxp/tests/test_linear_and_add_fusion.py +653 -0
- executorch/backends/nxp/tests/test_move_activation_before_concatenation.py +905 -0
- executorch/backends/nxp/tests/test_neutron_backend.py +63 -0
- executorch/backends/nxp/tests/test_neutron_backend_executor.py +327 -0
- executorch/backends/nxp/tests/test_neutron_converter_manager.py +59 -0
- executorch/backends/nxp/tests/test_node_format_inference.py +91 -0
- executorch/backends/nxp/tests/test_operator_selector.py +24 -0
- executorch/backends/nxp/tests/test_per_channel_conversion.py +182 -0
- executorch/backends/nxp/tests/test_qdq_clustering_conv.py +31 -0
- executorch/backends/nxp/tests/test_quantizer.py +703 -0
- executorch/backends/nxp/tests/test_removing_dead_code.py +65 -0
- executorch/backends/nxp/tests/test_removing_nodes_with_known_outputs.py +116 -0
- executorch/backends/nxp/tests/test_split_group_convolution.py +291 -0
- executorch/backends/nxp/tests/use_qat.py +11 -0
- executorch/backends/openvino/__init__.py +5 -0
- executorch/backends/openvino/partitioner.py +238 -0
- executorch/backends/openvino/preprocess.py +62 -0
- executorch/backends/openvino/quantizer/__init__.py +3 -0
- executorch/backends/openvino/quantizer/observers.py +186 -0
- executorch/backends/openvino/quantizer/quantizer.py +595 -0
- executorch/backends/openvino/tests/models/test_classification.py +38 -0
- executorch/backends/openvino/tests/ops/base_openvino_op_test.py +86 -0
- executorch/backends/openvino/tests/ops/test_add.py +22 -0
- executorch/backends/openvino/tests/ops/test_addmm.py +28 -0
- executorch/backends/openvino/tests/ops/test_arange.py +23 -0
- executorch/backends/openvino/tests/ops/test_batch_norm.py +61 -0
- executorch/backends/openvino/tests/ops/test_convolution.py +296 -0
- executorch/backends/openvino/tests/ops/test_mean.py +90 -0
- executorch/backends/openvino/tests/ops/test_permute.py +33 -0
- executorch/backends/openvino/tests/ops/test_pooling.py +91 -0
- executorch/backends/openvino/tests/ops/test_unary_ops.py +37 -0
- executorch/backends/openvino/tests/ops/test_view.py +35 -0
- executorch/backends/openvino/tests/test_runner.py +76 -0
- executorch/backends/qualcomm/__init__.py +13 -0
- executorch/backends/qualcomm/_passes/__init__.py +101 -0
- executorch/backends/qualcomm/_passes/annotate_adaptive_avg_pool1d.py +43 -0
- executorch/backends/qualcomm/_passes/annotate_quant_attrs.py +145 -0
- executorch/backends/qualcomm/_passes/annotate_stack.py +44 -0
- executorch/backends/qualcomm/_passes/annotate_unbind.py +42 -0
- executorch/backends/qualcomm/_passes/build_quant_io.py +49 -0
- executorch/backends/qualcomm/_passes/canonicalize_conv.py +204 -0
- executorch/backends/qualcomm/_passes/convert_bmm_to_matmul.py +83 -0
- executorch/backends/qualcomm/_passes/convert_linear_to_conv2d.py +232 -0
- executorch/backends/qualcomm/_passes/convert_mha_to_sha.py +626 -0
- executorch/backends/qualcomm/_passes/convert_square_to_pow.py +38 -0
- executorch/backends/qualcomm/_passes/decompose_any.py +64 -0
- executorch/backends/qualcomm/_passes/decompose_binary_alpha.py +61 -0
- executorch/backends/qualcomm/_passes/decompose_cdist.py +69 -0
- executorch/backends/qualcomm/_passes/decompose_col_im.py +121 -0
- executorch/backends/qualcomm/_passes/decompose_einsum.py +51 -0
- executorch/backends/qualcomm/_passes/decompose_expm1.py +46 -0
- executorch/backends/qualcomm/_passes/decompose_floor_divide.py +62 -0
- executorch/backends/qualcomm/_passes/decompose_glu.py +55 -0
- executorch/backends/qualcomm/_passes/decompose_linalg_vector_norm.py +75 -0
- executorch/backends/qualcomm/_passes/decompose_maxpool3d.py +133 -0
- executorch/backends/qualcomm/_passes/decompose_minmaxdim.py +109 -0
- executorch/backends/qualcomm/_passes/decompose_roll.py +78 -0
- executorch/backends/qualcomm/_passes/decompose_silu.py +45 -0
- executorch/backends/qualcomm/_passes/decompose_threshold.py +61 -0
- executorch/backends/qualcomm/_passes/decompose_triu.py +71 -0
- executorch/backends/qualcomm/_passes/decompose_wrap_with_autocast.py +79 -0
- executorch/backends/qualcomm/_passes/expand_broadcast_tensor_shape.py +67 -0
- executorch/backends/qualcomm/_passes/fixed_linear_keep_dim.py +95 -0
- executorch/backends/qualcomm/_passes/fold_qdq.py +80 -0
- executorch/backends/qualcomm/_passes/fuse_consecutive_cast.py +116 -0
- executorch/backends/qualcomm/_passes/fuse_consecutive_transpose.py +109 -0
- executorch/backends/qualcomm/_passes/i64_to_i32.py +184 -0
- executorch/backends/qualcomm/_passes/insert_io_qdq.py +154 -0
- executorch/backends/qualcomm/_passes/insert_requantize.py +111 -0
- executorch/backends/qualcomm/_passes/insert_reshape_for_reduce_ops.py +59 -0
- executorch/backends/qualcomm/_passes/layout_transform.py +355 -0
- executorch/backends/qualcomm/_passes/lift_constant_scalar_operands.py +186 -0
- executorch/backends/qualcomm/_passes/qnn_pass_manager.py +271 -0
- executorch/backends/qualcomm/_passes/recompose_pad_maxpool2d.py +147 -0
- executorch/backends/qualcomm/_passes/recompose_pixel_unshuffle.py +81 -0
- executorch/backends/qualcomm/_passes/recompose_rms_norm.py +155 -0
- executorch/backends/qualcomm/_passes/reduce_dynamic_range.py +60 -0
- executorch/backends/qualcomm/_passes/remove_0d_tensor.py +36 -0
- executorch/backends/qualcomm/_passes/remove_redundancy.py +73 -0
- executorch/backends/qualcomm/_passes/replace_arange_args.py +48 -0
- executorch/backends/qualcomm/_passes/replace_inf_values.py +60 -0
- executorch/backends/qualcomm/_passes/seq_mse.py +224 -0
- executorch/backends/qualcomm/_passes/tag_quant_io.py +45 -0
- executorch/backends/qualcomm/_passes/utils.py +283 -0
- executorch/backends/qualcomm/builders/__init__.py +221 -0
- executorch/backends/qualcomm/builders/node_visitor.py +518 -0
- executorch/backends/qualcomm/builders/node_visitor_manager.py +79 -0
- executorch/backends/qualcomm/builders/op_abs.py +57 -0
- executorch/backends/qualcomm/builders/op_adaptive_avg_pool2d.py +126 -0
- executorch/backends/qualcomm/builders/op_adaptive_max_pool2d.py +151 -0
- executorch/backends/qualcomm/builders/op_add.py +62 -0
- executorch/backends/qualcomm/builders/op_amax.py +90 -0
- executorch/backends/qualcomm/builders/op_amin.py +90 -0
- executorch/backends/qualcomm/builders/op_and.py +60 -0
- executorch/backends/qualcomm/builders/op_arange.py +41 -0
- executorch/backends/qualcomm/builders/op_argmax.py +78 -0
- executorch/backends/qualcomm/builders/op_argmin.py +78 -0
- executorch/backends/qualcomm/builders/op_asin.py +56 -0
- executorch/backends/qualcomm/builders/op_atan.py +55 -0
- executorch/backends/qualcomm/builders/op_avg_pool2d.py +168 -0
- executorch/backends/qualcomm/builders/op_avg_pool3d.py +299 -0
- executorch/backends/qualcomm/builders/op_batch_norm.py +151 -0
- executorch/backends/qualcomm/builders/op_binary.py +84 -0
- executorch/backends/qualcomm/builders/op_bmm.py +59 -0
- executorch/backends/qualcomm/builders/op_cat.py +89 -0
- executorch/backends/qualcomm/builders/op_ceil.py +56 -0
- executorch/backends/qualcomm/builders/op_clamp.py +80 -0
- executorch/backends/qualcomm/builders/op_conv.py +263 -0
- executorch/backends/qualcomm/builders/op_copy.py +112 -0
- executorch/backends/qualcomm/builders/op_cos.py +56 -0
- executorch/backends/qualcomm/builders/op_cum_sum.py +87 -0
- executorch/backends/qualcomm/builders/op_custom_op.py +93 -0
- executorch/backends/qualcomm/builders/op_depth_to_space.py +78 -0
- executorch/backends/qualcomm/builders/op_dequantize.py +72 -0
- executorch/backends/qualcomm/builders/op_div.py +62 -0
- executorch/backends/qualcomm/builders/op_elu.py +68 -0
- executorch/backends/qualcomm/builders/op_embedding.py +79 -0
- executorch/backends/qualcomm/builders/op_eq.py +62 -0
- executorch/backends/qualcomm/builders/op_exp.py +60 -0
- executorch/backends/qualcomm/builders/op_expand.py +84 -0
- executorch/backends/qualcomm/builders/op_flip.py +81 -0
- executorch/backends/qualcomm/builders/op_floor.py +56 -0
- executorch/backends/qualcomm/builders/op_full.py +41 -0
- executorch/backends/qualcomm/builders/op_full_like.py +41 -0
- executorch/backends/qualcomm/builders/op_gather.py +76 -0
- executorch/backends/qualcomm/builders/op_ge.py +62 -0
- executorch/backends/qualcomm/builders/op_gelu.py +57 -0
- executorch/backends/qualcomm/builders/op_grid_sampler_2d.py +162 -0
- executorch/backends/qualcomm/builders/op_group_norm.py +94 -0
- executorch/backends/qualcomm/builders/op_gt.py +62 -0
- executorch/backends/qualcomm/builders/op_hardsigmoid.py +78 -0
- executorch/backends/qualcomm/builders/op_hardswish.py +57 -0
- executorch/backends/qualcomm/builders/op_hardtanh.py +79 -0
- executorch/backends/qualcomm/builders/op_index.py +85 -0
- executorch/backends/qualcomm/builders/op_index_put.py +481 -0
- executorch/backends/qualcomm/builders/op_index_select.py +81 -0
- executorch/backends/qualcomm/builders/op_instance_norm.py +112 -0
- executorch/backends/qualcomm/builders/op_layer_norm.py +113 -0
- executorch/backends/qualcomm/builders/op_le.py +62 -0
- executorch/backends/qualcomm/builders/op_linear.py +98 -0
- executorch/backends/qualcomm/builders/op_log.py +58 -0
- executorch/backends/qualcomm/builders/op_log_softmax.py +81 -0
- executorch/backends/qualcomm/builders/op_logical_not.py +56 -0
- executorch/backends/qualcomm/builders/op_lt.py +62 -0
- executorch/backends/qualcomm/builders/op_matmul.py +59 -0
- executorch/backends/qualcomm/builders/op_max.py +62 -0
- executorch/backends/qualcomm/builders/op_max_dim.py +89 -0
- executorch/backends/qualcomm/builders/op_max_pool2d.py +145 -0
- executorch/backends/qualcomm/builders/op_mean_dim.py +100 -0
- executorch/backends/qualcomm/builders/op_min.py +62 -0
- executorch/backends/qualcomm/builders/op_min_dim.py +89 -0
- executorch/backends/qualcomm/builders/op_mul.py +62 -0
- executorch/backends/qualcomm/builders/op_ne.py +62 -0
- executorch/backends/qualcomm/builders/op_neg.py +54 -0
- executorch/backends/qualcomm/builders/op_or.py +60 -0
- executorch/backends/qualcomm/builders/op_pad.py +97 -0
- executorch/backends/qualcomm/builders/op_pow.py +75 -0
- executorch/backends/qualcomm/builders/op_prelu.py +81 -0
- executorch/backends/qualcomm/builders/op_quantize.py +73 -0
- executorch/backends/qualcomm/builders/op_relu.py +58 -0
- executorch/backends/qualcomm/builders/op_repeat.py +68 -0
- executorch/backends/qualcomm/builders/op_reshape.py +55 -0
- executorch/backends/qualcomm/builders/op_resize.py +85 -0
- executorch/backends/qualcomm/builders/op_rms_norm.py +132 -0
- executorch/backends/qualcomm/builders/op_round.py +58 -0
- executorch/backends/qualcomm/builders/op_rsqrt.py +58 -0
- executorch/backends/qualcomm/builders/op_scalar_tensor.py +51 -0
- executorch/backends/qualcomm/builders/op_select_copy.py +89 -0
- executorch/backends/qualcomm/builders/op_sigmoid.py +58 -0
- executorch/backends/qualcomm/builders/op_sign.py +56 -0
- executorch/backends/qualcomm/builders/op_sin.py +56 -0
- executorch/backends/qualcomm/builders/op_skip_ops.py +55 -0
- executorch/backends/qualcomm/builders/op_slice_copy.py +95 -0
- executorch/backends/qualcomm/builders/op_slice_scatter.py +122 -0
- executorch/backends/qualcomm/builders/op_softmax.py +79 -0
- executorch/backends/qualcomm/builders/op_space_to_depth.py +78 -0
- executorch/backends/qualcomm/builders/op_split_with_sizes.py +99 -0
- executorch/backends/qualcomm/builders/op_sqrt.py +60 -0
- executorch/backends/qualcomm/builders/op_squeeze.py +57 -0
- executorch/backends/qualcomm/builders/op_stack.py +71 -0
- executorch/backends/qualcomm/builders/op_sub.py +62 -0
- executorch/backends/qualcomm/builders/op_sum_int_list.py +84 -0
- executorch/backends/qualcomm/builders/op_tanh.py +57 -0
- executorch/backends/qualcomm/builders/op_to.py +149 -0
- executorch/backends/qualcomm/builders/op_topk.py +112 -0
- executorch/backends/qualcomm/builders/op_transpose.py +76 -0
- executorch/backends/qualcomm/builders/op_unbind.py +73 -0
- executorch/backends/qualcomm/builders/op_unsqueeze.py +57 -0
- executorch/backends/qualcomm/builders/op_upsample_bilinear2d.py +68 -0
- executorch/backends/qualcomm/builders/op_upsample_nearest2d.py +68 -0
- executorch/backends/qualcomm/builders/op_where.py +82 -0
- executorch/backends/qualcomm/builders/op_xor.py +60 -0
- executorch/backends/qualcomm/builders/qnn_constants.py +630 -0
- executorch/backends/qualcomm/builders/utils.py +160 -0
- executorch/backends/qualcomm/debugger/format_outputs.py +221 -0
- executorch/backends/qualcomm/debugger/metrics_evaluator.py +90 -0
- executorch/backends/qualcomm/debugger/qnn_intermediate_debugger.py +328 -0
- executorch/backends/qualcomm/debugger/utils.py +435 -0
- executorch/backends/qualcomm/partition/common_defs.py +44 -0
- executorch/backends/qualcomm/partition/qnn_partitioner.py +225 -0
- executorch/backends/qualcomm/partition/utils.py +75 -0
- executorch/backends/qualcomm/qnn_preprocess.py +218 -0
- executorch/backends/qualcomm/quantizer/annotators.py +1501 -0
- executorch/backends/qualcomm/quantizer/custom_annotation.py +499 -0
- executorch/backends/qualcomm/quantizer/observers/concat_observer.py +74 -0
- executorch/backends/qualcomm/quantizer/observers/per_block_param_observer.py +145 -0
- executorch/backends/qualcomm/quantizer/observers/per_channel_param_observer.py +113 -0
- executorch/backends/qualcomm/quantizer/qconfig.py +802 -0
- executorch/backends/qualcomm/quantizer/quant_recipe.py +402 -0
- executorch/backends/qualcomm/quantizer/quantizer.py +507 -0
- executorch/backends/qualcomm/recipes/__init__.py +16 -0
- executorch/backends/qualcomm/recipes/qnn_recipe_provider.py +179 -0
- executorch/backends/qualcomm/recipes/qnn_recipe_types.py +28 -0
- executorch/backends/qualcomm/scripts/download_qnn_sdk.py +642 -0
- executorch/backends/qualcomm/serialization/qc_compiler_spec.fbs +299 -0
- executorch/backends/qualcomm/serialization/qc_schema.py +240 -0
- executorch/backends/qualcomm/serialization/qc_schema_serialize.py +59 -0
- executorch/backends/qualcomm/tests/models.py +2393 -0
- executorch/backends/qualcomm/tests/test_passes.py +154 -0
- executorch/backends/qualcomm/tests/test_qnn_delegate.py +8454 -0
- executorch/backends/qualcomm/tests/tester.py +113 -0
- executorch/backends/qualcomm/tests/utils.py +770 -0
- executorch/backends/qualcomm/utils/constants.py +49 -0
- executorch/backends/qualcomm/utils/qnn_manager_lifecycle.py +88 -0
- executorch/backends/qualcomm/utils/utils.py +1302 -0
- executorch/backends/samsung/_passes/annotate_qparams.py +201 -0
- executorch/backends/samsung/_passes/annotate_scalar_parameters.py +65 -0
- executorch/backends/samsung/_passes/conv1d_to_conv2d.py +97 -0
- executorch/backends/samsung/_passes/customized_constant_prop.py +40 -0
- executorch/backends/samsung/_passes/fold_qdq.py +36 -0
- executorch/backends/samsung/_passes/fuse_conv_act.py +77 -0
- executorch/backends/samsung/_passes/insert_qdq.py +164 -0
- executorch/backends/samsung/_passes/remove_useless_ops.py +87 -0
- executorch/backends/samsung/_passes/replace_scalar_ops.py +46 -0
- executorch/backends/samsung/_passes/utils.py +15 -0
- executorch/backends/samsung/builders/__init__.py +97 -0
- executorch/backends/samsung/builders/node_visitor.py +116 -0
- executorch/backends/samsung/builders/op_add.py +41 -0
- executorch/backends/samsung/builders/op_avg_pool2d.py +70 -0
- executorch/backends/samsung/builders/op_batch_norm.py +56 -0
- executorch/backends/samsung/builders/op_bmm.py +43 -0
- executorch/backends/samsung/builders/op_cat.py +50 -0
- executorch/backends/samsung/builders/op_clamp.py +47 -0
- executorch/backends/samsung/builders/op_constant_pad_nd.py +56 -0
- executorch/backends/samsung/builders/op_conv2d.py +89 -0
- executorch/backends/samsung/builders/op_dequantize.py +19 -0
- executorch/backends/samsung/builders/op_div.py +42 -0
- executorch/backends/samsung/builders/op_embedding.py +41 -0
- executorch/backends/samsung/builders/op_expand_copy.py +77 -0
- executorch/backends/samsung/builders/op_gelu.py +40 -0
- executorch/backends/samsung/builders/op_getitem.py +32 -0
- executorch/backends/samsung/builders/op_hardsigmoid.py +35 -0
- executorch/backends/samsung/builders/op_hardswish.py +35 -0
- executorch/backends/samsung/builders/op_hardtanh.py +42 -0
- executorch/backends/samsung/builders/op_layer_norm.py +53 -0
- executorch/backends/samsung/builders/op_leaky_relu.py +58 -0
- executorch/backends/samsung/builders/op_linear.py +51 -0
- executorch/backends/samsung/builders/op_log_softmax.py +39 -0
- executorch/backends/samsung/builders/op_max_pool2d.py +96 -0
- executorch/backends/samsung/builders/op_maximum.py +37 -0
- executorch/backends/samsung/builders/op_mean_dim.py +49 -0
- executorch/backends/samsung/builders/op_minimum.py +39 -0
- executorch/backends/samsung/builders/op_mul.py +43 -0
- executorch/backends/samsung/builders/op_permute.py +37 -0
- executorch/backends/samsung/builders/op_pixel_shuffle.py +38 -0
- executorch/backends/samsung/builders/op_quantize.py +60 -0
- executorch/backends/samsung/builders/op_relu.py +37 -0
- executorch/backends/samsung/builders/op_reshape.py +34 -0
- executorch/backends/samsung/builders/op_rsqrt.py +35 -0
- executorch/backends/samsung/builders/op_select.py +52 -0
- executorch/backends/samsung/builders/op_slice_copy.py +59 -0
- executorch/backends/samsung/builders/op_softmax.py +39 -0
- executorch/backends/samsung/builders/op_sqrt.py +35 -0
- executorch/backends/samsung/builders/op_squeeze.py +37 -0
- executorch/backends/samsung/builders/op_sub.py +39 -0
- executorch/backends/samsung/builders/op_to_copy.py +44 -0
- executorch/backends/samsung/builders/op_unsqueeze.py +35 -0
- executorch/backends/samsung/builders/op_upsample_bilinear2d.py +53 -0
- executorch/backends/samsung/builders/op_upsample_nearest2d.py +52 -0
- executorch/backends/samsung/builders/utils.py +64 -0
- executorch/backends/samsung/enn_preprocess.py +110 -0
- executorch/backends/samsung/partition/enn_partitioner.py +134 -0
- executorch/backends/samsung/quantizer/__init__.py +10 -0
- executorch/backends/samsung/quantizer/annotator.py +871 -0
- executorch/backends/samsung/quantizer/qconfig.py +174 -0
- executorch/backends/samsung/quantizer/quantizer.py +65 -0
- executorch/backends/samsung/serialization/compile_options.py +77 -0
- executorch/backends/samsung/serialization/compile_options_def.fbs +23 -0
- executorch/backends/samsung/serialization/enn_graph_schema.py +141 -0
- executorch/backends/samsung/test/models/test_deeplab_v3.py +28 -0
- executorch/backends/samsung/test/models/test_edsr.py +30 -0
- executorch/backends/samsung/test/models/test_inception_v3.py +30 -0
- executorch/backends/samsung/test/models/test_inception_v4.py +30 -0
- executorch/backends/samsung/test/models/test_mobilenet_v2.py +28 -0
- executorch/backends/samsung/test/models/test_mobilenet_v3.py +33 -0
- executorch/backends/samsung/test/models/test_resnet18.py +30 -0
- executorch/backends/samsung/test/models/test_resnet50.py +30 -0
- executorch/backends/samsung/test/models/test_torchvision_vit.py +32 -0
- executorch/backends/samsung/test/models/test_wav2letter.py +28 -0
- executorch/backends/samsung/test/ops/test_add.py +63 -0
- executorch/backends/samsung/test/ops/test_avg_pool2d.py +66 -0
- executorch/backends/samsung/test/ops/test_batch_norm.py +52 -0
- executorch/backends/samsung/test/ops/test_bmm.py +50 -0
- executorch/backends/samsung/test/ops/test_cat.py +49 -0
- executorch/backends/samsung/test/ops/test_clamp.py +50 -0
- executorch/backends/samsung/test/ops/test_constant_pad_nd.py +46 -0
- executorch/backends/samsung/test/ops/test_conv2d.py +95 -0
- executorch/backends/samsung/test/ops/test_div.py +50 -0
- executorch/backends/samsung/test/ops/test_embedding.py +46 -0
- executorch/backends/samsung/test/ops/test_expand_copy.py +46 -0
- executorch/backends/samsung/test/ops/test_gelu.py +65 -0
- executorch/backends/samsung/test/ops/test_leaky_relu.py +47 -0
- executorch/backends/samsung/test/ops/test_linear.py +48 -0
- executorch/backends/samsung/test/ops/test_log_softmax.py +46 -0
- executorch/backends/samsung/test/ops/test_max_pool2d.py +72 -0
- executorch/backends/samsung/test/ops/test_mean_dim.py +51 -0
- executorch/backends/samsung/test/ops/test_minimum.py +45 -0
- executorch/backends/samsung/test/ops/test_mul.py +63 -0
- executorch/backends/samsung/test/ops/test_permute.py +55 -0
- executorch/backends/samsung/test/ops/test_pixel_shuffle.py +49 -0
- executorch/backends/samsung/test/ops/test_relu.py +65 -0
- executorch/backends/samsung/test/ops/test_reshape.py +46 -0
- executorch/backends/samsung/test/ops/test_rsqrt.py +46 -0
- executorch/backends/samsung/test/ops/test_select.py +52 -0
- executorch/backends/samsung/test/ops/test_slice_copy.py +46 -0
- executorch/backends/samsung/test/ops/test_softmax.py +46 -0
- executorch/backends/samsung/test/ops/test_sqrt.py +46 -0
- executorch/backends/samsung/test/ops/test_squeeze.py +47 -0
- executorch/backends/samsung/test/ops/test_sub.py +63 -0
- executorch/backends/samsung/test/ops/test_to_copy.py +49 -0
- executorch/backends/samsung/test/ops/test_unsqueeze.py +47 -0
- executorch/backends/samsung/test/ops/test_upsample_bilinear2d.py +54 -0
- executorch/backends/samsung/test/ops/test_upsample_nearest2d.py +53 -0
- executorch/backends/samsung/test/tester/__init__.py +11 -0
- executorch/backends/samsung/test/tester/samsung_tester.py +125 -0
- executorch/backends/samsung/test/utils/__init__.py +11 -0
- executorch/backends/samsung/test/utils/runtime_executor.py +186 -0
- executorch/backends/samsung/utils/constants.py +45 -0
- executorch/backends/samsung/utils/export_utils.py +93 -0
- executorch/backends/samsung/utils/utils.py +125 -0
- executorch/backends/test/facto/__init__.py +0 -0
- executorch/backends/test/facto/facto_specs.py +59 -0
- executorch/backends/test/facto/test_facto.py +301 -0
- executorch/backends/test/harness/__init__.py +3 -0
- executorch/backends/test/harness/error_statistics.py +99 -0
- executorch/backends/test/harness/stages/__init__.py +23 -0
- executorch/backends/test/harness/stages/export.py +32 -0
- executorch/backends/test/harness/stages/partition.py +26 -0
- executorch/backends/test/harness/stages/quantize.py +128 -0
- executorch/backends/test/harness/stages/run_passes.py +66 -0
- executorch/backends/test/harness/stages/serialize.py +59 -0
- executorch/backends/test/harness/stages/stage.py +91 -0
- executorch/backends/test/harness/stages/to_edge.py +27 -0
- executorch/backends/test/harness/stages/to_edge_transform_and_lower.py +50 -0
- executorch/backends/test/harness/stages/to_executorch.py +54 -0
- executorch/backends/test/harness/tester.py +478 -0
- executorch/backends/test/harness/tests/test_error_statistics.py +67 -0
- executorch/backends/test/suite/__init__.py +74 -0
- executorch/backends/test/suite/conftest.py +182 -0
- executorch/backends/test/suite/context.py +34 -0
- executorch/backends/test/suite/discovery.py +100 -0
- executorch/backends/test/suite/flow.py +150 -0
- executorch/backends/test/suite/flows/__init__.py +7 -0
- executorch/backends/test/suite/flows/arm.py +92 -0
- executorch/backends/test/suite/flows/coreml.py +31 -0
- executorch/backends/test/suite/flows/portable.py +19 -0
- executorch/backends/test/suite/flows/qualcomm.py +61 -0
- executorch/backends/test/suite/flows/vulkan.py +44 -0
- executorch/backends/test/suite/flows/xnnpack.py +79 -0
- executorch/backends/test/suite/generate_markdown_summary.py +249 -0
- executorch/backends/test/suite/generate_markdown_summary_json.py +229 -0
- executorch/backends/test/suite/models/__init__.py +7 -0
- executorch/backends/test/suite/models/test_torchaudio.py +110 -0
- executorch/backends/test/suite/models/test_torchvision.py +194 -0
- executorch/backends/test/suite/operators/__init__.py +108 -0
- executorch/backends/test/suite/operators/test_abs.py +60 -0
- executorch/backends/test/suite/operators/test_adaptive_avgpool1d.py +102 -0
- executorch/backends/test/suite/operators/test_adaptive_avgpool2d.py +112 -0
- executorch/backends/test/suite/operators/test_adaptive_avgpool3d.py +112 -0
- executorch/backends/test/suite/operators/test_adaptive_maxpool1d.py +125 -0
- executorch/backends/test/suite/operators/test_adaptive_maxpool2d.py +135 -0
- executorch/backends/test/suite/operators/test_adaptive_maxpool3d.py +135 -0
- executorch/backends/test/suite/operators/test_add.py +76 -0
- executorch/backends/test/suite/operators/test_amax.py +257 -0
- executorch/backends/test/suite/operators/test_amin.py +259 -0
- executorch/backends/test/suite/operators/test_argmax.py +201 -0
- executorch/backends/test/suite/operators/test_argmin.py +201 -0
- executorch/backends/test/suite/operators/test_avgpool1d.py +155 -0
- executorch/backends/test/suite/operators/test_avgpool2d.py +168 -0
- executorch/backends/test/suite/operators/test_avgpool3d.py +163 -0
- executorch/backends/test/suite/operators/test_cat.py +176 -0
- executorch/backends/test/suite/operators/test_ceil.py +60 -0
- executorch/backends/test/suite/operators/test_clamp.py +86 -0
- executorch/backends/test/suite/operators/test_conv1d.py +144 -0
- executorch/backends/test/suite/operators/test_conv2d.py +167 -0
- executorch/backends/test/suite/operators/test_conv3d.py +162 -0
- executorch/backends/test/suite/operators/test_convtranspose1d.py +144 -0
- executorch/backends/test/suite/operators/test_convtranspose2d.py +171 -0
- executorch/backends/test/suite/operators/test_convtranspose3d.py +166 -0
- executorch/backends/test/suite/operators/test_div.py +110 -0
- executorch/backends/test/suite/operators/test_elu.py +49 -0
- executorch/backends/test/suite/operators/test_embedding.py +89 -0
- executorch/backends/test/suite/operators/test_embedding_bag.py +118 -0
- executorch/backends/test/suite/operators/test_exp.py +65 -0
- executorch/backends/test/suite/operators/test_expand.py +122 -0
- executorch/backends/test/suite/operators/test_floor.py +57 -0
- executorch/backends/test/suite/operators/test_floor_divide.py +216 -0
- executorch/backends/test/suite/operators/test_gelu.py +52 -0
- executorch/backends/test/suite/operators/test_glu.py +52 -0
- executorch/backends/test/suite/operators/test_hardsigmoid.py +50 -0
- executorch/backends/test/suite/operators/test_hardswish.py +50 -0
- executorch/backends/test/suite/operators/test_hardtanh.py +57 -0
- executorch/backends/test/suite/operators/test_index_put.py +455 -0
- executorch/backends/test/suite/operators/test_index_select.py +128 -0
- executorch/backends/test/suite/operators/test_leaky_relu.py +56 -0
- executorch/backends/test/suite/operators/test_linear.py +124 -0
- executorch/backends/test/suite/operators/test_log.py +80 -0
- executorch/backends/test/suite/operators/test_log10.py +60 -0
- executorch/backends/test/suite/operators/test_log1p.py +60 -0
- executorch/backends/test/suite/operators/test_log2.py +60 -0
- executorch/backends/test/suite/operators/test_logsigmoid.py +40 -0
- executorch/backends/test/suite/operators/test_lstm.py +247 -0
- executorch/backends/test/suite/operators/test_masked_fill.py +101 -0
- executorch/backends/test/suite/operators/test_maxpool1d.py +185 -0
- executorch/backends/test/suite/operators/test_maxpool2d.py +191 -0
- executorch/backends/test/suite/operators/test_maxpool3d.py +189 -0
- executorch/backends/test/suite/operators/test_mean.py +305 -0
- executorch/backends/test/suite/operators/test_median.py +188 -0
- executorch/backends/test/suite/operators/test_mul.py +66 -0
- executorch/backends/test/suite/operators/test_neg.py +70 -0
- executorch/backends/test/suite/operators/test_permute.py +109 -0
- executorch/backends/test/suite/operators/test_pow.py +149 -0
- executorch/backends/test/suite/operators/test_prelu.py +55 -0
- executorch/backends/test/suite/operators/test_relu.py +45 -0
- executorch/backends/test/suite/operators/test_reshape.py +82 -0
- executorch/backends/test/suite/operators/test_round.py +129 -0
- executorch/backends/test/suite/operators/test_rsqrt.py +76 -0
- executorch/backends/test/suite/operators/test_select.py +89 -0
- executorch/backends/test/suite/operators/test_sigmoid.py +40 -0
- executorch/backends/test/suite/operators/test_silu.py +50 -0
- executorch/backends/test/suite/operators/test_slice.py +146 -0
- executorch/backends/test/suite/operators/test_split.py +119 -0
- executorch/backends/test/suite/operators/test_sqrt.py +71 -0
- executorch/backends/test/suite/operators/test_square.py +67 -0
- executorch/backends/test/suite/operators/test_squeeze.py +86 -0
- executorch/backends/test/suite/operators/test_stack.py +114 -0
- executorch/backends/test/suite/operators/test_sub.py +84 -0
- executorch/backends/test/suite/operators/test_tanh.py +40 -0
- executorch/backends/test/suite/operators/test_threshold.py +71 -0
- executorch/backends/test/suite/operators/test_transpose.py +143 -0
- executorch/backends/test/suite/operators/test_trunc.py +73 -0
- executorch/backends/test/suite/operators/test_unsqueeze.py +110 -0
- executorch/backends/test/suite/operators/test_upsample_bilinear2d.py +273 -0
- executorch/backends/test/suite/operators/test_upsample_nearest2d.py +137 -0
- executorch/backends/test/suite/operators/test_view.py +82 -0
- executorch/backends/test/suite/reporting.py +421 -0
- executorch/backends/test/suite/runner.py +328 -0
- executorch/backends/test/suite/tests/__init__.py +0 -0
- executorch/backends/test/suite/tests/test_reporting.py +144 -0
- executorch/backends/transforms/__init__.py +12 -0
- executorch/backends/transforms/addmm_mm_to_linear.py +170 -0
- executorch/backends/transforms/convert_dtype_pass.py +103 -0
- executorch/backends/transforms/decompose_sdpa.py +120 -0
- executorch/backends/transforms/duplicate_dynamic_quant_chain.py +195 -0
- executorch/backends/transforms/fuse_batch_norm_with_conv.py +161 -0
- executorch/backends/transforms/fuse_conv_with_clamp.py +77 -0
- executorch/backends/transforms/fuse_view_copy.py +116 -0
- executorch/backends/transforms/mean_to_sum_div.py +41 -0
- executorch/backends/transforms/rank_0_to_rank_1.py +18 -0
- executorch/backends/transforms/remove_clone_ops.py +109 -0
- executorch/backends/transforms/remove_getitem_op.py +109 -0
- executorch/backends/transforms/replace_scalar_with_tensor.py +93 -0
- executorch/backends/transforms/test/test_create_delete_constant_placeholder.py +122 -0
- executorch/backends/transforms/test/test_create_mutable_buffer.py +503 -0
- executorch/backends/transforms/test/test_duplicate_dynamic_quant_chain.py +184 -0
- executorch/backends/transforms/test/test_rank_0_to_rank_1.py +32 -0
- executorch/backends/transforms/test/test_remove_clone_ops.py +197 -0
- executorch/backends/transforms/utils.py +377 -0
- executorch/backends/transforms/view_copy_to_squeeze_unsqueeze.py +135 -0
- executorch/backends/vulkan/__init__.py +14 -0
- executorch/backends/vulkan/_passes/__init__.py +37 -0
- executorch/backends/vulkan/_passes/fold_qdq.py +40 -0
- executorch/backends/vulkan/_passes/fuse_patterns.py +34 -0
- executorch/backends/vulkan/_passes/fuse_quantized_ops.py +236 -0
- executorch/backends/vulkan/_passes/insert_prepack_nodes.py +83 -0
- executorch/backends/vulkan/_passes/remove_asserts.py +52 -0
- executorch/backends/vulkan/_passes/remove_redundant_ops.py +72 -0
- executorch/backends/vulkan/_passes/squeeze_unsqueeze_inputs.py +93 -0
- executorch/backends/vulkan/_passes/tag_memory_meta_pass.py +485 -0
- executorch/backends/vulkan/custom_ops_lib.py +597 -0
- executorch/backends/vulkan/op_registry.py +885 -0
- executorch/backends/vulkan/partitioner/vulkan_partitioner.py +401 -0
- executorch/backends/vulkan/patterns/__init__.py +139 -0
- executorch/backends/vulkan/patterns/pattern_registry.py +116 -0
- executorch/backends/vulkan/patterns/quantized_binary.py +161 -0
- executorch/backends/vulkan/patterns/quantized_convolution.py +260 -0
- executorch/backends/vulkan/patterns/quantized_linear.py +500 -0
- executorch/backends/vulkan/patterns/rope.py +173 -0
- executorch/backends/vulkan/patterns/sdpa.py +155 -0
- executorch/backends/vulkan/patterns/select_as_symint.py +104 -0
- executorch/backends/vulkan/quantizer/vulkan_quantizer.py +183 -0
- executorch/backends/vulkan/quantizer/vulkan_quantizer_utils.py +223 -0
- executorch/backends/vulkan/runtime/gen_vulkan_spv.py +1517 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_naive_buffer.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_naive_texture3d.yaml +24 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/addmm_optimized.yaml +43 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/arange.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/avg_pool2d.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/batchnorm.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_op.yaml +118 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_q8ta_q8ta_q8to.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_scalar_buffer.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/binary_scalar_texture.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/bitw8_image_to_nchw_nobitw8buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/buffer_to_buffer.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/buffer_to_nchw.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/choose_qparams_per_row.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/clone.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/col2im.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/concat_buffer.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/concat_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv1d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_output_tile.yaml +27 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_prepack_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_q8ta_q8csw_q8to.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_dw_sned_output_tile.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_prepack_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw_q8ta_q8csw_q8to_tiled.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_pw_s1p0.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8csw_linear_tiled.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8ta_q8csw_linear_tiled.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8ta_q8csw_q8to.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv2d_q8ta_q8csw_q8to_linear_tiled.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv_transpose2d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/conv_transpose2d_prepack_weights.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/embedding_buffer.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/embedding_legacy.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/embedding_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/expand_buffer.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/flip.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/full.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/gather_buffer.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/gather_texture.yaml +17 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/grid_priors.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/group_norm_reduce_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/group_norm_texture.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/im2col.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/im2col_packed_int8.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/image_to_nchw.yaml +38 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/index_select.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/index_select_channel.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_dq8ca_q4gsw_tiled.yaml +29 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q4gsw_coop.yaml +43 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q4gsw_tiled.yaml +28 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q8csw_tiled.yaml +28 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_q8ta_q8csw_tiled.yaml +24 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_coop.yaml +38 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/linear_qcsnw_tiled.yaml +54 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/max_pool2d.yaml +17 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/native_layer_norm.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_bitw8_image_nobitw8buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_buffer.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/nchw_to_image.yaml +37 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/no_op.yaml +24 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_int4_linear_weight_transposed_interleaved.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q4_linear_weight.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q8_conv2d_dw_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q8_conv2d_weights.yaml +15 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pack_q8_linear_weight.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pad_channel.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/pad_height_width.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/permute_buffer.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/permute_texture.yaml +11 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_4h4w.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_4h4w_with_group_sums.yaml +30 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_4w4c.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/quantize_and_pack_im2col.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/reduce.yaml +29 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/reduce2d.yaml +29 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/reduce_per_row_buffer.yaml +42 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/repeat.yaml +14 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/repeat_channel.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/repeat_interleave.yaml +12 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/rotary_embedding.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/scalar_tensor.yaml +27 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_attn_weights_softmax.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_attn_weights_coop.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_attn_weights_tiled.yaml +26 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_out_coop.yaml +25 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_compute_out_tiled.yaml +26 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/sdpa_kv_cache_update.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/set_zero.yaml +8 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/softmax.yaml +21 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/split_buffer.yaml +18 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/split_texture.yaml +17 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/tan.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/transfer_buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/transfer_texture.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/unary_op.yaml +48 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/unpack_4w4c_and_dequantize.yaml +23 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/update_concat_offset.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/upsample_2d.yaml +19 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/var_buffer.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/var_texture3d.yaml +16 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/view.yaml +13 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/view_buffer.yaml +20 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/view_convert_buffer.yaml +22 -0
- executorch/backends/vulkan/runtime/graph/ops/glsl/where.yaml +12 -0
- executorch/backends/vulkan/serialization/schema.fbs +158 -0
- executorch/backends/vulkan/serialization/vulkan_graph_builder.py +505 -0
- executorch/backends/vulkan/serialization/vulkan_graph_schema.py +161 -0
- executorch/backends/vulkan/serialization/vulkan_graph_serialize.py +274 -0
- executorch/backends/vulkan/test/custom_ops/glsl/add.yaml +29 -0
- executorch/backends/vulkan/test/glsl/all_shaders.yaml +68 -0
- executorch/backends/vulkan/test/glsl/dynamic_dispatch_test.yaml +7 -0
- executorch/backends/vulkan/test/glsl/reference_matmul_common.yaml +9 -0
- executorch/backends/vulkan/test/op_tests/cases.py +2026 -0
- executorch/backends/vulkan/test/op_tests/generate_op_benchmarks.py +88 -0
- executorch/backends/vulkan/test/op_tests/generate_op_correctness_tests.py +90 -0
- executorch/backends/vulkan/test/op_tests/utils/aten_types.py +31 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_benchmark_vk.py +350 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_computegraph.py +788 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_correctness_base.py +421 -0
- executorch/backends/vulkan/test/op_tests/utils/gen_correctness_vk.py +164 -0
- executorch/backends/vulkan/test/op_tests/utils/test_suite.py +53 -0
- executorch/backends/vulkan/test/test_serialization.py +135 -0
- executorch/backends/vulkan/test/test_vulkan_delegate.py +2696 -0
- executorch/backends/vulkan/test/test_vulkan_delegate_header.py +104 -0
- executorch/backends/vulkan/test/test_vulkan_passes.py +193 -0
- executorch/backends/vulkan/test/tester.py +91 -0
- executorch/backends/vulkan/test/utils.py +1111 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/apiconventions.py +21 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/base_generator.py +937 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/cgenerator.py +549 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/generator.py +1424 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/parse_dependency.py +404 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/reg.py +1885 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/spec_tools/conventions.py +562 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/spec_tools/util.py +58 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/stripAPI.py +42 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/vkconventions.py +314 -0
- executorch/backends/vulkan/third-party/Vulkan-Headers/registry/vulkan_object.py +484 -0
- executorch/backends/vulkan/third-party/VulkanMemoryAllocator/tools/GpuMemDumpVis/GpuMemDumpVis.py +333 -0
- executorch/backends/vulkan/third-party/volk/generate.py +212 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/buf_bandwidth.yaml +18 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/buf_cacheline_size.yaml +12 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/reg_count.yaml +16 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/tex_bandwidth.yaml +15 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/tex_cacheline_concurr.yaml +14 -0
- executorch/backends/vulkan/tools/gpuinfo/glsl/warp_size.yaml +16 -0
- executorch/backends/vulkan/utils.py +1474 -0
- executorch/backends/vulkan/vulkan_preprocess.py +249 -0
- executorch/backends/xnnpack/__init__.py +34 -0
- executorch/backends/xnnpack/_passes/__init__.py +109 -0
- executorch/backends/xnnpack/_passes/channels_last_tagged_reshape_pass.py +561 -0
- executorch/backends/xnnpack/_passes/conv1d_unsqueeze_pass.py +203 -0
- executorch/backends/xnnpack/_passes/convert_to_linear.py +198 -0
- executorch/backends/xnnpack/_passes/convert_to_sdpa.py +114 -0
- executorch/backends/xnnpack/_passes/convert_to_upsample_bilinear2d.py +65 -0
- executorch/backends/xnnpack/_passes/decompose_cat.py +105 -0
- executorch/backends/xnnpack/_passes/fuse_activation_pass.py +87 -0
- executorch/backends/xnnpack/_passes/fuse_batch_norm.py +261 -0
- executorch/backends/xnnpack/_passes/prelu_reshape_pass.py +75 -0
- executorch/backends/xnnpack/_passes/propagate_custom_meta_pass.py +44 -0
- executorch/backends/xnnpack/_passes/remove_redundant_copy_pass.py +158 -0
- executorch/backends/xnnpack/_passes/xnnpack_pass.py +22 -0
- executorch/backends/xnnpack/operators/__init__.py +61 -0
- executorch/backends/xnnpack/operators/node_visitor.py +758 -0
- executorch/backends/xnnpack/operators/op_abs.py +52 -0
- executorch/backends/xnnpack/operators/op_add.py +77 -0
- executorch/backends/xnnpack/operators/op_addmm.py +70 -0
- executorch/backends/xnnpack/operators/op_avg_pooling2d.py +75 -0
- executorch/backends/xnnpack/operators/op_bmm.py +54 -0
- executorch/backends/xnnpack/operators/op_cat.py +121 -0
- executorch/backends/xnnpack/operators/op_ceiling.py +52 -0
- executorch/backends/xnnpack/operators/op_clamp.py +64 -0
- executorch/backends/xnnpack/operators/op_clone.py +60 -0
- executorch/backends/xnnpack/operators/op_conv2d.py +186 -0
- executorch/backends/xnnpack/operators/op_cos.py +52 -0
- executorch/backends/xnnpack/operators/op_div.py +56 -0
- executorch/backends/xnnpack/operators/op_dynamic_dequantize_ops.py +114 -0
- executorch/backends/xnnpack/operators/op_dynamic_quantize_ops.py +179 -0
- executorch/backends/xnnpack/operators/op_elu.py +56 -0
- executorch/backends/xnnpack/operators/op_exp.py +52 -0
- executorch/backends/xnnpack/operators/op_floor.py +48 -0
- executorch/backends/xnnpack/operators/op_gelu.py +52 -0
- executorch/backends/xnnpack/operators/op_hardswish.py +52 -0
- executorch/backends/xnnpack/operators/op_hardtanh.py +67 -0
- executorch/backends/xnnpack/operators/op_leaky_relu.py +65 -0
- executorch/backends/xnnpack/operators/op_linear.py +110 -0
- executorch/backends/xnnpack/operators/op_log.py +52 -0
- executorch/backends/xnnpack/operators/op_matrix_multiplication.py +66 -0
- executorch/backends/xnnpack/operators/op_max_dim.py +206 -0
- executorch/backends/xnnpack/operators/op_max_pool2d.py +136 -0
- executorch/backends/xnnpack/operators/op_maximum.py +55 -0
- executorch/backends/xnnpack/operators/op_mean_dim.py +78 -0
- executorch/backends/xnnpack/operators/op_minimum.py +54 -0
- executorch/backends/xnnpack/operators/op_multiply.py +84 -0
- executorch/backends/xnnpack/operators/op_negate.py +51 -0
- executorch/backends/xnnpack/operators/op_permute.py +87 -0
- executorch/backends/xnnpack/operators/op_prelu.py +56 -0
- executorch/backends/xnnpack/operators/op_quant_dequant.py +196 -0
- executorch/backends/xnnpack/operators/op_relu.py +61 -0
- executorch/backends/xnnpack/operators/op_rsqrt.py +52 -0
- executorch/backends/xnnpack/operators/op_sigmoid.py +48 -0
- executorch/backends/xnnpack/operators/op_sin.py +52 -0
- executorch/backends/xnnpack/operators/op_skip_ops.py +89 -0
- executorch/backends/xnnpack/operators/op_slice_copy.py +100 -0
- executorch/backends/xnnpack/operators/op_softmax.py +58 -0
- executorch/backends/xnnpack/operators/op_square.py +52 -0
- executorch/backends/xnnpack/operators/op_square_root.py +52 -0
- executorch/backends/xnnpack/operators/op_squeeze.py +145 -0
- executorch/backends/xnnpack/operators/op_static_constant_pad.py +145 -0
- executorch/backends/xnnpack/operators/op_static_resize_bilinear_2d.py +61 -0
- executorch/backends/xnnpack/operators/op_sub.py +77 -0
- executorch/backends/xnnpack/operators/op_tanh.py +52 -0
- executorch/backends/xnnpack/operators/op_to_copy.py +91 -0
- executorch/backends/xnnpack/operators/op_view_copy.py +96 -0
- executorch/backends/xnnpack/operators/quant_params.py +412 -0
- executorch/backends/xnnpack/partition/config/__init__.py +127 -0
- executorch/backends/xnnpack/partition/config/gemm_configs.py +575 -0
- executorch/backends/xnnpack/partition/config/generic_node_configs.py +711 -0
- executorch/backends/xnnpack/partition/config/node_configs.py +148 -0
- executorch/backends/xnnpack/partition/config/quant_affine_configs.py +56 -0
- executorch/backends/xnnpack/partition/config/xnnpack_config.py +252 -0
- executorch/backends/xnnpack/partition/graphs/bilinear_2d.py +55 -0
- executorch/backends/xnnpack/partition/graphs/sdpa.py +86 -0
- executorch/backends/xnnpack/partition/xnnpack_partitioner.py +160 -0
- executorch/backends/xnnpack/quantizer/xnnpack_quantizer.py +462 -0
- executorch/backends/xnnpack/quantizer/xnnpack_quantizer_utils.py +1121 -0
- executorch/backends/xnnpack/recipes/__init__.py +19 -0
- executorch/backends/xnnpack/recipes/xnnpack_recipe_provider.py +200 -0
- executorch/backends/xnnpack/recipes/xnnpack_recipe_types.py +37 -0
- executorch/backends/xnnpack/serialization/runtime_schema.fbs +389 -0
- executorch/backends/xnnpack/serialization/schema.fbs +381 -0
- executorch/backends/xnnpack/serialization/xnnpack_graph_schema.py +542 -0
- executorch/backends/xnnpack/serialization/xnnpack_graph_serialize.py +373 -0
- executorch/backends/xnnpack/test/__init__.py +0 -0
- executorch/backends/xnnpack/test/models/deeplab_v3.py +42 -0
- executorch/backends/xnnpack/test/models/edsr.py +55 -0
- executorch/backends/xnnpack/test/models/emformer_rnnt.py +98 -0
- executorch/backends/xnnpack/test/models/inception_v3.py +84 -0
- executorch/backends/xnnpack/test/models/inception_v4.py +62 -0
- executorch/backends/xnnpack/test/models/llama2_et_example.py +49 -0
- executorch/backends/xnnpack/test/models/mobilebert.py +55 -0
- executorch/backends/xnnpack/test/models/mobilenet_v2.py +103 -0
- executorch/backends/xnnpack/test/models/mobilenet_v3.py +84 -0
- executorch/backends/xnnpack/test/models/resnet.py +90 -0
- executorch/backends/xnnpack/test/models/torchvision_vit.py +105 -0
- executorch/backends/xnnpack/test/models/very_big_model.py +45 -0
- executorch/backends/xnnpack/test/models/w2l.py +60 -0
- executorch/backends/xnnpack/test/ops/test_abs.py +87 -0
- executorch/backends/xnnpack/test/ops/test_add.py +266 -0
- executorch/backends/xnnpack/test/ops/test_avgpool2d.py +92 -0
- executorch/backends/xnnpack/test/ops/test_bilinear2d.py +152 -0
- executorch/backends/xnnpack/test/ops/test_bmm.py +49 -0
- executorch/backends/xnnpack/test/ops/test_cat.py +254 -0
- executorch/backends/xnnpack/test/ops/test_ceil.py +63 -0
- executorch/backends/xnnpack/test/ops/test_check_quant_params.py +107 -0
- executorch/backends/xnnpack/test/ops/test_clamp.py +79 -0
- executorch/backends/xnnpack/test/ops/test_clone.py +137 -0
- executorch/backends/xnnpack/test/ops/test_conv1d.py +190 -0
- executorch/backends/xnnpack/test/ops/test_conv2d.py +747 -0
- executorch/backends/xnnpack/test/ops/test_cos.py +87 -0
- executorch/backends/xnnpack/test/ops/test_div.py +78 -0
- executorch/backends/xnnpack/test/ops/test_elu.py +98 -0
- executorch/backends/xnnpack/test/ops/test_exp.py +70 -0
- executorch/backends/xnnpack/test/ops/test_floor.py +58 -0
- executorch/backends/xnnpack/test/ops/test_gelu.py +71 -0
- executorch/backends/xnnpack/test/ops/test_hardswish.py +70 -0
- executorch/backends/xnnpack/test/ops/test_hardtanh.py +83 -0
- executorch/backends/xnnpack/test/ops/test_leaky_relu.py +131 -0
- executorch/backends/xnnpack/test/ops/test_linear.py +1059 -0
- executorch/backends/xnnpack/test/ops/test_log.py +45 -0
- executorch/backends/xnnpack/test/ops/test_lstm.py +67 -0
- executorch/backends/xnnpack/test/ops/test_max_dim.py +66 -0
- executorch/backends/xnnpack/test/ops/test_maximum.py +66 -0
- executorch/backends/xnnpack/test/ops/test_maxpool2d.py +221 -0
- executorch/backends/xnnpack/test/ops/test_mean_dim.py +98 -0
- executorch/backends/xnnpack/test/ops/test_minimum.py +49 -0
- executorch/backends/xnnpack/test/ops/test_multiply.py +149 -0
- executorch/backends/xnnpack/test/ops/test_negate.py +58 -0
- executorch/backends/xnnpack/test/ops/test_permute.py +134 -0
- executorch/backends/xnnpack/test/ops/test_pow.py +62 -0
- executorch/backends/xnnpack/test/ops/test_prelu.py +50 -0
- executorch/backends/xnnpack/test/ops/test_quantize_per_tensor.py +70 -0
- executorch/backends/xnnpack/test/ops/test_relu.py +38 -0
- executorch/backends/xnnpack/test/ops/test_rsqrt.py +45 -0
- executorch/backends/xnnpack/test/ops/test_sigmoid.py +45 -0
- executorch/backends/xnnpack/test/ops/test_sin.py +87 -0
- executorch/backends/xnnpack/test/ops/test_slice_copy.py +170 -0
- executorch/backends/xnnpack/test/ops/test_softmax.py +73 -0
- executorch/backends/xnnpack/test/ops/test_sqrt.py +45 -0
- executorch/backends/xnnpack/test/ops/test_square.py +48 -0
- executorch/backends/xnnpack/test/ops/test_static_constant_pad.py +294 -0
- executorch/backends/xnnpack/test/ops/test_sub.py +178 -0
- executorch/backends/xnnpack/test/ops/test_tanh.py +43 -0
- executorch/backends/xnnpack/test/ops/test_to_copy.py +113 -0
- executorch/backends/xnnpack/test/passes/__init__.py +0 -0
- executorch/backends/xnnpack/test/passes/test_activation_fusion.py +232 -0
- executorch/backends/xnnpack/test/passes/test_batch_norm_fusion.py +179 -0
- executorch/backends/xnnpack/test/passes/test_channels_last_tagged_reshape.py +635 -0
- executorch/backends/xnnpack/test/passes/test_convert_to_linear.py +43 -0
- executorch/backends/xnnpack/test/passes/test_decompose_cat_pass.py +112 -0
- executorch/backends/xnnpack/test/passes/test_propagate_custom_meta_pass.py +185 -0
- executorch/backends/xnnpack/test/passes/test_remove_get_item_pass.py +99 -0
- executorch/backends/xnnpack/test/passes/test_remove_redundant_copy_pass.py +182 -0
- executorch/backends/xnnpack/test/quantizer/test_pt2e_quantization.py +818 -0
- executorch/backends/xnnpack/test/quantizer/test_representation.py +308 -0
- executorch/backends/xnnpack/test/quantizer/test_xnnpack_quantizer.py +1217 -0
- executorch/backends/xnnpack/test/recipes/test_xnnpack_recipes.py +320 -0
- executorch/backends/xnnpack/test/serialization/test_serialization.py +50 -0
- executorch/backends/xnnpack/test/serialization/test_xnnheader.py +104 -0
- executorch/backends/xnnpack/test/test_xnnpack_partitioner.py +163 -0
- executorch/backends/xnnpack/test/test_xnnpack_utils.py +532 -0
- executorch/backends/xnnpack/test/test_xnnpack_utils_classes.py +44 -0
- executorch/backends/xnnpack/test/tester/__init__.py +29 -0
- executorch/backends/xnnpack/test/tester/tester.py +130 -0
- executorch/backends/xnnpack/third-party/FP16/configure.py +65 -0
- executorch/backends/xnnpack/third-party/FP16/confu.yaml +8 -0
- executorch/backends/xnnpack/third-party/FP16/include/fp16/__init__.py +0 -0
- executorch/backends/xnnpack/third-party/FP16/include/fp16/avx.py +50 -0
- executorch/backends/xnnpack/third-party/FP16/include/fp16/avx2.py +53 -0
- executorch/backends/xnnpack/third-party/FP16/test/peachpy/stubs.py +38 -0
- executorch/backends/xnnpack/third-party/FXdiv/configure.py +30 -0
- executorch/backends/xnnpack/third-party/FXdiv/confu.yaml +6 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/aarch32_template.py +361 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/aarch64_template.py +347 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/arm_template.py +78 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/avx512bf16_template.py +81 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/avx512f_template.py +390 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/avx512vnni_template.py +703 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/base_architecture.py +276 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/fma3_template.py +260 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate.py +71 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_bf16_f32_gemm_microkernels.py +39 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_f32_gemm_microkernels.py +104 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_gemm_microkernels_main.py +29 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qd8_f32_qc4w_gemm_microkernels.py +69 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qd8_f32_qc8w_gemm_microkernels.py +93 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qs8_qc4w_gemm_microkernels.py +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/generate_qs8_qc8w_gemm_microkernels.py +43 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/neondot_template.py +463 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/neonfma_template.py +248 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/neonmlal_aarch32_template.py +394 -0
- executorch/backends/xnnpack/third-party/XNNPACK/gemm_compiler/x64_template.py +512 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/check_config.py +152 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/check_files_changed.py +53 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/generate-build-identifier.py +106 -0
- executorch/backends/xnnpack/third-party/XNNPACK/scripts/sort-filenames.py +134 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/bf16-f32-gemm-minmax.yaml +121 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/bf16-gemm-minmax.yaml +106 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-conv-hwc2chw.yaml +8 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-dwconv2d-chw.yaml +88 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-gemm-minmax.yaml +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-f32acc-igemm-minmax.yaml +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-gemm-minmax.yaml +219 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-ibilinear-chw.yaml +9 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-ibilinear.yaml +12 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-igemm-minmax.yaml +165 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f16-raddstoreexpminusmax.yaml +52 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-argmaxpool.yaml +15 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-conv-hwc2chw.yaml +32 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-dwconv2d-chw.yaml +712 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-minmax.yaml +1572 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm-relu.yaml +123 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-gemm.yaml +127 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ibilinear-chw.yaml +22 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ibilinear.yaml +23 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-minmax.yaml +1001 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm-relu.yaml +123 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-igemm.yaml +123 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-ppmm-minmax.yaml +122 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc4w-gemm-minmax.yaml +277 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm-minmax.yaml +757 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm-relu.yaml +67 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-qc8w-gemm.yaml +115 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddexpminusmax.yaml +38 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/f32-raddstoreexpminusmax.yaml +88 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/pf16-gemm-minmax.yaml +20 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/pf32-gemm-minmax.yaml +34 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/pqs8-qc8w-gemm-minmax.yaml +20 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qb4w-gemm-minmax.yaml +260 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc4w-gemm-minmax.yaml +678 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc8w-gemm-minmax.yaml +412 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f16-qc8w-igemm-minmax.yaml +360 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qb4w-gemm-minmax.yaml +537 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc4w-gemm-minmax.yaml +2176 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc8w-gemm-minmax.yaml +1564 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qd8-f32-qc8w-igemm-minmax.yaml +1035 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qp8-f32-qb4w-gemm-minmax.yaml +54 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qp8-f32-qc4w-gemm-minmax.yaml +66 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qp8-f32-qc8w-gemm-minmax.yaml +42 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc4w-gemm-minmax-fp32.yaml +345 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-gemm-minmax-fp32.yaml +2029 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qs8-qc8w-igemm-minmax-fp32.yaml +1831 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gemm-minmax-fp32.yaml +584 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-gemm-minmax-rndnu.yaml +148 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-igemm-minmax-fp32.yaml +581 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/qu8-igemm-minmax-rndnu.yaml +110 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/s8-ibilinear.yaml +22 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/u8-ibilinear.yaml +22 -0
- executorch/backends/xnnpack/third-party/XNNPACK/test/x8-lut.yaml +47 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-argmaxpool-test.py +692 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-conv-hwc-test.py +543 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-conv-hwc2chw-test.py +591 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv-test.py +339 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-dwconv2d-chw-test.py +463 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-gemm-test.py +1150 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-ibilinear-chw-test.py +236 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-ibilinear-test.py +237 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-lut-test.py +164 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddexpminusmax-test.py +159 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-raddstoreexpminusmax-test.py +210 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-reduce-discontiguous-test.py +495 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-reduce-test.py +289 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-spmm-test.py +554 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vbinary-test.py +179 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/generate-vunary-test.py +280 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/parse-microkernel-bench.py +189 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/primes.py +1015 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/update-microkernels.py +567 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/xngen.py +159 -0
- executorch/backends/xnnpack/third-party/XNNPACK/tools/xnncommon.py +275 -0
- executorch/backends/xnnpack/third-party/cpuinfo/configure.py +110 -0
- executorch/backends/xnnpack/third-party/cpuinfo/confu.yaml +9 -0
- executorch/backends/xnnpack/third-party/cpuinfo/deps/clog/configure.py +26 -0
- executorch/backends/xnnpack/third-party/cpuinfo/deps/clog/confu.yaml +5 -0
- executorch/backends/xnnpack/third-party/cpuinfo/scripts/android-device-dump.py +400 -0
- executorch/backends/xnnpack/third-party/cpuinfo/scripts/arm-linux-filesystem-dump.py +107 -0
- executorch/backends/xnnpack/third-party/cpuinfo/scripts/parse-x86-cpuid-dump.py +47 -0
- executorch/backends/xnnpack/third-party/generate-cpuinfo-wrappers.py +93 -0
- executorch/backends/xnnpack/third-party/pthreadpool/configure.py +38 -0
- executorch/backends/xnnpack/third-party/pthreadpool/confu.yaml +8 -0
- executorch/backends/xnnpack/utils/configs.py +49 -0
- executorch/backends/xnnpack/utils/quant_utils.py +301 -0
- executorch/backends/xnnpack/utils/utils.py +221 -0
- executorch/backends/xnnpack/utils/xnnpack_constants.py +37 -0
- executorch/backends/xnnpack/xnnpack_preprocess.py +194 -0
- executorch/codegen/__init__.py +0 -0
- executorch/codegen/api/__init__.py +0 -0
- executorch/codegen/api/custom_ops.py +151 -0
- executorch/codegen/api/et_cpp.py +368 -0
- executorch/codegen/api/types/__init__.py +5 -0
- executorch/codegen/api/types/signatures.py +77 -0
- executorch/codegen/api/types/types.py +77 -0
- executorch/codegen/api/unboxing.py +232 -0
- executorch/codegen/gen.py +1049 -0
- executorch/codegen/model.py +220 -0
- executorch/codegen/parse.py +158 -0
- executorch/codegen/test/test_executorch_custom_ops.py +153 -0
- executorch/codegen/test/test_executorch_gen.py +698 -0
- executorch/codegen/test/test_executorch_signatures.py +65 -0
- executorch/codegen/test/test_executorch_types.py +121 -0
- executorch/codegen/test/test_executorch_unboxing.py +165 -0
- executorch/codegen/test/test_selective_build.py +51 -0
- executorch/codegen/tools/__init__.py +0 -0
- executorch/codegen/tools/combine_prim_ops_headers.py +164 -0
- executorch/codegen/tools/gen_all_oplist.py +252 -0
- executorch/codegen/tools/gen_oplist.py +369 -0
- executorch/codegen/tools/gen_ops_def.py +96 -0
- executorch/codegen/tools/gen_selected_op_variants.py +133 -0
- executorch/codegen/tools/gen_selected_prim_ops.py +96 -0
- executorch/codegen/tools/merge_yaml.py +125 -0
- executorch/codegen/tools/selective_build.cp313-win_amd64.pyd +0 -0
- executorch/codegen/tools/selective_build.pyi +23 -0
- executorch/codegen/tools/test/test_gen_all_oplist.py +122 -0
- executorch/codegen/tools/test/test_gen_oplist.py +263 -0
- executorch/codegen/tools/test/test_gen_oplist_real_model.py +50 -0
- executorch/codegen/tools/test/test_gen_selected_op_variants.py +204 -0
- executorch/codegen/tools/test/test_tools_selective_build.py +129 -0
- executorch/codegen/tools/yaml_util.py +15 -0
- executorch/data/bin/__init__.py +44 -0
- executorch/data/bin/flatc.exe +0 -0
- executorch/data/lib/aoti_cuda_shims.lib +0 -0
- executorch/devtools/__init__.py +19 -0
- executorch/devtools/backend_debug/__init__.py +13 -0
- executorch/devtools/backend_debug/delegation_info.py +183 -0
- executorch/devtools/backend_debug/tests/test_delegation_info.py +79 -0
- executorch/devtools/bundled_program/config.py +120 -0
- executorch/devtools/bundled_program/core.py +395 -0
- executorch/devtools/bundled_program/schema/__init__.py +9 -0
- executorch/devtools/bundled_program/schema/bundled_program_schema.fbs +97 -0
- executorch/devtools/bundled_program/schema/bundled_program_schema.py +99 -0
- executorch/devtools/bundled_program/schema/scalar_type.fbs +43 -0
- executorch/devtools/bundled_program/schema/test/test_schema.py +27 -0
- executorch/devtools/bundled_program/serialize/__init__.py +122 -0
- executorch/devtools/bundled_program/serialize/bundled_program_schema.fbs +97 -0
- executorch/devtools/bundled_program/serialize/scalar_type.fbs +43 -0
- executorch/devtools/bundled_program/serialize/test/test_serialize.py +37 -0
- executorch/devtools/bundled_program/test/test_bundle_data.py +168 -0
- executorch/devtools/bundled_program/test/test_config.py +131 -0
- executorch/devtools/bundled_program/test/test_end2end.py +64 -0
- executorch/devtools/bundled_program/util/test_util.py +289 -0
- executorch/devtools/bundled_program/version.py +13 -0
- executorch/devtools/debug_format/base_schema.py +61 -0
- executorch/devtools/debug_format/et_schema.py +432 -0
- executorch/devtools/etdump/etdump_schema_flatcc.fbs +181 -0
- executorch/devtools/etdump/scalar_type.fbs +43 -0
- executorch/devtools/etdump/schema_flatcc.py +154 -0
- executorch/devtools/etdump/serialize.py +108 -0
- executorch/devtools/etdump/tests/serialize_test.py +142 -0
- executorch/devtools/etrecord/__init__.py +13 -0
- executorch/devtools/etrecord/_etrecord.py +776 -0
- executorch/devtools/etrecord/tests/etrecord_test.py +1748 -0
- executorch/devtools/inspector/__init__.py +24 -0
- executorch/devtools/inspector/_inspector.py +1495 -0
- executorch/devtools/inspector/_inspector_utils.py +1286 -0
- executorch/devtools/inspector/_intermediate_output_capturer.py +62 -0
- executorch/devtools/inspector/inspector_cli.py +76 -0
- executorch/devtools/inspector/numerical_comparator/__init__.py +25 -0
- executorch/devtools/inspector/numerical_comparator/l1_numerical_comparator.py +27 -0
- executorch/devtools/inspector/numerical_comparator/mse_numerical_comparator.py +29 -0
- executorch/devtools/inspector/numerical_comparator/numerical_comparator_base.py +26 -0
- executorch/devtools/inspector/numerical_comparator/snr_numerical_comparator.py +39 -0
- executorch/devtools/inspector/tests/event_blocks_test.py +657 -0
- executorch/devtools/inspector/tests/inspector_test.py +1263 -0
- executorch/devtools/inspector/tests/inspector_test_utils.py +189 -0
- executorch/devtools/inspector/tests/inspector_utils_test.py +896 -0
- executorch/devtools/inspector/tests/intermediate_output_capturer_test.py +101 -0
- executorch/devtools/inspector/tests/l1_comparator_test.py +49 -0
- executorch/devtools/inspector/tests/mse_comparator_test.py +49 -0
- executorch/devtools/inspector/tests/snr_comparator_test.py +52 -0
- executorch/devtools/scripts/generate_profiling_csv.py +62 -0
- executorch/devtools/size_analysis_tool/size_analysis_tool.py +180 -0
- executorch/devtools/size_analysis_tool/size_analysis_tool_test.py +101 -0
- executorch/devtools/visualization/__init__.py +13 -0
- executorch/devtools/visualization/visualization_utils.py +301 -0
- executorch/devtools/visualization/visualization_utils_test.py +177 -0
- executorch/examples/apple/coreml/llama/export.py +224 -0
- executorch/examples/apple/coreml/llama/export_static_llm_coreml.py +504 -0
- executorch/examples/apple/coreml/llama/llama_transformer.py +958 -0
- executorch/examples/apple/coreml/llama/run.py +206 -0
- executorch/examples/apple/coreml/llama/run_lookahead.py +284 -0
- executorch/examples/apple/coreml/llama/run_static_llm.py +293 -0
- executorch/examples/apple/coreml/llama/test.py +48 -0
- executorch/examples/apple/coreml/llama/utils.py +116 -0
- executorch/examples/apple/coreml/scripts/debugger_cli.py +181 -0
- executorch/examples/apple/coreml/scripts/export.py +280 -0
- executorch/examples/apple/coreml/scripts/extract_coreml_models.py +77 -0
- executorch/examples/apple/coreml/scripts/inspector_cli.py +64 -0
- executorch/examples/apple/coreml/scripts/inspector_utils.py +425 -0
- executorch/examples/apple/mps/scripts/bench_utils.py +108 -0
- executorch/examples/apple/mps/scripts/mps_example.py +230 -0
- executorch/examples/cuda/scripts/__init__.py +0 -0
- executorch/examples/cuda/scripts/export.py +107 -0
- executorch/examples/llm_pte_finetuning/__init__.py +19 -0
- executorch/examples/llm_pte_finetuning/llama3_config.yaml +96 -0
- executorch/examples/llm_pte_finetuning/model_exporter.py +87 -0
- executorch/examples/llm_pte_finetuning/model_loading_lib.py +143 -0
- executorch/examples/llm_pte_finetuning/phi3_alpaca_code_config.yaml +44 -0
- executorch/examples/llm_pte_finetuning/phi3_config.yaml +42 -0
- executorch/examples/llm_pte_finetuning/qwen_05b_config.yaml +43 -0
- executorch/examples/llm_pte_finetuning/runner.py +135 -0
- executorch/examples/llm_pte_finetuning/training_lib.py +157 -0
- executorch/examples/models/__init__.py +98 -0
- executorch/examples/models/checkpoint.py +114 -0
- executorch/examples/models/codegen/__init__.py +16 -0
- executorch/examples/models/codegen/convert_weight.py +93 -0
- executorch/examples/models/deeplab_v3/__init__.py +9 -0
- executorch/examples/models/deeplab_v3/model.py +50 -0
- executorch/examples/models/deepseek-r1-distill-llama-8B/config/deepseek_xnnpack_q8da4w.yaml +16 -0
- executorch/examples/models/deit_tiny/__init__.py +8 -0
- executorch/examples/models/deit_tiny/model.py +36 -0
- executorch/examples/models/edsr/__init__.py +11 -0
- executorch/examples/models/edsr/model.py +28 -0
- executorch/examples/models/efficient_sam/__init__.py +11 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/build_efficient_sam.py +25 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/efficient_sam.py +316 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/efficient_sam_decoder.py +373 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/efficient_sam_encoder.py +261 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/mlp.py +31 -0
- executorch/examples/models/efficient_sam/efficient_sam_core/two_way_transformer.py +268 -0
- executorch/examples/models/efficient_sam/model.py +34 -0
- executorch/examples/models/emformer_rnnt/__init__.py +17 -0
- executorch/examples/models/emformer_rnnt/model.py +132 -0
- executorch/examples/models/gemma/__init__.py +16 -0
- executorch/examples/models/gemma/convert_weights.py +104 -0
- executorch/examples/models/gemma2/__init__.py +19 -0
- executorch/examples/models/gemma2/convert_weights.py +113 -0
- executorch/examples/models/gemma3/__init__.py +16 -0
- executorch/examples/models/gemma3/convert_weights.py +110 -0
- executorch/examples/models/glm/__init__.py +16 -0
- executorch/examples/models/glm/convert_weights.py +79 -0
- executorch/examples/models/granite/__init__.py +16 -0
- executorch/examples/models/granite/convert_weights.py +106 -0
- executorch/examples/models/inception_v3/__init__.py +11 -0
- executorch/examples/models/inception_v3/model.py +28 -0
- executorch/examples/models/inception_v4/__init__.py +11 -0
- executorch/examples/models/inception_v4/model.py +26 -0
- executorch/examples/models/internvl3/__init__.py +16 -0
- executorch/examples/models/internvl3/convert_weights.py +82 -0
- executorch/examples/models/lfm2/__init__.py +10 -0
- executorch/examples/models/lfm2/config/lfm2_xnnpack_fp32.yaml +12 -0
- executorch/examples/models/lfm2/config/lfm2_xnnpack_q8da4w.yaml +15 -0
- executorch/examples/models/lfm2/convert_weights.py +74 -0
- executorch/examples/models/lfm2/short_conv.py +112 -0
- executorch/examples/models/llama/__init__.py +11 -0
- executorch/examples/models/llama/attention.py +536 -0
- executorch/examples/models/llama/config/llama_bf16.yaml +7 -0
- executorch/examples/models/llama/config/llama_q8da4w.yaml +11 -0
- executorch/examples/models/llama/config/llama_xnnpack.yaml +17 -0
- executorch/examples/models/llama/config/llama_xnnpack_qat.yaml +23 -0
- executorch/examples/models/llama/config/llama_xnnpack_spinquant.yaml +22 -0
- executorch/examples/models/llama/config/test_llm_config.py +104 -0
- executorch/examples/models/llama/convert_weights.py +61 -0
- executorch/examples/models/llama/eval_llama.py +38 -0
- executorch/examples/models/llama/eval_llama_lib.py +395 -0
- executorch/examples/models/llama/evaluate/__init__.py +11 -0
- executorch/examples/models/llama/evaluate/eager_eval.py +87 -0
- executorch/examples/models/llama/experimental/__init__.py +0 -0
- executorch/examples/models/llama/experimental/generate.py +190 -0
- executorch/examples/models/llama/experimental/load_gguf_q4_0.py +184 -0
- executorch/examples/models/llama/experimental/subclass.py +413 -0
- executorch/examples/models/llama/experimental/test_subclass.py +28 -0
- executorch/examples/models/llama/export_llama.py +56 -0
- executorch/examples/models/llama/export_llama_lib.py +1560 -0
- executorch/examples/models/llama/fairseq2.py +63 -0
- executorch/examples/models/llama/feed_forward.py +68 -0
- executorch/examples/models/llama/hf_download.py +50 -0
- executorch/examples/models/llama/install_requirement_helper.py +29 -0
- executorch/examples/models/llama/llama_transformer.py +289 -0
- executorch/examples/models/llama/lora.py +48 -0
- executorch/examples/models/llama/model.py +378 -0
- executorch/examples/models/llama/model_args.py +173 -0
- executorch/examples/models/llama/norm.py +55 -0
- executorch/examples/models/llama/rope.py +327 -0
- executorch/examples/models/llama/runner/eager.py +142 -0
- executorch/examples/models/llama/runner/generation.py +234 -0
- executorch/examples/models/llama/runner/native.py +145 -0
- executorch/examples/models/llama/source_transformation/__init__.py +0 -0
- executorch/examples/models/llama/source_transformation/apply_spin_quant_r1_r2.py +202 -0
- executorch/examples/models/llama/source_transformation/attention.py +223 -0
- executorch/examples/models/llama/source_transformation/attention_sink.py +312 -0
- executorch/examples/models/llama/source_transformation/custom_kv_cache.py +598 -0
- executorch/examples/models/llama/source_transformation/lora.py +153 -0
- executorch/examples/models/llama/source_transformation/pre_quantization.py +204 -0
- executorch/examples/models/llama/source_transformation/prune_vocab.py +119 -0
- executorch/examples/models/llama/source_transformation/quantize.py +910 -0
- executorch/examples/models/llama/source_transformation/rms_norm.py +23 -0
- executorch/examples/models/llama/source_transformation/rope.py +39 -0
- executorch/examples/models/llama/source_transformation/sdpa.py +550 -0
- executorch/examples/models/llama/source_transformation/spin_quant.py +88 -0
- executorch/examples/models/llama/source_transformation/test_attention_sink.py +514 -0
- executorch/examples/models/llama/source_transformation/test_quantized_kv_cache.py +126 -0
- executorch/examples/models/llama/source_transformation/test_quantized_sdpa.py +167 -0
- executorch/examples/models/llama/source_transformation/test_sdpa_with_quantized_kv_cache.py +97 -0
- executorch/examples/models/llama/static_attention.py +1257 -0
- executorch/examples/models/llama/tests/test_export_llama_lib.py +50 -0
- executorch/examples/models/llama/tests/test_pre_quantization_transforms.py +188 -0
- executorch/examples/models/llama/tests/test_replace_kv_cache.py +158 -0
- executorch/examples/models/llama/tests/test_ring_attention.py +359 -0
- executorch/examples/models/llama/tests/test_ring_kv_cache.py +492 -0
- executorch/examples/models/llama/tests/test_simple_sdpa.py +66 -0
- executorch/examples/models/llama/tests/test_static_attention.py +363 -0
- executorch/examples/models/llama/tokenizer/tiktoken.py +224 -0
- executorch/examples/models/llama3_2_vision/__init__.py +14 -0
- executorch/examples/models/llama3_2_vision/preprocess/__init__.py +0 -0
- executorch/examples/models/llama3_2_vision/preprocess/export_preprocess.py +45 -0
- executorch/examples/models/llama3_2_vision/preprocess/model.py +72 -0
- executorch/examples/models/llama3_2_vision/preprocess/test_preprocess.py +338 -0
- executorch/examples/models/llama3_2_vision/runner/eager.py +59 -0
- executorch/examples/models/llama3_2_vision/runner/exported.py +94 -0
- executorch/examples/models/llama3_2_vision/runner/generation.py +102 -0
- executorch/examples/models/llama3_2_vision/runner/native.py +143 -0
- executorch/examples/models/llama3_2_vision/text_decoder/model.py +199 -0
- executorch/examples/models/llama3_2_vision/text_decoder/test/__init__.py +0 -0
- executorch/examples/models/llama3_2_vision/text_decoder/test/test_text_decoder.py +89 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/__init__.py +12 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/model.py +96 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/test/__init__.py +0 -0
- executorch/examples/models/llama3_2_vision/vision_encoder/test/test_vision_encoder.py +46 -0
- executorch/examples/models/llava/__init__.py +11 -0
- executorch/examples/models/llava/export_llava.py +365 -0
- executorch/examples/models/llava/model.py +415 -0
- executorch/examples/models/llava/test/test_llava.py +151 -0
- executorch/examples/models/llava/test/test_pte.py +106 -0
- executorch/examples/models/lstm/__init__.py +12 -0
- executorch/examples/models/lstm/model.py +31 -0
- executorch/examples/models/mobilebert/__init__.py +11 -0
- executorch/examples/models/mobilebert/model.py +31 -0
- executorch/examples/models/mobilenet_v2/__init__.py +12 -0
- executorch/examples/models/mobilenet_v2/model.py +73 -0
- executorch/examples/models/mobilenet_v3/__init__.py +11 -0
- executorch/examples/models/mobilenet_v3/model.py +30 -0
- executorch/examples/models/model_base.py +47 -0
- executorch/examples/models/model_factory.py +60 -0
- executorch/examples/models/moshi/mimi/test_mimi.py +245 -0
- executorch/examples/models/parakeet/export_parakeet_tdt.py +591 -0
- executorch/examples/models/phi-3-mini/__init__.py +11 -0
- executorch/examples/models/phi-3-mini-lora/export_model.py +144 -0
- executorch/examples/models/phi_4_mini/__init__.py +16 -0
- executorch/examples/models/phi_4_mini/config/phi_4_mini_xnnpack.yaml +12 -0
- executorch/examples/models/phi_4_mini/convert_weights.py +151 -0
- executorch/examples/models/qwen2_5/__init__.py +16 -0
- executorch/examples/models/qwen2_5/config/qwen2_5_xnnpack_q8da4w.yaml +14 -0
- executorch/examples/models/qwen2_5/convert_weights.py +90 -0
- executorch/examples/models/qwen3/__init__.py +16 -0
- executorch/examples/models/qwen3/config/qwen3_xnnpack.yaml +18 -0
- executorch/examples/models/qwen3/config/qwen3_xnnpack_q8da4w.yaml +20 -0
- executorch/examples/models/qwen3/convert_weights.py +140 -0
- executorch/examples/models/resnet/__init__.py +12 -0
- executorch/examples/models/resnet/model.py +48 -0
- executorch/examples/models/smollm2/__init__.py +16 -0
- executorch/examples/models/smollm2/convert_weights.py +84 -0
- executorch/examples/models/smollm3/__init__.py +16 -0
- executorch/examples/models/smollm3/convert_weights.py +112 -0
- executorch/examples/models/smolvlm/__init__.py +16 -0
- executorch/examples/models/smolvlm/convert_weights.py +77 -0
- executorch/examples/models/stable_diffusion/__init__.py +9 -0
- executorch/examples/models/stable_diffusion/model.py +193 -0
- executorch/examples/models/test/__init__.py +0 -0
- executorch/examples/models/test/test_export.py +161 -0
- executorch/examples/models/torchvision_vit/__init__.py +11 -0
- executorch/examples/models/torchvision_vit/model.py +28 -0
- executorch/examples/models/toy_model/__init__.py +25 -0
- executorch/examples/models/toy_model/model.py +143 -0
- executorch/examples/models/wav2letter/__init__.py +11 -0
- executorch/examples/models/wav2letter/model.py +29 -0
- executorch/examples/models/yolo12/export_and_validate.py +397 -0
- executorch/examples/nxp/experimental/cifar_net/cifar_net.py +270 -0
- executorch/examples/xnnpack/__init__.py +51 -0
- executorch/examples/xnnpack/aot_compiler.py +148 -0
- executorch/examples/xnnpack/quantization/example.py +205 -0
- executorch/examples/xnnpack/quantization/utils.py +42 -0
- executorch/exir/__init__.py +57 -0
- executorch/exir/_serialize/__init__.py +20 -0
- executorch/exir/_serialize/_cord.py +49 -0
- executorch/exir/_serialize/_dataclass.py +145 -0
- executorch/exir/_serialize/_flatbuffer.py +357 -0
- executorch/exir/_serialize/_named_data_store.py +222 -0
- executorch/exir/_serialize/_program.py +767 -0
- executorch/exir/_serialize/_serialize.py +123 -0
- executorch/exir/_serialize/data_serializer.py +80 -0
- executorch/exir/_serialize/padding.py +39 -0
- executorch/exir/_serialize/program.fbs +489 -0
- executorch/exir/_serialize/scalar_type.fbs +43 -0
- executorch/exir/_serialize/test/__init__.py +0 -0
- executorch/exir/_serialize/test/test_cord.py +63 -0
- executorch/exir/_serialize/test/test_flatbuffer.py +331 -0
- executorch/exir/_serialize/test/test_named_data_store.py +212 -0
- executorch/exir/_serialize/test/test_program.py +1265 -0
- executorch/exir/_serialize/test/test_serialize.py +289 -0
- executorch/exir/_warnings.py +44 -0
- executorch/exir/backend/backend_api.py +794 -0
- executorch/exir/backend/backend_details.py +150 -0
- executorch/exir/backend/canonical_partitioners/all_node_partitioner.py +55 -0
- executorch/exir/backend/canonical_partitioners/config_partitioner.py +262 -0
- executorch/exir/backend/canonical_partitioners/duplicate_constant_node_pass.py +156 -0
- executorch/exir/backend/canonical_partitioners/duplicate_dequant_node_pass.py +111 -0
- executorch/exir/backend/canonical_partitioners/group_partitioner.py +371 -0
- executorch/exir/backend/canonical_partitioners/pattern_op_partitioner.py +185 -0
- executorch/exir/backend/compile_spec_schema.py +17 -0
- executorch/exir/backend/operator_support.py +127 -0
- executorch/exir/backend/partitioner.py +114 -0
- executorch/exir/backend/test/backend_with_compiler_demo.py +142 -0
- executorch/exir/backend/test/backend_with_delegate_mapping_demo.py +210 -0
- executorch/exir/backend/test/backend_with_named_data_map.py +115 -0
- executorch/exir/backend/test/backend_with_preprocess_all_demo.py +297 -0
- executorch/exir/backend/test/demo_backend.py +35 -0
- executorch/exir/backend/test/demos/rpc/executor_backend_partitioner.py +77 -0
- executorch/exir/backend/test/demos/rpc/executor_backend_preprocess.py +39 -0
- executorch/exir/backend/test/demos/rpc/test_rpc.py +189 -0
- executorch/exir/backend/test/demos/test_delegate_aten_mode.py +72 -0
- executorch/exir/backend/test/hta_partitioner_demo.py +288 -0
- executorch/exir/backend/test/op_partitioner_demo.py +266 -0
- executorch/exir/backend/test/test_backend_with_named_data_map.py +85 -0
- executorch/exir/backend/test/test_backends.py +1463 -0
- executorch/exir/backend/test/test_backends_lifted.py +1326 -0
- executorch/exir/backend/test/test_backends_nested.py +258 -0
- executorch/exir/backend/test/test_compatibility.py +118 -0
- executorch/exir/backend/test/test_debug_handle_map.py +143 -0
- executorch/exir/backend/test/test_delegate_map_builder.py +257 -0
- executorch/exir/backend/test/test_graph_partition.py +248 -0
- executorch/exir/backend/test/test_group_partitioner.py +1674 -0
- executorch/exir/backend/test/test_lowered_backend_module.py +207 -0
- executorch/exir/backend/test/test_partitioner.py +731 -0
- executorch/exir/backend/test/test_passes.py +48 -0
- executorch/exir/backend/test/test_to_backend_multi_method.py +595 -0
- executorch/exir/backend/test/test_utils.py +264 -0
- executorch/exir/backend/utils.py +661 -0
- executorch/exir/capture/__init__.py +28 -0
- executorch/exir/capture/_capture.py +381 -0
- executorch/exir/capture/_config.py +119 -0
- executorch/exir/capture/_unlift.py +159 -0
- executorch/exir/common.py +140 -0
- executorch/exir/control_flow.py +204 -0
- executorch/exir/debug_handle_utils.py +29 -0
- executorch/exir/delegate.py +171 -0
- executorch/exir/delegate.pyi +21 -0
- executorch/exir/dialects/__init__.py +0 -0
- executorch/exir/dialects/_ops.py +166 -0
- executorch/exir/dialects/backend/_ops.py +123 -0
- executorch/exir/dialects/backend/test/test_backend_ops.py +88 -0
- executorch/exir/dialects/edge/_ops.py +405 -0
- executorch/exir/dialects/edge/arg/model.py +238 -0
- executorch/exir/dialects/edge/arg/type.py +46 -0
- executorch/exir/dialects/edge/dtype/runner.py +122 -0
- executorch/exir/dialects/edge/dtype/supported.py +47 -0
- executorch/exir/dialects/edge/dtype/utils.py +36 -0
- executorch/exir/dialects/edge/edge.yaml +8388 -0
- executorch/exir/dialects/edge/op/api.py +86 -0
- executorch/exir/dialects/edge/op/sample_input.py +1283 -0
- executorch/exir/dialects/edge/op/test/test_api.py +51 -0
- executorch/exir/dialects/edge/spec/gen.py +523 -0
- executorch/exir/dialects/edge/spec/utils.py +328 -0
- executorch/exir/dialects/edge/test/test_edge_ops.py +443 -0
- executorch/exir/dialects/edge/test/test_edge_yaml.py +225 -0
- executorch/exir/dialects/test/test_exir_dialect_ops.py +22 -0
- executorch/exir/dim_order_utils.py +85 -0
- executorch/exir/dynamic_shape.py +12 -0
- executorch/exir/emit/__init__.py +11 -0
- executorch/exir/emit/_emit_program.py +216 -0
- executorch/exir/emit/_emitter.py +2071 -0
- executorch/exir/emit/test/test_emit.py +2405 -0
- executorch/exir/error.py +55 -0
- executorch/exir/graph.py +86 -0
- executorch/exir/graph_module.py +153 -0
- executorch/exir/lowered_backend_module.py +966 -0
- executorch/exir/memory.py +50 -0
- executorch/exir/memory_planning.py +1250 -0
- executorch/exir/operator/convert.py +307 -0
- executorch/exir/operator/manip.py +89 -0
- executorch/exir/operator/test/test_operator.py +84 -0
- executorch/exir/operator/util.py +68 -0
- executorch/exir/pass_base.py +808 -0
- executorch/exir/pass_manager.py +78 -0
- executorch/exir/passes/__init__.py +528 -0
- executorch/exir/passes/_quant_patterns_and_replacements.py +1563 -0
- executorch/exir/passes/const_prop_pass.py +84 -0
- executorch/exir/passes/constant_prop_pass.py +402 -0
- executorch/exir/passes/debug_handle_generator_pass.py +81 -0
- executorch/exir/passes/dim_order_ops_registry.py +90 -0
- executorch/exir/passes/dynamic_shape_prop_pass.py +301 -0
- executorch/exir/passes/executorch_prim_ops_registry.py +166 -0
- executorch/exir/passes/external_constants_pass.py +113 -0
- executorch/exir/passes/init_mutable_pass.py +32 -0
- executorch/exir/passes/insert_write_back_for_buffers_pass.py +185 -0
- executorch/exir/passes/memory_format_ops_pass.py +119 -0
- executorch/exir/passes/memory_planning_pass.py +315 -0
- executorch/exir/passes/normalize_transpose_pass.py +24 -0
- executorch/exir/passes/normalize_view_copy_base_pass.py +62 -0
- executorch/exir/passes/pass_registry.py +89 -0
- executorch/exir/passes/prune_empty_tensors_pass.py +67 -0
- executorch/exir/passes/quant_fusion_pass.py +174 -0
- executorch/exir/passes/quantize_io_pass.py +414 -0
- executorch/exir/passes/reinplace.py +103 -0
- executorch/exir/passes/remove_graph_asserts_pass.py +62 -0
- executorch/exir/passes/remove_mixed_type_operators.py +95 -0
- executorch/exir/passes/remove_noop_pass.py +123 -0
- executorch/exir/passes/remove_unused_parameters_pass.py +55 -0
- executorch/exir/passes/replace_aten_with_edge_pass.py +59 -0
- executorch/exir/passes/replace_broken_ops_with_function_ops_pass.py +42 -0
- executorch/exir/passes/replace_edge_with_backend_pass.py +56 -0
- executorch/exir/passes/replace_sym_size_op_pass.py +35 -0
- executorch/exir/passes/replace_view_copy_with_view_pass.py +325 -0
- executorch/exir/passes/scalar_to_tensor_pass.py +32 -0
- executorch/exir/passes/spec_prop_pass.py +123 -0
- executorch/exir/passes/sym_shape_eval_pass.py +289 -0
- executorch/exir/passes/sym_to_tensor_pass.py +64 -0
- executorch/exir/passes/weights_to_outputs_pass.py +88 -0
- executorch/exir/print_program.py +420 -0
- executorch/exir/program/__init__.py +32 -0
- executorch/exir/program/_fake_program.py +67 -0
- executorch/exir/program/_program.py +1995 -0
- executorch/exir/program/test/__init__.py +0 -0
- executorch/exir/program/test/test_fake_program.py +78 -0
- executorch/exir/program/test/test_program.py +922 -0
- executorch/exir/scalar_type.py +38 -0
- executorch/exir/schema.py +308 -0
- executorch/exir/serde/__init__.py +0 -0
- executorch/exir/serde/export_serialize.py +2872 -0
- executorch/exir/serde/schema.py +406 -0
- executorch/exir/serde/schema_check.py +293 -0
- executorch/exir/serde/serialize.py +838 -0
- executorch/exir/serde/union.py +77 -0
- executorch/exir/sym_util.py +95 -0
- executorch/exir/tensor.py +392 -0
- executorch/exir/tensor_layout.py +39 -0
- executorch/exir/tests/asr_joiner.py +82 -0
- executorch/exir/tests/common.py +96 -0
- executorch/exir/tests/control_flow_models.py +105 -0
- executorch/exir/tests/dynamic_shape_models.py +51 -0
- executorch/exir/tests/models.py +576 -0
- executorch/exir/tests/test_arg_validator.py +72 -0
- executorch/exir/tests/test_capture.py +29 -0
- executorch/exir/tests/test_common.py +81 -0
- executorch/exir/tests/test_delegate.py +308 -0
- executorch/exir/tests/test_dim_order_utils.py +49 -0
- executorch/exir/tests/test_dynamic_shape_propagation.py +174 -0
- executorch/exir/tests/test_error.py +19 -0
- executorch/exir/tests/test_extract_io_quant_params.py +93 -0
- executorch/exir/tests/test_joint_graph.py +124 -0
- executorch/exir/tests/test_memory_format_ops_pass.py +443 -0
- executorch/exir/tests/test_memory_format_ops_pass_aten.py +142 -0
- executorch/exir/tests/test_memory_format_ops_pass_utils.py +266 -0
- executorch/exir/tests/test_memory_planning.py +1135 -0
- executorch/exir/tests/test_op_convert.py +88 -0
- executorch/exir/tests/test_pass_infra.py +179 -0
- executorch/exir/tests/test_passes.py +2332 -0
- executorch/exir/tests/test_print_program.py +54 -0
- executorch/exir/tests/test_prune_empty_tensors_pass.py +77 -0
- executorch/exir/tests/test_quant_fusion_pass.py +528 -0
- executorch/exir/tests/test_quantization.py +120 -0
- executorch/exir/tests/test_quantize_io_pass.py +156 -0
- executorch/exir/tests/test_reinplace_pass.py +124 -0
- executorch/exir/tests/test_remove_unused_parameters_pass.py +205 -0
- executorch/exir/tests/test_remove_view_copy.py +234 -0
- executorch/exir/tests/test_serde.py +352 -0
- executorch/exir/tests/test_tensor.py +341 -0
- executorch/exir/tests/test_tracer.py +497 -0
- executorch/exir/tests/test_verification.py +275 -0
- executorch/exir/tests/test_warnings.py +169 -0
- executorch/exir/tests/transformer.py +122 -0
- executorch/exir/tracer.py +803 -0
- executorch/exir/types.py +18 -0
- executorch/exir/verification/arg_validator.py +140 -0
- executorch/exir/verification/dev_html.py +68 -0
- executorch/exir/verification/interpreter.py +425 -0
- executorch/exir/verification/test/test_verifier.py +177 -0
- executorch/exir/verification/verifier.py +352 -0
- executorch/exir/version.py +9 -0
- executorch/exir/wrap.py +32 -0
- executorch/export/__init__.py +40 -0
- executorch/export/export.py +696 -0
- executorch/export/recipe.py +328 -0
- executorch/export/recipe_provider.py +60 -0
- executorch/export/recipe_registry.py +86 -0
- executorch/export/stages.py +686 -0
- executorch/export/target_recipes.py +185 -0
- executorch/export/tests/test_executorch_export.py +34 -0
- executorch/export/tests/test_export_recipe.py +131 -0
- executorch/export/tests/test_export_session.py +973 -0
- executorch/export/tests/test_export_stages.py +534 -0
- executorch/export/tests/test_recipe_provider.py +98 -0
- executorch/export/tests/test_recipe_registry.py +139 -0
- executorch/export/tests/test_target_recipes.py +539 -0
- executorch/export/types.py +22 -0
- executorch/export/utils.py +51 -0
- executorch/extension/audio/mel_spectrogram.py +279 -0
- executorch/extension/export_util/__init__.py +13 -0
- executorch/extension/export_util/utils.py +147 -0
- executorch/extension/flat_tensor/__init__.py +0 -0
- executorch/extension/flat_tensor/serialize/__init__.py +0 -0
- executorch/extension/flat_tensor/serialize/flat_tensor.fbs +73 -0
- executorch/extension/flat_tensor/serialize/flat_tensor_schema.py +34 -0
- executorch/extension/flat_tensor/serialize/scalar_type.fbs +38 -0
- executorch/extension/flat_tensor/serialize/serialize.py +446 -0
- executorch/extension/flat_tensor/test/test_serialize.py +326 -0
- executorch/extension/gguf_util/convert_main.py +53 -0
- executorch/extension/gguf_util/converter.py +27 -0
- executorch/extension/gguf_util/converters/llama_converter.py +123 -0
- executorch/extension/gguf_util/load_gguf.py +103 -0
- executorch/extension/llm/custom_ops/__init__.py +0 -0
- executorch/extension/llm/custom_ops/custom_ops.py +495 -0
- executorch/extension/llm/custom_ops/custom_ops_aot_lib.dll +0 -0
- executorch/extension/llm/custom_ops/model_sharding.py +117 -0
- executorch/extension/llm/custom_ops/op_tile_crop_aot.py +38 -0
- executorch/extension/llm/custom_ops/preprocess_custom_ops.py +69 -0
- executorch/extension/llm/custom_ops/spinquant/special_hadamard_code_gen.py +279 -0
- executorch/extension/llm/custom_ops/spinquant/third-party/FFHT/example.py +20 -0
- executorch/extension/llm/custom_ops/spinquant/third-party/FFHT/gen.py +869 -0
- executorch/extension/llm/custom_ops/test_preprocess_custom_ops.py +34 -0
- executorch/extension/llm/custom_ops/test_quantized_sdpa.py +550 -0
- executorch/extension/llm/custom_ops/test_sdpa_with_kv_cache.py +651 -0
- executorch/extension/llm/custom_ops/test_update_cache.py +433 -0
- executorch/extension/llm/custom_ops/test_update_cross_attn_cache.py +284 -0
- executorch/extension/llm/export/__init__.py +11 -0
- executorch/extension/llm/export/builder.py +535 -0
- executorch/extension/llm/export/config/llm_config.py +727 -0
- executorch/extension/llm/export/export_llm.py +106 -0
- executorch/extension/llm/export/export_passes.py +202 -0
- executorch/extension/llm/export/partitioner_lib.py +238 -0
- executorch/extension/llm/export/quantizer_lib.py +322 -0
- executorch/extension/llm/export/test/__init__.py +0 -0
- executorch/extension/llm/export/test/test_builder.py +118 -0
- executorch/extension/llm/export/test/test_export_llm.py +155 -0
- executorch/extension/llm/export/test_export_passes.py +209 -0
- executorch/extension/llm/modules/__init__.py +24 -0
- executorch/extension/llm/modules/_position_embeddings.py +729 -0
- executorch/extension/llm/modules/attention.py +415 -0
- executorch/extension/llm/modules/kv_cache.py +151 -0
- executorch/extension/llm/modules/test/__init__.py +0 -0
- executorch/extension/llm/modules/test/test_attention.py +353 -0
- executorch/extension/llm/modules/test/test_kv_cache.py +218 -0
- executorch/extension/llm/modules/test/test_position_embeddings.py +230 -0
- executorch/extension/llm/runner/__init__.py +235 -0
- executorch/extension/llm/runner/_llm_runner.pyi +523 -0
- executorch/extension/llm/runner/test/test_runner_pybindings.py +258 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/__init__.py +63 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/constants.py +31 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/hf_tokenizer.py +57 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/llama2c.py +111 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tiktoken.py +198 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tools/__init__.py +0 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tools/llama2c/__init__.py +0 -0
- executorch/extension/llm/tokenizers/pytorch_tokenizers/tools/llama2c/convert.py +49 -0
- executorch/extension/llm/tokenizers/setup.py +199 -0
- executorch/extension/llm/tokenizers/test/test_hf_tokenizer.py +83 -0
- executorch/extension/llm/tokenizers/test/test_python_bindings.py +131 -0
- executorch/extension/llm/tokenizers/test/test_tekken_python.py +453 -0
- executorch/extension/llm/tokenizers/test/test_tiktoken.py +49 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/absl/abseil.podspec.gen.py +243 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/absl/copts/copts.py +194 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/absl/copts/generate_copts.py +109 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/conanfile.py +51 -0
- executorch/extension/llm/tokenizers/third-party/abseil-cpp/create_lts.py +139 -0
- executorch/extension/llm/tokenizers/third-party/json/docs/mkdocs/scripts/check_structure.py +179 -0
- executorch/extension/llm/tokenizers/third-party/json/tests/thirdparty/imapdl/filterbr.py +109 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/amalgamate/amalgamate.py +299 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/gdb_pretty_printer/nlohmann-json.py +32 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/generate_natvis/generate_natvis.py +41 -0
- executorch/extension/llm/tokenizers/third-party/json/tools/serve_header/serve_header.py +410 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateCommon.py +354 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateTest.py +186 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateUcd.py +999 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateUcpHeader.py +98 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/GenerateUcpTables.py +203 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/UpdateCommon.py +31 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/UpdateDates.py +59 -0
- executorch/extension/llm/tokenizers/third-party/pcre2/maint/UpdateRelease.py +29 -0
- executorch/extension/llm/tokenizers/third-party/re2/benchlog/benchplot.py +98 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/re2.py +583 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/re2_test.py +489 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/setup.py +158 -0
- executorch/extension/llm/tokenizers/third-party/re2/python/toolchains/generate.py +98 -0
- executorch/extension/llm/tokenizers/third-party/re2/re2/make_unicode_casefold.py +151 -0
- executorch/extension/llm/tokenizers/third-party/re2/re2/make_unicode_groups.py +117 -0
- executorch/extension/llm/tokenizers/third-party/re2/re2/unicode.py +284 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/setup.py +215 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/__init__.py +1224 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/_version.py +1 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/sentencepiece_model_pb2.py +44 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/src/sentencepiece/sentencepiece_pb2.py +30 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/test/__init__.py +0 -0
- executorch/extension/llm/tokenizers/third-party/sentencepiece/python/test/sentencepiece_test.py +937 -0
- executorch/extension/module/test/resources/gen_bundled_program.py +99 -0
- executorch/extension/pybindings/_portable_lib.cp313-win_amd64.pyd +0 -0
- executorch/extension/pybindings/portable_lib.py +82 -0
- executorch/extension/pybindings/pybindings.pyi +299 -0
- executorch/extension/pybindings/test/make_test.py +186 -0
- executorch/extension/pybindings/test/test_backend_pybinding.py +27 -0
- executorch/extension/pybindings/test/test_pybindings.py +735 -0
- executorch/extension/pytree/__init__.py +54 -0
- executorch/extension/pytree/test/test.py +331 -0
- executorch/extension/training/__init__.py +22 -0
- executorch/extension/training/examples/CIFAR/data_utils.py +389 -0
- executorch/extension/training/examples/CIFAR/export.py +220 -0
- executorch/extension/training/examples/CIFAR/main.py +188 -0
- executorch/extension/training/examples/CIFAR/model.py +73 -0
- executorch/extension/training/examples/CIFAR/train_utils.py +622 -0
- executorch/extension/training/examples/XOR/export_model.py +74 -0
- executorch/extension/training/examples/XOR/model.py +34 -0
- executorch/extension/training/examples/XOR/test/test_export.py +19 -0
- executorch/extension/training/pybindings/_training_lib.pyi +45 -0
- executorch/extension/training/pybindings/_training_module.py +86 -0
- executorch/extension/training/pybindings/test/test.py +67 -0
- executorch/extension/wasm/test/test_model.py +34 -0
- executorch/include/executorch/extension/kernel_util/make_boxed_from_unboxed_functor.h +260 -0
- executorch/include/executorch/extension/kernel_util/meta_programming.h +119 -0
- executorch/include/executorch/extension/kernel_util/type_list.h +145 -0
- executorch/include/executorch/extension/tensor/tensor.h +14 -0
- executorch/include/executorch/extension/tensor/tensor_accessor.h +218 -0
- executorch/include/executorch/extension/tensor/tensor_ptr.h +485 -0
- executorch/include/executorch/extension/tensor/tensor_ptr_maker.h +687 -0
- executorch/include/executorch/extension/threadpool/cpuinfo_utils.h +24 -0
- executorch/include/executorch/extension/threadpool/threadpool.h +124 -0
- executorch/include/executorch/extension/threadpool/threadpool_guard.h +37 -0
- executorch/include/executorch/runtime/core/array_ref.h +262 -0
- executorch/include/executorch/runtime/core/data_loader.h +141 -0
- executorch/include/executorch/runtime/core/defines.h +20 -0
- executorch/include/executorch/runtime/core/error.h +257 -0
- executorch/include/executorch/runtime/core/evalue.h +608 -0
- executorch/include/executorch/runtime/core/event_tracer.h +592 -0
- executorch/include/executorch/runtime/core/event_tracer_hooks.h +340 -0
- executorch/include/executorch/runtime/core/event_tracer_hooks_delegate.h +204 -0
- executorch/include/executorch/runtime/core/exec_aten/exec_aten.h +175 -0
- executorch/include/executorch/runtime/core/exec_aten/testing_util/tensor_factory.h +1133 -0
- executorch/include/executorch/runtime/core/exec_aten/testing_util/tensor_util.h +378 -0
- executorch/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +278 -0
- executorch/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1430 -0
- executorch/include/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- executorch/include/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +68 -0
- executorch/include/executorch/runtime/core/exec_aten/util/tensor_util.h +1415 -0
- executorch/include/executorch/runtime/core/freeable_buffer.h +218 -0
- executorch/include/executorch/runtime/core/function_ref.h +108 -0
- executorch/include/executorch/runtime/core/hierarchical_allocator.h +125 -0
- executorch/include/executorch/runtime/core/memory_allocator.h +233 -0
- executorch/include/executorch/runtime/core/named_data_map.h +77 -0
- executorch/include/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- executorch/include/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- executorch/include/executorch/runtime/core/portable_type/bits_types.h +83 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +299 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +8 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/complex.h +78 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/complex_math.h +406 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/complex_utils.h +46 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +1 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +123 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/llvmMathExtras.h +905 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/overflows.h +100 -0
- executorch/include/executorch/runtime/core/portable_type/c10/c10/util/safe_numerics.h +114 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Export.h +153 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Macros.h +694 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/BFloat16.h +480 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/Half.h +788 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/TypeSafeSignMath.h +148 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/bit_cast.h +50 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/complex.h +616 -0
- executorch/include/executorch/runtime/core/portable_type/c10/torch/headeronly/util/floating_point_utils.h +38 -0
- executorch/include/executorch/runtime/core/portable_type/complex.h +21 -0
- executorch/include/executorch/runtime/core/portable_type/device.h +74 -0
- executorch/include/executorch/runtime/core/portable_type/half.h +27 -0
- executorch/include/executorch/runtime/core/portable_type/optional.h +36 -0
- executorch/include/executorch/runtime/core/portable_type/qint_types.h +83 -0
- executorch/include/executorch/runtime/core/portable_type/scalar.h +123 -0
- executorch/include/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- executorch/include/executorch/runtime/core/portable_type/string_view.h +29 -0
- executorch/include/executorch/runtime/core/portable_type/tensor.h +175 -0
- executorch/include/executorch/runtime/core/portable_type/tensor_impl.h +304 -0
- executorch/include/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- executorch/include/executorch/runtime/core/result.h +268 -0
- executorch/include/executorch/runtime/core/span.h +110 -0
- executorch/include/executorch/runtime/core/tag.h +90 -0
- executorch/include/executorch/runtime/core/tensor_layout.h +93 -0
- executorch/include/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- executorch/include/executorch/runtime/core/testing_util/error_matchers.h +303 -0
- executorch/include/executorch/runtime/kernel/kernel_includes.h +23 -0
- executorch/include/executorch/runtime/kernel/kernel_runtime_context.h +131 -0
- executorch/include/executorch/runtime/kernel/operator_registry.h +298 -0
- executorch/include/executorch/runtime/kernel/test/test_util.h +40 -0
- executorch/include/executorch/runtime/kernel/thread_parallel_interface.h +107 -0
- executorch/include/executorch/runtime/platform/abort.h +36 -0
- executorch/include/executorch/runtime/platform/assert.h +124 -0
- executorch/include/executorch/runtime/platform/clock.h +43 -0
- executorch/include/executorch/runtime/platform/compat_unistd.h +75 -0
- executorch/include/executorch/runtime/platform/compiler.h +214 -0
- executorch/include/executorch/runtime/platform/log.h +216 -0
- executorch/include/executorch/runtime/platform/platform.h +276 -0
- executorch/include/executorch/runtime/platform/profiler.h +289 -0
- executorch/include/executorch/runtime/platform/runtime.h +35 -0
- executorch/include/executorch/runtime/platform/system.h +49 -0
- executorch/include/executorch/runtime/platform/test/pal_spy.h +86 -0
- executorch/include/executorch/runtime/platform/test/stub_platform.h +76 -0
- executorch/include/executorch/runtime/platform/types.h +24 -0
- executorch/kernels/quantized/__init__.py +21 -0
- executorch/kernels/quantized/quantized.yaml +113 -0
- executorch/kernels/quantized/quantized_ops_aot_lib.dll +0 -0
- executorch/kernels/quantized/test/supported_features_def.yaml +1 -0
- executorch/kernels/quantized/test/test_out_variants.py +100 -0
- executorch/kernels/quantized/test/test_quant_dequant_per_token.py +149 -0
- executorch/runtime/__init__.py +334 -0
- executorch/runtime/kernel/test/functions.yaml +13 -0
- executorch/runtime/test/test_runtime.py +106 -0
- executorch/runtime/test/test_runtime_etdump_gen.py +163 -0
- executorch/schema/program.fbs +489 -0
- executorch/schema/scalar_type.fbs +43 -0
- executorch/share/cmake/executorch-config.cmake +77 -0
- executorch/util/activation_memory_profiler.py +177 -0
- executorch/util/collect_env.py +748 -0
- executorch/util/python_profiler.py +96 -0
- executorch/version.py +4 -0
- executorch-1.1.0.dist-info/METADATA +87 -0
- executorch-1.1.0.dist-info/RECORD +2784 -0
- executorch-1.1.0.dist-info/WHEEL +5 -0
- executorch-1.1.0.dist-info/entry_points.txt +2 -0
- executorch-1.1.0.dist-info/licenses/LICENSE +37 -0
- executorch-1.1.0.dist-info/top_level.txt +7 -0
|
@@ -0,0 +1,1885 @@
|
|
|
1
|
+
#!/usr/bin/env python3 -i
|
|
2
|
+
#
|
|
3
|
+
# Copyright 2013-2025 The Khronos Group Inc.
|
|
4
|
+
#
|
|
5
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
|
|
7
|
+
"""Types and classes for manipulating an API registry."""
|
|
8
|
+
|
|
9
|
+
import copy
|
|
10
|
+
import re
|
|
11
|
+
import sys
|
|
12
|
+
import xml.etree.ElementTree as etree
|
|
13
|
+
from collections import defaultdict, deque, namedtuple
|
|
14
|
+
|
|
15
|
+
from generator import GeneratorOptions, OutputGenerator, noneStr, write
|
|
16
|
+
from apiconventions import APIConventions
|
|
17
|
+
|
|
18
|
+
def apiNameMatch(str, supported):
|
|
19
|
+
"""Return whether a required api name matches a pattern specified for an
|
|
20
|
+
XML <feature> 'api' attribute or <extension> 'supported' attribute.
|
|
21
|
+
|
|
22
|
+
- str - API name such as 'vulkan' or 'openxr'. May be None, in which
|
|
23
|
+
case it never matches (this should not happen).
|
|
24
|
+
- supported - comma-separated list of XML API names. May be None, in
|
|
25
|
+
which case str always matches (this is the usual case)."""
|
|
26
|
+
|
|
27
|
+
if str is not None:
|
|
28
|
+
return supported is None or str in supported.split(',')
|
|
29
|
+
|
|
30
|
+
# Fallthrough case - either str is None or the test failed
|
|
31
|
+
return False
|
|
32
|
+
|
|
33
|
+
def matchAPIProfile(api, profile, elem):
|
|
34
|
+
"""Return whether an API and profile
|
|
35
|
+
being generated matches an element's profile
|
|
36
|
+
|
|
37
|
+
- api - string naming the API to match
|
|
38
|
+
- profile - string naming the profile to match
|
|
39
|
+
- elem - Element which (may) have 'api' and 'profile'
|
|
40
|
+
attributes to match to.
|
|
41
|
+
|
|
42
|
+
If a tag is not present in the Element, the corresponding API
|
|
43
|
+
or profile always matches.
|
|
44
|
+
|
|
45
|
+
Otherwise, the tag must exactly match the API or profile.
|
|
46
|
+
|
|
47
|
+
Thus, if 'profile' = core:
|
|
48
|
+
|
|
49
|
+
- `<remove>` with no attribute will match
|
|
50
|
+
- `<remove profile="core">` will match
|
|
51
|
+
- `<remove profile="compatibility">` will not match
|
|
52
|
+
|
|
53
|
+
Possible match conditions:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Requested Element
|
|
57
|
+
Profile Profile
|
|
58
|
+
--------- --------
|
|
59
|
+
None None Always matches
|
|
60
|
+
'string' None Always matches
|
|
61
|
+
None 'string' Does not match. Cannot generate multiple APIs
|
|
62
|
+
or profiles, so if an API/profile constraint
|
|
63
|
+
is present, it must be asked for explicitly.
|
|
64
|
+
'string' 'string' Strings must match
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
** In the future, we will allow regexes for the attributes,
|
|
68
|
+
not just strings, so that `api="^(gl|gles2)"` will match. Even
|
|
69
|
+
this is not really quite enough, we might prefer something
|
|
70
|
+
like `"gl(core)|gles1(common-lite)"`."""
|
|
71
|
+
# Match 'api', if present
|
|
72
|
+
elem_api = elem.get('api')
|
|
73
|
+
if elem_api:
|
|
74
|
+
if api is None:
|
|
75
|
+
raise UserWarning("No API requested, but 'api' attribute is present with value '"
|
|
76
|
+
+ elem_api + "'")
|
|
77
|
+
elif api != elem_api:
|
|
78
|
+
# Requested API does not match attribute
|
|
79
|
+
return False
|
|
80
|
+
elem_profile = elem.get('profile')
|
|
81
|
+
if elem_profile:
|
|
82
|
+
if profile is None:
|
|
83
|
+
raise UserWarning("No profile requested, but 'profile' attribute is present with value '"
|
|
84
|
+
+ elem_profile + "'")
|
|
85
|
+
elif profile != elem_profile:
|
|
86
|
+
# Requested profile does not match attribute
|
|
87
|
+
return False
|
|
88
|
+
return True
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def mergeAPIs(tree, fromApiNames, toApiName):
|
|
92
|
+
"""Merge multiple APIs using the precedence order specified in apiNames.
|
|
93
|
+
Also deletes <remove> elements.
|
|
94
|
+
|
|
95
|
+
tree - Element at the root of the hierarchy to merge.
|
|
96
|
+
apiNames - list of strings of API names."""
|
|
97
|
+
|
|
98
|
+
stack = deque()
|
|
99
|
+
stack.append(tree)
|
|
100
|
+
|
|
101
|
+
while len(stack) > 0:
|
|
102
|
+
parent = stack.pop()
|
|
103
|
+
|
|
104
|
+
for child in parent.findall('*'):
|
|
105
|
+
if child.tag == 'remove':
|
|
106
|
+
# Remove <remove> elements
|
|
107
|
+
parent.remove(child)
|
|
108
|
+
else:
|
|
109
|
+
stack.append(child)
|
|
110
|
+
|
|
111
|
+
supportedList = child.get('supported')
|
|
112
|
+
if supportedList:
|
|
113
|
+
supportedList = supportedList.split(',')
|
|
114
|
+
for apiName in [toApiName] + fromApiNames:
|
|
115
|
+
if apiName in supportedList:
|
|
116
|
+
child.set('supported', toApiName)
|
|
117
|
+
|
|
118
|
+
if child.get('api'):
|
|
119
|
+
definitionName = None
|
|
120
|
+
definitionVariants = []
|
|
121
|
+
|
|
122
|
+
# Keep only one definition with the same name if there are multiple definitions
|
|
123
|
+
if child.tag in ['type']:
|
|
124
|
+
if child.get('name') is not None:
|
|
125
|
+
definitionName = child.get('name')
|
|
126
|
+
definitionVariants = parent.findall(f"{child.tag}[@name='{definitionName}']")
|
|
127
|
+
else:
|
|
128
|
+
definitionName = child.find('name').text
|
|
129
|
+
definitionVariants = parent.findall(f"{child.tag}/name[.='{definitionName}']/..")
|
|
130
|
+
elif child.tag in ['member', 'param']:
|
|
131
|
+
definitionName = child.find('name').text
|
|
132
|
+
definitionVariants = parent.findall(f"{child.tag}/name[.='{definitionName}']/..")
|
|
133
|
+
elif child.tag in ['enum', 'feature']:
|
|
134
|
+
definitionName = child.get('name')
|
|
135
|
+
definitionVariants = parent.findall(f"{child.tag}[@name='{definitionName}']")
|
|
136
|
+
elif child.tag in ['require']:
|
|
137
|
+
# No way to correlate require tags because they do not have a definite identifier in the way they
|
|
138
|
+
# are used in the latest forms of the XML so the best we can do is simply enable all of them
|
|
139
|
+
if child.get('api') in fromApiNames:
|
|
140
|
+
child.set('api', toApiName)
|
|
141
|
+
elif child.tag in ['command']:
|
|
142
|
+
definitionName = child.find('proto/name').text
|
|
143
|
+
definitionVariants = parent.findall(f"{child.tag}/proto/name[.='{definitionName}']/../..")
|
|
144
|
+
|
|
145
|
+
if definitionName:
|
|
146
|
+
bestMatchApi = None
|
|
147
|
+
requires = None
|
|
148
|
+
for apiName in [toApiName] + fromApiNames:
|
|
149
|
+
for variant in definitionVariants:
|
|
150
|
+
# Keep any requires attributes from the target API
|
|
151
|
+
if variant.get('requires') and variant.get('api') == apiName:
|
|
152
|
+
requires = variant.get('requires')
|
|
153
|
+
# Find the best matching definition
|
|
154
|
+
if apiName in variant.get('api').split(',') and bestMatchApi is None:
|
|
155
|
+
bestMatchApi = variant.get('api')
|
|
156
|
+
|
|
157
|
+
if bestMatchApi:
|
|
158
|
+
for variant in definitionVariants:
|
|
159
|
+
if variant.get('api') != bestMatchApi:
|
|
160
|
+
# Only keep best matching definition
|
|
161
|
+
parent.remove(variant)
|
|
162
|
+
else:
|
|
163
|
+
# Add requires attribute from the target API if it is not overridden
|
|
164
|
+
if requires is not None and variant.get('requires') is None:
|
|
165
|
+
variant.set('requires', requires)
|
|
166
|
+
variant.set('api', toApiName)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def stripNonmatchingAPIs(tree, apiName, actuallyDelete = True):
|
|
170
|
+
"""Remove tree Elements with 'api' attributes matching apiName.
|
|
171
|
+
|
|
172
|
+
tree - Element at the root of the hierarchy to strip. Only its
|
|
173
|
+
children can actually be removed, not the tree itself.
|
|
174
|
+
apiName - string which much match a command-separated component of
|
|
175
|
+
the 'api' attribute.
|
|
176
|
+
actuallyDelete - only delete matching elements if True."""
|
|
177
|
+
|
|
178
|
+
stack = deque()
|
|
179
|
+
stack.append(tree)
|
|
180
|
+
|
|
181
|
+
while len(stack) > 0:
|
|
182
|
+
parent = stack.pop()
|
|
183
|
+
|
|
184
|
+
for child in parent.findall('*'):
|
|
185
|
+
api = child.get('api')
|
|
186
|
+
|
|
187
|
+
if apiNameMatch(apiName, api):
|
|
188
|
+
# Add child to the queue
|
|
189
|
+
stack.append(child)
|
|
190
|
+
elif not apiNameMatch(apiName, api):
|
|
191
|
+
# Child does not match requested api. Remove it.
|
|
192
|
+
if actuallyDelete:
|
|
193
|
+
parent.remove(child)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class BaseInfo:
|
|
197
|
+
"""Base class for information about a registry feature
|
|
198
|
+
(type/group/enum/command/API/extension).
|
|
199
|
+
|
|
200
|
+
Represents the state of a registry feature, used during API generation.
|
|
201
|
+
"""
|
|
202
|
+
|
|
203
|
+
def __init__(self, elem):
|
|
204
|
+
self.required = False
|
|
205
|
+
"""should this feature be defined during header generation
|
|
206
|
+
(has it been removed by a profile or version)?"""
|
|
207
|
+
|
|
208
|
+
self.declared = False
|
|
209
|
+
"has this feature been defined already?"
|
|
210
|
+
|
|
211
|
+
self.elem = elem
|
|
212
|
+
"etree Element for this feature"
|
|
213
|
+
|
|
214
|
+
self.deprecatedbyversion = None
|
|
215
|
+
self.deprecatedbyextensions = []
|
|
216
|
+
self.deprecatedlink = None
|
|
217
|
+
|
|
218
|
+
def resetState(self):
|
|
219
|
+
"""Reset required/declared to initial values. Used
|
|
220
|
+
prior to generating a new API interface."""
|
|
221
|
+
self.required = False
|
|
222
|
+
self.declared = False
|
|
223
|
+
|
|
224
|
+
def compareKeys(self, info, key, required = False):
|
|
225
|
+
"""Return True if self.elem and info.elem have the same attribute
|
|
226
|
+
value for key.
|
|
227
|
+
If 'required' is not True, also returns True if neither element
|
|
228
|
+
has an attribute value for key."""
|
|
229
|
+
|
|
230
|
+
if required and key not in self.elem.keys():
|
|
231
|
+
return False
|
|
232
|
+
return self.elem.get(key) == info.elem.get(key)
|
|
233
|
+
|
|
234
|
+
def compareElem(self, info, infoName):
|
|
235
|
+
"""Return True if self.elem and info.elem have the same definition.
|
|
236
|
+
info - the other object
|
|
237
|
+
infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' /
|
|
238
|
+
'extension'"""
|
|
239
|
+
|
|
240
|
+
if infoName == 'enum':
|
|
241
|
+
if self.compareKeys(info, 'extends'):
|
|
242
|
+
# Either both extend the same type, or no type
|
|
243
|
+
if (self.compareKeys(info, 'value', required = True) or
|
|
244
|
+
self.compareKeys(info, 'bitpos', required = True)):
|
|
245
|
+
# If both specify the same value or bit position,
|
|
246
|
+
# they are equal
|
|
247
|
+
return True
|
|
248
|
+
elif (self.compareKeys(info, 'extnumber') and
|
|
249
|
+
self.compareKeys(info, 'offset') and
|
|
250
|
+
self.compareKeys(info, 'dir')):
|
|
251
|
+
# If both specify the same relative offset, they are equal
|
|
252
|
+
return True
|
|
253
|
+
elif (self.compareKeys(info, 'alias')):
|
|
254
|
+
# If both are aliases of the same value
|
|
255
|
+
return True
|
|
256
|
+
else:
|
|
257
|
+
return False
|
|
258
|
+
else:
|
|
259
|
+
# The same enum cannot extend two different types
|
|
260
|
+
return False
|
|
261
|
+
else:
|
|
262
|
+
# Non-<enum>s should never be redefined
|
|
263
|
+
return False
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class TypeInfo(BaseInfo):
|
|
267
|
+
"""Registry information about a type. No additional state
|
|
268
|
+
beyond BaseInfo is required."""
|
|
269
|
+
|
|
270
|
+
def __init__(self, elem):
|
|
271
|
+
BaseInfo.__init__(self, elem)
|
|
272
|
+
self.additionalValidity = []
|
|
273
|
+
self.removedValidity = []
|
|
274
|
+
|
|
275
|
+
def getMembers(self):
|
|
276
|
+
"""Get a collection of all member elements for this type, if any."""
|
|
277
|
+
return self.elem.findall('member')
|
|
278
|
+
|
|
279
|
+
def resetState(self):
|
|
280
|
+
BaseInfo.resetState(self)
|
|
281
|
+
self.additionalValidity = []
|
|
282
|
+
self.removedValidity = []
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
class GroupInfo(BaseInfo):
|
|
286
|
+
"""Registry information about a group of related enums
|
|
287
|
+
in an <enums> block, generally corresponding to a C "enum" type."""
|
|
288
|
+
|
|
289
|
+
def __init__(self, elem):
|
|
290
|
+
BaseInfo.__init__(self, elem)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
class EnumInfo(BaseInfo):
|
|
294
|
+
"""Registry information about an enum"""
|
|
295
|
+
|
|
296
|
+
def __init__(self, elem):
|
|
297
|
+
BaseInfo.__init__(self, elem)
|
|
298
|
+
self.type = elem.get('type')
|
|
299
|
+
"""numeric type of the value of the <enum> tag
|
|
300
|
+
( '' for GLint, 'u' for GLuint, 'ull' for GLuint64 )"""
|
|
301
|
+
if self.type is None:
|
|
302
|
+
self.type = ''
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class CmdInfo(BaseInfo):
|
|
306
|
+
"""Registry information about a command"""
|
|
307
|
+
|
|
308
|
+
def __init__(self, elem):
|
|
309
|
+
BaseInfo.__init__(self, elem)
|
|
310
|
+
self.additionalValidity = []
|
|
311
|
+
self.removedValidity = []
|
|
312
|
+
|
|
313
|
+
def getParams(self):
|
|
314
|
+
"""Get a collection of all param elements for this command, if any."""
|
|
315
|
+
return self.elem.findall('param')
|
|
316
|
+
|
|
317
|
+
def resetState(self):
|
|
318
|
+
BaseInfo.resetState(self)
|
|
319
|
+
self.additionalValidity = []
|
|
320
|
+
self.removedValidity = []
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
class FeatureInfo(BaseInfo):
|
|
324
|
+
"""Registry information about an API <feature>
|
|
325
|
+
or <extension>."""
|
|
326
|
+
|
|
327
|
+
def __init__(self, elem):
|
|
328
|
+
BaseInfo.__init__(self, elem)
|
|
329
|
+
self.name = elem.get('name')
|
|
330
|
+
"feature name string (e.g. 'VK_KHR_surface')"
|
|
331
|
+
|
|
332
|
+
self.emit = False
|
|
333
|
+
"has this feature been defined already?"
|
|
334
|
+
|
|
335
|
+
self.sortorder = int(elem.get('sortorder', 0))
|
|
336
|
+
"""explicit numeric sort key within feature and extension groups.
|
|
337
|
+
Defaults to 0."""
|
|
338
|
+
|
|
339
|
+
# Determine element category (vendor). Only works
|
|
340
|
+
# for <extension> elements.
|
|
341
|
+
if elem.tag == 'feature':
|
|
342
|
+
# Element category (vendor) is meaningless for <feature>
|
|
343
|
+
self.category = 'VERSION'
|
|
344
|
+
"""category, e.g. VERSION or khr/vendor tag"""
|
|
345
|
+
|
|
346
|
+
self.version = elem.get('name')
|
|
347
|
+
"""feature name string"""
|
|
348
|
+
|
|
349
|
+
self.versionNumber = elem.get('number')
|
|
350
|
+
"""versionNumber - API version number, taken from the 'number'
|
|
351
|
+
attribute of <feature>. Extensions do not have API version
|
|
352
|
+
numbers and are assigned number 0."""
|
|
353
|
+
|
|
354
|
+
self.number = 0
|
|
355
|
+
self.supported = None
|
|
356
|
+
|
|
357
|
+
self.deprecates = elem.findall('deprecate')
|
|
358
|
+
else:
|
|
359
|
+
# Extract vendor portion of <APIprefix>_<vendor>_<name>
|
|
360
|
+
self.category = self.name.split('_', 2)[1]
|
|
361
|
+
self.version = "0"
|
|
362
|
+
self.versionNumber = "0"
|
|
363
|
+
|
|
364
|
+
self.number = int(elem.get('number','0'))
|
|
365
|
+
"""extension number, used for ordering and for assigning
|
|
366
|
+
enumerant offsets. <feature> features do not have extension
|
|
367
|
+
numbers and are assigned number 0, as are extensions without
|
|
368
|
+
numbers, so sorting works."""
|
|
369
|
+
|
|
370
|
+
self.supported = elem.get('supported', 'disabled')
|
|
371
|
+
|
|
372
|
+
class SpirvInfo(BaseInfo):
|
|
373
|
+
"""Registry information about an API <spirvextensions>
|
|
374
|
+
or <spirvcapability>."""
|
|
375
|
+
|
|
376
|
+
def __init__(self, elem):
|
|
377
|
+
BaseInfo.__init__(self, elem)
|
|
378
|
+
|
|
379
|
+
class FormatInfo(BaseInfo):
|
|
380
|
+
"""Registry information about an API <format>."""
|
|
381
|
+
|
|
382
|
+
def __init__(self, elem, condition):
|
|
383
|
+
BaseInfo.__init__(self, elem)
|
|
384
|
+
# Need to save the condition here when it is known
|
|
385
|
+
self.condition = condition
|
|
386
|
+
|
|
387
|
+
class SyncStageInfo(BaseInfo):
|
|
388
|
+
"""Registry information about <syncstage>."""
|
|
389
|
+
|
|
390
|
+
def __init__(self, elem, condition):
|
|
391
|
+
BaseInfo.__init__(self, elem)
|
|
392
|
+
# Need to save the condition here when it is known
|
|
393
|
+
self.condition = condition
|
|
394
|
+
|
|
395
|
+
class SyncAccessInfo(BaseInfo):
|
|
396
|
+
"""Registry information about <syncaccess>."""
|
|
397
|
+
|
|
398
|
+
def __init__(self, elem, condition):
|
|
399
|
+
BaseInfo.__init__(self, elem)
|
|
400
|
+
# Need to save the condition here when it is known
|
|
401
|
+
self.condition = condition
|
|
402
|
+
|
|
403
|
+
class SyncPipelineInfo(BaseInfo):
|
|
404
|
+
"""Registry information about <syncpipeline>."""
|
|
405
|
+
|
|
406
|
+
def __init__(self, elem):
|
|
407
|
+
BaseInfo.__init__(self, elem)
|
|
408
|
+
|
|
409
|
+
class Registry:
|
|
410
|
+
"""Object representing an API registry, loaded from an XML file."""
|
|
411
|
+
|
|
412
|
+
def __init__(self, gen=None, genOpts=None):
|
|
413
|
+
if gen is None:
|
|
414
|
+
# If not specified, give a default object so messaging will work
|
|
415
|
+
self.gen = OutputGenerator()
|
|
416
|
+
else:
|
|
417
|
+
self.gen = gen
|
|
418
|
+
"Output generator used to write headers / messages"
|
|
419
|
+
|
|
420
|
+
if genOpts is None:
|
|
421
|
+
# If no generator is provided, we may still need the XML API name
|
|
422
|
+
# (for example, in genRef.py).
|
|
423
|
+
self.genOpts = GeneratorOptions(apiname = APIConventions().xml_api_name)
|
|
424
|
+
else:
|
|
425
|
+
self.genOpts = genOpts
|
|
426
|
+
"Options controlling features to write and how to format them"
|
|
427
|
+
|
|
428
|
+
self.gen.registry = self
|
|
429
|
+
self.gen.genOpts = self.genOpts
|
|
430
|
+
self.gen.genOpts.registry = self
|
|
431
|
+
|
|
432
|
+
self.tree = None
|
|
433
|
+
"ElementTree containing the root `<registry>`"
|
|
434
|
+
|
|
435
|
+
self.typedict = {}
|
|
436
|
+
"dictionary of TypeInfo objects keyed by type name"
|
|
437
|
+
|
|
438
|
+
self.groupdict = {}
|
|
439
|
+
"dictionary of GroupInfo objects keyed by group name"
|
|
440
|
+
|
|
441
|
+
self.enumdict = {}
|
|
442
|
+
"dictionary of EnumInfo objects keyed by enum name"
|
|
443
|
+
|
|
444
|
+
self.cmddict = {}
|
|
445
|
+
"dictionary of CmdInfo objects keyed by command name"
|
|
446
|
+
|
|
447
|
+
self.aliasdict = {}
|
|
448
|
+
"dictionary of type and command names mapped to their alias, such as VkFooKHR -> VkFoo"
|
|
449
|
+
|
|
450
|
+
self.enumvaluedict = {}
|
|
451
|
+
"dictionary of enum values mapped to their type, such as VK_FOO_VALUE -> VkFoo"
|
|
452
|
+
|
|
453
|
+
self.apidict = {}
|
|
454
|
+
"dictionary of FeatureInfo objects for `<feature>` elements keyed by API name"
|
|
455
|
+
|
|
456
|
+
self.extensions = []
|
|
457
|
+
"list of `<extension>` Elements"
|
|
458
|
+
|
|
459
|
+
self.extdict = {}
|
|
460
|
+
"dictionary of FeatureInfo objects for `<extension>` elements keyed by extension name"
|
|
461
|
+
|
|
462
|
+
self.spirvextdict = {}
|
|
463
|
+
"dictionary of FeatureInfo objects for `<spirvextension>` elements keyed by spirv extension name"
|
|
464
|
+
|
|
465
|
+
self.spirvcapdict = {}
|
|
466
|
+
"dictionary of FeatureInfo objects for `<spirvcapability>` elements keyed by spirv capability name"
|
|
467
|
+
|
|
468
|
+
self.formatsdict = {}
|
|
469
|
+
"dictionary of FeatureInfo objects for `<format>` elements keyed by VkFormat name"
|
|
470
|
+
|
|
471
|
+
self.syncstagedict = {}
|
|
472
|
+
"dictionary of Sync*Info objects for `<syncstage>` elements keyed by VkPipelineStageFlagBits2 name"
|
|
473
|
+
|
|
474
|
+
self.syncaccessdict = {}
|
|
475
|
+
"dictionary of Sync*Info objects for `<syncaccess>` elements keyed by VkAccessFlagBits2 name"
|
|
476
|
+
|
|
477
|
+
self.syncpipelinedict = {}
|
|
478
|
+
"dictionary of Sync*Info objects for `<syncpipeline>` elements keyed by pipeline type name"
|
|
479
|
+
|
|
480
|
+
self.emitFeatures = False
|
|
481
|
+
"""True to actually emit features for a version / extension,
|
|
482
|
+
or False to just treat them as emitted"""
|
|
483
|
+
|
|
484
|
+
self.breakPat = None
|
|
485
|
+
"regexp pattern to break on when generating names"
|
|
486
|
+
# self.breakPat = re.compile('VkFenceImportFlagBits.*')
|
|
487
|
+
|
|
488
|
+
self.requiredextensions = [] # Hack - can remove it after validity generator goes away
|
|
489
|
+
|
|
490
|
+
# ** Global types for automatic source generation **
|
|
491
|
+
# Length Member data
|
|
492
|
+
self.commandextensiontuple = namedtuple('commandextensiontuple',
|
|
493
|
+
['command', # The name of the command being modified
|
|
494
|
+
'value', # The value to append to the command
|
|
495
|
+
'extension']) # The name of the extension that added it
|
|
496
|
+
self.validextensionstructs = defaultdict(list)
|
|
497
|
+
self.commandextensionsuccesses = []
|
|
498
|
+
self.commandextensionerrors = []
|
|
499
|
+
|
|
500
|
+
self.filename = None
|
|
501
|
+
|
|
502
|
+
def loadElementTree(self, tree):
|
|
503
|
+
"""Load ElementTree into a Registry object and parse it."""
|
|
504
|
+
self.tree = tree
|
|
505
|
+
self.parseTree()
|
|
506
|
+
|
|
507
|
+
def loadFile(self, file):
|
|
508
|
+
"""Load an API registry XML file into a Registry object and parse it"""
|
|
509
|
+
self.filename = file
|
|
510
|
+
self.tree = etree.parse(file)
|
|
511
|
+
self.parseTree()
|
|
512
|
+
|
|
513
|
+
def setGenerator(self, gen):
|
|
514
|
+
"""Specify output generator object.
|
|
515
|
+
|
|
516
|
+
`None` restores the default generator."""
|
|
517
|
+
self.gen = gen
|
|
518
|
+
self.gen.setRegistry(self)
|
|
519
|
+
|
|
520
|
+
def addElementInfo(self, elem, info, infoName, dictionary):
|
|
521
|
+
"""Add information about an element to the corresponding dictionary.
|
|
522
|
+
|
|
523
|
+
Intended for internal use only.
|
|
524
|
+
|
|
525
|
+
- elem - `<type>`/`<enums>`/`<enum>`/`<command>`/`<feature>`/`<extension>`/`<spirvextension>`/`<spirvcapability>`/`<format>`/`<syncstage>`/`<syncaccess>`/`<syncpipeline>` Element
|
|
526
|
+
- info - corresponding {Type|Group|Enum|Cmd|Feature|Spirv|Format|SyncStage|SyncAccess|SyncPipeline}Info object
|
|
527
|
+
- infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' / 'spirvextension' / 'spirvcapability' / 'format' / 'syncstage' / 'syncaccess' / 'syncpipeline'
|
|
528
|
+
- dictionary - self.{type|group|enum|cmd|api|ext|format|spirvext|spirvcap|sync}dict
|
|
529
|
+
|
|
530
|
+
The dictionary key is the element 'name' attribute."""
|
|
531
|
+
|
|
532
|
+
# self.gen.logMsg('diag', 'Adding ElementInfo.required =',
|
|
533
|
+
# info.required, 'name =', elem.get('name'))
|
|
534
|
+
key = elem.get('name')
|
|
535
|
+
if key in dictionary:
|
|
536
|
+
if not dictionary[key].compareElem(info, infoName):
|
|
537
|
+
self.gen.logMsg('warn', 'Attempt to redefine', key,
|
|
538
|
+
'(this should not happen)')
|
|
539
|
+
else:
|
|
540
|
+
dictionary[key] = info
|
|
541
|
+
|
|
542
|
+
def lookupElementInfo(self, fname, dictionary):
|
|
543
|
+
"""Find a {Type|Enum|Cmd}Info object by name.
|
|
544
|
+
|
|
545
|
+
Intended for internal use only.
|
|
546
|
+
|
|
547
|
+
If an object qualified by API name exists, use that.
|
|
548
|
+
|
|
549
|
+
- fname - name of type / enum / command
|
|
550
|
+
- dictionary - self.{type|enum|cmd}dict"""
|
|
551
|
+
key = (fname, self.genOpts.apiname)
|
|
552
|
+
if key in dictionary:
|
|
553
|
+
# self.gen.logMsg('diag', 'Found API-specific element for feature', fname)
|
|
554
|
+
return dictionary[key]
|
|
555
|
+
if fname in dictionary:
|
|
556
|
+
# self.gen.logMsg('diag', 'Found generic element for feature', fname)
|
|
557
|
+
return dictionary[fname]
|
|
558
|
+
|
|
559
|
+
return None
|
|
560
|
+
|
|
561
|
+
def breakOnName(self, regexp):
|
|
562
|
+
"""Specify a feature name regexp to break on when generating features."""
|
|
563
|
+
self.breakPat = re.compile(regexp)
|
|
564
|
+
|
|
565
|
+
def addEnumValue(self, enum, type_name):
|
|
566
|
+
"""Track aliasing and map back from enum values to their type"""
|
|
567
|
+
# Record alias, if any
|
|
568
|
+
value = enum.get('name')
|
|
569
|
+
alias = enum.get('alias')
|
|
570
|
+
if alias:
|
|
571
|
+
self.aliasdict[value] = alias
|
|
572
|
+
# Map the value back to the type
|
|
573
|
+
if type_name in self.aliasdict:
|
|
574
|
+
type_name = self.aliasdict[type_name]
|
|
575
|
+
if value in self.enumvaluedict:
|
|
576
|
+
# Some times the same enum is defined by multiple extensions
|
|
577
|
+
assert(type_name == self.enumvaluedict[value])
|
|
578
|
+
else:
|
|
579
|
+
self.enumvaluedict[value] = type_name
|
|
580
|
+
|
|
581
|
+
def parseTree(self):
|
|
582
|
+
"""Parse the registry Element, once created"""
|
|
583
|
+
# This must be the Element for the root <registry>
|
|
584
|
+
if self.tree is None:
|
|
585
|
+
raise RuntimeError("Tree not initialized!")
|
|
586
|
+
self.reg = self.tree.getroot()
|
|
587
|
+
|
|
588
|
+
# Preprocess the tree in one of the following ways:
|
|
589
|
+
# - either merge a set of APIs to another API based on their 'api' attributes
|
|
590
|
+
# - or remove all elements with non-matching 'api' attributes
|
|
591
|
+
# The preprocessing happens through a breath-first tree traversal.
|
|
592
|
+
# This is a blunt hammer, but eliminates the need to track and test
|
|
593
|
+
# the apis deeper in processing to select the correct elements and
|
|
594
|
+
# avoid duplicates.
|
|
595
|
+
# Schema validation should prevent duplicate elements with
|
|
596
|
+
# overlapping api attributes, or where one element has an api
|
|
597
|
+
# attribute and the other does not.
|
|
598
|
+
|
|
599
|
+
if self.genOpts.mergeApiNames:
|
|
600
|
+
mergeAPIs(self.reg, self.genOpts.mergeApiNames.split(','), self.genOpts.apiname)
|
|
601
|
+
else:
|
|
602
|
+
stripNonmatchingAPIs(self.reg, self.genOpts.apiname, actuallyDelete = True)
|
|
603
|
+
|
|
604
|
+
self.aliasdict = {}
|
|
605
|
+
self.enumvaluedict = {}
|
|
606
|
+
|
|
607
|
+
# Create dictionary of registry types from toplevel <types> tags
|
|
608
|
+
# and add 'name' attribute to each <type> tag (where missing)
|
|
609
|
+
# based on its <name> element.
|
|
610
|
+
#
|
|
611
|
+
# There is usually one <types> block; more are OK
|
|
612
|
+
# Required <type> attributes: 'name' or nested <name> tag contents
|
|
613
|
+
self.typedict = {}
|
|
614
|
+
for type_elem in self.reg.findall('types/type'):
|
|
615
|
+
# If the <type> does not already have a 'name' attribute, set
|
|
616
|
+
# it from contents of its <name> tag.
|
|
617
|
+
name = type_elem.get('name')
|
|
618
|
+
if name is None:
|
|
619
|
+
name_elem = type_elem.find('name')
|
|
620
|
+
if name_elem is None or not name_elem.text:
|
|
621
|
+
raise RuntimeError("Type without a name!")
|
|
622
|
+
name = name_elem.text
|
|
623
|
+
type_elem.set('name', name)
|
|
624
|
+
self.addElementInfo(type_elem, TypeInfo(type_elem), 'type', self.typedict)
|
|
625
|
+
|
|
626
|
+
# Record alias, if any
|
|
627
|
+
alias = type_elem.get('alias')
|
|
628
|
+
if alias:
|
|
629
|
+
self.aliasdict[name] = alias
|
|
630
|
+
|
|
631
|
+
# Create dictionary of registry enum groups from <enums> tags.
|
|
632
|
+
#
|
|
633
|
+
# Required <enums> attributes: 'name'. If no name is given, one is
|
|
634
|
+
# generated, but that group cannot be identified and turned into an
|
|
635
|
+
# enum type definition - it is just a container for <enum> tags.
|
|
636
|
+
self.groupdict = {}
|
|
637
|
+
for group in self.reg.findall('enums'):
|
|
638
|
+
self.addElementInfo(group, GroupInfo(group), 'group', self.groupdict)
|
|
639
|
+
|
|
640
|
+
# Create dictionary of registry enums from <enum> tags
|
|
641
|
+
#
|
|
642
|
+
# <enums> tags usually define different namespaces for the values
|
|
643
|
+
# defined in those tags, but the actual names all share the
|
|
644
|
+
# same dictionary.
|
|
645
|
+
# Required <enum> attributes: 'name', 'value'
|
|
646
|
+
# For containing <enums> which have type="enum" or type="bitmask",
|
|
647
|
+
# tag all contained <enum>s are required. This is a stopgap until
|
|
648
|
+
# a better scheme for tagging core and extension enums is created.
|
|
649
|
+
self.enumdict = {}
|
|
650
|
+
for enums in self.reg.findall('enums'):
|
|
651
|
+
required = (enums.get('type') is not None)
|
|
652
|
+
type_name = enums.get('name')
|
|
653
|
+
# Enum values are defined only for the type that is not aliased to something else.
|
|
654
|
+
assert(type_name not in self.aliasdict)
|
|
655
|
+
for enum in enums.findall('enum'):
|
|
656
|
+
enumInfo = EnumInfo(enum)
|
|
657
|
+
enumInfo.required = required
|
|
658
|
+
self.addElementInfo(enum, enumInfo, 'enum', self.enumdict)
|
|
659
|
+
self.addEnumValue(enum, type_name)
|
|
660
|
+
|
|
661
|
+
# Create dictionary of registry commands from <command> tags
|
|
662
|
+
# and add 'name' attribute to each <command> tag (where missing)
|
|
663
|
+
# based on its <proto><name> element.
|
|
664
|
+
#
|
|
665
|
+
# There is usually only one <commands> block; more are OK.
|
|
666
|
+
# Required <command> attributes: 'name' or <proto><name> tag contents
|
|
667
|
+
self.cmddict = {}
|
|
668
|
+
# List of commands which alias others. Contains
|
|
669
|
+
# [ name, aliasName, element ]
|
|
670
|
+
# for each alias
|
|
671
|
+
cmdAlias = []
|
|
672
|
+
for cmd in self.reg.findall('commands/command'):
|
|
673
|
+
# If the <command> does not already have a 'name' attribute, set
|
|
674
|
+
# it from contents of its <proto><name> tag.
|
|
675
|
+
name = cmd.get('name')
|
|
676
|
+
if name is None:
|
|
677
|
+
name_elem = cmd.find('proto/name')
|
|
678
|
+
if name_elem is None or not name_elem.text:
|
|
679
|
+
raise RuntimeError("Command without a name!")
|
|
680
|
+
name = cmd.set('name', name_elem.text)
|
|
681
|
+
ci = CmdInfo(cmd)
|
|
682
|
+
self.addElementInfo(cmd, ci, 'command', self.cmddict)
|
|
683
|
+
alias = cmd.get('alias')
|
|
684
|
+
if alias:
|
|
685
|
+
cmdAlias.append([name, alias, cmd])
|
|
686
|
+
self.aliasdict[name] = alias
|
|
687
|
+
|
|
688
|
+
# Now loop over aliases, injecting a copy of the aliased command's
|
|
689
|
+
# Element with the aliased prototype name replaced with the command
|
|
690
|
+
# name - if it exists.
|
|
691
|
+
# Copy the 'export' sttribute (whether it exists or not) from the
|
|
692
|
+
# original, aliased command, since that can be different for a
|
|
693
|
+
# command and its alias.
|
|
694
|
+
for (name, alias, cmd) in cmdAlias:
|
|
695
|
+
if alias in self.cmddict:
|
|
696
|
+
aliasInfo = self.cmddict[alias]
|
|
697
|
+
cmdElem = copy.deepcopy(aliasInfo.elem)
|
|
698
|
+
cmdElem.find('proto/name').text = name
|
|
699
|
+
cmdElem.set('name', name)
|
|
700
|
+
cmdElem.set('alias', alias)
|
|
701
|
+
export = cmd.get('export')
|
|
702
|
+
if export is not None:
|
|
703
|
+
# Replicate the command's 'export' attribute
|
|
704
|
+
cmdElem.set('export', export)
|
|
705
|
+
elif cmdElem.get('export') is not None:
|
|
706
|
+
# Remove the 'export' attribute, if the alias has one but
|
|
707
|
+
# the command does not.
|
|
708
|
+
del cmdElem.attrib['export']
|
|
709
|
+
ci = CmdInfo(cmdElem)
|
|
710
|
+
# Replace the dictionary entry for the CmdInfo element
|
|
711
|
+
self.cmddict[name] = ci
|
|
712
|
+
|
|
713
|
+
# @ newString = etree.tostring(base, encoding="unicode").replace(aliasValue, aliasName)
|
|
714
|
+
# @elem.append(etree.fromstring(replacement))
|
|
715
|
+
else:
|
|
716
|
+
self.gen.logMsg('warn', 'No matching <command> found for command',
|
|
717
|
+
cmd.get('name'), 'alias', alias)
|
|
718
|
+
|
|
719
|
+
# Create dictionaries of API and extension interfaces
|
|
720
|
+
# from toplevel <api> and <extension> tags.
|
|
721
|
+
self.apidict = {}
|
|
722
|
+
format_condition = dict()
|
|
723
|
+
for feature in self.reg.findall('feature'):
|
|
724
|
+
featureInfo = FeatureInfo(feature)
|
|
725
|
+
self.addElementInfo(feature, featureInfo, 'feature', self.apidict)
|
|
726
|
+
|
|
727
|
+
# Add additional enums defined only in <feature> tags
|
|
728
|
+
# to the corresponding enumerated type.
|
|
729
|
+
# When seen here, the <enum> element, processed to contain the
|
|
730
|
+
# numeric enum value, is added to the corresponding <enums>
|
|
731
|
+
# element, as well as adding to the enum dictionary. It is no
|
|
732
|
+
# longer removed from the <require> element it is introduced in.
|
|
733
|
+
# Instead, generateRequiredInterface ignores <enum> elements
|
|
734
|
+
# that extend enumerated types.
|
|
735
|
+
#
|
|
736
|
+
# For <enum> tags which are actually just constants, if there is
|
|
737
|
+
# no 'extends' tag but there is a 'value' or 'bitpos' tag, just
|
|
738
|
+
# add an EnumInfo record to the dictionary. That works because
|
|
739
|
+
# output generation of constants is purely dependency-based, and
|
|
740
|
+
# does not need to iterate through the XML tags.
|
|
741
|
+
for elem in feature.findall('require'):
|
|
742
|
+
for enum in elem.findall('enum'):
|
|
743
|
+
addEnumInfo = False
|
|
744
|
+
groupName = enum.get('extends')
|
|
745
|
+
if groupName is not None:
|
|
746
|
+
# self.gen.logMsg('diag', 'Found extension enum',
|
|
747
|
+
# enum.get('name'))
|
|
748
|
+
# Add version number attribute to the <enum> element
|
|
749
|
+
enum.set('version', featureInfo.version)
|
|
750
|
+
# Look up the GroupInfo with matching groupName
|
|
751
|
+
if groupName in self.groupdict:
|
|
752
|
+
# self.gen.logMsg('diag', 'Matching group',
|
|
753
|
+
# groupName, 'found, adding element...')
|
|
754
|
+
gi = self.groupdict[groupName]
|
|
755
|
+
gi.elem.append(copy.deepcopy(enum))
|
|
756
|
+
else:
|
|
757
|
+
self.gen.logMsg('warn', 'NO matching group',
|
|
758
|
+
groupName, 'for enum', enum.get('name'), 'found.')
|
|
759
|
+
if groupName == "VkFormat":
|
|
760
|
+
format_name = enum.get('name')
|
|
761
|
+
if enum.get('alias'):
|
|
762
|
+
format_name = enum.get('alias')
|
|
763
|
+
format_condition[format_name] = featureInfo.name
|
|
764
|
+
addEnumInfo = True
|
|
765
|
+
elif enum.get('value') or enum.get('bitpos') or enum.get('alias'):
|
|
766
|
+
# self.gen.logMsg('diag', 'Adding extension constant "enum"',
|
|
767
|
+
# enum.get('name'))
|
|
768
|
+
addEnumInfo = True
|
|
769
|
+
if addEnumInfo:
|
|
770
|
+
enumInfo = EnumInfo(enum)
|
|
771
|
+
self.addElementInfo(enum, enumInfo, 'enum', self.enumdict)
|
|
772
|
+
self.addEnumValue(enum, groupName)
|
|
773
|
+
|
|
774
|
+
sync_pipeline_stage_condition = dict()
|
|
775
|
+
sync_access_condition = dict()
|
|
776
|
+
|
|
777
|
+
self.extensions = self.reg.findall('extensions/extension')
|
|
778
|
+
self.extdict = {}
|
|
779
|
+
for feature in self.extensions:
|
|
780
|
+
featureInfo = FeatureInfo(feature)
|
|
781
|
+
self.addElementInfo(feature, featureInfo, 'extension', self.extdict)
|
|
782
|
+
|
|
783
|
+
# Add additional enums defined only in <extension> tags
|
|
784
|
+
# to the corresponding core type.
|
|
785
|
+
# Algorithm matches that of enums in a "feature" tag as above.
|
|
786
|
+
#
|
|
787
|
+
# This code also adds a 'extnumber' attribute containing the
|
|
788
|
+
# extension number, used for enumerant value calculation.
|
|
789
|
+
for elem in feature.findall('require'):
|
|
790
|
+
for enum in elem.findall('enum'):
|
|
791
|
+
addEnumInfo = False
|
|
792
|
+
groupName = enum.get('extends')
|
|
793
|
+
if groupName is not None:
|
|
794
|
+
# self.gen.logMsg('diag', 'Found extension enum',
|
|
795
|
+
# enum.get('name'))
|
|
796
|
+
|
|
797
|
+
# Add <extension> block's extension number attribute to
|
|
798
|
+
# the <enum> element unless specified explicitly, such
|
|
799
|
+
# as when redefining an enum in another extension.
|
|
800
|
+
extnumber = enum.get('extnumber')
|
|
801
|
+
if not extnumber:
|
|
802
|
+
enum.set('extnumber', str(featureInfo.number))
|
|
803
|
+
|
|
804
|
+
enum.set('extname', featureInfo.name)
|
|
805
|
+
enum.set('supported', noneStr(featureInfo.supported))
|
|
806
|
+
# Look up the GroupInfo with matching groupName
|
|
807
|
+
if groupName in self.groupdict:
|
|
808
|
+
# self.gen.logMsg('diag', 'Matching group',
|
|
809
|
+
# groupName, 'found, adding element...')
|
|
810
|
+
gi = self.groupdict[groupName]
|
|
811
|
+
gi.elem.append(copy.deepcopy(enum))
|
|
812
|
+
else:
|
|
813
|
+
self.gen.logMsg('warn', 'NO matching group',
|
|
814
|
+
groupName, 'for enum', enum.get('name'), 'found.')
|
|
815
|
+
# This is Vulkan-specific
|
|
816
|
+
if groupName == "VkFormat":
|
|
817
|
+
format_name = enum.get('name')
|
|
818
|
+
if enum.get('alias'):
|
|
819
|
+
format_name = enum.get('alias')
|
|
820
|
+
if format_name in format_condition:
|
|
821
|
+
format_condition[format_name] += f",{featureInfo.name}"
|
|
822
|
+
else:
|
|
823
|
+
format_condition[format_name] = featureInfo.name
|
|
824
|
+
elif groupName == "VkPipelineStageFlagBits2":
|
|
825
|
+
stage_flag = enum.get('name')
|
|
826
|
+
if enum.get('alias'):
|
|
827
|
+
stage_flag = enum.get('alias')
|
|
828
|
+
featureName = elem.get('depends') if elem.get('depends') is not None else featureInfo.name
|
|
829
|
+
if stage_flag in sync_pipeline_stage_condition:
|
|
830
|
+
sync_pipeline_stage_condition[stage_flag] += f",{featureName}"
|
|
831
|
+
else:
|
|
832
|
+
sync_pipeline_stage_condition[stage_flag] = featureName
|
|
833
|
+
elif groupName == "VkAccessFlagBits2":
|
|
834
|
+
access_flag = enum.get('name')
|
|
835
|
+
if enum.get('alias'):
|
|
836
|
+
access_flag = enum.get('alias')
|
|
837
|
+
featureName = elem.get('depends') if elem.get('depends') is not None else featureInfo.name
|
|
838
|
+
if access_flag in sync_access_condition:
|
|
839
|
+
sync_access_condition[access_flag] += f",{featureName}"
|
|
840
|
+
else:
|
|
841
|
+
sync_access_condition[access_flag] = featureName
|
|
842
|
+
|
|
843
|
+
addEnumInfo = True
|
|
844
|
+
elif enum.get('value') or enum.get('bitpos') or enum.get('alias'):
|
|
845
|
+
# self.gen.logMsg('diag', 'Adding extension constant "enum"',
|
|
846
|
+
# enum.get('name'))
|
|
847
|
+
addEnumInfo = True
|
|
848
|
+
if addEnumInfo:
|
|
849
|
+
enumInfo = EnumInfo(enum)
|
|
850
|
+
self.addElementInfo(enum, enumInfo, 'enum', self.enumdict)
|
|
851
|
+
self.addEnumValue(enum, groupName)
|
|
852
|
+
|
|
853
|
+
# Parse out all spirv tags in dictionaries
|
|
854
|
+
# Use addElementInfo to catch duplicates
|
|
855
|
+
for spirv in self.reg.findall('spirvextensions/spirvextension'):
|
|
856
|
+
spirvInfo = SpirvInfo(spirv)
|
|
857
|
+
self.addElementInfo(spirv, spirvInfo, 'spirvextension', self.spirvextdict)
|
|
858
|
+
for spirv in self.reg.findall('spirvcapabilities/spirvcapability'):
|
|
859
|
+
spirvInfo = SpirvInfo(spirv)
|
|
860
|
+
self.addElementInfo(spirv, spirvInfo, 'spirvcapability', self.spirvcapdict)
|
|
861
|
+
|
|
862
|
+
for format in self.reg.findall('formats/format'):
|
|
863
|
+
condition = None
|
|
864
|
+
format_name = format.get('name')
|
|
865
|
+
if format_name in format_condition:
|
|
866
|
+
condition = format_condition[format_name]
|
|
867
|
+
formatInfo = FormatInfo(format, condition)
|
|
868
|
+
self.addElementInfo(format, formatInfo, 'format', self.formatsdict)
|
|
869
|
+
|
|
870
|
+
for stage in self.reg.findall('sync/syncstage'):
|
|
871
|
+
condition = None
|
|
872
|
+
stage_flag = stage.get('name')
|
|
873
|
+
if stage_flag in sync_pipeline_stage_condition:
|
|
874
|
+
condition = sync_pipeline_stage_condition[stage_flag]
|
|
875
|
+
syncInfo = SyncStageInfo(stage, condition)
|
|
876
|
+
self.addElementInfo(stage, syncInfo, 'syncstage', self.syncstagedict)
|
|
877
|
+
|
|
878
|
+
for access in self.reg.findall('sync/syncaccess'):
|
|
879
|
+
condition = None
|
|
880
|
+
access_flag = access.get('name')
|
|
881
|
+
if access_flag in sync_access_condition:
|
|
882
|
+
condition = sync_access_condition[access_flag]
|
|
883
|
+
syncInfo = SyncAccessInfo(access, condition)
|
|
884
|
+
self.addElementInfo(access, syncInfo, 'syncaccess', self.syncaccessdict)
|
|
885
|
+
|
|
886
|
+
for pipeline in self.reg.findall('sync/syncpipeline'):
|
|
887
|
+
syncInfo = SyncPipelineInfo(pipeline)
|
|
888
|
+
self.addElementInfo(pipeline, syncInfo, 'syncpipeline', self.syncpipelinedict)
|
|
889
|
+
|
|
890
|
+
def dumpReg(self, maxlen=120, filehandle=sys.stdout):
|
|
891
|
+
"""Dump all the dictionaries constructed from the Registry object.
|
|
892
|
+
|
|
893
|
+
Diagnostic to dump the dictionaries to specified file handle (default stdout).
|
|
894
|
+
Truncates type / enum / command elements to maxlen characters (default 120)"""
|
|
895
|
+
write('***************************************', file=filehandle)
|
|
896
|
+
write(' ** Dumping Registry contents **', file=filehandle)
|
|
897
|
+
write('***************************************', file=filehandle)
|
|
898
|
+
write('// Types', file=filehandle)
|
|
899
|
+
for name in self.typedict:
|
|
900
|
+
tobj = self.typedict[name]
|
|
901
|
+
write(' Type', name, '->', etree.tostring(tobj.elem)[0:maxlen], file=filehandle)
|
|
902
|
+
write('// Groups', file=filehandle)
|
|
903
|
+
for name in self.groupdict:
|
|
904
|
+
gobj = self.groupdict[name]
|
|
905
|
+
write(' Group', name, '->', etree.tostring(gobj.elem)[0:maxlen], file=filehandle)
|
|
906
|
+
write('// Enums', file=filehandle)
|
|
907
|
+
for name in self.enumdict:
|
|
908
|
+
eobj = self.enumdict[name]
|
|
909
|
+
write(' Enum', name, '->', etree.tostring(eobj.elem)[0:maxlen], file=filehandle)
|
|
910
|
+
write('// Commands', file=filehandle)
|
|
911
|
+
for name in self.cmddict:
|
|
912
|
+
cobj = self.cmddict[name]
|
|
913
|
+
write(' Command', name, '->', etree.tostring(cobj.elem)[0:maxlen], file=filehandle)
|
|
914
|
+
write('// APIs', file=filehandle)
|
|
915
|
+
for key in self.apidict:
|
|
916
|
+
write(' API Version ', key, '->',
|
|
917
|
+
etree.tostring(self.apidict[key].elem)[0:maxlen], file=filehandle)
|
|
918
|
+
write('// Extensions', file=filehandle)
|
|
919
|
+
for key in self.extdict:
|
|
920
|
+
write(' Extension', key, '->',
|
|
921
|
+
etree.tostring(self.extdict[key].elem)[0:maxlen], file=filehandle)
|
|
922
|
+
write('// SPIR-V', file=filehandle)
|
|
923
|
+
for key in self.spirvextdict:
|
|
924
|
+
write(' SPIR-V Extension', key, '->',
|
|
925
|
+
etree.tostring(self.spirvextdict[key].elem)[0:maxlen], file=filehandle)
|
|
926
|
+
for key in self.spirvcapdict:
|
|
927
|
+
write(' SPIR-V Capability', key, '->',
|
|
928
|
+
etree.tostring(self.spirvcapdict[key].elem)[0:maxlen], file=filehandle)
|
|
929
|
+
write('// VkFormat', file=filehandle)
|
|
930
|
+
for key in self.formatsdict:
|
|
931
|
+
write(' VkFormat', key, '->',
|
|
932
|
+
etree.tostring(self.formatsdict[key].elem)[0:maxlen], file=filehandle)
|
|
933
|
+
|
|
934
|
+
def markTypeRequired(self, typename, required):
|
|
935
|
+
"""Require (along with its dependencies) or remove (but not its dependencies) a type.
|
|
936
|
+
|
|
937
|
+
- typename - name of type
|
|
938
|
+
- required - boolean (to tag features as required or not)
|
|
939
|
+
"""
|
|
940
|
+
self.gen.logMsg('diag', 'tagging type:', typename, '-> required =', required)
|
|
941
|
+
|
|
942
|
+
# Get TypeInfo object for <type> tag corresponding to typename
|
|
943
|
+
typeinfo = self.lookupElementInfo(typename, self.typedict)
|
|
944
|
+
if typeinfo is not None:
|
|
945
|
+
if required:
|
|
946
|
+
# Tag type dependencies in 'alias' and 'required' attributes as
|
|
947
|
+
# required. This does not un-tag dependencies in a <remove>
|
|
948
|
+
# tag. See comments in markRequired() below for the reason.
|
|
949
|
+
for attrib_name in ['requires', 'alias']:
|
|
950
|
+
depname = typeinfo.elem.get(attrib_name)
|
|
951
|
+
if depname:
|
|
952
|
+
self.gen.logMsg('diag', 'Generating dependent type',
|
|
953
|
+
depname, 'for', attrib_name, 'type', typename)
|
|
954
|
+
# Do not recurse on self-referential structures.
|
|
955
|
+
if typename != depname:
|
|
956
|
+
self.markTypeRequired(depname, required)
|
|
957
|
+
else:
|
|
958
|
+
self.gen.logMsg('diag', 'type', typename, 'is self-referential')
|
|
959
|
+
# Tag types used in defining this type (e.g. in nested
|
|
960
|
+
# <type> tags)
|
|
961
|
+
# Look for <type> in entire <command> tree,
|
|
962
|
+
# not just immediate children
|
|
963
|
+
for subtype in typeinfo.elem.findall('.//type'):
|
|
964
|
+
self.gen.logMsg('diag', 'markRequired: type requires dependent <type>', subtype.text)
|
|
965
|
+
if typename != subtype.text:
|
|
966
|
+
self.markTypeRequired(subtype.text, required)
|
|
967
|
+
else:
|
|
968
|
+
self.gen.logMsg('diag', 'type', typename, 'is self-referential')
|
|
969
|
+
# Tag enums used in defining this type, for example in
|
|
970
|
+
# <member><name>member</name>[<enum>MEMBER_SIZE</enum>]</member>
|
|
971
|
+
for subenum in typeinfo.elem.findall('.//enum'):
|
|
972
|
+
self.gen.logMsg('diag', 'markRequired: type requires dependent <enum>', subenum.text)
|
|
973
|
+
self.markEnumRequired(subenum.text, required)
|
|
974
|
+
# Tag type dependency in 'bitvalues' attributes as
|
|
975
|
+
# required. This ensures that the bit values for a flag
|
|
976
|
+
# are emitted
|
|
977
|
+
depType = typeinfo.elem.get('bitvalues')
|
|
978
|
+
if depType:
|
|
979
|
+
self.gen.logMsg('diag', 'Generating bitflag type',
|
|
980
|
+
depType, 'for type', typename)
|
|
981
|
+
self.markTypeRequired(depType, required)
|
|
982
|
+
group = self.lookupElementInfo(depType, self.groupdict)
|
|
983
|
+
if group is not None:
|
|
984
|
+
group.flagType = typeinfo
|
|
985
|
+
|
|
986
|
+
typeinfo.required = required
|
|
987
|
+
elif '.h' not in typename:
|
|
988
|
+
self.gen.logMsg('warn', 'type:', typename, 'IS NOT DEFINED')
|
|
989
|
+
|
|
990
|
+
def markEnumRequired(self, enumname, required):
|
|
991
|
+
"""Mark an enum as required or not.
|
|
992
|
+
|
|
993
|
+
- enumname - name of enum
|
|
994
|
+
- required - boolean (to tag features as required or not)"""
|
|
995
|
+
|
|
996
|
+
self.gen.logMsg('diag', 'markEnumRequired: tagging enum:', enumname, '-> required =', required)
|
|
997
|
+
enum = self.lookupElementInfo(enumname, self.enumdict)
|
|
998
|
+
if enum is not None:
|
|
999
|
+
# If the enum is part of a group, and is being removed, then
|
|
1000
|
+
# look it up in that <enums> tag and remove the Element there,
|
|
1001
|
+
# so that it is not visible to generators (which traverse the
|
|
1002
|
+
# <enums> tag elements rather than using the dictionaries).
|
|
1003
|
+
if not required:
|
|
1004
|
+
groupName = enum.elem.get('extends')
|
|
1005
|
+
if groupName is not None:
|
|
1006
|
+
self.gen.logMsg('diag', f'markEnumRequired: Removing extending enum {enum.elem.get("name")}')
|
|
1007
|
+
|
|
1008
|
+
# Look up the Info with matching groupName
|
|
1009
|
+
if groupName in self.groupdict:
|
|
1010
|
+
gi = self.groupdict[groupName]
|
|
1011
|
+
gienum = gi.elem.find(f"enum[@name='{enumname}']")
|
|
1012
|
+
if gienum is not None:
|
|
1013
|
+
# Remove copy of this enum from the group
|
|
1014
|
+
gi.elem.remove(gienum)
|
|
1015
|
+
else:
|
|
1016
|
+
self.gen.logMsg('warn', 'markEnumRequired: Cannot remove enum',
|
|
1017
|
+
enumname, 'not found in group',
|
|
1018
|
+
groupName)
|
|
1019
|
+
else:
|
|
1020
|
+
self.gen.logMsg('warn', 'markEnumRequired: Cannot remove enum',
|
|
1021
|
+
enumname, 'from nonexistent group',
|
|
1022
|
+
groupName)
|
|
1023
|
+
else:
|
|
1024
|
+
# This enum is not an extending enum.
|
|
1025
|
+
# The XML tree must be searched for all <enums> that
|
|
1026
|
+
# might have it, so we know the parent to delete from.
|
|
1027
|
+
|
|
1028
|
+
enumName = enum.elem.get('name')
|
|
1029
|
+
|
|
1030
|
+
self.gen.logMsg('diag', f'markEnumRequired: Removing non-extending enum {enumName}')
|
|
1031
|
+
|
|
1032
|
+
count = 0
|
|
1033
|
+
for enums in self.reg.findall('enums'):
|
|
1034
|
+
for thisEnum in enums.findall('enum'):
|
|
1035
|
+
if thisEnum.get('name') == enumName:
|
|
1036
|
+
# Actually remove it
|
|
1037
|
+
count = count + 1
|
|
1038
|
+
enums.remove(thisEnum)
|
|
1039
|
+
|
|
1040
|
+
if count == 0:
|
|
1041
|
+
self.gen.logMsg('warn', f'markEnumRequired: {enumName}) not found in any <enums> tag')
|
|
1042
|
+
|
|
1043
|
+
enum.required = required
|
|
1044
|
+
# Tag enum dependencies in 'alias' attribute as required
|
|
1045
|
+
depname = enum.elem.get('alias')
|
|
1046
|
+
if depname:
|
|
1047
|
+
self.gen.logMsg('diag', 'markEnumRequired: Generating dependent enum',
|
|
1048
|
+
depname, 'for alias', enumname, 'required =', enum.required)
|
|
1049
|
+
self.markEnumRequired(depname, required)
|
|
1050
|
+
else:
|
|
1051
|
+
self.gen.logMsg('warn', f'markEnumRequired: {enumname} IS NOT DEFINED')
|
|
1052
|
+
|
|
1053
|
+
def markCmdRequired(self, cmdname, required):
|
|
1054
|
+
"""Mark a command as required or not.
|
|
1055
|
+
|
|
1056
|
+
- cmdname - name of command
|
|
1057
|
+
- required - boolean (to tag features as required or not)"""
|
|
1058
|
+
self.gen.logMsg('diag', 'tagging command:', cmdname, '-> required =', required)
|
|
1059
|
+
cmd = self.lookupElementInfo(cmdname, self.cmddict)
|
|
1060
|
+
if cmd is not None:
|
|
1061
|
+
cmd.required = required
|
|
1062
|
+
|
|
1063
|
+
# Tag command dependencies in 'alias' attribute as required
|
|
1064
|
+
#
|
|
1065
|
+
# This is usually not done, because command 'aliases' are not
|
|
1066
|
+
# actual C language aliases like type and enum aliases. Instead
|
|
1067
|
+
# they are just duplicates of the function signature of the
|
|
1068
|
+
# alias. This means that there is no dependency of a command
|
|
1069
|
+
# alias on what it aliases. One exception is validity includes,
|
|
1070
|
+
# where the spec markup needs the promoted-to validity include
|
|
1071
|
+
# even if only the promoted-from command is being built.
|
|
1072
|
+
if self.genOpts.requireCommandAliases:
|
|
1073
|
+
depname = cmd.elem.get('alias')
|
|
1074
|
+
if depname:
|
|
1075
|
+
self.gen.logMsg('diag', 'Generating dependent command',
|
|
1076
|
+
depname, 'for alias', cmdname)
|
|
1077
|
+
self.markCmdRequired(depname, required)
|
|
1078
|
+
|
|
1079
|
+
# Tag all parameter types of this command as required.
|
|
1080
|
+
# This does not remove types of commands in a <remove>
|
|
1081
|
+
# tag, because many other commands may use the same type.
|
|
1082
|
+
# We could be more clever and reference count types,
|
|
1083
|
+
# instead of using a boolean.
|
|
1084
|
+
if required:
|
|
1085
|
+
# Look for <type> in entire <command> tree,
|
|
1086
|
+
# not just immediate children
|
|
1087
|
+
for type_elem in cmd.elem.findall('.//type'):
|
|
1088
|
+
self.gen.logMsg('diag', 'markRequired: command implicitly requires dependent type', type_elem.text)
|
|
1089
|
+
self.markTypeRequired(type_elem.text, required)
|
|
1090
|
+
else:
|
|
1091
|
+
self.gen.logMsg('warn', 'command:', cmdname, 'IS NOT DEFINED')
|
|
1092
|
+
|
|
1093
|
+
def markRequired(self, featurename, feature, required):
|
|
1094
|
+
"""Require or remove features specified in the Element.
|
|
1095
|
+
|
|
1096
|
+
- featurename - name of the feature
|
|
1097
|
+
- feature - Element for `<require>` or `<remove>` tag
|
|
1098
|
+
- required - boolean (to tag features as required or not)"""
|
|
1099
|
+
self.gen.logMsg('diag', 'markRequired (feature = <too long to print>, required =', required, ')')
|
|
1100
|
+
|
|
1101
|
+
# Loop over types, enums, and commands in the tag
|
|
1102
|
+
# @@ It would be possible to respect 'api' and 'profile' attributes
|
|
1103
|
+
# in individual features, but that is not done yet.
|
|
1104
|
+
for typeElem in feature.findall('type'):
|
|
1105
|
+
self.markTypeRequired(typeElem.get('name'), required)
|
|
1106
|
+
for enumElem in feature.findall('enum'):
|
|
1107
|
+
self.markEnumRequired(enumElem.get('name'), required)
|
|
1108
|
+
|
|
1109
|
+
for cmdElem in feature.findall('command'):
|
|
1110
|
+
self.markCmdRequired(cmdElem.get('name'), required)
|
|
1111
|
+
|
|
1112
|
+
# Extensions may need to extend existing commands or other items in the future.
|
|
1113
|
+
# So, look for extend tags.
|
|
1114
|
+
for extendElem in feature.findall('extend'):
|
|
1115
|
+
extendType = extendElem.get('type')
|
|
1116
|
+
if extendType == 'command':
|
|
1117
|
+
commandName = extendElem.get('name')
|
|
1118
|
+
successExtends = extendElem.get('successcodes')
|
|
1119
|
+
if successExtends is not None:
|
|
1120
|
+
for success in successExtends.split(','):
|
|
1121
|
+
self.commandextensionsuccesses.append(self.commandextensiontuple(command=commandName,
|
|
1122
|
+
value=success,
|
|
1123
|
+
extension=featurename))
|
|
1124
|
+
errorExtends = extendElem.get('errorcodes')
|
|
1125
|
+
if errorExtends is not None:
|
|
1126
|
+
for error in errorExtends.split(','):
|
|
1127
|
+
self.commandextensionerrors.append(self.commandextensiontuple(command=commandName,
|
|
1128
|
+
value=error,
|
|
1129
|
+
extension=featurename))
|
|
1130
|
+
else:
|
|
1131
|
+
self.gen.logMsg('warn', 'extend type:', extendType, 'IS NOT SUPPORTED')
|
|
1132
|
+
|
|
1133
|
+
def getAlias(self, elem, dict):
|
|
1134
|
+
"""Check for an alias in the same require block.
|
|
1135
|
+
|
|
1136
|
+
- elem - Element to check for an alias"""
|
|
1137
|
+
|
|
1138
|
+
# Try to find an alias
|
|
1139
|
+
alias = elem.get('alias')
|
|
1140
|
+
if alias is None:
|
|
1141
|
+
name = elem.get('name')
|
|
1142
|
+
typeinfo = self.lookupElementInfo(name, dict)
|
|
1143
|
+
if not typeinfo:
|
|
1144
|
+
self.gen.logMsg('error', name, 'is not a known name')
|
|
1145
|
+
alias = typeinfo.elem.get('alias')
|
|
1146
|
+
|
|
1147
|
+
return alias
|
|
1148
|
+
|
|
1149
|
+
def checkForCorrectionAliases(self, alias, require, tag):
|
|
1150
|
+
"""Check for an alias in the same require block.
|
|
1151
|
+
|
|
1152
|
+
- alias - String name of the alias
|
|
1153
|
+
- require - `<require>` block from the registry
|
|
1154
|
+
- tag - tag to look for in the require block"""
|
|
1155
|
+
|
|
1156
|
+
# For the time being, the code below is bypassed. It has the effect
|
|
1157
|
+
# of excluding "spelling aliases" created to comply with the style
|
|
1158
|
+
# guide, but this leaves references out of the specification and
|
|
1159
|
+
# causes broken internal links.
|
|
1160
|
+
#
|
|
1161
|
+
# if alias and require.findall(tag + "[@name='" + alias + "']"):
|
|
1162
|
+
# return True
|
|
1163
|
+
|
|
1164
|
+
return False
|
|
1165
|
+
|
|
1166
|
+
def fillFeatureDictionary(self, interface, featurename, api, profile):
|
|
1167
|
+
"""Capture added interfaces for a `<version>` or `<extension>`.
|
|
1168
|
+
|
|
1169
|
+
- interface - Element for `<version>` or `<extension>`, containing
|
|
1170
|
+
`<require>` and `<remove>` tags
|
|
1171
|
+
- featurename - name of the feature
|
|
1172
|
+
- api - string specifying API name being generated
|
|
1173
|
+
- profile - string specifying API profile being generated"""
|
|
1174
|
+
|
|
1175
|
+
# Explicitly initialize known types - errors for unhandled categories
|
|
1176
|
+
self.gen.featureDictionary[featurename] = {
|
|
1177
|
+
"enumconstant": {},
|
|
1178
|
+
"command": {},
|
|
1179
|
+
"enum": {},
|
|
1180
|
+
"struct": {},
|
|
1181
|
+
"handle": {},
|
|
1182
|
+
"basetype": {},
|
|
1183
|
+
"include": {},
|
|
1184
|
+
"define": {},
|
|
1185
|
+
"bitmask": {},
|
|
1186
|
+
"union": {},
|
|
1187
|
+
"funcpointer": {},
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
# <require> marks things that are required by this version/profile
|
|
1191
|
+
for require in interface.findall('require'):
|
|
1192
|
+
if matchAPIProfile(api, profile, require):
|
|
1193
|
+
|
|
1194
|
+
# Determine the required extension or version needed for a require block
|
|
1195
|
+
# Assumes that only one of these is specified
|
|
1196
|
+
# 'extension', and therefore 'required_key', may be a boolean
|
|
1197
|
+
# expression of extension names.
|
|
1198
|
+
# 'required_key' is used only as a dictionary key at
|
|
1199
|
+
# present, and passed through to the script generators, so
|
|
1200
|
+
# they must be prepared to parse that boolean expression.
|
|
1201
|
+
required_key = require.get('depends')
|
|
1202
|
+
|
|
1203
|
+
# Loop over types, enums, and commands in the tag
|
|
1204
|
+
for typeElem in require.findall('type'):
|
|
1205
|
+
typename = typeElem.get('name')
|
|
1206
|
+
typeinfo = self.lookupElementInfo(typename, self.typedict)
|
|
1207
|
+
|
|
1208
|
+
if typeinfo:
|
|
1209
|
+
# Remove aliases in the same extension/feature; these are always added as a correction. Do not need the original to be visible.
|
|
1210
|
+
alias = self.getAlias(typeElem, self.typedict)
|
|
1211
|
+
if not self.checkForCorrectionAliases(alias, require, 'type'):
|
|
1212
|
+
# Resolve the type info to the actual type, so we get an accurate read for 'structextends'
|
|
1213
|
+
while alias:
|
|
1214
|
+
typeinfo = self.lookupElementInfo(alias, self.typedict)
|
|
1215
|
+
if not typeinfo:
|
|
1216
|
+
raise RuntimeError(f"Missing alias {alias}")
|
|
1217
|
+
alias = typeinfo.elem.get('alias')
|
|
1218
|
+
|
|
1219
|
+
typecat = typeinfo.elem.get('category')
|
|
1220
|
+
typeextends = typeinfo.elem.get('structextends')
|
|
1221
|
+
if not required_key in self.gen.featureDictionary[featurename][typecat]:
|
|
1222
|
+
self.gen.featureDictionary[featurename][typecat][required_key] = {}
|
|
1223
|
+
if not typeextends in self.gen.featureDictionary[featurename][typecat][required_key]:
|
|
1224
|
+
self.gen.featureDictionary[featurename][typecat][required_key][typeextends] = []
|
|
1225
|
+
self.gen.featureDictionary[featurename][typecat][required_key][typeextends].append(typename)
|
|
1226
|
+
else:
|
|
1227
|
+
self.gen.logMsg('warn', f'fillFeatureDictionary: NOT filling for {typename}')
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
for enumElem in require.findall('enum'):
|
|
1231
|
+
enumname = enumElem.get('name')
|
|
1232
|
+
typeinfo = self.lookupElementInfo(enumname, self.enumdict)
|
|
1233
|
+
|
|
1234
|
+
# Remove aliases in the same extension/feature; these are always added as a correction. Do not need the original to be visible.
|
|
1235
|
+
alias = self.getAlias(enumElem, self.enumdict)
|
|
1236
|
+
if not self.checkForCorrectionAliases(alias, require, 'enum'):
|
|
1237
|
+
enumextends = enumElem.get('extends')
|
|
1238
|
+
if not required_key in self.gen.featureDictionary[featurename]['enumconstant']:
|
|
1239
|
+
self.gen.featureDictionary[featurename]['enumconstant'][required_key] = {}
|
|
1240
|
+
if not enumextends in self.gen.featureDictionary[featurename]['enumconstant'][required_key]:
|
|
1241
|
+
self.gen.featureDictionary[featurename]['enumconstant'][required_key][enumextends] = []
|
|
1242
|
+
self.gen.featureDictionary[featurename]['enumconstant'][required_key][enumextends].append(enumname)
|
|
1243
|
+
else:
|
|
1244
|
+
self.gen.logMsg('warn', f'fillFeatureDictionary: NOT filling for {typename}')
|
|
1245
|
+
|
|
1246
|
+
for cmdElem in require.findall('command'):
|
|
1247
|
+
# Remove aliases in the same extension/feature; these are always added as a correction. Do not need the original to be visible.
|
|
1248
|
+
alias = self.getAlias(cmdElem, self.cmddict)
|
|
1249
|
+
if not self.checkForCorrectionAliases(alias, require, 'command'):
|
|
1250
|
+
if not required_key in self.gen.featureDictionary[featurename]['command']:
|
|
1251
|
+
self.gen.featureDictionary[featurename]['command'][required_key] = []
|
|
1252
|
+
self.gen.featureDictionary[featurename]['command'][required_key].append(cmdElem.get('name'))
|
|
1253
|
+
else:
|
|
1254
|
+
self.gen.logMsg('warn', f'fillFeatureDictionary: NOT filling for {typename}')
|
|
1255
|
+
|
|
1256
|
+
def requireFeatures(self, interface, featurename, api, profile):
|
|
1257
|
+
"""Process `<require>` tags for a `<version>` or `<extension>`.
|
|
1258
|
+
|
|
1259
|
+
- interface - Element for `<version>` or `<extension>`, containing
|
|
1260
|
+
`<require>` tags
|
|
1261
|
+
- featurename - name of the feature
|
|
1262
|
+
- api - string specifying API name being generated
|
|
1263
|
+
- profile - string specifying API profile being generated"""
|
|
1264
|
+
|
|
1265
|
+
# <require> marks things that are required by this version/profile
|
|
1266
|
+
for feature in interface.findall('require'):
|
|
1267
|
+
if matchAPIProfile(api, profile, feature):
|
|
1268
|
+
self.markRequired(featurename, feature, True)
|
|
1269
|
+
|
|
1270
|
+
def deprecateFeatures(self, interface, featurename, api, profile):
|
|
1271
|
+
"""Process `<require>` tags for a `<version>` or `<extension>`.
|
|
1272
|
+
|
|
1273
|
+
- interface - Element for `<version>` or `<extension>`, containing
|
|
1274
|
+
`<require>` tags
|
|
1275
|
+
- featurename - name of the feature
|
|
1276
|
+
- api - string specifying API name being generated
|
|
1277
|
+
- profile - string specifying API profile being generated"""
|
|
1278
|
+
|
|
1279
|
+
versionmatch = APIConventions().is_api_version_name(featurename)
|
|
1280
|
+
|
|
1281
|
+
# <deprecate> marks things that are deprecated by this version/profile
|
|
1282
|
+
for deprecation in interface.findall('deprecate'):
|
|
1283
|
+
if matchAPIProfile(api, profile, deprecation):
|
|
1284
|
+
for typeElem in deprecation.findall('type'):
|
|
1285
|
+
type = self.lookupElementInfo(typeElem.get('name'), self.typedict)
|
|
1286
|
+
if type:
|
|
1287
|
+
if versionmatch is not False:
|
|
1288
|
+
type.deprecatedbyversion = featurename
|
|
1289
|
+
else:
|
|
1290
|
+
type.deprecatedbyextensions.append(featurename)
|
|
1291
|
+
type.deprecatedlink = deprecation.get('explanationlink')
|
|
1292
|
+
else:
|
|
1293
|
+
self.gen.logMsg('error', typeElem.get('name'), ' is tagged for deprecation but not present in registry')
|
|
1294
|
+
for enumElem in deprecation.findall('enum'):
|
|
1295
|
+
enum = self.lookupElementInfo(enumElem.get('name'), self.enumdict)
|
|
1296
|
+
if enum:
|
|
1297
|
+
if versionmatch is not False:
|
|
1298
|
+
enum.deprecatedbyversion = featurename
|
|
1299
|
+
else:
|
|
1300
|
+
enum.deprecatedbyextensions.append(featurename)
|
|
1301
|
+
enum.deprecatedlink = deprecation.get('explanationlink')
|
|
1302
|
+
else:
|
|
1303
|
+
self.gen.logMsg('error', enumElem.get('name'), ' is tagged for deprecation but not present in registry')
|
|
1304
|
+
for cmdElem in deprecation.findall('command'):
|
|
1305
|
+
cmd = self.lookupElementInfo(cmdElem.get('name'), self.cmddict)
|
|
1306
|
+
if cmd:
|
|
1307
|
+
if versionmatch is not False:
|
|
1308
|
+
cmd.deprecatedbyversion = featurename
|
|
1309
|
+
else:
|
|
1310
|
+
cmd.deprecatedbyextensions.append(featurename)
|
|
1311
|
+
cmd.deprecatedlink = deprecation.get('explanationlink')
|
|
1312
|
+
else:
|
|
1313
|
+
self.gen.logMsg('error', cmdElem.get('name'), ' is tagged for deprecation but not present in registry')
|
|
1314
|
+
|
|
1315
|
+
def removeFeatures(self, interface, featurename, api, profile):
|
|
1316
|
+
"""Process `<remove>` tags for a `<version>` or `<extension>`.
|
|
1317
|
+
|
|
1318
|
+
- interface - Element for `<version>` or `<extension>`, containing
|
|
1319
|
+
`<remove>` tags
|
|
1320
|
+
- featurename - name of the feature
|
|
1321
|
+
- api - string specifying API name being generated
|
|
1322
|
+
- profile - string specifying API profile being generated"""
|
|
1323
|
+
|
|
1324
|
+
# <remove> marks things that are removed by this version/profile
|
|
1325
|
+
for feature in interface.findall('remove'):
|
|
1326
|
+
if matchAPIProfile(api, profile, feature):
|
|
1327
|
+
self.markRequired(featurename, feature, False)
|
|
1328
|
+
|
|
1329
|
+
def assignAdditionalValidity(self, interface, api, profile):
|
|
1330
|
+
# Loop over all usage inside all <require> tags.
|
|
1331
|
+
for feature in interface.findall('require'):
|
|
1332
|
+
if matchAPIProfile(api, profile, feature):
|
|
1333
|
+
for v in feature.findall('usage'):
|
|
1334
|
+
if v.get('command'):
|
|
1335
|
+
self.cmddict[v.get('command')].additionalValidity.append(copy.deepcopy(v))
|
|
1336
|
+
if v.get('struct'):
|
|
1337
|
+
self.typedict[v.get('struct')].additionalValidity.append(copy.deepcopy(v))
|
|
1338
|
+
|
|
1339
|
+
def removeAdditionalValidity(self, interface, api, profile):
|
|
1340
|
+
# Loop over all usage inside all <remove> tags.
|
|
1341
|
+
for feature in interface.findall('remove'):
|
|
1342
|
+
if matchAPIProfile(api, profile, feature):
|
|
1343
|
+
for v in feature.findall('usage'):
|
|
1344
|
+
if v.get('command'):
|
|
1345
|
+
self.cmddict[v.get('command')].removedValidity.append(copy.deepcopy(v))
|
|
1346
|
+
if v.get('struct'):
|
|
1347
|
+
self.typedict[v.get('struct')].removedValidity.append(copy.deepcopy(v))
|
|
1348
|
+
|
|
1349
|
+
def generateFeature(self, fname, ftype, dictionary, explicit=False):
|
|
1350
|
+
"""Generate a single type / enum group / enum / command,
|
|
1351
|
+
and all its dependencies as needed.
|
|
1352
|
+
|
|
1353
|
+
- fname - name of feature (`<type>`/`<enum>`/`<command>`)
|
|
1354
|
+
- ftype - type of feature, 'type' | 'enum' | 'command'
|
|
1355
|
+
- dictionary - of *Info objects - self.{type|enum|cmd}dict
|
|
1356
|
+
- explicit - True if this is explicitly required by the top-level
|
|
1357
|
+
XML <require> tag, False if it is a dependency of an explicit
|
|
1358
|
+
requirement."""
|
|
1359
|
+
|
|
1360
|
+
self.gen.logMsg('diag', 'generateFeature: generating', ftype, fname)
|
|
1361
|
+
|
|
1362
|
+
if not (explicit or self.genOpts.requireDepends):
|
|
1363
|
+
self.gen.logMsg('diag', 'generateFeature: NOT generating', ftype, fname, 'because generator does not require dependencies')
|
|
1364
|
+
return
|
|
1365
|
+
|
|
1366
|
+
f = self.lookupElementInfo(fname, dictionary)
|
|
1367
|
+
if f is None:
|
|
1368
|
+
# No such feature. This is an error, but reported earlier
|
|
1369
|
+
self.gen.logMsg('diag', 'No entry found for feature', fname,
|
|
1370
|
+
'returning!')
|
|
1371
|
+
return
|
|
1372
|
+
|
|
1373
|
+
# If feature is not required, or has already been declared, return
|
|
1374
|
+
if not f.required:
|
|
1375
|
+
self.gen.logMsg('diag', 'Skipping', ftype, fname, '(not required)')
|
|
1376
|
+
return
|
|
1377
|
+
if f.declared:
|
|
1378
|
+
self.gen.logMsg('diag', 'Skipping', ftype, fname, '(already declared)')
|
|
1379
|
+
return
|
|
1380
|
+
# Always mark feature declared, as though actually emitted
|
|
1381
|
+
f.declared = True
|
|
1382
|
+
|
|
1383
|
+
# Determine if this is an alias, and of what, if so
|
|
1384
|
+
alias = f.elem.get('alias')
|
|
1385
|
+
if alias:
|
|
1386
|
+
self.gen.logMsg('diag', fname, 'is an alias of', alias)
|
|
1387
|
+
|
|
1388
|
+
# Pull in dependent declaration(s) of the feature.
|
|
1389
|
+
# For types, there may be one type in the 'requires' attribute of
|
|
1390
|
+
# the element, one in the 'alias' attribute, and many in
|
|
1391
|
+
# embedded <type> and <enum> tags within the element.
|
|
1392
|
+
# For commands, there may be many in <type> tags within the element.
|
|
1393
|
+
# For enums, no dependencies are allowed (though perhaps if you
|
|
1394
|
+
# have a uint64 enum, it should require that type).
|
|
1395
|
+
genProc = None
|
|
1396
|
+
followupFeature = None
|
|
1397
|
+
if ftype == 'type':
|
|
1398
|
+
genProc = self.gen.genType
|
|
1399
|
+
|
|
1400
|
+
# Generate type dependencies in 'alias' and 'requires' attributes
|
|
1401
|
+
if alias:
|
|
1402
|
+
self.generateFeature(alias, 'type', self.typedict)
|
|
1403
|
+
requires = f.elem.get('requires')
|
|
1404
|
+
if requires:
|
|
1405
|
+
self.gen.logMsg('diag', 'Generating required dependent type',
|
|
1406
|
+
requires)
|
|
1407
|
+
self.generateFeature(requires, 'type', self.typedict)
|
|
1408
|
+
|
|
1409
|
+
# Generate types used in defining this type (e.g. in nested
|
|
1410
|
+
# <type> tags)
|
|
1411
|
+
# Look for <type> in entire <command> tree,
|
|
1412
|
+
# not just immediate children
|
|
1413
|
+
for subtype in f.elem.findall('.//type'):
|
|
1414
|
+
self.gen.logMsg('diag', 'Generating required dependent <type>',
|
|
1415
|
+
subtype.text)
|
|
1416
|
+
self.generateFeature(subtype.text, 'type', self.typedict)
|
|
1417
|
+
|
|
1418
|
+
# Generate enums used in defining this type, for example in
|
|
1419
|
+
# <member><name>member</name>[<enum>MEMBER_SIZE</enum>]</member>
|
|
1420
|
+
for subtype in f.elem.findall('.//enum'):
|
|
1421
|
+
self.gen.logMsg('diag', 'Generating required dependent <enum>',
|
|
1422
|
+
subtype.text)
|
|
1423
|
+
self.generateFeature(subtype.text, 'enum', self.enumdict)
|
|
1424
|
+
|
|
1425
|
+
# If the type is an enum group, look up the corresponding
|
|
1426
|
+
# group in the group dictionary and generate that instead.
|
|
1427
|
+
if f.elem.get('category') == 'enum':
|
|
1428
|
+
self.gen.logMsg('diag', 'Type', fname, 'is an enum group, so generate that instead')
|
|
1429
|
+
group = self.lookupElementInfo(fname, self.groupdict)
|
|
1430
|
+
if alias is not None:
|
|
1431
|
+
# An alias of another group name.
|
|
1432
|
+
# Pass to genGroup with 'alias' parameter = aliased name
|
|
1433
|
+
self.gen.logMsg('diag', 'Generating alias', fname,
|
|
1434
|
+
'for enumerated type', alias)
|
|
1435
|
+
# Now, pass the *aliased* GroupInfo to the genGroup, but
|
|
1436
|
+
# with an additional parameter which is the alias name.
|
|
1437
|
+
genProc = self.gen.genGroup
|
|
1438
|
+
f = self.lookupElementInfo(alias, self.groupdict)
|
|
1439
|
+
elif group is None:
|
|
1440
|
+
self.gen.logMsg('warn', 'Skipping enum type', fname,
|
|
1441
|
+
': No matching enumerant group')
|
|
1442
|
+
return
|
|
1443
|
+
else:
|
|
1444
|
+
genProc = self.gen.genGroup
|
|
1445
|
+
f = group
|
|
1446
|
+
|
|
1447
|
+
# @ The enum group is not ready for generation. At this
|
|
1448
|
+
# @ point, it contains all <enum> tags injected by
|
|
1449
|
+
# @ <extension> tags without any verification of whether
|
|
1450
|
+
# @ they are required or not. It may also contain
|
|
1451
|
+
# @ duplicates injected by multiple consistent
|
|
1452
|
+
# @ definitions of an <enum>.
|
|
1453
|
+
|
|
1454
|
+
# @ Pass over each enum, marking its enumdict[] entry as
|
|
1455
|
+
# @ required or not. Mark aliases of enums as required,
|
|
1456
|
+
# @ too.
|
|
1457
|
+
|
|
1458
|
+
enums = group.elem.findall('enum')
|
|
1459
|
+
|
|
1460
|
+
self.gen.logMsg('diag', 'generateFeature: checking enums for group', fname)
|
|
1461
|
+
|
|
1462
|
+
# Check for required enums, including aliases
|
|
1463
|
+
# LATER - Check for, report, and remove duplicates?
|
|
1464
|
+
enumAliases = []
|
|
1465
|
+
for elem in enums:
|
|
1466
|
+
name = elem.get('name')
|
|
1467
|
+
|
|
1468
|
+
required = False
|
|
1469
|
+
|
|
1470
|
+
extname = elem.get('extname')
|
|
1471
|
+
version = elem.get('version')
|
|
1472
|
+
if extname is not None:
|
|
1473
|
+
# 'supported' attribute was injected when the <enum> element was
|
|
1474
|
+
# moved into the <enums> group in Registry.parseTree()
|
|
1475
|
+
supported_list = elem.get('supported').split(",")
|
|
1476
|
+
if self.genOpts.defaultExtensions in supported_list:
|
|
1477
|
+
required = True
|
|
1478
|
+
elif re.match(self.genOpts.addExtensions, extname) is not None:
|
|
1479
|
+
required = True
|
|
1480
|
+
elif version is not None:
|
|
1481
|
+
required = re.match(self.genOpts.emitversions, version) is not None
|
|
1482
|
+
else:
|
|
1483
|
+
required = True
|
|
1484
|
+
|
|
1485
|
+
self.gen.logMsg('diag', '* required =', required, 'for', name)
|
|
1486
|
+
if required:
|
|
1487
|
+
# Mark this element as required (in the element, not the EnumInfo)
|
|
1488
|
+
elem.set('required', 'true')
|
|
1489
|
+
# If it is an alias, track that for later use
|
|
1490
|
+
enumAlias = elem.get('alias')
|
|
1491
|
+
if enumAlias:
|
|
1492
|
+
enumAliases.append(enumAlias)
|
|
1493
|
+
for elem in enums:
|
|
1494
|
+
name = elem.get('name')
|
|
1495
|
+
if name in enumAliases:
|
|
1496
|
+
elem.set('required', 'true')
|
|
1497
|
+
self.gen.logMsg('diag', '* also need to require alias', name)
|
|
1498
|
+
if f is None:
|
|
1499
|
+
raise RuntimeError("Should not get here")
|
|
1500
|
+
if f.elem.get('category') == 'bitmask':
|
|
1501
|
+
followupFeature = f.elem.get('bitvalues')
|
|
1502
|
+
elif ftype == 'command':
|
|
1503
|
+
# Generate command dependencies in 'alias' attribute
|
|
1504
|
+
if alias:
|
|
1505
|
+
self.generateFeature(alias, 'command', self.cmddict)
|
|
1506
|
+
|
|
1507
|
+
genProc = self.gen.genCmd
|
|
1508
|
+
for type_elem in f.elem.findall('.//type'):
|
|
1509
|
+
depname = type_elem.text
|
|
1510
|
+
self.gen.logMsg('diag', 'Generating required parameter type',
|
|
1511
|
+
depname)
|
|
1512
|
+
self.generateFeature(depname, 'type', self.typedict)
|
|
1513
|
+
elif ftype == 'enum':
|
|
1514
|
+
# Generate enum dependencies in 'alias' attribute
|
|
1515
|
+
if alias:
|
|
1516
|
+
self.generateFeature(alias, 'enum', self.enumdict)
|
|
1517
|
+
genProc = self.gen.genEnum
|
|
1518
|
+
|
|
1519
|
+
# Actually generate the type only if emitting declarations
|
|
1520
|
+
if self.emitFeatures:
|
|
1521
|
+
self.gen.logMsg('diag', 'Emitting', ftype, 'decl for', fname)
|
|
1522
|
+
if genProc is None:
|
|
1523
|
+
raise RuntimeError("genProc is None when we should be emitting")
|
|
1524
|
+
genProc(f, fname, alias)
|
|
1525
|
+
else:
|
|
1526
|
+
self.gen.logMsg('diag', 'Skipping', ftype, fname,
|
|
1527
|
+
'(should not be emitted)')
|
|
1528
|
+
|
|
1529
|
+
if followupFeature:
|
|
1530
|
+
self.gen.logMsg('diag', 'Generating required bitvalues <enum>',
|
|
1531
|
+
followupFeature)
|
|
1532
|
+
self.generateFeature(followupFeature, "type", self.typedict)
|
|
1533
|
+
|
|
1534
|
+
def generateRequiredInterface(self, interface):
|
|
1535
|
+
"""Generate all interfaces required by an API version or extension.
|
|
1536
|
+
|
|
1537
|
+
- interface - Element for `<version>` or `<extension>`"""
|
|
1538
|
+
|
|
1539
|
+
# Loop over all features inside all <require> tags.
|
|
1540
|
+
for features in interface.findall('require'):
|
|
1541
|
+
for t in features.findall('type'):
|
|
1542
|
+
self.generateFeature(t.get('name'), 'type', self.typedict, explicit=True)
|
|
1543
|
+
for e in features.findall('enum'):
|
|
1544
|
+
# If this is an enum extending an enumerated type, do not
|
|
1545
|
+
# generate it - this has already been done in reg.parseTree,
|
|
1546
|
+
# by copying this element into the enumerated type.
|
|
1547
|
+
enumextends = e.get('extends')
|
|
1548
|
+
if not enumextends:
|
|
1549
|
+
self.generateFeature(e.get('name'), 'enum', self.enumdict, explicit=True)
|
|
1550
|
+
for c in features.findall('command'):
|
|
1551
|
+
self.generateFeature(c.get('name'), 'command', self.cmddict, explicit=True)
|
|
1552
|
+
|
|
1553
|
+
def generateSpirv(self, spirv, dictionary):
|
|
1554
|
+
if spirv is None:
|
|
1555
|
+
self.gen.logMsg('diag', 'No entry found for element', name,
|
|
1556
|
+
'returning!')
|
|
1557
|
+
return
|
|
1558
|
+
|
|
1559
|
+
name = spirv.elem.get('name')
|
|
1560
|
+
# No known alias for spirv elements
|
|
1561
|
+
alias = None
|
|
1562
|
+
if spirv.emit:
|
|
1563
|
+
genProc = self.gen.genSpirv
|
|
1564
|
+
genProc(spirv, name, alias)
|
|
1565
|
+
|
|
1566
|
+
def stripUnsupportedAPIs(self, dictionary, attribute, supportedDictionary):
|
|
1567
|
+
"""Strip unsupported APIs from attributes of APIs.
|
|
1568
|
+
dictionary - *Info dictionary of APIs to be updated
|
|
1569
|
+
attribute - attribute name to look for in each API
|
|
1570
|
+
supportedDictionary - dictionary in which to look for supported
|
|
1571
|
+
API elements in the attribute"""
|
|
1572
|
+
|
|
1573
|
+
for key in dictionary:
|
|
1574
|
+
eleminfo = dictionary[key]
|
|
1575
|
+
attribstring = eleminfo.elem.get(attribute)
|
|
1576
|
+
if attribstring is not None:
|
|
1577
|
+
apis = []
|
|
1578
|
+
stripped = False
|
|
1579
|
+
for api in attribstring.split(','):
|
|
1580
|
+
##print('Checking API {} referenced by {}'.format(api, key))
|
|
1581
|
+
if api in supportedDictionary and supportedDictionary[api].required:
|
|
1582
|
+
apis.append(api)
|
|
1583
|
+
else:
|
|
1584
|
+
stripped = True
|
|
1585
|
+
##print('\t**STRIPPING API {} from {}'.format(api, key))
|
|
1586
|
+
|
|
1587
|
+
# Update the attribute after stripping stuff.
|
|
1588
|
+
# Could sort apis before joining, but it is not a clear win
|
|
1589
|
+
if stripped:
|
|
1590
|
+
eleminfo.elem.set(attribute, ','.join(apis))
|
|
1591
|
+
|
|
1592
|
+
def stripUnsupportedAPIsFromList(self, dictionary, supportedDictionary):
|
|
1593
|
+
"""Strip unsupported APIs from attributes of APIs.
|
|
1594
|
+
dictionary - dictionary of list of structure name strings
|
|
1595
|
+
supportedDictionary - dictionary in which to look for supported
|
|
1596
|
+
API elements in the attribute"""
|
|
1597
|
+
|
|
1598
|
+
for key in dictionary:
|
|
1599
|
+
attribstring = dictionary[key]
|
|
1600
|
+
if attribstring is not None:
|
|
1601
|
+
apis = []
|
|
1602
|
+
stripped = False
|
|
1603
|
+
for api in attribstring:
|
|
1604
|
+
##print('Checking API {} referenced by {}'.format(api, key))
|
|
1605
|
+
if supportedDictionary[api].required:
|
|
1606
|
+
apis.append(api)
|
|
1607
|
+
else:
|
|
1608
|
+
stripped = True
|
|
1609
|
+
##print('\t**STRIPPING API {} from {}'.format(api, key))
|
|
1610
|
+
|
|
1611
|
+
# Update the attribute after stripping stuff.
|
|
1612
|
+
# Could sort apis before joining, but it is not a clear win
|
|
1613
|
+
if stripped:
|
|
1614
|
+
dictionary[key] = apis
|
|
1615
|
+
|
|
1616
|
+
def generateFormat(self, format, dictionary):
|
|
1617
|
+
if format is None:
|
|
1618
|
+
self.gen.logMsg('diag', 'No entry found for format element',
|
|
1619
|
+
'returning!')
|
|
1620
|
+
return
|
|
1621
|
+
|
|
1622
|
+
name = format.elem.get('name')
|
|
1623
|
+
# No known alias for VkFormat elements
|
|
1624
|
+
alias = None
|
|
1625
|
+
if format.emit:
|
|
1626
|
+
genProc = self.gen.genFormat
|
|
1627
|
+
genProc(format, name, alias)
|
|
1628
|
+
|
|
1629
|
+
def generateSyncStage(self, sync):
|
|
1630
|
+
genProc = self.gen.genSyncStage
|
|
1631
|
+
genProc(sync)
|
|
1632
|
+
|
|
1633
|
+
def generateSyncAccess(self, sync):
|
|
1634
|
+
genProc = self.gen.genSyncAccess
|
|
1635
|
+
genProc(sync)
|
|
1636
|
+
|
|
1637
|
+
def generateSyncPipeline(self, sync):
|
|
1638
|
+
genProc = self.gen.genSyncPipeline
|
|
1639
|
+
genProc(sync)
|
|
1640
|
+
|
|
1641
|
+
def tagValidExtensionStructs(self):
|
|
1642
|
+
"""Construct a "validextensionstructs" list for parent structures
|
|
1643
|
+
based on "structextends" tags in child structures.
|
|
1644
|
+
Only do this for structures tagged as required."""
|
|
1645
|
+
|
|
1646
|
+
for typeinfo in self.typedict.values():
|
|
1647
|
+
type_elem = typeinfo.elem
|
|
1648
|
+
if typeinfo.required and type_elem.get('category') == 'struct':
|
|
1649
|
+
struct_extends = type_elem.get('structextends')
|
|
1650
|
+
if struct_extends is not None:
|
|
1651
|
+
for parent in struct_extends.split(','):
|
|
1652
|
+
# self.gen.logMsg('diag', type_elem.get('name'), 'extends', parent)
|
|
1653
|
+
self.validextensionstructs[parent].append(type_elem.get('name'))
|
|
1654
|
+
|
|
1655
|
+
# Sort the lists so they do not depend on the XML order
|
|
1656
|
+
for parent in self.validextensionstructs:
|
|
1657
|
+
self.validextensionstructs[parent].sort()
|
|
1658
|
+
|
|
1659
|
+
def apiGen(self):
|
|
1660
|
+
"""Generate interface for specified versions using the current
|
|
1661
|
+
generator and generator options"""
|
|
1662
|
+
|
|
1663
|
+
self.gen.logMsg('diag', '*******************************************')
|
|
1664
|
+
self.gen.logMsg('diag', ' Registry.apiGen file:', self.genOpts.filename,
|
|
1665
|
+
'api:', self.genOpts.apiname,
|
|
1666
|
+
'profile:', self.genOpts.profile)
|
|
1667
|
+
self.gen.logMsg('diag', '*******************************************')
|
|
1668
|
+
|
|
1669
|
+
# Could reset required/declared flags for all features here.
|
|
1670
|
+
# This has been removed as never used. The initial motivation was
|
|
1671
|
+
# the idea of calling apiGen() repeatedly for different targets, but
|
|
1672
|
+
# this has never been done. The 20% or so build-time speedup that
|
|
1673
|
+
# might result is not worth the effort to make it actually work.
|
|
1674
|
+
#
|
|
1675
|
+
# self.apiReset()
|
|
1676
|
+
|
|
1677
|
+
# Compile regexps used to select versions & extensions
|
|
1678
|
+
regVersions = re.compile(self.genOpts.versions)
|
|
1679
|
+
regEmitVersions = re.compile(self.genOpts.emitversions)
|
|
1680
|
+
regAddExtensions = re.compile(self.genOpts.addExtensions)
|
|
1681
|
+
regRemoveExtensions = re.compile(self.genOpts.removeExtensions)
|
|
1682
|
+
regEmitExtensions = re.compile(self.genOpts.emitExtensions)
|
|
1683
|
+
regEmitSpirv = re.compile(self.genOpts.emitSpirv)
|
|
1684
|
+
regEmitFormats = re.compile(self.genOpts.emitFormats)
|
|
1685
|
+
|
|
1686
|
+
# Get all matching API feature names & add to list of FeatureInfo
|
|
1687
|
+
# Note we used to select on feature version attributes, not names.
|
|
1688
|
+
features = []
|
|
1689
|
+
apiMatch = False
|
|
1690
|
+
for key in self.apidict:
|
|
1691
|
+
fi = self.apidict[key]
|
|
1692
|
+
api = fi.elem.get('api')
|
|
1693
|
+
if apiNameMatch(self.genOpts.apiname, api):
|
|
1694
|
+
apiMatch = True
|
|
1695
|
+
if regVersions.match(fi.name):
|
|
1696
|
+
# Matches API & version #s being generated. Mark for
|
|
1697
|
+
# emission and add to the features[] list .
|
|
1698
|
+
# @@ Could use 'declared' instead of 'emit'?
|
|
1699
|
+
fi.emit = (regEmitVersions.match(fi.name) is not None)
|
|
1700
|
+
features.append(fi)
|
|
1701
|
+
if not fi.emit:
|
|
1702
|
+
self.gen.logMsg('diag', 'NOT tagging feature api =', api,
|
|
1703
|
+
'name =', fi.name, 'version =', fi.version,
|
|
1704
|
+
'for emission (does not match emitversions pattern)')
|
|
1705
|
+
else:
|
|
1706
|
+
self.gen.logMsg('diag', 'Including feature api =', api,
|
|
1707
|
+
'name =', fi.name, 'version =', fi.version,
|
|
1708
|
+
'for emission (matches emitversions pattern)')
|
|
1709
|
+
else:
|
|
1710
|
+
self.gen.logMsg('diag', 'NOT including feature api =', api,
|
|
1711
|
+
'name =', fi.name, 'version =', fi.version,
|
|
1712
|
+
'(does not match requested versions)')
|
|
1713
|
+
else:
|
|
1714
|
+
self.gen.logMsg('diag', 'NOT including feature api =', api,
|
|
1715
|
+
'name =', fi.name,
|
|
1716
|
+
'(does not match requested API)')
|
|
1717
|
+
if not apiMatch:
|
|
1718
|
+
self.gen.logMsg('warn', 'No matching API versions found!')
|
|
1719
|
+
|
|
1720
|
+
# Get all matching extensions, in order by their extension number,
|
|
1721
|
+
# and add to the list of features.
|
|
1722
|
+
# Start with extensions whose 'supported' attributes match the API
|
|
1723
|
+
# being generated. Add extensions matching the pattern specified in
|
|
1724
|
+
# regExtensions, then remove extensions matching the pattern
|
|
1725
|
+
# specified in regRemoveExtensions
|
|
1726
|
+
for (extName, ei) in sorted(self.extdict.items(), key=lambda x: x[1].number if x[1].number is not None else '0'):
|
|
1727
|
+
extName = ei.name
|
|
1728
|
+
include = False
|
|
1729
|
+
|
|
1730
|
+
# Include extension if defaultExtensions is not None and is
|
|
1731
|
+
# exactly matched by the 'supported' attribute.
|
|
1732
|
+
if apiNameMatch(self.genOpts.defaultExtensions,
|
|
1733
|
+
ei.elem.get('supported')):
|
|
1734
|
+
self.gen.logMsg('diag', 'Including extension',
|
|
1735
|
+
extName, "(defaultExtensions matches the 'supported' attribute)")
|
|
1736
|
+
include = True
|
|
1737
|
+
|
|
1738
|
+
# Include additional extensions if the extension name matches
|
|
1739
|
+
# the regexp specified in the generator options. This allows
|
|
1740
|
+
# forcing extensions into an interface even if they are not
|
|
1741
|
+
# tagged appropriately in the registry.
|
|
1742
|
+
# However, we still respect the 'supported' attribute.
|
|
1743
|
+
if regAddExtensions.match(extName) is not None:
|
|
1744
|
+
if not apiNameMatch(self.genOpts.apiname, ei.elem.get('supported')):
|
|
1745
|
+
self.gen.logMsg('diag', 'NOT including extension',
|
|
1746
|
+
extName, '(matches explicitly requested, but does not match the \'supported\' attribute)')
|
|
1747
|
+
include = False
|
|
1748
|
+
else:
|
|
1749
|
+
self.gen.logMsg('diag', 'Including extension',
|
|
1750
|
+
extName, '(matches explicitly requested extensions to add)')
|
|
1751
|
+
include = True
|
|
1752
|
+
# Remove extensions if the name matches the regexp specified
|
|
1753
|
+
# in generator options. This allows forcing removal of
|
|
1754
|
+
# extensions from an interface even if they are tagged that
|
|
1755
|
+
# way in the registry.
|
|
1756
|
+
if regRemoveExtensions.match(extName) is not None:
|
|
1757
|
+
self.gen.logMsg('diag', 'Removing extension',
|
|
1758
|
+
extName, '(matches explicitly requested extensions to remove)')
|
|
1759
|
+
include = False
|
|
1760
|
+
|
|
1761
|
+
# If the extension is to be included, add it to the
|
|
1762
|
+
# extension features list.
|
|
1763
|
+
if include:
|
|
1764
|
+
ei.emit = (regEmitExtensions.match(extName) is not None)
|
|
1765
|
+
features.append(ei)
|
|
1766
|
+
if not ei.emit:
|
|
1767
|
+
self.gen.logMsg('diag', 'NOT tagging extension',
|
|
1768
|
+
extName,
|
|
1769
|
+
'for emission (does not match emitextensions pattern)')
|
|
1770
|
+
|
|
1771
|
+
# Hack - can be removed when validity generator goes away
|
|
1772
|
+
# (Jon) I am not sure what this does, or if it should
|
|
1773
|
+
# respect the ei.emit flag above.
|
|
1774
|
+
self.requiredextensions.append(extName)
|
|
1775
|
+
else:
|
|
1776
|
+
self.gen.logMsg('diag', 'NOT including extension',
|
|
1777
|
+
extName, '(does not match api attribute or explicitly requested extensions)')
|
|
1778
|
+
|
|
1779
|
+
# Add all spirv elements to list
|
|
1780
|
+
# generators decide to emit them all or not
|
|
1781
|
+
# Currently no filtering as no client of these elements needs filtering
|
|
1782
|
+
spirvexts = []
|
|
1783
|
+
for key in self.spirvextdict:
|
|
1784
|
+
si = self.spirvextdict[key]
|
|
1785
|
+
si.emit = (regEmitSpirv.match(key) is not None)
|
|
1786
|
+
spirvexts.append(si)
|
|
1787
|
+
spirvcaps = []
|
|
1788
|
+
for key in self.spirvcapdict:
|
|
1789
|
+
si = self.spirvcapdict[key]
|
|
1790
|
+
si.emit = (regEmitSpirv.match(key) is not None)
|
|
1791
|
+
spirvcaps.append(si)
|
|
1792
|
+
|
|
1793
|
+
formats = []
|
|
1794
|
+
for key in self.formatsdict:
|
|
1795
|
+
si = self.formatsdict[key]
|
|
1796
|
+
si.emit = (regEmitFormats.match(key) is not None)
|
|
1797
|
+
formats.append(si)
|
|
1798
|
+
|
|
1799
|
+
# Sort the features list, if a sort procedure is defined
|
|
1800
|
+
if self.genOpts.sortProcedure:
|
|
1801
|
+
self.genOpts.sortProcedure(features)
|
|
1802
|
+
|
|
1803
|
+
# Passes 1+2: loop over requested API versions and extensions tagging
|
|
1804
|
+
# types/commands/features as required (in an <require> block) or no
|
|
1805
|
+
# longer required (in an <remove> block). <remove>s are processed
|
|
1806
|
+
# after all <require>s, so removals win.
|
|
1807
|
+
# If a profile other than 'None' is being generated, it must
|
|
1808
|
+
# match the profile attribute (if any) of the <require> and
|
|
1809
|
+
# <remove> tags.
|
|
1810
|
+
self.gen.logMsg('diag', 'PASS 1: TAG FEATURES')
|
|
1811
|
+
for f in features:
|
|
1812
|
+
self.gen.logMsg('diag', 'PASS 1: Tagging required and features for', f.name)
|
|
1813
|
+
self.fillFeatureDictionary(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
|
|
1814
|
+
self.requireFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
|
|
1815
|
+
self.deprecateFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
|
|
1816
|
+
self.assignAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile)
|
|
1817
|
+
|
|
1818
|
+
for f in features:
|
|
1819
|
+
self.gen.logMsg('diag', 'PASS 2: Tagging removed features for', f.name)
|
|
1820
|
+
self.removeFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile)
|
|
1821
|
+
self.removeAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile)
|
|
1822
|
+
|
|
1823
|
+
# Now, strip references to APIs that are not required.
|
|
1824
|
+
# At present such references may occur in:
|
|
1825
|
+
# Structs in <type category="struct"> 'structextends' attributes
|
|
1826
|
+
# Enums in <command> 'successcodes' and 'errorcodes' attributes
|
|
1827
|
+
self.stripUnsupportedAPIs(self.typedict, 'structextends', self.typedict)
|
|
1828
|
+
self.stripUnsupportedAPIs(self.cmddict, 'successcodes', self.enumdict)
|
|
1829
|
+
self.stripUnsupportedAPIs(self.cmddict, 'errorcodes', self.enumdict)
|
|
1830
|
+
self.stripUnsupportedAPIsFromList(self.validextensionstructs, self.typedict)
|
|
1831
|
+
|
|
1832
|
+
# Construct lists of valid extension structures
|
|
1833
|
+
self.tagValidExtensionStructs()
|
|
1834
|
+
|
|
1835
|
+
# @@May need to strip <spirvcapability> / <spirvextension> <enable>
|
|
1836
|
+
# tags of these forms:
|
|
1837
|
+
# <enable version="VK_API_VERSION_1_0"/>
|
|
1838
|
+
# <enable struct="VkPhysicalDeviceFeatures" feature="geometryShader" requires="VK_VERSION_1_0"/>
|
|
1839
|
+
# <enable extension="VK_KHR_shader_draw_parameters"/>
|
|
1840
|
+
# <enable property="VkPhysicalDeviceVulkan12Properties" member="shaderDenormPreserveFloat16" value="VK_TRUE" requires="VK_VERSION_1_2,VK_KHR_shader_float_controls"/>
|
|
1841
|
+
|
|
1842
|
+
# Pass 3: loop over specified API versions and extensions printing
|
|
1843
|
+
# declarations for required things which have not already been
|
|
1844
|
+
# generated.
|
|
1845
|
+
self.gen.logMsg('diag', 'PASS 3: GENERATE INTERFACES FOR FEATURES')
|
|
1846
|
+
self.gen.beginFile(self.genOpts)
|
|
1847
|
+
for f in features:
|
|
1848
|
+
self.gen.logMsg('diag', 'PASS 3: Generating interface for',
|
|
1849
|
+
f.name)
|
|
1850
|
+
emit = self.emitFeatures = f.emit
|
|
1851
|
+
if not emit:
|
|
1852
|
+
self.gen.logMsg('diag', 'PASS 3: NOT declaring feature',
|
|
1853
|
+
f.elem.get('name'), 'because it is not tagged for emission')
|
|
1854
|
+
# Generate the interface (or just tag its elements as having been
|
|
1855
|
+
# emitted, if they have not been).
|
|
1856
|
+
self.gen.beginFeature(f.elem, emit)
|
|
1857
|
+
self.generateRequiredInterface(f.elem)
|
|
1858
|
+
self.gen.endFeature()
|
|
1859
|
+
# Generate spirv elements
|
|
1860
|
+
for s in spirvexts:
|
|
1861
|
+
self.generateSpirv(s, self.spirvextdict)
|
|
1862
|
+
for s in spirvcaps:
|
|
1863
|
+
self.generateSpirv(s, self.spirvcapdict)
|
|
1864
|
+
for s in formats:
|
|
1865
|
+
self.generateFormat(s, self.formatsdict)
|
|
1866
|
+
for s in self.syncstagedict:
|
|
1867
|
+
self.generateSyncStage(self.syncstagedict[s])
|
|
1868
|
+
for s in self.syncaccessdict:
|
|
1869
|
+
self.generateSyncAccess(self.syncaccessdict[s])
|
|
1870
|
+
for s in self.syncpipelinedict:
|
|
1871
|
+
self.generateSyncPipeline(self.syncpipelinedict[s])
|
|
1872
|
+
self.gen.endFile()
|
|
1873
|
+
|
|
1874
|
+
def apiReset(self):
|
|
1875
|
+
"""Reset type/enum/command dictionaries before generating another API.
|
|
1876
|
+
|
|
1877
|
+
Use between apiGen() calls to reset internal state."""
|
|
1878
|
+
for datatype in self.typedict:
|
|
1879
|
+
self.typedict[datatype].resetState()
|
|
1880
|
+
for enum in self.enumdict:
|
|
1881
|
+
self.enumdict[enum].resetState()
|
|
1882
|
+
for cmd in self.cmddict:
|
|
1883
|
+
self.cmddict[cmd].resetState()
|
|
1884
|
+
for cmd in self.apidict:
|
|
1885
|
+
self.apidict[cmd].resetState()
|