├── bindings └── python │ ├── CMakeLists.txt │ ├── cc │ └── CMakeLists.txt │ ├── python │ └── flexflow │ │ ├── __init__.py │ │ └── op_attrs │ │ └── __init__.py │ └── old │ ├── flexflow │ ├── onnx │ │ └── __init__.py │ ├── torch │ │ ├── __init__.py │ │ └── nn │ │ │ ├── __init__.py │ │ │ └── modules │ │ │ └── __init__.py │ └── keras │ │ ├── datasets │ │ └── __init__.py │ │ ├── utils │ │ └── __init__.py │ │ └── preprocessing │ │ └── __init__.py │ ├── requirements.txt │ └── flexflow_python.py ├── lib ├── ffi │ └── src │ │ └── ffi.cc ├── utils │ ├── src │ │ ├── tuple.cc │ │ ├── dot_file.cc │ │ ├── hash-utils.cc │ │ ├── utils │ │ │ ├── expected.cc │ │ │ ├── fmt │ │ │ │ ├── map.cc │ │ │ │ ├── pair.cc │ │ │ │ ├── vector.cc │ │ │ │ ├── expected.cc │ │ │ │ ├── multiset.cc │ │ │ │ ├── variant.cc │ │ │ │ ├── unordered_map.cc │ │ │ │ ├── unordered_set.cc │ │ │ │ ├── unordered_multiset.cc │ │ │ │ ├── json.cc │ │ │ │ ├── half.cc │ │ │ │ ├── optional.cc │ │ │ │ ├── monostate.cc │ │ │ │ ├── tuple.cc │ │ │ │ └── set.cc │ │ │ ├── hash │ │ │ │ ├── set.cc │ │ │ │ ├── pair.cc │ │ │ │ ├── tuple.cc │ │ │ │ ├── multiset.cc │ │ │ │ ├── vector.cc │ │ │ │ ├── unordered_map.cc │ │ │ │ ├── unordered_set.cc │ │ │ │ └── unordered_multiset.cc │ │ │ ├── overload.cc │ │ │ ├── bidict │ │ │ │ ├── bidict.cc │ │ │ │ ├── generate_bidict.cc │ │ │ │ ├── algorithms │ │ │ │ │ ├── left_entries.cc │ │ │ │ │ ├── right_entries.cc │ │ │ │ │ ├── bidict_from_pairs.cc │ │ │ │ │ ├── merge_disjoint_bidicts.cc │ │ │ │ │ └── bidict_from_keys_and_values.cc │ │ │ │ └── try_merge_nondisjoint_bidicts.cc │ │ │ ├── check_fmtable.cc │ │ │ ├── json │ │ │ │ ├── optional.cc │ │ │ │ ├── is_jsonable.cc │ │ │ │ ├── check_is_jsonable.cc │ │ │ │ ├── is_json_serializable.cc │ │ │ │ ├── is_json_deserializable.cc │ │ │ │ ├── check_is_json_deserializable.cc │ │ │ │ ├── check_is_json_serializable.cc │ │ │ │ └── half.cc │ │ │ ├── containers │ │ │ │ ├── find.cc │ │ │ │ ├── keys.cc │ │ │ │ ├── sum.cc │ │ │ │ ├── all_of.cc │ │ │ │ ├── any_of.cc │ │ │ │ ├── extend.cc │ │ │ │ ├── filter.cc │ │ │ │ ├── flatmap.cc │ │ │ │ ├── foldl.cc │ │ │ │ ├── foldl1.cc │ │ │ │ ├── foldr1.cc │ │ │ │ ├── items.cc │ │ │ │ ├── maximum.cc │ │ │ │ ├── minimum.cc │ │ │ │ ├── product.cc │ │ │ │ ├── scanl.cc │ │ │ │ ├── set_of.cc │ │ │ │ ├── sorted.cc │ │ │ │ ├── try_at.cc │ │ │ │ ├── values.cc │ │ │ │ ├── contains.cc │ │ │ │ ├── get_only.cc │ │ │ │ ├── group_by.cc │ │ │ │ ├── index_of.cc │ │ │ │ ├── map_keys.cc │ │ │ │ ├── reversed.cc │ │ │ │ ├── set_minus.cc │ │ │ │ ├── set_union.cc │ │ │ │ ├── sorted_by.cc │ │ │ │ ├── sum_where.cc │ │ │ │ ├── transform.cc │ │ │ │ ├── value_all.cc │ │ │ │ ├── are_all_same.cc │ │ │ │ ├── are_disjoint.cc │ │ │ │ ├── compare_by.cc │ │ │ │ ├── contains_key.cc │ │ │ │ ├── filter_keys.cc │ │ │ │ ├── generate_map.cc │ │ │ │ ├── get_one_of.cc │ │ │ │ ├── intersection.cc │ │ │ │ ├── map_values.cc │ │ │ │ ├── merge_maps.cc │ │ │ │ ├── require_same.cc │ │ │ │ ├── vector_split.cc │ │ │ │ ├── filter_values.cc │ │ │ │ ├── filtermap_keys.cc │ │ │ │ ├── inplace_filter.cc │ │ │ │ ├── is_submapeq_of.cc │ │ │ │ ├── is_subseteq_of.cc │ │ │ │ ├── maybe_get_only.cc │ │ │ │ ├── multiset_union.cc │ │ │ │ ├── product_where.cc │ │ │ │ ├── restrict_keys.cc │ │ │ │ ├── set_difference.cc │ │ │ │ ├── are_all_distinct.cc │ │ │ │ ├── cartesian_product.cc │ │ │ │ ├── filtermap_values.cc │ │ │ │ ├── get_element_type.cc │ │ │ │ ├── is_superseteq_of.cc │ │ │ │ ├── require_all_same1.cc │ │ │ │ ├── unordered_set_of.cc │ │ │ │ ├── reversed_container.cc │ │ │ │ ├── get_all_permutations.cc │ │ │ │ ├── require_no_duplicates.cc │ │ │ │ ├── unordered_multiset_of.cc │ │ │ │ ├── unordered_map_from_pairs.cc │ │ │ │ ├── slice.cc │ │ │ │ ├── try_merge_nondisjoint_unordered_maps.cc │ │ │ │ ├── make.cc │ │ │ │ ├── all_are_true.cc │ │ │ │ ├── at_idx.cc │ │ │ │ ├── count.cc │ │ │ │ ├── repeat_element.cc │ │ │ │ ├── enumerate_vector.cc │ │ │ │ ├── repeat.cc │ │ │ │ ├── to_uppercase.cc │ │ │ │ ├── get_element_counts.cc │ │ │ │ ├── collapse_optionals.cc │ │ │ │ ├── lookup_in_map.cc │ │ │ │ ├── without_nullopts.cc │ │ │ │ ├── recurse_n.cc │ │ │ │ ├── enumerate.cc │ │ │ │ ├── filtrans.cc │ │ │ │ ├── zip.cc │ │ │ │ ├── transform_until.cc │ │ │ │ ├── zip_strict.cc │ │ │ │ ├── get_all_assignments.cc │ │ │ │ ├── contains_value.cc │ │ │ │ ├── zip3_strict.cc │ │ │ │ └── zip_with.cc │ │ │ ├── graph │ │ │ │ ├── query_set.cc │ │ │ │ ├── digraph │ │ │ │ │ └── i_digraph.cc │ │ │ │ ├── node │ │ │ │ │ ├── i_graph_view.cc │ │ │ │ │ ├── node_source.cc │ │ │ │ │ └── graph_view.cc │ │ │ │ ├── multidigraph │ │ │ │ │ ├── i_multidigraph.cc │ │ │ │ │ └── algorithms │ │ │ │ │ │ ├── add_nodes.cc │ │ │ │ │ │ ├── get_edges.cc │ │ │ │ │ │ └── get_directed_edge.cc │ │ │ │ ├── dataflow_graph │ │ │ │ │ └── i_dataflow_graph.cc │ │ │ │ ├── open_dataflow_graph │ │ │ │ │ ├── i_open_dataflow_graph.cc │ │ │ │ │ └── algorithms │ │ │ │ │ │ ├── get_open_dataflow_graph_inputs.cc │ │ │ │ │ │ ├── get_edges.cc │ │ │ │ │ │ └── are_isomorphic.cc │ │ │ │ ├── labelled_open_dataflow_graph │ │ │ │ │ ├── algorithms │ │ │ │ │ │ ├── as_dot.cc │ │ │ │ │ │ ├── get_graph_data.cc │ │ │ │ │ │ ├── with_labelling.cc │ │ │ │ │ │ ├── find_isomorphism.cc │ │ │ │ │ │ ├── permute_input_ids.cc │ │ │ │ │ │ ├── is_isomorphic_under.cc │ │ │ │ │ │ ├── from_labelled_open_dataflow_graph_data.cc │ │ │ │ │ │ └── labelled_open_dataflow_graphs_are_isomorphic.cc │ │ │ │ │ ├── labelled_open_dataflow_graph.cc │ │ │ │ │ ├── i_labelled_open_dataflow_graph.cc │ │ │ │ │ ├── labelled_open_dataflow_graph_view.cc │ │ │ │ │ └── i_labelled_open_dataflow_graph_view.cc │ │ │ │ ├── labelled_dataflow_graph │ │ │ │ │ ├── i_labelled_dataflow_graph.cc │ │ │ │ │ ├── algorithms │ │ │ │ │ │ ├── is_isomorphic_under.cc │ │ │ │ │ │ ├── view_as_labelled_open_dataflow_graph.cc │ │ │ │ │ │ ├── labelled_dataflow_graphs_are_isomorphic.cc │ │ │ │ │ │ └── create_lazy_copy_of_labelled_dataflow_graph_view.cc │ │ │ │ │ └── i_labelled_dataflow_graph_view.cc │ │ │ │ ├── instances │ │ │ │ │ └── unordered_set_labelled_open_dataflow_graph.cc │ │ │ │ └── undirected │ │ │ │ │ ├── undirected_edge.cc │ │ │ │ │ └── algorithms │ │ │ │ │ ├── make_undirected_edge.cc │ │ │ │ │ └── get_edges.cc │ │ │ ├── commutative_pair.cc │ │ │ ├── rapidcheck │ │ │ │ ├── optional.cc │ │ │ │ ├── variant.cc │ │ │ │ ├── half.cc │ │ │ │ └── monostate.cc │ │ │ ├── stack_string.cc │ │ │ ├── archetypes │ │ │ │ ├── value_type.cc │ │ │ │ └── ordered_value_type.cc │ │ │ ├── exception.cc │ │ │ ├── nonnegative_int │ │ │ │ └── num_elements.cc │ │ │ ├── stack_vector │ │ │ │ ├── stack_vector.cc │ │ │ │ └── stack_vector_of.cc │ │ │ ├── full_binary_tree │ │ │ │ ├── visit.cc │ │ │ │ └── get_num_tree_nodes.cc │ │ │ ├── integer_conversions.cc │ │ │ ├── positive_int │ │ │ │ └── ceildiv.cc │ │ │ └── tuple │ │ │ │ └── visit.cc │ │ └── half.cc │ ├── ffi │ │ ├── src │ │ │ └── utils.cc │ │ └── CMakeLists.txt │ ├── test │ │ ├── common │ │ │ ├── src │ │ │ │ └── test │ │ │ │ │ └── utils │ │ │ │ │ └── doctest │ │ │ │ │ └── fmt │ │ │ │ │ ├── map.cc │ │ │ │ │ ├── set.cc │ │ │ │ │ ├── variant.cc │ │ │ │ │ ├── vector.cc │ │ │ │ │ ├── expected.cc │ │ │ │ │ ├── multiset.cc │ │ │ │ │ ├── unordered_map.cc │ │ │ │ │ ├── unordered_set.cc │ │ │ │ │ ├── unordered_multiset.cc │ │ │ │ │ ├── half.cc │ │ │ │ │ ├── optional.cc │ │ │ │ │ ├── pair.cc │ │ │ │ │ └── tuple.cc │ │ │ ├── include │ │ │ │ └── test │ │ │ │ │ └── utils │ │ │ │ │ ├── rapidcheck.h │ │ │ │ │ ├── doctest │ │ │ │ │ └── check_kv.h │ │ │ │ │ └── rapidcheck │ │ │ │ │ └── some.h │ │ │ └── CMakeLists.txt │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── utils │ │ │ ├── containers │ │ │ ├── make.cc │ │ │ ├── count.cc │ │ │ ├── all_of.cc │ │ │ └── to_uppercase.cc │ │ │ ├── rapidcheck │ │ │ ├── optional.cc │ │ │ └── variant.cc │ │ │ ├── fmt │ │ │ ├── set.cc │ │ │ ├── pair.cc │ │ │ ├── vector.cc │ │ │ └── map.cc │ │ │ └── nonnegative_int │ │ │ └── num_elements.cc │ ├── benchmark │ │ └── CMakeLists.txt │ ├── include │ │ └── utils │ │ │ ├── any.h │ │ │ ├── graph │ │ │ ├── views │ │ │ │ ├── lr_direction.enum.toml │ │ │ │ └── join_node_key.struct.toml │ │ │ ├── series_parallel │ │ │ │ ├── split_type.enum.toml │ │ │ │ ├── sink_settings.enum.toml │ │ │ │ ├── source_settings.enum.toml │ │ │ │ ├── sp_decomposition_tree_node_type.enum.toml │ │ │ │ ├── parallel_reduction.struct.toml │ │ │ │ └── series_reduction.struct.toml │ │ │ ├── node │ │ │ │ ├── node.struct.toml │ │ │ │ ├── algorithms │ │ │ │ │ └── new_node.struct.toml │ │ │ │ └── node_query.struct.toml │ │ │ ├── digraph │ │ │ │ ├── di_output.struct.toml │ │ │ │ ├── di_input.struct.toml │ │ │ │ ├── directed_edge.struct.toml │ │ │ │ └── algorithms │ │ │ │ │ ├── is_acyclic.h │ │ │ │ │ ├── digraph_has_edge.h │ │ │ │ │ └── transitive_closure.h │ │ │ ├── multidigraph │ │ │ │ ├── multidiedge.struct.toml │ │ │ │ └── algorithms │ │ │ │ │ └── get_edges.h │ │ │ ├── open_dataflow_graph │ │ │ │ ├── dataflow_graph_input.struct.toml │ │ │ │ └── algorithms │ │ │ │ │ └── new_dataflow_graph_input.struct.toml │ │ │ ├── undirected │ │ │ │ ├── undirected_edge.struct.toml │ │ │ │ ├── undirected_edge_query.struct.toml │ │ │ │ └── algorithms │ │ │ │ │ └── get_edges.h │ │ │ └── dataflow_graph │ │ │ │ ├── algorithms │ │ │ │ └── dataflow_graph_isomorphism.struct.toml │ │ │ │ └── dataflow_input.struct.toml │ │ │ ├── json_core.h │ │ │ ├── indent.h │ │ │ ├── cli │ │ │ ├── cli_flag_key.struct.toml │ │ │ ├── cli_positional_argument_key.struct.toml │ │ │ ├── cli_argument_key.variant.toml │ │ │ └── cli_get_help_message.h │ │ │ ├── containers │ │ │ ├── merge_method.enum.toml │ │ │ ├── to_uppercase.h │ │ │ ├── make.h │ │ │ ├── range.h │ │ │ ├── contains_key.h │ │ │ ├── all_of.h │ │ │ ├── any_of.h │ │ │ ├── reversed.h │ │ │ ├── all_are_true.h │ │ │ └── items.h │ │ │ ├── full_binary_tree │ │ │ ├── binary_tree_path_entry.enum.toml │ │ │ └── full_binary_tree_node_type.enum.toml │ │ │ ├── for_internal_use_only.h │ │ │ ├── integer_conversions.h │ │ │ ├── internal_only_tag.h │ │ │ ├── overload.h │ │ │ ├── positive_int │ │ │ └── ceildiv.h │ │ │ ├── rapidcheck │ │ │ ├── half.h │ │ │ └── monostate.h │ │ │ ├── nonnegative_int │ │ │ └── ceildiv.h │ │ │ └── json │ │ │ └── half.h │ └── CMakeLists.txt ├── compiler │ ├── ffi │ │ ├── src │ │ │ └── compiler.cc │ │ └── CMakeLists.txt │ ├── benchmark │ │ └── CMakeLists.txt │ ├── test │ │ └── CMakeLists.txt │ ├── include │ │ └── compiler │ │ │ ├── machine_mapping │ │ │ ├── parallel_split_transformation.enum.toml │ │ │ ├── memory_optimization │ │ │ │ └── machine_memory_constraints.struct.toml │ │ │ ├── include_unconstrained.struct.toml │ │ │ └── transitive_reduced_pcg.struct.toml │ │ │ ├── task_graph_simulator │ │ │ └── task_execution_constraint.struct.toml │ │ │ ├── optimizer_config.struct.toml │ │ │ └── cost_estimator │ │ │ └── runtime_only_op_cost_metrics.struct.toml │ └── CMakeLists.txt ├── op-attrs │ ├── ffi │ │ ├── src │ │ │ └── op-attrs.cc │ │ └── CMakeLists.txt │ ├── src │ │ └── op-attrs │ │ │ ├── dim_ordered │ │ │ ├── zip.cc │ │ │ ├── slice.cc │ │ │ └── transform.cc │ │ │ ├── is_valid.cc │ │ │ ├── replica_parallel_dim.cc │ │ │ ├── shard_parallel_dim.cc │ │ │ ├── ff_ordered │ │ │ ├── reversed.cc │ │ │ ├── enumerate.cc │ │ │ ├── get_idxs.cc │ │ │ ├── transform.cc │ │ │ ├── filtrans.cc │ │ │ ├── zip.cc │ │ │ ├── ff_ordered.cc │ │ │ └── ff_ordered_from_map.cc │ │ │ ├── ops │ │ │ ├── reduce.cc │ │ │ ├── topk.cc │ │ │ ├── input.cc │ │ │ ├── reverse.cc │ │ │ └── transpose.cc │ │ │ └── parallel_dim.cc │ ├── include │ │ └── op-attrs │ │ │ ├── ops │ │ │ ├── noop_attrs.struct.toml │ │ │ ├── cast_attrs.struct.toml │ │ │ ├── dropout_attrs.struct.toml │ │ │ ├── reshape_attrs.struct.toml │ │ │ ├── input_attrs.struct.toml │ │ │ ├── broadcast_attrs.struct.toml │ │ │ ├── concat_attrs.struct.toml │ │ │ ├── reduction_attrs.struct.toml │ │ │ ├── reverse_attrs.struct.toml │ │ │ ├── softmax_attrs.struct.toml │ │ │ ├── replicate_attrs.struct.toml │ │ │ ├── loss_functions │ │ │ │ ├── sparse_categorical_cross_entropy_loss_attrs.struct.toml │ │ │ │ └── nonconfigurable_loss_attrs.struct.toml │ │ │ ├── gather_attrs.struct.toml │ │ │ ├── topk_attrs.struct.toml │ │ │ └── transpose_attrs.struct.toml │ │ │ ├── pool_op.enum.toml │ │ │ ├── initializers │ │ │ ├── zero_initializer_attrs.struct.toml │ │ │ ├── glorot_normal_attrs.struct.toml │ │ │ ├── glorot_uniform_attrs.struct.toml │ │ │ ├── kaiming_initializer_mode.enum.toml │ │ │ ├── kaiming_initializer_nonlinearity.enum.toml │ │ │ ├── constant_initializer_attrs.struct.toml │ │ │ ├── uniform_initializer_attrs.struct.toml │ │ │ └── norm_initializer_attrs.struct.toml │ │ │ ├── aggregate_op.enum.toml │ │ │ ├── relative_ff_dim_t.struct.toml │ │ │ ├── replica_type.enum.toml │ │ │ ├── incoming_tensor_role.enum.toml │ │ │ ├── l1_regularizer_attrs.struct.toml │ │ │ ├── l2_regularizer_attrs.struct.toml │ │ │ ├── activation.enum.toml │ │ │ ├── ff_dim_t.struct.toml │ │ │ ├── shard_parallel_dim.h │ │ │ ├── parallel_tensor_shape │ │ │ ├── sum_degree.struct.toml │ │ │ └── discard_copy_degree.struct.toml │ │ │ ├── replica_parallel_dim.h │ │ │ ├── operator_type.h │ │ │ ├── datatype.enum.toml │ │ │ ├── parallel_tensor_dim_idx_t.variant.toml │ │ │ ├── tensor_dims.struct.toml │ │ │ ├── tensor_dims_coord.struct.toml │ │ │ └── shard_parallel_dim.struct.toml │ ├── test │ │ ├── CMakeLists.txt │ │ └── src │ │ │ └── op-attrs │ │ │ ├── ff_ordered │ │ │ └── ff_ordered.cc │ │ │ ├── dim_ordered │ │ │ └── dim_ordered.cc │ │ │ └── regularizer_attrs.cc │ └── CMakeLists.txt ├── task-spec │ ├── src │ │ └── task-spec │ │ │ ├── profiling.cc │ │ │ ├── task_argument_accessor.cc │ │ │ ├── itask_argument_accessor.cc │ │ │ ├── privilege_tensor_accessor.cc │ │ │ ├── ops │ │ │ ├── input.cc │ │ │ └── weight.cc │ │ │ ├── variadic_tensor_ref.cc │ │ │ ├── op_arg_spec.cc │ │ │ ├── task_arg_spec.cc │ │ │ └── loss_tensor_source.cc │ ├── include │ │ └── task-spec │ │ │ ├── slot_id_t.struct.toml │ │ │ ├── is_grad.enum.toml │ │ │ ├── per_device_op_state_ref_type.struct.toml │ │ │ ├── is_trainable.enum.toml │ │ │ ├── forward_tensor_guid_t.struct.toml │ │ │ ├── gradient_tensor_guid_t.struct.toml │ │ │ ├── slot_type.enum.toml │ │ │ ├── optimizer_tensor_guid_t.struct.toml │ │ │ ├── op_task_type.enum.toml │ │ │ ├── ops │ │ │ ├── noop.h │ │ │ ├── input.h │ │ │ └── weight.h │ │ │ ├── loss_tensor_guid_t.struct.toml │ │ │ ├── task_arg_spec.h │ │ │ ├── task_invocation.h │ │ │ ├── tensor_type.enum.toml │ │ │ ├── runtime_arg_ref_type.enum.toml │ │ │ ├── op_slot_options.enum.toml │ │ │ ├── op_task_invocation.struct.toml │ │ │ ├── op_arg_spec.h │ │ │ ├── slot_grad_id.struct.toml │ │ │ ├── task_invocation.struct.toml │ │ │ ├── task_arg_spec.variant.toml │ │ │ └── tensor_sub_slot_id_t.struct.toml │ ├── test │ │ └── CMakeLists.txt │ └── CMakeLists.txt ├── substitutions │ ├── ffi │ │ ├── src │ │ │ └── substitutions.cc │ │ └── include │ │ │ └── flexflow │ │ │ └── substitutions.h │ ├── test │ │ └── CMakeLists.txt │ ├── include │ │ └── substitutions │ │ │ ├── constraint_type.enum.toml │ │ │ ├── unlabelled │ │ │ ├── pattern_node.struct.toml │ │ │ ├── unlabelled_graph_pattern.struct.toml │ │ │ ├── standard_pattern_edge.struct.toml │ │ │ ├── pattern_value_use.struct.toml │ │ │ ├── input_pattern_edge.struct.toml │ │ │ ├── pattern_node_output.struct.toml │ │ │ └── pattern_input.struct.toml │ │ │ ├── output_graph │ │ │ ├── output_graph_expr_node.struct.toml │ │ │ ├── attr_constant.struct.toml │ │ │ ├── output_pattern_value.struct.toml │ │ │ ├── output_graph_expr_node_output.struct.toml │ │ │ └── output_graph_expr_input.struct.toml │ │ │ ├── open_parallel_tensor_guid_t.struct.toml │ │ │ ├── sub_parallel_computation_graph_edge.struct.toml │ │ │ ├── input_parallel_tensor_guid_t.struct.toml │ │ │ └── tensor_pattern │ │ │ ├── tensor_attribute_key.enum.toml │ │ │ └── tensor_attribute_list_size.struct.toml │ ├── CMakeLists.txt │ └── src │ │ └── substitutions │ │ └── unlabelled │ │ └── pattern_node_output.cc ├── runtime │ ├── src │ │ ├── profiling.cc │ │ ├── layer_id.cc │ │ ├── interface.h │ │ ├── tensor.cu │ │ ├── tensor.cpp │ │ ├── ops │ │ │ └── fused_parallel_op_attrs.cc │ │ ├── accessor_kernel.cu │ │ ├── task_spec │ │ │ ├── task_invocation.cc │ │ │ └── typed_task_invocation.cc │ │ ├── accessor_kernel.cpp │ │ ├── loggers.cc │ │ ├── loggers.h │ │ ├── op_manager.h │ │ ├── parallel_op_info.cc │ │ └── layer_id.h │ └── test │ │ └── src │ │ └── main.cc ├── pcg │ ├── ffi │ │ ├── src │ │ │ └── pcg.cc │ │ └── CMakeLists.txt │ ├── include │ │ └── pcg │ │ │ ├── cost_values.h │ │ │ ├── create_grad.enum.toml │ │ │ ├── device_type.enum.toml │ │ │ ├── num_points_t.struct.toml │ │ │ ├── create_grad.h │ │ │ ├── tensor_role.enum.toml │ │ │ ├── machine_specification_dimension.enum.toml │ │ │ ├── layer_guid_t.struct.toml │ │ │ ├── tensor_guid_t.struct.toml │ │ │ ├── stride_t.struct.toml │ │ │ ├── cpu_id_t.struct.toml │ │ │ ├── file_format │ │ │ └── v1 │ │ │ │ └── graphs │ │ │ │ └── v1_graph_output.struct.toml │ │ │ ├── gpu_id_t.struct.toml │ │ │ ├── computation_graph │ │ │ └── computation_graph_edge.struct.toml │ │ │ ├── parallel_computation_graph │ │ │ ├── parallel_tensor_guid_t.struct.toml │ │ │ ├── parallel_tensor_use_t.struct.toml │ │ │ ├── parallel_computation_graph_edge.struct.toml │ │ │ └── parallel_layer_guid_t.struct.toml │ │ │ ├── device_id_t.variant.toml │ │ │ ├── computation_graph.struct.toml │ │ │ ├── pcg_from_computation_graph.h │ │ │ ├── optimizer_attrs.h │ │ │ └── tensor_attrs.struct.toml │ ├── test │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ └── src │ │ └── pcg │ │ ├── parallel_computation_graph │ │ └── parallel_tensor_guid_t.cc │ │ ├── create_grad.cc │ │ └── file_format │ │ └── v1 │ │ └── v1_parallel_computation_graph.cc ├── models │ ├── test │ │ └── CMakeLists.txt │ ├── include │ │ └── models │ │ │ └── dlrm │ │ │ └── dlrm_arch_interaction_op.enum.toml │ └── CMakeLists.txt ├── kernels │ ├── include │ │ └── kernels │ │ │ ├── cpu.h │ │ │ ├── device_stream_t.variant.toml │ │ │ ├── profiling_settings.struct.toml │ │ │ ├── legion_dim_t.struct.toml │ │ │ ├── device_handle_t.variant.toml │ │ │ ├── gather_per_device_state.struct.toml │ │ │ ├── partition_per_device_state.struct.toml │ │ │ ├── create_local_allocator_for_device_type.h │ │ │ ├── element_unary_per_device_state.struct.toml │ │ │ ├── tensor_accessor_reductions.h │ │ │ └── reduce_kernels_cpu.h │ ├── src │ │ └── kernels │ │ │ ├── legion_ordered │ │ │ ├── legion_ordered.cc │ │ │ ├── transform.cc │ │ │ └── slice.cc │ │ │ ├── reduce_kernels_cpu.cc │ │ │ └── dropout_kernels_cpu.cc │ └── test │ │ ├── CMakeLists.txt │ │ └── src │ │ └── kernels │ │ └── legion_ordered │ │ └── legion_ordered.cc ├── local-execution │ ├── src │ │ └── local-execution │ │ │ └── registered_task.cc │ ├── test │ │ └── CMakeLists.txt │ ├── CMakeLists.txt │ └── include │ │ └── local-execution │ │ ├── registered_task.h │ │ └── tasks.h ├── substitution-generator │ └── CMakeLists.txt └── CMakeLists.txt ├── bin ├── protobuf-to-json │ └── README.md ├── substitution-to-dot │ ├── README.md │ └── CMakeLists.txt ├── export-model-arch │ └── CMakeLists.txt └── CMakeLists.txt ├── .gitattributes ├── .ignore ├── docs ├── requirements.txt ├── plantuml │ ├── Makefile │ └── README.md └── source │ ├── welcome.rst │ ├── installation.rst │ ├── developers_guide.rst │ ├── jupyter.rst │ ├── mt5.rst │ ├── python │ ├── models.rst │ ├── init.rst │ ├── create.rst │ └── dataloader.rst │ └── docker.rst ├── substitutions └── graph_subst_3_v2.pb ├── .github ├── runs-on.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── helpers │ └── free_space_on_runner.sh │ └── shell-check.yml ├── INTERNALS.md ├── cmake ├── rapidcheck.cmake ├── fmt.cmake ├── zlib.cmake ├── libassert.cmake ├── expected.cmake ├── gbenchmark.cmake ├── json.cmake ├── visit_struct.cmake ├── aliasing.cmake └── spdlog.cmake ├── packaging └── conda │ ├── pytorch-gpu.yml │ └── environment.yml ├── .flake └── pkgs │ ├── ffdb │ └── ffdb.py │ ├── hpp2plantuml.nix │ └── fccf │ ├── fix-argparse-include.patch │ └── json-package-name.patch └── .dockerignore /bindings/python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/python/cc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/python/python/flexflow/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/onnx/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/torch/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bindings/python/python/flexflow/op_attrs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/ffi/src/ffi.cc: -------------------------------------------------------------------------------- 1 | #include "flexflow/flexflow.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/tuple.cc: -------------------------------------------------------------------------------- 1 | #include "utils/tuple.h" 2 | -------------------------------------------------------------------------------- /lib/utils/ffi/src/utils.cc: -------------------------------------------------------------------------------- 1 | #include "flexflow/utils.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/dot_file.cc: -------------------------------------------------------------------------------- 1 | #include "utils/dot_file.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/hash-utils.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash-utils.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/expected.cc: -------------------------------------------------------------------------------- 1 | #include "utils/expected.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/map.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/map.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/pair.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/pair.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/set.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/set.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/overload.cc: -------------------------------------------------------------------------------- 1 | #include "utils/overload.h" 2 | -------------------------------------------------------------------------------- /bin/protobuf-to-json/README.md: -------------------------------------------------------------------------------- 1 | # protobuf-to-json 2 | 3 | TODO 4 | -------------------------------------------------------------------------------- /lib/compiler/ffi/src/compiler.cc: -------------------------------------------------------------------------------- 1 | #include "flexflow/compiler.h" 2 | -------------------------------------------------------------------------------- /lib/op-attrs/ffi/src/op-attrs.cc: -------------------------------------------------------------------------------- 1 | #include "flexflow/op-attrs.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/vector.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/vector.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/pair.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/pair.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/tuple.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/tuple.h" 2 | -------------------------------------------------------------------------------- /bin/substitution-to-dot/README.md: -------------------------------------------------------------------------------- 1 | # substitution-to-dot 2 | 3 | TODO 4 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/bidict.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/bidict.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/check_fmtable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/check_fmtable.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/expected.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/expected.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/multiset.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/multiset.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/variant.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/variant.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/multiset.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/multiset.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/vector.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/vector.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/optional.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/optional.h" 2 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/torch/nn/__init__.py: -------------------------------------------------------------------------------- 1 | from .modules import * 2 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/profiling.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/profiling.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/find.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/find.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/keys.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/keys.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/sum.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/sum.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/query_set.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/query_set.h" 2 | -------------------------------------------------------------------------------- /lib/substitutions/ffi/src/substitutions.cc: -------------------------------------------------------------------------------- 1 | #include "flexflow/substitutions.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/commutative_pair.cc: -------------------------------------------------------------------------------- 1 | #include "utils/commutative_pair.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/all_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/all_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/any_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/any_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/extend.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/extend.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/filter.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/filter.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/flatmap.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/flatmap.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/foldl.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/foldl.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/foldl1.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/foldl1.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/foldr1.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/foldr1.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/items.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/items.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/maximum.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/maximum.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/minimum.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/minimum.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/product.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/product.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/scanl.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/scanl.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/set_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/set_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/sorted.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/sorted.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/try_at.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/try_at.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/values.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/values.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/unordered_map.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/unordered_map.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/unordered_set.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/unordered_set.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/unordered_map.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/unordered_map.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/unordered_set.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/unordered_set.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/is_jsonable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/is_jsonable.h" 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.dtg.cc linguist-generated=true 2 | *.dtg.h linguist-generated=true 3 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/dim_ordered/zip.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/dim_ordered/zip.h" 2 | -------------------------------------------------------------------------------- /lib/runtime/src/profiling.cc: -------------------------------------------------------------------------------- 1 | #include "profiling.h" 2 | 3 | namespace FlexFlow {} 4 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/contains.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/contains.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/get_only.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/get_only.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/group_by.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/group_by.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/index_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/index_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/map_keys.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/map_keys.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/reversed.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/reversed.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/set_minus.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/set_minus.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/set_union.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/set_union.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/sorted_by.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/sorted_by.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/sum_where.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/sum_where.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/transform.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/transform.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/value_all.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/value_all.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/rapidcheck/optional.cc: -------------------------------------------------------------------------------- 1 | #include "utils/rapidcheck/optional.h" 2 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/dim_ordered/slice.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/dim_ordered/slice.h" 2 | -------------------------------------------------------------------------------- /lib/pcg/ffi/src/pcg.cc: -------------------------------------------------------------------------------- 1 | #include "flexflow/pcg.h" 2 | #include "pcg/model_compilation.h" 3 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/generate_bidict.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/generate_bidict.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/are_all_same.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/are_all_same.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/are_disjoint.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/are_disjoint.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/compare_by.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/compare_by.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/contains_key.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/contains_key.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/filter_keys.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/filter_keys.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/generate_map.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/generate_map.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/get_one_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/get_one_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/intersection.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/intersection.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/map_values.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/map_values.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/merge_maps.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/merge_maps.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/require_same.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/require_same.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/vector_split.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/vector_split.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/unordered_multiset.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/unordered_multiset.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/digraph/i_digraph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/digraph/i_digraph.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/node/i_graph_view.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/node/i_graph_view.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/hash/unordered_multiset.cc: -------------------------------------------------------------------------------- 1 | #include "utils/hash/unordered_multiset.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/check_is_jsonable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/check_is_jsonable.h" 2 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | /deps/ 2 | /substitutions/ 3 | /triton/ 4 | /examples/ 5 | /docs/ 6 | /build-external/ 7 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/dim_ordered/transform.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/dim_ordered/transform.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/filter_values.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/filter_values.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/filtermap_keys.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/filtermap_keys.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/inplace_filter.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/inplace_filter.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/is_submapeq_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/is_submapeq_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/is_subseteq_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/is_subseteq_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/maybe_get_only.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/maybe_get_only.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/multiset_union.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/multiset_union.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/product_where.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/product_where.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/restrict_keys.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/restrict_keys.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/set_difference.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/set_difference.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/is_json_serializable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/is_json_serializable.h" 2 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/task_argument_accessor.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/task_argument_accessor.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/are_all_distinct.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/are_all_distinct.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/cartesian_product.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/cartesian_product.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/filtermap_values.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/filtermap_values.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/get_element_type.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/get_element_type.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/is_superseteq_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/is_superseteq_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/require_all_same1.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/require_all_same1.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/unordered_set_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/unordered_set_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/is_json_deserializable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/is_json_deserializable.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/map.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/map.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/set.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/set.h" 2 | -------------------------------------------------------------------------------- /lib/runtime/src/layer_id.cc: -------------------------------------------------------------------------------- 1 | #include "layer_id.h" 2 | #include 3 | 4 | namespace FlexFlow {} 5 | -------------------------------------------------------------------------------- /lib/runtime/test/src/main.cc: -------------------------------------------------------------------------------- 1 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 2 | #include "doctest/doctest.h" 3 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/itask_argument_accessor.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/itask_argument_accessor.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/algorithms/left_entries.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/algorithms/left_entries.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/reversed_container.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/reversed_container.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/variant.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/variant.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/vector.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/vector.h" 2 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/privilege_tensor_accessor.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/privilege_tensor_accessor.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/algorithms/right_entries.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/algorithms/right_entries.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/get_all_permutations.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/get_all_permutations.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/require_no_duplicates.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/require_no_duplicates.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/unordered_multiset_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/unordered_multiset_of.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/multidigraph/i_multidigraph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/multidigraph/i_multidigraph.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/check_is_json_deserializable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/check_is_json_deserializable.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/check_is_json_serializable.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/check_is_json_serializable.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/expected.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/expected.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/multiset.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/multiset.h" 2 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx 2 | sphinx_rtd_theme 3 | m2r2 4 | breathe 5 | exhale 6 | cffi 7 | numpy 8 | qualname 9 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/algorithms/bidict_from_pairs.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/algorithms/bidict_from_pairs.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/unordered_map_from_pairs.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/unordered_map_from_pairs.h" 2 | -------------------------------------------------------------------------------- /docs/plantuml/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all 2 | all: figures/pytorch-tracing.svg 3 | 4 | %.svg : %.puml 5 | plantuml -tsvg $< 6 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/try_merge_nondisjoint_bidicts.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/try_merge_nondisjoint_bidicts.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/dataflow_graph/i_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/dataflow_graph/i_dataflow_graph.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/unordered_map.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/unordered_map.h" 2 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/unordered_set.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/unordered_set.h" 2 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/is_valid.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/is_valid.h" 2 | 3 | namespace FlexFlow {} // namespace FlexFlow 4 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/algorithms/merge_disjoint_bidicts.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/algorithms/merge_disjoint_bidicts.h" 2 | -------------------------------------------------------------------------------- /substitutions/graph_subst_3_v2.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flexflow/flexflow-train/HEAD/substitutions/graph_subst_3_v2.pb -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/slice.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/slice.h" 2 | 3 | namespace FlexFlow {} // namespace FlexFlow 4 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/unordered_multiset.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/unordered_multiset.h" 2 | -------------------------------------------------------------------------------- /docs/source/welcome.rst: -------------------------------------------------------------------------------- 1 | ************* 2 | Overview 3 | ************* 4 | 5 | .. mdinclude:: ../../README.md 6 | :start-line: 3 7 | -------------------------------------------------------------------------------- /lib/utils/src/utils/bidict/algorithms/bidict_from_keys_and_values.cc: -------------------------------------------------------------------------------- 1 | #include "utils/bidict/algorithms/bidict_from_keys_and_values.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/try_merge_nondisjoint_unordered_maps.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/try_merge_nondisjoint_unordered_maps.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/open_dataflow_graph/i_open_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/open_dataflow_graph/i_open_dataflow_graph.h" 2 | -------------------------------------------------------------------------------- /docs/source/installation.rst: -------------------------------------------------------------------------------- 1 | ************* 2 | Installing FlexFlow 3 | ************* 4 | 5 | .. mdinclude:: ../../INSTALL.md 6 | :start-line: 2 7 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/as_dot.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/as_dot.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_dataflow_graph/i_labelled_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_dataflow_graph/i_labelled_dataflow_graph.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/json.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/json.h" 2 | 3 | namespace fmt { 4 | 5 | template struct formatter<::nlohmann::json, char>; 6 | 7 | } 8 | -------------------------------------------------------------------------------- /docs/source/developers_guide.rst: -------------------------------------------------------------------------------- 1 | ****************** 2 | Developers Guide 3 | ****************** 4 | 5 | .. mdinclude:: ../../CONTRIBUTING.md 6 | :start-line: 2 7 | -------------------------------------------------------------------------------- /docs/source/jupyter.rst: -------------------------------------------------------------------------------- 1 | ***************** 2 | Jupyter Notebook 3 | ***************** 4 | 5 | .. mdinclude:: ../../jupyter_notebook/README.md 6 | :start-line: 2 7 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_dataflow_graph/algorithms/is_isomorphic_under.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_dataflow_graph/algorithms/is_isomorphic_under.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_dataflow_graph/i_labelled_dataflow_graph_view.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_dataflow_graph/i_labelled_dataflow_graph_view.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/get_graph_data.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/get_graph_data.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/with_labelling.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/with_labelling.h" 2 | -------------------------------------------------------------------------------- /docs/source/mt5.rst: -------------------------------------------------------------------------------- 1 | **************** 2 | HuggingFace mT5 3 | **************** 4 | 5 | .. mdinclude:: ../../examples/python/pytorch/mt5/README.md 6 | :start-line: 2 7 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/find_isomorphism.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/find_isomorphism.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/permute_input_ids.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/permute_input_ids.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/labelled_open_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/labelled_open_dataflow_graph.h" 2 | -------------------------------------------------------------------------------- /.github/runs-on.yml: -------------------------------------------------------------------------------- 1 | images: 2 | flexflow-gpu-ci: 3 | platform: "linux" 4 | arch: "x64" 5 | owner: "409719625166" # flexflow 6 | name: "flexflow-gpu-ci" 7 | 8 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/is_isomorphic_under.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/is_isomorphic_under.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/i_labelled_open_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/i_labelled_open_dataflow_graph.h" 2 | -------------------------------------------------------------------------------- /bin/substitution-to-dot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_executable( 2 | NAME 3 | substitution-to-dot 4 | SRC_PATTERNS 5 | *.cc 6 | DEPS 7 | substitution-generator 8 | ) 9 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/keras/datasets/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import cifar10 4 | from . import mnist 5 | from . import reuters 6 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/labelled_open_dataflow_graph_view.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/labelled_open_dataflow_graph_view.h" 2 | -------------------------------------------------------------------------------- /INTERNALS.md: -------------------------------------------------------------------------------- 1 | # Internals 2 | 3 | ## Diagram 4 | 5 | The most common (pytorch) flow proceeds as shown in the diagram below: 6 | ![](./docs/plantuml/figures/pytorch-tracing.svg?raw=1) 7 | -------------------------------------------------------------------------------- /bindings/python/old/requirements.txt: -------------------------------------------------------------------------------- 1 | python>=3.6 2 | cffi>=1.11.0 3 | numpy>=1.16.0 4 | qualname>=0.1.0 5 | keras_preprocessing>=1.1.2 6 | Pillow 7 | pybind11 8 | cmake-build-extension 9 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/i_labelled_open_dataflow_graph_view.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/i_labelled_open_dataflow_graph_view.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/stack_string.cc: -------------------------------------------------------------------------------- 1 | #include "utils/stack_string.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template struct stack_basic_string; 6 | 7 | } // namespace FlexFlow 8 | -------------------------------------------------------------------------------- /cmake/rapidcheck.cmake: -------------------------------------------------------------------------------- 1 | if (FF_USE_EXTERNAL_RAPIDCHECK) 2 | find_package(rapidcheck REQUIRED) 3 | else() 4 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/rapidcheck) 5 | endif() 6 | -------------------------------------------------------------------------------- /lib/utils/src/utils/archetypes/value_type.cc: -------------------------------------------------------------------------------- 1 | #include "utils/archetypes/value_type.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template struct value_type<0>; 6 | 7 | } // namespace FlexFlow 8 | -------------------------------------------------------------------------------- /lib/utils/test/common/include/test/utils/rapidcheck.h: -------------------------------------------------------------------------------- 1 | #include "rapidcheck/doctest.h" 2 | #include "rapidcheck/gen.h" 3 | #include "rapidcheck/some.h" 4 | #include "rapidcheck/visitable.h" 5 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Description of changes:** 2 | 3 | 4 | 5 | **Related Issues:** 6 | 7 | Linked Issues: 8 | - Issue # 9 | 10 | Issues closed by this PR: 11 | - Closes # 12 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow_python.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | from flexflow import flexflow_driver 5 | 6 | if __name__ == '__main__': 7 | sys.exit(flexflow_driver()) 8 | 9 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_dataflow_graph/algorithms/view_as_labelled_open_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_dataflow_graph/algorithms/view_as_labelled_open_dataflow_graph.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_dataflow_graph/algorithms/labelled_dataflow_graphs_are_isomorphic.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_dataflow_graph/algorithms/labelled_dataflow_graphs_are_isomorphic.h" 2 | -------------------------------------------------------------------------------- /lib/runtime/src/interface.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_RUNTIME_SRC_INTERFACE_H 2 | #define _FLEXFLOW_RUNTIME_SRC_INTERFACE_H 3 | 4 | #include "model_training_instance.h" 5 | 6 | namespace FlexFlow {} 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lib/utils/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_benchmark_executable( 2 | NAME 3 | utils-benchmarks 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | ) 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/archetypes/ordered_value_type.cc: -------------------------------------------------------------------------------- 1 | #include "utils/archetypes/ordered_value_type.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template struct ordered_value_type<0>; 6 | 7 | } // namespace FlexFlow 8 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/from_labelled_open_dataflow_graph_data.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/from_labelled_open_dataflow_graph_data.h" 2 | -------------------------------------------------------------------------------- /cmake/fmt.cmake: -------------------------------------------------------------------------------- 1 | include(aliasing) 2 | 3 | if (FF_USE_EXTERNAL_FMT) 4 | find_package(fmt REQUIRED) 5 | else() 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/fmt) 7 | endif() 8 | alias_library(fmt fmt::fmt) 9 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/make.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/make.h" 2 | #include 3 | 4 | namespace FlexFlow { 5 | 6 | template decltype(auto) make>(); 7 | 8 | } // namespace FlexFlow 9 | -------------------------------------------------------------------------------- /packaging/conda/pytorch-gpu.yml: -------------------------------------------------------------------------------- 1 | name: pytorch 2 | channels: 3 | - defaults 4 | - conda-forge 5 | dependencies: 6 | - python>=3.6 7 | - numpy>=1.16.0 8 | - pip 9 | - pip: 10 | - torch>=1.13.1 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_dataflow_graph/algorithms/create_lazy_copy_of_labelled_dataflow_graph_view.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_dataflow_graph/algorithms/create_lazy_copy_of_labelled_dataflow_graph_view.h" 2 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/labelled_open_dataflow_graph/algorithms/labelled_open_dataflow_graphs_are_isomorphic.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/labelled_open_dataflow_graph/algorithms/labelled_open_dataflow_graphs_are_isomorphic.h" 2 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/cost_values.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_PCG_INCLUDE_PCG_COST_VALUES_H 2 | #define _FLEXFLOW_PCG_INCLUDE_PCG_COST_VALUES_H 3 | 4 | namespace FlexFlow { 5 | 6 | struct CostValues; 7 | 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /docs/source/python/models.rst: -------------------------------------------------------------------------------- 1 | ************ 2 | Models API 3 | ************ 4 | 5 | Models API in FlexFlow is used to create models . 6 | 7 | .. toctree:: 8 | :maxdepth: 2 9 | 10 | create 11 | init 12 | train -------------------------------------------------------------------------------- /lib/utils/ffi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | utils-ffi 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | PRIVATE_DEPS 11 | utils 12 | ) 13 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/keras/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from . import generic_utils 3 | from . import data_utils 4 | 5 | from .np_utils import to_categorical 6 | from .np_utils import normalize 7 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/noop_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "NoopAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | fields = [] 12 | -------------------------------------------------------------------------------- /bin/export-model-arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_executable( 2 | NAME 3 | export-model-arch 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | include/ 8 | DEPS 9 | utils 10 | models 11 | compiler 12 | ) 13 | -------------------------------------------------------------------------------- /docs/plantuml/README.md: -------------------------------------------------------------------------------- 1 | # plantuml 2 | 3 | [PlantUML](https://plantuml.com/) figures for documentation as [mermaid](https://mermaid.js.org/) was missing some features I needed. 4 | 5 | ## Building 6 | 7 | ``` 8 | $ make 9 | ``` 10 | -------------------------------------------------------------------------------- /lib/models/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | models-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | models 10 | doctest 11 | utils-test-common 12 | ) 13 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/slot_id_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "slot_id_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | [[fields]] 11 | name = "raw_id" 12 | type = "int" 13 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/ops/input.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/ops/input.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::vector get_task_ids(InputAttrs const &attrs) { 6 | return {}; 7 | } 8 | 9 | }; // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/half.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/half.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::ostream &operator<<(std::ostream &s, ::half h) { 6 | return (s << static_cast(h)); 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/cpu.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_KERNELS_INCLUDE_KERNELS_CPU_H 2 | #define _FLEXFLOW_KERNELS_INCLUDE_KERNELS_CPU_H 3 | 4 | namespace FlexFlow { 5 | 6 | enum class TaskLocation { CPU, GPU }; 7 | 8 | } 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/ops/weight.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/ops/weight.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::vector get_task_ids(WeightAttrs const &attrs) { 6 | return {}; 7 | } 8 | 9 | }; // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/utils/src/utils/exception.cc: -------------------------------------------------------------------------------- 1 | #include "utils/exception.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::runtime_error mk_runtime_error(std::string const &s) { 6 | return std::runtime_error(s); 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/compiler/benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_benchmark_executable( 2 | NAME 3 | compiler-benchmarks 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | compiler 11 | models 12 | ) 13 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/replica_parallel_dim.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/replica_parallel_dim.h" 2 | 3 | namespace FlexFlow { 4 | 5 | bool is_valid(ReplicaParallelDim const &d) { 6 | return d.degree > 0; 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/pcg/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | pcg-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | pcg 11 | doctest 12 | utils-test-common 13 | ) 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/any.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_UTILS_INCLUDE_UTILS_ANY_H 2 | #define _FLEXFLOW_UTILS_INCLUDE_UTILS_ANY_H 3 | 4 | #include "any.hpp" 5 | 6 | namespace FlexFlow { 7 | 8 | using namespace ::linb; 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/rapidcheck/variant.cc: -------------------------------------------------------------------------------- 1 | #include "utils/rapidcheck/variant.h" 2 | 3 | namespace rc { 4 | 5 | using T0 = int; 6 | using T1 = std::string; 7 | 8 | template struct Arbitrary>; 9 | 10 | } // namespace rc 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/optional.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/optional.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::ostream &operator<<(std::ostream &s, std::nullopt_t) { 6 | return (s << std::string{"nullopt"}); 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/utils/src/utils/rapidcheck/half.cc: -------------------------------------------------------------------------------- 1 | #include "utils/rapidcheck/half.h" 2 | 3 | namespace rc { 4 | 5 | Gen<::half> Arbitrary<::half>::arbitrary() { 6 | return gen::construct<::half>(gen::arbitrary()); 7 | } 8 | 9 | } // namespace rc 10 | -------------------------------------------------------------------------------- /cmake/zlib.cmake: -------------------------------------------------------------------------------- 1 | find_package(ZLIB REQUIRED) 2 | if(ZLIB_FOUND) 3 | list(APPEND FLEXFLOW_EXT_LIBRARIES 4 | ${ZLIB_LIBRARIES}) 5 | message( STATUS "ZLIB libraries : ${ZLIB_LIBRARIES}" ) 6 | else() 7 | message( FATAL_ERROR "ZLIB package not found") 8 | endif() -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/pool_op.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "PoolOp" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "MAX" 12 | 13 | [[values]] 14 | name = "AVG" 15 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/create_grad.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "CreateGrad" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "YES" 12 | 13 | [[values]] 14 | name = "NO" 15 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/device_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DeviceType" 3 | features = [ 4 | "hash", 5 | "json", 6 | "fmt", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "GPU" 12 | 13 | [[values]] 14 | name = "CPU" 15 | -------------------------------------------------------------------------------- /lib/runtime/src/tensor.cu: -------------------------------------------------------------------------------- 1 | #include "flexflow/accessor.h" 2 | #include "flexflow/config.h" 3 | #include "flexflow/model.h" 4 | #include "flexflow/parallel_tensor.h" 5 | #include "flexflow/utils/cuda_helper.h" 6 | 7 | namespace FlexFlow {} // namespace FlexFlow 8 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/is_grad.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "IsGrad" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "YES" 12 | 13 | [[values]] 14 | name = "NO" 15 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/per_device_op_state_ref_type.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "PerDeviceOpStateRefType" 3 | 4 | features = [ 5 | "eq", 6 | "ord", 7 | "hash", 8 | "json", 9 | "fmt", 10 | ] 11 | 12 | fields = [] 13 | -------------------------------------------------------------------------------- /lib/op-attrs/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | op-attrs-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | op-attrs 11 | doctest 12 | utils-test-common 13 | ) 14 | -------------------------------------------------------------------------------- /lib/utils/src/half.cc: -------------------------------------------------------------------------------- 1 | #include "utils/half.h" 2 | #include "utils/hash-utils.h" 3 | 4 | namespace std { 5 | 6 | size_t hash::operator()(half h) const { 7 | return ::FlexFlow::get_std_hash(static_cast(h)); 8 | } 9 | 10 | } // namespace std 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/monostate.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/monostate.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::ostream &operator<<(std::ostream &s, std::monostate const &m) { 6 | return (s << fmt::to_string(m)); 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/tuple.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/tuple.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template std::ostream &operator<<(std::ostream &s, 6 | std::tuple const &); 7 | 8 | } // namespace FlexFlow 9 | -------------------------------------------------------------------------------- /lib/utils/src/utils/rapidcheck/monostate.cc: -------------------------------------------------------------------------------- 1 | #include "utils/rapidcheck/monostate.h" 2 | 3 | namespace rc { 4 | 5 | Gen Arbitrary::arbitrary() { 6 | return gen::construct(); 7 | } 8 | 9 | } // namespace rc 10 | -------------------------------------------------------------------------------- /lib/op-attrs/ffi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | op-attrs-ffi 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils-ffi 12 | PRIVATE_DEPS 13 | op-attrs 14 | ) 15 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/zero_initializer_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ZeroInitializerAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | fields = [] 12 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/is_trainable.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "IsTrainable" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "YES" 12 | 13 | [[values]] 14 | name = "NO" 15 | -------------------------------------------------------------------------------- /cmake/libassert.cmake: -------------------------------------------------------------------------------- 1 | include(aliasing) 2 | 3 | if(FF_USE_EXTERNAL_LIBASSERT) 4 | find_package(libassert REQUIRED) 5 | else() 6 | message(FATAL_ERROR "Currently FF_USE_EXTERNAL_LIBASSERT is required") 7 | endif() 8 | 9 | alias_library(libassert libassert::assert) 10 | -------------------------------------------------------------------------------- /docs/source/docker.rst: -------------------------------------------------------------------------------- 1 | ************* 2 | Docker 3 | ************* 4 | We provide a ready-to-use Docker container to quickly run FlexFlow with no manual installation required. To use it, follow the steps below. 5 | 6 | .. mdinclude:: ../../docker/README.md 7 | :start-line: 3 8 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/aggregate_op.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "AggregateOp" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "SUM" 12 | 13 | [[values]] 14 | name = "AVG" 15 | 16 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/relative_ff_dim_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "relative_ff_dim_t" 3 | 4 | features = [ 5 | "eq", 6 | "ord", 7 | "hash", 8 | "json", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "value" 14 | type = "int" 15 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/num_points_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "num_points_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "unwrapped" 14 | type = "int" 15 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/forward_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "forward_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | 11 | [[fields]] 12 | name = "raw_index" 13 | type = "int" 14 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/gradient_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "gradient_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | 11 | [[fields]] 12 | name = "raw_index" 13 | type = "int" 14 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/slot_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SlotType" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "TENSOR" 12 | 13 | [[values]] 14 | name = "VARIADIC" 15 | -------------------------------------------------------------------------------- /lib/utils/test/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | utils-test-common 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils 12 | rapidcheck 13 | doctest 14 | ) 15 | -------------------------------------------------------------------------------- /lib/compiler/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | compiler-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | compiler 11 | doctest 12 | utils-test-common 13 | models 14 | ) 15 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/replica_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ReplicaType" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "SUM" 12 | 13 | [[values]] 14 | name = "DISCARD_COPY" 15 | -------------------------------------------------------------------------------- /lib/pcg/ffi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | pcg-ffi 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils-ffi 12 | op-attrs-ffi 13 | PRIVATE_DEPS 14 | pcg 15 | ) 16 | -------------------------------------------------------------------------------- /lib/runtime/src/tensor.cpp: -------------------------------------------------------------------------------- 1 | #include "flexflow/accessor.h" 2 | #include "flexflow/config.h" 3 | #include "flexflow/model.h" 4 | #include "flexflow/parallel_tensor.h" 5 | #include "utils/hip_helper.h" 6 | #include 7 | 8 | namespace FlexFlow {} // namespace FlexFlow 9 | -------------------------------------------------------------------------------- /lib/substitutions/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | substitutions-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | doctest 11 | substitutions 12 | utils-test-common 13 | ) 14 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/optimizer_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "optimizer_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | 11 | [[fields]] 12 | name = "raw_index" 13 | type = "int" 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/views/lr_direction.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "LRDirection" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "LEFT" 12 | 13 | [[values]] 14 | name = "RIGHT" 15 | -------------------------------------------------------------------------------- /lib/utils/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | utils-tests 4 | SRC_PATTERNS 5 | src/utils/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | utils 10 | doctest 11 | utils-test-common 12 | ) 13 | 14 | add_subdirectory(common) 15 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/half.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/half.h" 2 | 3 | namespace doctest { 4 | 5 | String StringMaker<::half>::convert(::half const &h) { 6 | return toString(static_cast(h)); 7 | } 8 | 9 | } // namespace doctest 10 | -------------------------------------------------------------------------------- /.github/workflows/helpers/free_space_on_runner.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | set -x 4 | 5 | sudo rm -rf /usr/share/dotnet 6 | sudo rm -rf /usr/local/lib/android 7 | sudo rm -rf /opt/ghc 8 | sudo rm -rf "/usr/local/share/boost" 9 | sudo rm -rf "$AGENT_TOOLSDIRECTORY" 10 | -------------------------------------------------------------------------------- /lib/local-execution/src/local-execution/registered_task.cc: -------------------------------------------------------------------------------- 1 | #include "local-execution/registered_task.h" 2 | 3 | namespace FlexFlow { 4 | 5 | registered_task_t make_noop_registered_task() { 6 | return registered_task_t{std::monostate{}}; 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/op-attrs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | op-attrs 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils 12 | ) 13 | 14 | add_subdirectory(ffi) 15 | add_subdirectory(test) 16 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/shard_parallel_dim.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/shard_parallel_dim.h" 2 | 3 | namespace FlexFlow { 4 | 5 | bool is_valid(ShardParallelDim const &d) { 6 | return d.degree > 0 && d.size > 0 && (d.size % d.degree) == 0; 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/variadic_tensor_ref.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/variadic_tensor_ref.h" 2 | 3 | namespace FlexFlow { 4 | 5 | VariadicTensorRef get_input_tensors() { 6 | return {VariadicTensorRefType::INPUT_TENSORS}; 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/utils/include/utils/json_core.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_UTILS_INCLUDE_UTILS_JSON_CORE_H 2 | #define _FLEXFLOW_UTILS_INCLUDE_UTILS_JSON_CORE_H 3 | 4 | #include "nlohmann/json.hpp" 5 | 6 | namespace FlexFlow { 7 | 8 | using json = nlohmann::json; 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/all_are_true.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/all_are_true.h" 2 | #include 3 | 4 | namespace FlexFlow { 5 | 6 | using Container = std::vector; 7 | 8 | template bool all_are_true(Container const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /.flake/pkgs/ffdb/ffdb.py: -------------------------------------------------------------------------------- 1 | from proj.config_file import get_config_root 2 | from pathlib import Path 3 | import gdb 4 | 5 | gdb.execute(f'directory {get_config_root(Path.cwd())}') 6 | gdb.prompt_hook = lambda x: '(ffdb) ' 7 | gdb.execute('set history save on') 8 | gdb.execute('catch throw') 9 | -------------------------------------------------------------------------------- /lib/compiler/ffi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | compiler-ffi 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils-ffi 12 | pcg-ffi 13 | PRIVATE_DEPS 14 | compiler 15 | ) 16 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/incoming_tensor_role.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "IncomingTensorRole" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "INPUT" 12 | 13 | [[values]] 14 | name = "WEIGHT" 15 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/create_grad.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_PCG_INCLUDE_PCG_CREATE_GRAD_H 2 | #define _FLEXFLOW_PCG_INCLUDE_PCG_CREATE_GRAD_H 3 | 4 | #include "pcg/create_grad.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | bool bool_from_create_grad(CreateGrad); 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/series_parallel/split_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SplitType" 3 | features = [ 4 | "hash", 5 | "json", 6 | "fmt", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "SERIES" 12 | 13 | [[values]] 14 | name = "PARALLEL" 15 | -------------------------------------------------------------------------------- /lib/models/include/models/dlrm/dlrm_arch_interaction_op.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DLRMArchInteractionOp" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "DOT" 12 | 13 | [[values]] 14 | name = "CAT" 15 | -------------------------------------------------------------------------------- /lib/task-spec/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | task-spec-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | doctest 10 | utils-test-common 11 | local-execution 12 | kernels 13 | op-attrs 14 | ) 15 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/instances/unordered_set_labelled_open_dataflow_graph.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/instances/unordered_set_labelled_open_dataflow_graph.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template class UnorderedSetLabelledOpenDataflowGraph; 6 | 7 | } // namespace FlexFlow 8 | -------------------------------------------------------------------------------- /lib/kernels/src/kernels/legion_ordered/legion_ordered.cc: -------------------------------------------------------------------------------- 1 | #include "kernels/legion_ordered/legion_ordered.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template struct LegionOrdered; 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/l1_regularizer_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "L1RegularizerAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "lambda" 14 | type = "float" 15 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/l2_regularizer_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "L2RegularizerAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "lambda" 14 | type = "float" 15 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/constraint_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ConstraintType" 3 | features = [ 4 | "json", 5 | "hash", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "EQUAL" 12 | 13 | [[values]] 14 | name = "DIVISIBLE_BY" 15 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/optional.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/optional.h" 2 | 3 | namespace doctest { 4 | 5 | String StringMaker::convert(std::nullopt_t const &m) { 6 | return toString(fmt::to_string(m)); 7 | } 8 | 9 | } // namespace doctest 10 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/keras/preprocessing/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from __future__ import division 3 | from __future__ import print_function 4 | 5 | from .. import utils 6 | 7 | import keras_preprocessing 8 | 9 | from . import sequence 10 | from . import text 11 | -------------------------------------------------------------------------------- /lib/models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | models 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | op-attrs 12 | utils 13 | pcg 14 | rapidcheck 15 | ) 16 | 17 | add_subdirectory(test) 18 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/glorot_normal_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "GlorotNormalAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "seed" 14 | type = "int" 15 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/glorot_uniform_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "GlorotUniformAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "seed" 14 | type = "int" 15 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/reversed.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/reversed.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template FFOrdered reversed(FFOrdered const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/tensor_role.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorRole" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "INPUT" 12 | 13 | [[values]] 14 | name = "WEIGHT" 15 | 16 | [[values]] 17 | name = "OUTPUT" 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/node/node.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "Node" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | "json", 9 | ] 10 | 11 | includes = [ 12 | "", 13 | ] 14 | 15 | [[fields]] 16 | name = "raw_uid" 17 | type = "size_t" 18 | -------------------------------------------------------------------------------- /lib/pcg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | pcg 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | op-attrs 12 | utils 13 | rapidcheck 14 | ) 15 | 16 | add_subdirectory(ffi) 17 | add_subdirectory(test) 18 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/machine_specification_dimension.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "MachineSpecificationDimension" 3 | features = [ 4 | "hash", 5 | "json", 6 | "fmt", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "INTER_NODE" 12 | 13 | [[values]] 14 | name = "INTRA_NODE" 15 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/digraph/di_output.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DiOutput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | ] 8 | 9 | includes = [ 10 | "utils/graph/node/node.dtg.h", 11 | ] 12 | 13 | [[fields]] 14 | name = "src" 15 | type = "::FlexFlow::Node" 16 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/multidigraph/multidiedge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "MultiDiEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_uid" 16 | type = "size_t" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/at_idx.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/at_idx.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using E = value_type<0>; 7 | 8 | template std::optional at_idx(std::vector const &, nonnegative_int); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/kaiming_initializer_mode.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "KaimingInitializerMode" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "FAN_IN" 12 | 13 | [[values]] 14 | name = "FAN_OUT" 15 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/enumerate.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/enumerate.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template std::map enumerate(FFOrdered const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/get_idxs.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/get_idxs.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template std::vector get_idxs(FFOrdered const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/substitutions/ffi/include/flexflow/substitutions.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_SUBSTITUTIONS_FFI_INCLUDE_FLEXFLOW_SUBSTITUTIONS_H 2 | #define _FLEXFLOW_SUBSTITUTIONS_FFI_INCLUDE_FLEXFLOW_SUBSTITUTIONS_H 3 | 4 | #include "flexflow/utils.h" 5 | 6 | FLEXFLOW_FFI_BEGIN() 7 | 8 | FLEXFLOW_FFI_END() 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/op_task_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OpTaskType" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "INIT" 12 | 13 | [[values]] 14 | name = "FWD" 15 | 16 | [[values]] 17 | name = "BWD" 18 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/count.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/count.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::vector count(size_t n) { 6 | std::vector v(n); 7 | for (size_t i = 0; i < n; i++) { 8 | v[i] = i; 9 | } 10 | return v; 11 | } 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/layer_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "layer_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_node" 16 | type = "::FlexFlow::Node" 17 | -------------------------------------------------------------------------------- /lib/task-spec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | task-spec 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | op-attrs 12 | utils 13 | kernels 14 | pcg 15 | spdlog 16 | ) 17 | 18 | add_subdirectory(test) 19 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/series_parallel/sink_settings.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SinkSettings" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "json", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "INCLUDE_SINK_NODES" 12 | 13 | [[values]] 14 | name = "EXCLUDE_SINK_NODES" 15 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/repeat_element.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/repeat_element.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template std::vector repeat_element(nonnegative_int, T const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/nonnegative_int/num_elements.cc: -------------------------------------------------------------------------------- 1 | #include "utils/nonnegative_int/num_elements.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using E = value_type<0>; 7 | 8 | template nonnegative_int num_elements(std::vector const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /cmake/expected.cmake: -------------------------------------------------------------------------------- 1 | include(aliasing) 2 | if (FF_USE_EXTERNAL_EXPECTED) 3 | find_package(tl-expected REQUIRED) 4 | alias_library(expected tl::expected) 5 | else() 6 | set(EXPECTED_BUILD_TESTS OFF) 7 | set(EXPECTED_BUILD_PACKAGE OFF) 8 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/expected) 9 | endif() 10 | -------------------------------------------------------------------------------- /lib/compiler/include/compiler/machine_mapping/parallel_split_transformation.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ParallelSplitTransformation" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "LthenR" 12 | 13 | [[values]] 14 | name = "RthenL" 15 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ops/reduce.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ops/reduce.h" 2 | 3 | namespace FlexFlow { 4 | 5 | ParallelTensorShape get_output_shape(ReduceAttrs const &, 6 | ParallelTensorShape const &input_shape) { 7 | NOT_IMPLEMENTED(); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/substitutions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | substitutions 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils 12 | op-attrs 13 | pcg 14 | ) 15 | 16 | add_subdirectory(ffi) 17 | add_subdirectory(test) 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/digraph/di_input.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DiInput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "dst" 16 | type = "::FlexFlow::Node" 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/series_parallel/source_settings.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SourceSettings" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "json", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "INCLUDE_SOURCE_NODES" 12 | 13 | [[values]] 14 | name = "EXCLUDE_SOURCE_NODES" 15 | -------------------------------------------------------------------------------- /lib/utils/include/utils/indent.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_INDENT_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_INDENT_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | std::string indent(std::string const &, int indent_size = 2); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/compiler/include/compiler/machine_mapping/memory_optimization/machine_memory_constraints.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "MachineMemoryConstraints" 3 | features = [ 4 | "eq", 5 | "hash", 6 | "fmt", 7 | ] 8 | 9 | includes = [] 10 | 11 | [[fields]] 12 | name = "memory_limit" 13 | type = "size_t" 14 | -------------------------------------------------------------------------------- /lib/local-execution/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | local-execution-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | doctest 10 | utils-test-common 11 | local-execution 12 | kernels 13 | op-attrs 14 | task-spec 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/kaiming_initializer_nonlinearity.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "KaimingInitializerNonlinearity" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "RELU" 12 | 13 | [[values]] 14 | name = "LEAKY_RELU" 15 | -------------------------------------------------------------------------------- /lib/runtime/src/ops/fused_parallel_op_attrs.cc: -------------------------------------------------------------------------------- 1 | #include "fused_parallel_op_attrs.h" 2 | 3 | namespace FlexFlow { 4 | 5 | FusedParallelOpAttrs::FusedParallelOpAttrs( 6 | stack_vector const &_parallel_ops) 7 | : parallel_ops(_parallel_ops) {} 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/op_arg_spec.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/op_arg_spec.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::type_index get_op_arg_spec_type_index(OpArgSpec const &s) { 6 | return s.visit( 7 | [](auto &&arg) { return arg.get_type_index(); }); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/open_dataflow_graph/dataflow_graph_input.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DataflowGraphInput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "", 12 | ] 13 | 14 | [[fields]] 15 | name = "idx" 16 | type = "size_t" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/stack_vector/stack_vector.cc: -------------------------------------------------------------------------------- 1 | #include "utils/stack_vector/stack_vector.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template struct stack_vector; 9 | template struct stack_vector; 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore all folders which start with "build" 2 | /build*/ 3 | 4 | # Ignore compiled files 5 | /.tools/ 6 | /python/flexflow_python 7 | /python/flexflow/core/legion_cffi.py 8 | python/flexflow/core/flexflow_cffi_header.py 9 | python/flexflow/core/legion_cffi_header.py 10 | *.pb.cc 11 | *.pb.h 12 | *.o 13 | *.a 14 | -------------------------------------------------------------------------------- /.flake/pkgs/hpp2plantuml.nix: -------------------------------------------------------------------------------- 1 | {buildPythonPackage, fetchPypi}: 2 | 3 | buildPythonPackage rec { 4 | pname = "hpp2plantuml"; 5 | version = "0.8.5"; 6 | format = "wheel"; 7 | src = fetchPypi { 8 | inherit pname version format; 9 | sha256 = "sha256-PfTJmBypI21AAK3sMojygQfrhnRqcMmVCW4dxGfDfQg="; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /lib/utils/include/utils/cli/cli_flag_key.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "CLIFlagKey" 3 | features = [ 4 | "eq", 5 | "hash", 6 | "fmt", 7 | ] 8 | 9 | includes = [ 10 | "utils/nonnegative_int/nonnegative_int.h", 11 | ] 12 | 13 | [[fields]] 14 | name = "raw_idx" 15 | type = "::FlexFlow::nonnegative_int" 16 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/node/algorithms/new_node.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "NewNode" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_node" 16 | type = "::FlexFlow::Node" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/enumerate_vector.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/enumerate_vector.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template std::map enumerate_vector(std::vector const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/device_stream_t.variant.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "device_stream_t" 3 | features = [] 4 | 5 | includes = [ 6 | "", 7 | "kernels/device.h", 8 | ] 9 | 10 | [[values]] 11 | type = "ffStream_t" 12 | key = "gpu" 13 | 14 | [[values]] 15 | type = "std::monostate" 16 | key = "cpu" 17 | -------------------------------------------------------------------------------- /lib/kernels/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_test_executable( 2 | NAME 3 | kernels-tests 4 | SRC_PATTERNS 5 | src/*.cc 6 | PRIVATE_INCLUDE 7 | src/ 8 | DEPS 9 | doctest 10 | utils-test-common 11 | kernels 12 | op-attrs 13 | cuda 14 | cudnn 15 | cudart 16 | cublas 17 | pcg 18 | ) 19 | -------------------------------------------------------------------------------- /lib/runtime/src/accessor_kernel.cu: -------------------------------------------------------------------------------- 1 | #include "flexflow/utils/cuda_helper.h" 2 | 3 | namespace FlexFlow { 4 | 5 | using namespace Legion; 6 | 7 | template 8 | __global__ void zero_array(DT *ptr, coord_t size) { 9 | CUDA_KERNEL_LOOP(i, size) { 10 | ptr[i] = 0; 11 | } 12 | } 13 | 14 | }; // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/runtime/src/task_spec/task_invocation.cc: -------------------------------------------------------------------------------- 1 | #include "task_invocation.h" 2 | 3 | namespace FlexFlow { 4 | 5 | void TaskBinding::insert_arg_spec(slot_id name, ArgSpec const &arg_spec) { 6 | assert(!contains_key(this->arg_bindings, name)); 7 | this->arg_bindings.insert({name, arg_spec}); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/repeat.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/repeat.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using Out = value_type<0>; 7 | using F = std::function; 8 | 9 | template std::vector repeat(nonnegative_int, F const &); 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/utils/src/utils/json/half.cc: -------------------------------------------------------------------------------- 1 | #include "utils/json/half.h" 2 | 3 | namespace nlohmann { 4 | 5 | void adl_serializer::to_json(json &j, half x) { 6 | j = static_cast(x); 7 | } 8 | 9 | void adl_serializer::from_json(json const &j, half &x) { 10 | x = j.get(); 11 | } 12 | 13 | } // namespace nlohmann 14 | -------------------------------------------------------------------------------- /packaging/conda/environment.yml: -------------------------------------------------------------------------------- 1 | name: flexflow 2 | channels: 3 | - defaults 4 | - conda-forge 5 | dependencies: 6 | - python>=3.6 7 | - cffi>=1.11.0 8 | - numpy>=1.16.0 9 | - Pillow 10 | - pybind11 11 | - cmake-build-extension 12 | - pip 13 | - pip: 14 | - qualname>=0.1.0 15 | - keras_preprocessing>=1.1.2 16 | -------------------------------------------------------------------------------- /bindings/python/old/flexflow/torch/nn/modules/__init__.py: -------------------------------------------------------------------------------- 1 | from .module import Module 2 | 3 | from torch.nn import Conv2d as Conv2d 4 | from torch.nn import MaxPool2d as MaxPool2d 5 | from torch.nn import Linear as Linear 6 | from torch.nn import Dropout as Dropout 7 | from torch.nn import Flatten as Flatten 8 | from torch.nn import ReLU as ReLU 9 | -------------------------------------------------------------------------------- /lib/compiler/include/compiler/machine_mapping/include_unconstrained.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "IncludeUnconstrained" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | "rapidcheck", 9 | "json", 10 | ] 11 | 12 | includes = [] 13 | 14 | [[fields]] 15 | name = "raw_bool" 16 | type = "bool" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/to_uppercase.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/to_uppercase.h" 2 | #include "utils/containers/transform.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::string to_uppercase(std::string const &s) { 7 | return transform(s, [](char c) -> char { return std::toupper(c); }); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /cmake/gbenchmark.cmake: -------------------------------------------------------------------------------- 1 | include(aliasing) 2 | 3 | if (FF_USE_EXTERNAL_GBENCHMARK) 4 | find_package(benchmark REQUIRED) 5 | alias_library(gbenchmark benchmark::benchmark) 6 | alias_library(gbenchmark-main benchmark::benchmark_main) 7 | else() 8 | message(FATAL_ERROR "Currently FF_USE_EXTERNAL_GBENCHMARK is required") 9 | endif() 10 | 11 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/profiling_settings.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ProfilingSettings" 3 | 4 | features = [ 5 | "eq", 6 | "ord", 7 | "hash", 8 | "json", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "warmup_iters" 14 | type = "int" 15 | 16 | [[fields]] 17 | name = "measure_iters" 18 | type = "int" 19 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/pattern_node.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "PatternNode" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_node" 16 | type = "::FlexFlow::Node" 17 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/ops/noop.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_NOOP_H 2 | #define _FLEXFLOW_NOOP_H 3 | 4 | #include "op-attrs/ops/noop_attrs.dtg.h" 5 | #include "task-spec/op_task_invocation.h" 6 | 7 | namespace FlexFlow { 8 | 9 | std::vector get_task_ids(NoopAttrs const &); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/merge_method.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "MergeMethod" 3 | features = [ 4 | "json", 5 | "hash", 6 | "fmt", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "REQUIRE_DISJOINT" 12 | 13 | [[values]] 14 | name = "LEFT_DOMINATES" 15 | 16 | [[values]] 17 | name = "RIGHT_DOMINATES" 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/full_binary_tree/binary_tree_path_entry.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "BinaryTreePathEntry" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "LEFT_CHILD" 12 | key = "left" 13 | 14 | [[values]] 15 | name = "RIGHT_CHILD" 16 | key = "right" 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/full_binary_tree/full_binary_tree_node_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "FullBinaryTreeNodeType" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "json", 7 | "rapidcheck", 8 | ] 9 | 10 | [[values]] 11 | name = "PARENT" 12 | key = "parent" 13 | 14 | [[values]] 15 | name = "LEAF" 16 | key = "leaf" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/get_element_counts.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/get_element_counts.h" 2 | #include "utils/containers/vector_of.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::unordered_map get_element_counts(std::string const &s) { 7 | return get_element_counts(vector_of(s)); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/activation.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "Activation" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "RELU" 12 | 13 | [[values]] 14 | name = "SIGMOID" 15 | 16 | [[values]] 17 | name = "TANH" 18 | 19 | [[values]] 20 | name = "GELU" 21 | -------------------------------------------------------------------------------- /lib/pcg/src/pcg/parallel_computation_graph/parallel_tensor_guid_t.cc: -------------------------------------------------------------------------------- 1 | #include "pcg/parallel_computation_graph/parallel_tensor_guid_t.h" 2 | 3 | namespace FlexFlow { 4 | 5 | parallel_layer_guid_t get_source_layer(parallel_tensor_guid_t const &t) { 6 | return parallel_layer_guid_t{t.raw_graph_output.node}; 7 | } 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/unlabelled_graph_pattern.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "UnlabelledGraphPattern" 3 | features = [] 4 | includes = [ 5 | "utils/graph/open_dataflow_graph/open_dataflow_graph_view.h" 6 | ] 7 | 8 | [[fields]] 9 | name = "raw_graph" 10 | type = "::FlexFlow::OpenDataflowGraphView" 11 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/ops/input.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_INPUT_H 2 | #define _FLEXFLOW_INPUT_H 3 | 4 | #include "op-attrs/ops/input_attrs.dtg.h" 5 | #include "task-spec/op_task_invocation.h" 6 | 7 | namespace FlexFlow { 8 | 9 | std::vector get_task_ids(InputAttrs const &); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/for_internal_use_only.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_UTILS_INCLUDE_UTILS_FOR_INTERNAL_USER_ONLY_H 2 | #define _FLEXFLOW_UTILS_INCLUDE_UTILS_FOR_INTERNAL_USER_ONLY_H 3 | 4 | namespace FlexFlow { 5 | 6 | struct for_internal_use_only { 7 | explicit for_internal_use_only(); 8 | }; 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/collapse_optionals.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/collapse_optionals.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template std::optional 9 | collapse_optionals(std::optional> const &); 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/utils/src/utils/stack_vector/stack_vector_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/stack_vector/stack_vector_of.h" 2 | #include "utils/archetypes/ordered_value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = ordered_value_type<0>; 7 | 8 | template stack_vector stack_vector_of<5>(std::vector const &vector); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /cmake/json.cmake: -------------------------------------------------------------------------------- 1 | include(aliasing) 2 | 3 | if (FF_USE_EXTERNAL_JSON) 4 | find_package(nlohmann_json REQUIRED) 5 | 6 | alias_library(json nlohmann_json) 7 | else() 8 | set(JSON_BuildTests OFF CACHE INTERNAL "") 9 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/json) 10 | 11 | alias_library(json nlohmann_json::nlohmann_json) 12 | endif() 13 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ff_dim_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ff_dim_t" 3 | 4 | features = [ 5 | "eq", 6 | "ord", 7 | "hash", 8 | "json", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/nonnegative_int/nonnegative_int.h" 14 | ] 15 | 16 | [[fields]] 17 | name = "value" 18 | type = "::FlexFlow::nonnegative_int" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/cast_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "CastAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/datatype.dtg.h" 14 | ] 15 | 16 | [[fields]] 17 | name = "dtype" 18 | type = "::FlexFlow::DataType" 19 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_output.dtg.h" 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_graph_output" 16 | type = "::FlexFlow::DataflowOutput" 17 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/ops/weight.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_WEIGHT_H 2 | #define _FLEXFLOW_WEIGHT_H 3 | 4 | #include "op-attrs/ops/weight_attrs.dtg.h" 5 | #include "task-spec/op_task_invocation.h" 6 | 7 | namespace FlexFlow { 8 | 9 | std::vector get_task_ids(WeightAttrs const &); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/to_uppercase.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_TO_UPPERCASE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_TO_UPPERCASE_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | std::string to_uppercase(std::string const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/legion_dim_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "legion_dim_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "fmt", 9 | ] 10 | 11 | includes = [ 12 | "utils/nonnegative_int/nonnegative_int.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "value" 17 | type = "::FlexFlow::nonnegative_int" 18 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/dropout_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DropoutAttrs" 3 | 4 | features = [ 5 | "eq", 6 | "ord", 7 | "hash", 8 | "json", 9 | "rapidcheck", 10 | "fmt", 11 | ] 12 | 13 | [[fields]] 14 | name = "rate" 15 | type = "float" 16 | 17 | [[fields]] 18 | name = "seed" 19 | type = "unsigned long long" 20 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/stride_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "stride_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "unwrapped" 18 | type = "::FlexFlow::positive_int" 19 | -------------------------------------------------------------------------------- /lib/runtime/src/accessor_kernel.cpp: -------------------------------------------------------------------------------- 1 | #include "utils/hip_helper.h" 2 | #include 3 | 4 | namespace FlexFlow { 5 | 6 | using namespace Legion; 7 | 8 | template 9 | __global__ void zero_array(DT *ptr, coord_t size) { 10 | CUDA_KERNEL_LOOP(i, size) { 11 | ptr[i] = 0; 12 | } 13 | } 14 | 15 | }; // namespace FlexFlow 16 | -------------------------------------------------------------------------------- /lib/runtime/src/loggers.cc: -------------------------------------------------------------------------------- 1 | #include "loggers.h" 2 | 3 | namespace FlexFlow { 4 | 5 | LegionRuntime::Logger::Category log_profile("profile"), log_measure("measure"), 6 | log_sim("sim"), log_ps_sim("ps_sim"), log_xfer_sim("xfer_sim"), 7 | log_xfer_est("xfer_est"), log_metrics("metrics"), log_model("Model"), 8 | log_mapper("Mapper"); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /lib/substitution-generator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | substitution-generator 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | utils 12 | op-attrs 13 | pcg 14 | substitutions 15 | ) 16 | 17 | # add_subdirectory(ffi) 18 | add_subdirectory(test) 19 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/loss_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "loss_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/nonnegative_int/nonnegative_int.h" 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_index" 16 | type = "::FlexFlow::nonnegative_int" 17 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/task_arg_spec.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_TASK_SPEC_INCLUDE_TASK_SPEC_TASK_ARG_SPEC_H 2 | #define _FLEXFLOW_LIB_TASK_SPEC_INCLUDE_TASK_SPEC_TASK_ARG_SPEC_H 3 | 4 | #include "task-spec/task_arg_spec.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::type_index get_type_index(TaskArgSpec const &); 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/task_invocation.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LOCAL_EXECUTION_TASK_INVOCATION_H 2 | #define _FLEXFLOW_LOCAL_EXECUTION_TASK_INVOCATION_H 3 | 4 | #include "task-spec/task_invocation.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | bool is_invocation_valid(TaskSignature const &sig, TaskInvocation const &inv); 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/tensor_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorType" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "LOSS" 12 | 13 | [[values]] 14 | name = "FORWARD" 15 | 16 | [[values]] 17 | name = "GRADIENT" 18 | 19 | [[values]] 20 | name = "OPTIMIZER" 21 | -------------------------------------------------------------------------------- /lib/utils/include/utils/cli/cli_positional_argument_key.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "CLIPositionalArgumentKey" 3 | features = [ 4 | "eq", 5 | "hash", 6 | "fmt", 7 | ] 8 | 9 | includes = [ 10 | "utils/nonnegative_int/nonnegative_int.h", 11 | ] 12 | 13 | [[fields]] 14 | name = "raw_idx" 15 | type = "::FlexFlow::nonnegative_int" 16 | -------------------------------------------------------------------------------- /lib/utils/include/utils/integer_conversions.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_INTEGER_CONVERSIONS_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_INTEGER_CONVERSIONS_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | size_t size_t_from_int(int); 9 | int int_from_size_t(size_t); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/device_handle_t.variant.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "device_handle_t" 3 | features = [] 4 | 5 | includes = [ 6 | "", 7 | "kernels/ff_handle.h", 8 | ] 9 | 10 | [[values]] 11 | type = "::FlexFlow::PerDeviceFFHandle" 12 | key = "for_gpu" 13 | 14 | [[values]] 15 | type = "std::monostate" 16 | key = "for_cpu" 17 | -------------------------------------------------------------------------------- /lib/local-execution/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | local-execution 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | op-attrs 12 | utils 13 | kernels 14 | task-spec 15 | pcg 16 | spdlog 17 | compiler 18 | ) 19 | 20 | add_subdirectory(test) 21 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/cpu_id_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "cpu_id_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/nonnegative_int/nonnegative_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "cpu_index" 18 | type = "::FlexFlow::nonnegative_int" 19 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/file_format/v1/graphs/v1_graph_output.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "V1GraphOutput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | # "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "srcNode" 14 | type = "size_t" 15 | 16 | [[fields]] 17 | name = "srcIdx" 18 | type = "size_t" 19 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/gpu_id_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "gpu_id_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/nonnegative_int/nonnegative_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "gpu_index" 18 | type = "::FlexFlow::nonnegative_int" 19 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/runtime_arg_ref_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "RuntimeArgRefType" 3 | features = [ 4 | "fmt", 5 | ] 6 | 7 | [[values]] 8 | name = "FF_HANDLE" 9 | 10 | [[values]] 11 | name = "PROFILING_SETTINGS" 12 | 13 | [[values]] 14 | name = "FF_ITERATION_CONFIG" 15 | 16 | [[values]] 17 | name = "KERNEL_DEVICE_TYPE" 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/make.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_MAKE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_MAKE_H 3 | 4 | namespace FlexFlow { 5 | 6 | template 7 | decltype(auto) make() { 8 | return [](auto const &x) { return T{x}; }; 9 | } 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/series_parallel/sp_decomposition_tree_node_type.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SPDecompositionTreeNodeType" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "SERIES" 12 | 13 | [[values]] 14 | name = "PARALLEL" 15 | 16 | [[values]] 17 | name = "NODE" 18 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/pair.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/pair.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | using ::FlexFlow::value_type; 5 | 6 | using L = value_type<0>; 7 | using R = value_type<1>; 8 | 9 | namespace doctest { 10 | 11 | template struct StringMaker>; 12 | 13 | } // namespace doctest 14 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/containers/make.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/make.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("make") { 8 | auto f = make(); 9 | 10 | int result = f(true); 11 | int correct = 1; 12 | 13 | CHECK(result == correct); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/reshape_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ReshapeAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/tensor_shape.dtg.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "shape" 18 | type = "::FlexFlow::TensorShape" 19 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/output_graph/output_graph_expr_node.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OutputGraphExprNode" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h" 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_graph_node" 16 | type = "::FlexFlow::Node" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/full_binary_tree/visit.cc: -------------------------------------------------------------------------------- 1 | #include "utils/full_binary_tree/visit.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template int visit(std::string const &, 6 | FullBinaryTreeImplementation const &, 7 | FullBinaryTreeVisitor const &); 8 | 9 | } // namespace FlexFlow 10 | -------------------------------------------------------------------------------- /cmake/visit_struct.cmake: -------------------------------------------------------------------------------- 1 | add_library( 2 | visit_struct 3 | INTERFACE 4 | ) 5 | target_include_directories( 6 | visit_struct 7 | INTERFACE 8 | ${CMAKE_CURRENT_SOURCE_DIR}/deps/visit_struct/include/ 9 | ) 10 | set_target_properties( 11 | visit_struct 12 | PROPERTIES 13 | CXX_STANDARD 11 14 | CXX_STANDARD_REQUIRED YES 15 | CXX_EXTENSIONS NO 16 | ) 17 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/input_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "InputAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/tensor_shape.dtg.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "tensor_shape" 18 | type = "::FlexFlow::TensorShape" 19 | -------------------------------------------------------------------------------- /lib/utils/include/utils/internal_only_tag.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_UTILS_INCLUDE_UTILS_GRAPH_INTERNAL_ONLY_TAG_H 2 | #define _FLEXFLOW_UTILS_INCLUDE_UTILS_GRAPH_INTERNAL_ONLY_TAG_H 3 | 4 | namespace FlexFlow { 5 | struct should_only_be_used_internally_tag_t { 6 | explicit should_only_be_used_internally_tag_t() = default; 7 | }; 8 | } // namespace FlexFlow 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/lookup_in_map.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/lookup_in_map.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using K = value_type<0>; 7 | using V = value_type<1>; 8 | 9 | template std::function 10 | lookup_in_map(std::unordered_map const &map); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/without_nullopts.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/without_nullopts.h" 2 | 3 | namespace FlexFlow { 4 | 5 | template std::unordered_set 6 | without_nullopts(std::unordered_set> const &); 7 | template std::vector 8 | without_nullopts(std::vector> const &); 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/undirected/undirected_edge.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/undirected/undirected_edge.h" 2 | #include "utils/hash/tuple.h" 3 | #include 4 | 5 | namespace FlexFlow { 6 | 7 | bool is_connected_to(UndirectedEdge const &e, Node const &n) { 8 | return e.endpoints.min() == n || e.endpoints.max() == n; 9 | } 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/broadcast_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "BroadcastAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/tensor_dims.dtg.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "target_dims" 18 | type = "::FlexFlow::TensorDims" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/shard_parallel_dim.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_OP_ATTRS_INCLUDE_OP_ATTRS_SHARD_PARALLEL_DIM_H 2 | #define _FLEXFLOW_LIB_OP_ATTRS_INCLUDE_OP_ATTRS_SHARD_PARALLEL_DIM_H 3 | 4 | #include "op-attrs/shard_parallel_dim.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | bool is_valid(ShardParallelDim const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/computation_graph/computation_graph_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ComputationGraphEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_edge.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_edge" 16 | type = "::FlexFlow::DataflowEdge" 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/node/node_query.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "NodeQuery" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | "utils/graph/query_set.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "nodes" 17 | type = "::FlexFlow::query_set<::FlexFlow::Node>" 18 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/recurse_n.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/recurse_n.h" 2 | #include "utils/archetypes/value_type.h" 3 | #include 4 | 5 | namespace FlexFlow { 6 | 7 | using T = value_type<0>; 8 | using F = std::function; // F :: T -> T 9 | 10 | template T recurse_n(F const &f, int n, T const &initial_value); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/multidigraph/algorithms/add_nodes.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/multidigraph/algorithms/add_nodes.h" 2 | #include "utils/containers/repeat.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::vector add_nodes(MultiDiGraph &g, nonnegative_int num_nodes) { 7 | return repeat(num_nodes, [&]() { return g.add_node(); }); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /.github/workflows/shell-check.yml: -------------------------------------------------------------------------------- 1 | name: Shell Check 2 | on: [push, pull_request, workflow_dispatch] 3 | jobs: 4 | shellcheck: 5 | name: Shellcheck 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v3 9 | - name: Run ShellCheck 10 | uses: ludeeus/action-shellcheck@master 11 | with: 12 | ignore_paths: ./triton/** 13 | -------------------------------------------------------------------------------- /bin/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(FF_BUILD_SUBSTITUTION_TOOL) 2 | add_subdirectory(protobuf-to-json) 3 | endif() 4 | 5 | if(FF_BUILD_VISUALIZATION_TOOL) 6 | add_subdirectory(substitution-to-dot) 7 | endif() 8 | 9 | if(FF_BUILD_ARG_PARSER) 10 | add_subdirectory(arg_parser) 11 | endif() 12 | 13 | if(FF_BUILD_BIN_EXPORT_MODEL_ARCH) 14 | add_subdirectory(export-model-arch) 15 | endif() 16 | -------------------------------------------------------------------------------- /lib/op-attrs/test/src/op-attrs/ff_ordered/ff_ordered.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/ff_ordered.h" 2 | #include "test/utils/rapidcheck.h" 3 | #include 4 | 5 | using namespace FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | TEST_CASE_TEMPLATE("Arbitrary> with T=", T, int, double, char) { 9 | RC_SUBCASE([](FFOrdered) {}); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/runtime/src/loggers.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_RUNTIME_SRC_LOGGERS_H 2 | #define _FLEXFLOW_RUNTIME_SRC_LOGGERS_H 3 | 4 | #include "legion/legion_utilities.h" 5 | 6 | namespace FlexFlow { 7 | 8 | extern LegionRuntime::Logger::Category log_profile, log_measure, log_sim, 9 | log_ps_sim, log_xfer_sim, log_xfer_est, log_metrics, log_model, log_mapper; 10 | 11 | } 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/runtime/src/op_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_RUNTIME_SRC_OP_MANAGER_H 2 | #define _FLEXFLOW_RUNTIME_SRC_OP_MANAGER_H 3 | 4 | #include "operator.h" 5 | 6 | namespace FlexFlow { 7 | 8 | struct OpManager { 9 | template 10 | Op *create(Args &&...args) { 11 | return new T( 12 | } 13 | }; 14 | 15 | } // namespace FlexFlow 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/task_arg_spec.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/task_arg_spec.h" 2 | #include "utils/overload.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::type_index get_type_index(TaskArgSpec const &task_arg_spec) { 7 | return task_arg_spec.visit( 8 | overload{[](auto const &e) { return e.get_type_index(); }}); 9 | } 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/range.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_RANGE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_RANGE_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | std::vector range(int start, int end, int step = 1); 9 | std::vector range(int end); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/multidigraph/algorithms/get_edges.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/multidigraph/algorithms/get_edges.h" 2 | #include "utils/graph/multidigraph/multidiedge_query.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::unordered_set get_edges(MultiDiGraphView const &g) { 7 | return g.query_edges(multidiedge_query_all()); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/undirected/algorithms/make_undirected_edge.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/undirected/algorithms/make_undirected_edge.h" 2 | #include "utils/commutative_pair.h" 3 | 4 | namespace FlexFlow { 5 | 6 | UndirectedEdge make_undirected_edge(Node const &n1, Node const &n2) { 7 | return UndirectedEdge{commutative_pair{n1, n2}}; 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/gather_per_device_state.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "GatherPerDeviceState" 3 | features = [] 4 | 5 | includes = [ 6 | "kernels/ff_handle.h", 7 | "op-attrs/ff_dim_t.dtg.h", 8 | ] 9 | 10 | [[fields]] 11 | name = "handle" 12 | type = "::FlexFlow::PerDeviceFFHandle" 13 | 14 | [[fields]] 15 | name = "dim" 16 | type = "::FlexFlow::ff_dim_t" 17 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/concat_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ConcatAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ff_dim_t.h", 14 | "op-attrs/ff_dim_t.dtg.h" 15 | ] 16 | 17 | [[fields]] 18 | name = "axis" 19 | type = "::FlexFlow::ff_dim_t" 20 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/reduction_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ReductionAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "reduction_degree" 18 | type = "::FlexFlow::positive_int" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/reverse_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ReverseAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ff_dim_t.h", 14 | "op-attrs/ff_dim_t.dtg.h", 15 | ] 16 | 17 | [[fields]] 18 | name = "axis" 19 | type = "::FlexFlow::ff_dim_t" 20 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/softmax_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SoftmaxAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ff_dim_t.h", 14 | "op-attrs/ff_dim_t.dtg.h", 15 | ] 16 | 17 | [[fields]] 18 | name = "dim" 19 | type = "::FlexFlow::ff_dim_t" 20 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/parallel_tensor_shape/sum_degree.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SumDegree" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "value" 18 | type = "::FlexFlow::positive_int" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/replica_parallel_dim.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_OP_ATTRS_INCLUDE_OP_ATTRS_REPLICA_PARALLEL_DIM_H 2 | #define _FLEXFLOW_LIB_OP_ATTRS_INCLUDE_OP_ATTRS_REPLICA_PARALLEL_DIM_H 3 | 4 | #include "op-attrs/replica_parallel_dim.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | bool is_valid(ReplicaParallelDim const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/transform.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/transform.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | using Out = value_type<1>; 8 | using F = std::function; 9 | 10 | template FFOrdered transform(FFOrdered const &, F &&); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/standard_pattern_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "StandardPatternEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_edge.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_edge" 16 | type = "::FlexFlow::DataflowEdge" 17 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/op_slot_options.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OpSlotOptions" 3 | features = [ 4 | "hash", 5 | "fmt", 6 | "rapidcheck", 7 | "json", 8 | ] 9 | 10 | [[values]] 11 | name = "OPTIONAL" 12 | 13 | [[values]] 14 | name = "UNTRAINABLE" 15 | 16 | [[values]] 17 | name = "OPTIONAL_UNTRAINABLE" 18 | 19 | [[values]] 20 | name = "NECESSARY" 21 | -------------------------------------------------------------------------------- /lib/utils/src/utils/fmt/set.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/set.h" 2 | #include "utils/archetypes/ordered_value_type.h" 3 | 4 | using T = ::FlexFlow::ordered_value_type<0>; 5 | 6 | namespace fmt { 7 | 8 | template struct formatter<::std::set, char>; 9 | 10 | } 11 | 12 | namespace FlexFlow { 13 | 14 | template std::ostream &operator<<(std::ostream &, std::set const &); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /docs/source/python/init.rst: -------------------------------------------------------------------------------- 1 | ******************** 2 | Model Initialization 3 | ******************** 4 | .. automodule:: flexflow.core.flexflow_cffi 5 | :noindex: 6 | 7 | Compile 8 | ======= 9 | .. autoclass:: FFModel() 10 | :noindex: 11 | :members: compile 12 | 13 | Initialization 14 | ============== 15 | .. autoclass:: FFModel() 16 | :noindex: 17 | :members: init_layers 18 | -------------------------------------------------------------------------------- /lib/compiler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | compiler 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | op-attrs 12 | utils 13 | json 14 | pcg 15 | spdlog 16 | substitutions 17 | ) 18 | 19 | add_subdirectory(ffi) 20 | add_subdirectory(test) 21 | add_subdirectory(benchmark) 22 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/replicate_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ReplicateAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "replicate_degree" 18 | type = "::FlexFlow::positive_int" 19 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/pattern_value_use.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "PatternValueUse" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_input.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_input" 16 | type = "::FlexFlow::DataflowInput" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/undirected/algorithms/get_edges.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/undirected/algorithms/get_edges.h" 2 | #include "utils/graph/undirected/undirected_edge_query.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::unordered_set get_edges(UndirectedGraphView const &g) { 7 | return g.query_edges(undirected_edge_query_all()); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /cmake/aliasing.cmake: -------------------------------------------------------------------------------- 1 | function(alias_library alias_name real_name) 2 | # https://cmake.org/cmake/help/v3.15/manual/cmake-buildsystem.7.html#alias-targets 3 | get_target_property(_aliased "${real_name}" ALIASED_TARGET) 4 | if(_aliased) 5 | add_library("${alias_name}" ALIAS "${_aliased}") 6 | else() 7 | add_library("${alias_name}" ALIAS "${real_name}") 8 | endif() 9 | endfunction() 10 | -------------------------------------------------------------------------------- /docs/source/python/create.rst: -------------------------------------------------------------------------------- 1 | ************** 2 | Model Creation 3 | ************** 4 | .. automodule:: flexflow.core.flexflow_cffi 5 | :noindex: 6 | 7 | Model Creation 8 | ============== 9 | .. autoclass:: FFModel() 10 | :noindex: 11 | :members: __init__ 12 | 13 | Tensor Creation 14 | =============== 15 | .. autoclass:: FFModel() 16 | :noindex: 17 | :members: create_tensor 18 | -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(pcg) 2 | add_subdirectory(compiler) 3 | add_subdirectory(runtime) 4 | add_subdirectory(op-attrs) 5 | add_subdirectory(kernels) 6 | add_subdirectory(local-execution) 7 | add_subdirectory(task-spec) 8 | add_subdirectory(utils) 9 | add_subdirectory(ffi) 10 | add_subdirectory(substitutions) 11 | add_subdirectory(substitution-generator) 12 | add_subdirectory(models) 13 | -------------------------------------------------------------------------------- /lib/kernels/src/kernels/legion_ordered/transform.cc: -------------------------------------------------------------------------------- 1 | #include "kernels/legion_ordered/transform.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | using Out = value_type<1>; 8 | using F = std::function; 9 | 10 | template LegionOrdered transform(LegionOrdered const &, F &&); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/parallel_computation_graph/parallel_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "parallel_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_output.dtg.h" 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_graph_output" 16 | type = "::FlexFlow::DataflowOutput" 17 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/parallel_computation_graph/parallel_tensor_use_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "parallel_tensor_use_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_input.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_input" 16 | type = "::FlexFlow::DataflowInput" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/output_graph/attr_constant.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "AttrConstant" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "substitutions/operator_pattern/operator_attribute_value.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "value" 16 | type = "::FlexFlow::OperatorAttributeValue" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/input_pattern_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "InputPatternEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/dataflow_input_edge.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_edge" 16 | type = "::FlexFlow::DataflowInputEdge" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/pattern_node_output.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "PatternNodeOutput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_output.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_output" 16 | type = "::FlexFlow::DataflowOutput" 17 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/op_task_invocation.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OpTaskInvocation" 3 | features = [] 4 | 5 | includes = [ 6 | "task-spec/op_task_binding.h", 7 | "task-spec/task_id_t.dtg.h", 8 | ] 9 | 10 | [[fields]] 11 | name = "task_id" 12 | type = "::FlexFlow::task_id_t" 13 | 14 | [[fields]] 15 | name = "binding" 16 | type = "::FlexFlow::OpTaskBinding" 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/digraph/directed_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DirectedEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "src" 16 | type = "::FlexFlow::Node" 17 | 18 | [[fields]] 19 | name = "dst" 20 | type = "::FlexFlow::Node" 21 | -------------------------------------------------------------------------------- /lib/utils/include/utils/overload.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_OVERLOAD_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_OVERLOAD_H 3 | 4 | namespace FlexFlow { 5 | 6 | template 7 | struct overload : Ts... { 8 | using Ts::operator()...; 9 | }; 10 | template 11 | overload(Ts...) -> overload; 12 | 13 | } // namespace FlexFlow 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /lib/utils/include/utils/positive_int/ceildiv.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_POSITIVE_INT_CEILDIV_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_POSITIVE_INT_CEILDIV_H 3 | 4 | #include "utils/positive_int/positive_int.h" 5 | 6 | namespace FlexFlow { 7 | 8 | positive_int ceildiv(positive_int numerator, positive_int denominator); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/rapidcheck/half.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_RAPIDCHECK_HALF_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_RAPIDCHECK_HALF_H 3 | 4 | #include "utils/half.h" 5 | #include 6 | 7 | namespace rc { 8 | 9 | template <> 10 | struct Arbitrary<::half> { 11 | static Gen<::half> arbitrary(); 12 | }; 13 | 14 | } // namespace rc 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/enumerate.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/enumerate.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template std::map enumerate(std::vector const &); 9 | 10 | template std::map enumerate(std::unordered_set const &); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/filtrans.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/filtrans.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using In = value_type<0>; 7 | using Out = value_type<1>; 8 | using F = std::function(In const &)>; 9 | 10 | template std::vector filtrans(std::vector const &, F &&); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/zip.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/zip.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using L1 = value_type<0>; 7 | using R1 = value_type<1>; 8 | 9 | template std::vector> zip(std::vector const &, 10 | std::vector const &); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/open_dataflow_graph/algorithms/get_open_dataflow_graph_inputs.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/open_dataflow_graph/algorithms/get_open_dataflow_graph_inputs.h" 2 | 3 | namespace FlexFlow { 4 | 5 | std::unordered_set 6 | get_open_dataflow_graph_inputs(OpenDataflowGraphView const &g) { 7 | return g.get_inputs(); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/rapidcheck/optional.cc: -------------------------------------------------------------------------------- 1 | #include "utils/rapidcheck/optional.h" 2 | #include "test/utils/rapidcheck.h" 3 | #include 4 | 5 | using namespace ::FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | TEST_CASE_TEMPLATE( 9 | "Arbitrary> with T=", T, int, double, char) { 10 | RC_SUBCASE([](std::optional o) {}); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/partition_per_device_state.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "RepartitionPerDeviceState" 3 | features = [] 4 | 5 | includes = [ 6 | "kernels/ff_handle.h", 7 | "op-attrs/datatype.dtg.h", 8 | ] 9 | 10 | [[fields]] 11 | name = "handle" 12 | type = "::FlexFlow::PerDeviceFFHandle" 13 | 14 | [[fields]] 15 | name = "data_type" 16 | type = "::FlexFlow::DataType" 17 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/parallel_tensor_shape/discard_copy_degree.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DiscardCopyDegree" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "value" 18 | type = "::FlexFlow::positive_int" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/filtrans.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/filtrans.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using In = value_type<0>; 7 | using Out = value_type<1>; 8 | using F = std::function(In const &)>; 9 | 10 | template FFOrdered filtrans(FFOrdered const &, F &&); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/zip.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/zip.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T1 = value_type<0>; 7 | using T2 = value_type<1>; 8 | 9 | template FFOrdered> zip(FFOrdered const &, 10 | FFOrdered const &); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/parallel_computation_graph/parallel_computation_graph_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ParallelComputationGraphEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_edge.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_edge" 16 | type = "::FlexFlow::DataflowEdge" 17 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/parallel_computation_graph/parallel_layer_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "parallel_layer_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | # "json", 8 | # "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/graph/node/node.dtg.h" 14 | ] 15 | 16 | [[fields]] 17 | name = "raw_graph_node" 18 | type = "::FlexFlow::Node" 19 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/op_arg_spec.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_LOCAL_EXECUTION_INCLUDE_LOCAL_EXECUTION_OP_ARG_SPEC_H 2 | #define _FLEXFLOW_LIB_LOCAL_EXECUTION_INCLUDE_LOCAL_EXECUTION_OP_ARG_SPEC_H 3 | 4 | #include "task-spec/op_arg_spec.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::type_index get_op_arg_spec_type_index(OpArgSpec const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/undirected/undirected_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "UndirectedEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/commutative_pair.h", 12 | "utils/graph/node/node.dtg.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "endpoints" 17 | type = "::FlexFlow::commutative_pair<::FlexFlow::Node>" 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/undirected/undirected_edge_query.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "UndirectedEdgeQuery" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/query_set.h", 12 | "utils/graph/node/node.dtg.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "nodes" 17 | type = "::FlexFlow::query_set<::FlexFlow::Node>" 18 | -------------------------------------------------------------------------------- /lib/utils/test/common/include/test/utils/doctest/check_kv.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_TEST_COMMON_INCLUDE_TEST_UTILS_DOCTEST_CHECK_KV_H 2 | #define _FLEXFLOW_LIB_UTILS_TEST_COMMON_INCLUDE_TEST_UTILS_DOCTEST_CHECK_KV_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | std::string check_kv(std::string const &k, std::string const &v); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/test/common/src/test/utils/doctest/fmt/tuple.cc: -------------------------------------------------------------------------------- 1 | #include "test/utils/doctest/fmt/tuple.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | using ::FlexFlow::value_type; 5 | 6 | using A = value_type<0>; 7 | using B = value_type<1>; 8 | using C = value_type<2>; 9 | 10 | namespace doctest { 11 | 12 | template struct StringMaker>; 13 | 14 | } // namespace doctest 15 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/constant_initializer_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ConstantInitializerAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/datatype_value.dtg.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "value" 18 | type = "::FlexFlow::DataTypeValue" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/operator_type.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_OP_ATTRS_INCLUDE_OP_ATTRS_OPERATOR_TYPE_H 2 | #define _FLEXFLOW_LIB_OP_ATTRS_INCLUDE_OP_ATTRS_OPERATOR_TYPE_H 3 | 4 | #include "op-attrs/operator_type.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::string get_operator_type_name(OperatorType); 9 | bool is_parallel_op(OperatorType); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/unlabelled/pattern_input.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "PatternInput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/dataflow_graph_input.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_graph_input" 16 | type = "::FlexFlow::DataflowGraphInput" 17 | -------------------------------------------------------------------------------- /.flake/pkgs/fccf/fix-argparse-include.patch: -------------------------------------------------------------------------------- 1 | diff --git a/source/main.cpp b/source/main.cpp 2 | index 7e131d3..6c05d89 100644 3 | --- a/source/main.cpp 4 | +++ b/source/main.cpp 5 | @@ -6,7 +6,7 @@ 6 | #include 7 | #include 8 | 9 | -#include 10 | +#include 11 | #include 12 | #include "searcher.hpp" 13 | #include 14 | -------------------------------------------------------------------------------- /cmake/spdlog.cmake: -------------------------------------------------------------------------------- 1 | include(aliasing) 2 | 3 | if (FF_USE_EXTERNAL_SPDLOG) 4 | find_package(spdlog REQUIRED) 5 | else() 6 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/spdlog) 7 | endif() 8 | 9 | add_library(ff_spdlog INTERFACE) 10 | target_link_libraries(ff_spdlog INTERFACE spdlog::spdlog) 11 | target_compile_definitions(ff_spdlog INTERFACE SPDLOG_FMT_EXTERNAL) 12 | alias_library(spdlog ff_spdlog) 13 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/create_local_allocator_for_device_type.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_KERNELS_INCLUDE_KERNELS_ALLOCATOR_FOR_DEVICE_TYPE_H 2 | #define _FLEXFLOW_LIB_KERNELS_INCLUDE_KERNELS_ALLOCATOR_FOR_DEVICE_TYPE_H 3 | 4 | #include "kernels/allocation.h" 5 | 6 | namespace FlexFlow { 7 | 8 | Allocator create_local_allocator_for_device_type(DeviceType); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/runtime/src/parallel_op_info.cc: -------------------------------------------------------------------------------- 1 | #include "parallel_op_info.h" 2 | 3 | namespace FlexFlow { 4 | 5 | ParallelOpInfo::ParallelOpInfo(OperatorType _op_type, 6 | ff_dim_t _parallel_dim, 7 | int _parallel_degree) 8 | : op_type(_op_type), parallel_dim(_parallel_dim), 9 | parallel_degree(_parallel_degree) {} 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/output_graph/output_pattern_value.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OutputPatternValue" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/open_dataflow_value.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_value" 16 | type = "::FlexFlow::OpenDataflowValue" 17 | -------------------------------------------------------------------------------- /lib/utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ff_add_library( 2 | NAME 3 | utils 4 | SRC_PATTERNS 5 | src/*.cc 6 | PUBLIC_INCLUDE 7 | include/ 8 | PRIVATE_INCLUDE 9 | src/ 10 | DEPS 11 | expected 12 | visit_struct 13 | fmt 14 | json 15 | cuda 16 | rapidcheck 17 | libassert 18 | ) 19 | 20 | add_subdirectory(ffi) 21 | add_subdirectory(test) 22 | add_subdirectory(benchmark) 23 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/contains_key.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_CONTAINS_KEY_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_CONTAINS_KEY_H 3 | 4 | namespace FlexFlow { 5 | 6 | template 7 | bool contains_key(C const &m, typename C::key_type const &k) { 8 | return m.find(k) != m.end(); 9 | } 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/transform_until.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/transform_until.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | using T2 = value_type<1>; 8 | using F = std::function(T const &)>; 9 | 10 | template std::vector transform_until(std::vector const &, F &&); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/multidigraph/algorithms/get_directed_edge.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/multidigraph/algorithms/get_directed_edge.h" 2 | 3 | namespace FlexFlow { 4 | 5 | DirectedEdge get_directed_edge(MultiDiGraphView const &g, 6 | MultiDiEdge const &e) { 7 | return DirectedEdge{g.get_multidiedge_src(e), g.get_multidiedge_dst(e)}; 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/fmt/set.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/set.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("fmt::to_string(std::set)") { 8 | std::set input = {0, 1, 3, 2}; 9 | std::string result = fmt::to_string(input); 10 | std::string correct = "{0, 1, 2, 3}"; 11 | CHECK(result == correct); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/uniform_initializer_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "UniformInitializerAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "fmt", 9 | ] 10 | 11 | [[fields]] 12 | name = "seed" 13 | type = "int" 14 | 15 | [[fields]] 16 | name = "min_val" 17 | type = "float" 18 | 19 | [[fields]] 20 | name = "max_val" 21 | type = "float" 22 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/loss_functions/sparse_categorical_cross_entropy_loss_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SparseCategoricalCrossEntropyLossAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | "rapidcheck", 9 | "json", 10 | ] 11 | 12 | [[fields]] 13 | # for aggregate_spec: More predictions than labels 14 | name = "replace_labels" 15 | type = "bool" 16 | -------------------------------------------------------------------------------- /lib/op-attrs/test/src/op-attrs/dim_ordered/dim_ordered.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/dim_ordered/dim_ordered.h" 2 | #include "doctest/doctest.h" 3 | #include "test/utils/rapidcheck.h" 4 | 5 | using namespace FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | 9 | TEST_CASE_TEMPLATE( 10 | "Arbitrary> with T=", T, int, double, char) { 11 | RC_SUBCASE([](DimOrdered) {}); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/device_id_t.variant.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "device_id_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "fmt", 9 | ] 10 | 11 | includes = [ 12 | "pcg/cpu_id_t.dtg.h", 13 | "pcg/gpu_id_t.dtg.h", 14 | ] 15 | 16 | [[values]] 17 | type = "::FlexFlow::gpu_id_t" 18 | key = "gpu" 19 | 20 | [[values]] 21 | type = "::FlexFlow::cpu_id_t" 22 | key = "cpu" 23 | -------------------------------------------------------------------------------- /lib/runtime/src/task_spec/typed_task_invocation.cc: -------------------------------------------------------------------------------- 1 | #include "typed_task_invocation.h" 2 | 3 | namespace FlexFlow { 4 | 5 | TaskInvocationSpec::TaskInvocationSpec(std::type_index const &type_idx, 6 | TaskInvocation const &invocation) 7 | : type_idx(type_idx) { 8 | this->invocation = std::make_shared(invocation); 9 | } 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/open_parallel_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "open_parallel_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/open_dataflow_value.dtg.h" 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_open_dataflow_value" 16 | type = "::FlexFlow::OpenDataflowValue" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/output_graph/output_graph_expr_node_output.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OutputGraphExprNodeOutput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/dataflow_graph/dataflow_output.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_output" 16 | type = "::FlexFlow::DataflowOutput" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/sub_parallel_computation_graph_edge.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SubParallelComputationGraphEdge" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/open_dataflow_edge.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_edge" 16 | type = "::FlexFlow::OpenDataflowEdge" 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/zip_strict.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/zip_strict.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using L = value_type<0>; 7 | using R = value_type<1>; 8 | 9 | template std::vector> zip_strict(std::vector const &, 10 | std::vector const &); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/fmt/pair.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/pair.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("fmt::to_string(std::pair)") { 8 | std::pair input = {3, 5}; 9 | std::string result = fmt::to_string(input); 10 | std::string correct = "{3, 5}"; 11 | CHECK(result == correct); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/kernels/test/src/kernels/legion_ordered/legion_ordered.cc: -------------------------------------------------------------------------------- 1 | #include "kernels/legion_ordered/legion_ordered.h" 2 | #include "test/utils/rapidcheck.h" 3 | #include 4 | 5 | using namespace ::FlexFlow; 6 | 7 | TEST_SUITE(FF_CUDA_TEST_SUITE) { 8 | TEST_CASE_TEMPLATE( 9 | "Arbitrary> with T=", T, int, double, char) { 10 | RC_SUBCASE([](LegionOrdered) {}); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/local-execution/include/local-execution/registered_task.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_LOCAL_EXECUTION_INCLUDE_LOCAL_EXECUTION_REGISTERED_TASK_H 2 | #define _FLEXFLOW_LIB_LOCAL_EXECUTION_INCLUDE_LOCAL_EXECUTION_REGISTERED_TASK_H 3 | 4 | #include "local-execution/registered_task_t.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | registered_task_t make_noop_registered_task(); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/gather_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "GatherAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ff_dim_t.dtg.h", 14 | ] 15 | 16 | src_includes = [ 17 | "op-attrs/ff_dim_t.h", 18 | ] 19 | 20 | [[fields]] 21 | name = "dim" 22 | type = "::FlexFlow::ff_dim_t" 23 | -------------------------------------------------------------------------------- /lib/runtime/src/layer_id.h: -------------------------------------------------------------------------------- 1 | #ifndef _FF_TYPE_H 2 | #define _FF_TYPE_H 3 | 4 | #include "utils/strong_typedef.h" 5 | 6 | namespace FlexFlow { 7 | 8 | struct LayerID : strong_typedef { 9 | using strong_typedef::strong_typedef; 10 | }; 11 | 12 | } // namespace FlexFlow 13 | 14 | MAKE_TYPEDEF_HASHABLE(::FlexFlow::LayerID); 15 | MAKE_TYPEDEF_PRINTABLE(::FlexFlow::LayerID, "LayerID"); 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/digraph/algorithms/is_acyclic.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_DIGRAPH_ALGORITHMS_IS_ACYCLIC_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_DIGRAPH_ALGORITHMS_IS_ACYCLIC_H 3 | 4 | #include "utils/graph/digraph/digraph_view.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::optional is_acyclic(DiGraphView const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/open_dataflow_graph/algorithms/new_dataflow_graph_input.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "NewDataflowGraphInput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/dataflow_graph_input.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_input" 16 | type = "::FlexFlow::DataflowGraphInput" 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/nonnegative_int/ceildiv.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_NONNEGATIVE_INT_CEILDIV_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_NONNEGATIVE_INT_CEILDIV_H 3 | 4 | #include "utils/nonnegative_int/nonnegative_int.h" 5 | 6 | namespace FlexFlow { 7 | 8 | nonnegative_int ceildiv(nonnegative_int numerator, nonnegative_int denominator); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/rapidcheck/monostate.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_RAPIDCHECK_MONOSTATE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_RAPIDCHECK_MONOSTATE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace rc { 8 | 9 | template <> 10 | struct Arbitrary { 11 | static Gen arbitrary(); 12 | }; 13 | 14 | } // namespace rc 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/get_all_assignments.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/get_all_assignments.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using K = value_type<0>; 7 | using V = value_type<1>; 8 | 9 | template std::unordered_set> 10 | get_all_assignments(std::unordered_map> const &); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/node/node_source.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/node/node_source.h" 2 | 3 | namespace FlexFlow { 4 | 5 | size_t NodeSource::next_available_node_id = 0; 6 | 7 | NodeSource::NodeSource() {} 8 | 9 | Node NodeSource::new_node() { 10 | Node result = Node{NodeSource::next_available_node_id}; 11 | NodeSource::next_available_node_id++; 12 | return result; 13 | } 14 | 15 | } // namespace FlexFlow 16 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/datatype.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DataType" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "BOOL" 12 | 13 | [[values]] 14 | name = "INT32" 15 | 16 | [[values]] 17 | name = "INT64" 18 | 19 | [[values]] 20 | name = "HALF" 21 | 22 | [[values]] 23 | name = "FLOAT" 24 | 25 | [[values]] 26 | name = "DOUBLE" 27 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/initializers/norm_initializer_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "NormInitializerAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | [[fields]] 13 | name = "seed" 14 | type = "int" 15 | 16 | [[fields]] 17 | name = "mean" 18 | type = "float" 19 | 20 | [[fields]] 21 | name = "stddev" 22 | type = "float" 23 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/topk_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TopKAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "k" 18 | type = "::FlexFlow::positive_int" 19 | 20 | [[fields]] 21 | name = "sorted" 22 | type = "bool" 23 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/ff_ordered.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/ff_ordered.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template struct FFOrdered; 9 | 10 | template std::string format_as(FFOrdered const &); 11 | 12 | template std::ostream &operator<<(std::ostream &, FFOrdered const &); 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/computation_graph.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ComputationGraph" 3 | features = [ ] 4 | 5 | includes = [ 6 | "pcg/layer_attrs.dtg.h", 7 | "pcg/tensor_attrs.dtg.h", 8 | "utils/graph/labelled_dataflow_graph/labelled_dataflow_graph.h", 9 | ] 10 | 11 | [[fields]] 12 | name = "raw_graph" 13 | type = "::FlexFlow::LabelledDataflowGraph<::FlexFlow::LayerAttrs, ::FlexFlow::TensorAttrs>" 14 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/input_parallel_tensor_guid_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "input_parallel_tensor_guid_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/dataflow_graph_input.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_graph_input" 16 | type = "::FlexFlow::DataflowGraphInput" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/output_graph/output_graph_expr_input.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OutputGraphExprInput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/open_dataflow_graph/dataflow_graph_input.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "raw_dataflow_graph_input" 16 | type = "::FlexFlow::DataflowGraphInput" 17 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/tensor_pattern/tensor_attribute_key.enum.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorAttributeKey" 3 | features = [ 4 | "hash", 5 | "json", 6 | "rapidcheck", 7 | "fmt", 8 | ] 9 | 10 | [[values]] 11 | name = "DIM_SIZES" 12 | 13 | [[values]] 14 | name = "DIM_DEGREES" 15 | 16 | [[values]] 17 | name = "DISCARD_COPY_DEGREE_DIM" 18 | 19 | [[values]] 20 | name = "SUM_DEGREE_DIM" 21 | -------------------------------------------------------------------------------- /lib/substitutions/src/substitutions/unlabelled/pattern_node_output.cc: -------------------------------------------------------------------------------- 1 | #include "substitutions/unlabelled/pattern_node_output.h" 2 | 3 | namespace FlexFlow { 4 | 5 | PatternNode get_src_node(PatternNodeOutput const &o) { 6 | return PatternNode{o.raw_dataflow_output.node}; 7 | } 8 | 9 | nonnegative_int get_idx(PatternNodeOutput const &o) { 10 | return o.raw_dataflow_output.idx; 11 | } 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/contains_value.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/contains_value.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using K = value_type<0>; 7 | using V = value_type<1>; 8 | 9 | template bool contains_value(std::unordered_map const &, V const &); 10 | 11 | template bool contains_value(std::map const &, V const &); 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/open_dataflow_graph/algorithms/get_edges.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/open_dataflow_graph/algorithms/get_edges.h" 2 | #include "utils/graph/open_dataflow_graph/open_dataflow_edge_query.h" 3 | 4 | namespace FlexFlow { 5 | 6 | std::unordered_set get_edges(OpenDataflowGraphView const &g) { 7 | return g.query_edges(open_dataflow_edge_query_all()); 8 | } 9 | 10 | } // namespace FlexFlow 11 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/containers/count.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/count.h" 2 | #include 3 | #include 4 | 5 | using namespace FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | TEST_CASE("count") { 9 | std::vector v = {1, 2, 3, 4, 5}; 10 | CHECK(count(v, [](int x) { return x % 2 == 0; }) == 2); 11 | CHECK(count(v, [](int x) { return x % 2 == 1; }) == 3); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/fmt/vector.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/vector.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("fmt::to_string(std::vector)") { 8 | std::vector input = {0, 1, 3, 2}; 9 | std::string result = fmt::to_string(input); 10 | std::string correct = "[0, 1, 3, 2]"; 11 | CHECK(result == correct); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/kernels/src/kernels/legion_ordered/slice.cc: -------------------------------------------------------------------------------- 1 | #include "kernels/legion_ordered/slice.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template LegionOrdered slice(LegionOrdered const &, 9 | legion_dim_t const &, 10 | std::optional const &); 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/local-execution/include/local-execution/tasks.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LOCAL_EXECUTION_TASKS_H 2 | #define _FLEXFLOW_LOCAL_EXECUTION_TASKS_H 3 | 4 | #include "task-spec/task_id_t.dtg.h" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace FlexFlow { 10 | // PYTHON_TOP_LEVEL_TASK_ID = 11111, 11 | 12 | void register_flexflow_internal_tasks(); 13 | 14 | } // namespace FlexFlow 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/loss_functions/nonconfigurable_loss_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "NonconfigurableLossAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ops/loss_functions/loss_function.dtg.h" 14 | ] 15 | 16 | [[fields]] 17 | name = "loss_type" 18 | type = "::FlexFlow::LossFunction" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ops/topk.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ops/topk.h" 2 | 3 | namespace FlexFlow { 4 | 5 | TensorShape get_output_shape(TopKAttrs const &, TensorShape const &) { 6 | NOT_IMPLEMENTED(); 7 | } 8 | 9 | ParallelTensorShape get_output_shape(TopKAttrs const &attrs, 10 | ParallelTensorShape const &input_shape) { 11 | NOT_IMPLEMENTED(); 12 | } 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/dataflow_graph/algorithms/dataflow_graph_isomorphism.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DataflowGraphIsomorphism" 3 | features = [ 4 | "eq", 5 | "hash", 6 | "fmt", 7 | ] 8 | 9 | includes = [ 10 | "utils/bidict/bidict.h", 11 | "utils/graph/node/node.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "node_mapping" 16 | type = "::FlexFlow::bidict<::FlexFlow::Node, ::FlexFlow::Node>" 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/series_parallel/parallel_reduction.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ParallelReduction" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/multidigraph/multidiedge.dtg.h", 12 | "utils/commutative_pair.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "edges" 17 | type = "::FlexFlow::commutative_pair<::FlexFlow::MultiDiEdge>" 18 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/parallel_tensor_dim_idx_t.variant.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "parallel_tensor_dim_idx_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "fmt", 9 | ] 10 | 11 | includes = [ 12 | "op-attrs/ff_dim_t.dtg.h", 13 | "op-attrs/replica_type.dtg.h", 14 | ] 15 | 16 | [[values]] 17 | type = "::FlexFlow::ff_dim_t" 18 | 19 | [[values]] 20 | type = "::FlexFlow::ReplicaType" 21 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/tensor_dims.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorDims" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ff_ordered/ff_ordered.h", 14 | "utils/positive_int/positive_int.h", 15 | ] 16 | 17 | [[fields]] 18 | name = "ff_ordered" 19 | type = "::FlexFlow::FFOrdered<::FlexFlow::positive_int>" 20 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/tensor_dims_coord.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorDimsCoord" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "fmt", 9 | ] 10 | 11 | includes = [ 12 | "op-attrs/ff_ordered/ff_ordered.h", 13 | "utils/nonnegative_int/nonnegative_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "ff_ordered" 18 | type = "::FlexFlow::FFOrdered<::FlexFlow::nonnegative_int>" 19 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ops/input.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ops/input.h" 2 | #include "op-attrs/parallel_tensor_shape.h" 3 | 4 | namespace FlexFlow { 5 | 6 | TensorShape get_output_shape(InputAttrs const &attrs) { 7 | return attrs.tensor_shape; 8 | } 9 | 10 | ParallelTensorShape get_output_parallel_tensor_shape(InputAttrs const &attrs) { 11 | return lift_to_parallel(attrs.tensor_shape); 12 | } 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/slot_grad_id.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SlotGradId" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "task-spec/is_grad.dtg.h", 12 | "task-spec/slot_id_t.dtg.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "slot_id" 17 | type = "::FlexFlow::slot_id_t" 18 | 19 | [[fields]] 20 | name = "is_grad" 21 | type = "::FlexFlow::IsGrad" 22 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/task_invocation.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TaskInvocation" 3 | features = [ 4 | "eq", 5 | "fmt", 6 | "hash" 7 | ] 8 | 9 | includes = [ 10 | "task-spec/task_binding.h", 11 | "task-spec/task_id_t.dtg.h" 12 | ] 13 | 14 | 15 | [[fields]] 16 | name = "task_id" 17 | type = "::FlexFlow::task_id_t" 18 | 19 | [[fields]] 20 | name = "binding" 21 | type = "::FlexFlow::TaskBinding" 22 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/digraph/algorithms/digraph_has_edge.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_DIGRAPH_ALGORITHMS_HAS_EDGE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_DIGRAPH_ALGORITHMS_HAS_EDGE_H 3 | 4 | #include "utils/graph/digraph/digraph_view.h" 5 | 6 | namespace FlexFlow { 7 | 8 | bool digraph_has_edge(DiGraphView const &, DirectedEdge const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/src/utils/integer_conversions.cc: -------------------------------------------------------------------------------- 1 | #include "utils/integer_conversions.h" 2 | #include 3 | #include 4 | 5 | namespace FlexFlow { 6 | 7 | size_t size_t_from_int(int x) { 8 | assert(x >= 0); 9 | return static_cast(x); 10 | } 11 | 12 | int int_from_size_t(size_t x) { 13 | assert(x < std::numeric_limits::max()); 14 | return static_cast(x); 15 | } 16 | 17 | } // namespace FlexFlow 18 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/containers/all_of.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/all_of.h" 2 | #include 3 | #include 4 | 5 | using namespace FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | TEST_CASE("all_of") { 9 | std::vector v = {2, 4, 6, 8}; 10 | CHECK(all_of(v, [](int x) { return x % 2 == 0; }) == true); 11 | CHECK(all_of(v, [](int x) { return x % 4 == 0; }) == false); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.flake/pkgs/fccf/json-package-name.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 20bcbbf..923075f 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -48,6 +48,7 @@ FetchContent_MakeAvailable(fmt) 6 | 7 | FetchContent_Declare(json 8 | URL https://github.com/nlohmann/json/releases/download/v3.10.5/json.tar.xz 9 | + FIND_PACKAGE_ARGS NAMES nlohmann_json 10 | ) 11 | FetchContent_MakeAvailable(json) 12 | 13 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ff_ordered/ff_ordered_from_map.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ff_ordered/ff_ordered_from_map.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T = value_type<0>; 7 | 8 | template FFOrdered ff_ordered_from_map(std::map const &); 9 | 10 | template FFOrdered 11 | ff_ordered_from_map(std::unordered_map const &); 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ops/reverse.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ops/reverse.h" 2 | 3 | namespace FlexFlow { 4 | 5 | TensorShape get_output_shape(ReverseAttrs const &, TensorShape const &) { 6 | NOT_IMPLEMENTED(); 7 | } 8 | 9 | ParallelTensorShape get_output_shape(ReverseAttrs const &attrs, 10 | ParallelTensorShape const &input_shape) { 11 | NOT_IMPLEMENTED(); 12 | } 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/pcg_from_computation_graph.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_PCG_INCLUDE_PCG_CG_TO_PCG_H 2 | #define _FLEXFLOW_PCG_INCLUDE_PCG_CG_TO_PCG_H 3 | 4 | #include "pcg/computation_graph.dtg.h" 5 | #include "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h" 6 | 7 | namespace FlexFlow { 8 | 9 | ParallelComputationGraph pcg_from_computation_graph(ComputationGraph const &cg); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/task-spec/src/task-spec/loss_tensor_source.cc: -------------------------------------------------------------------------------- 1 | #include "task-spec/loss_tensor_source.h" 2 | 3 | namespace FlexFlow { 4 | 5 | nonnegative_int LossTensorSource::next_available_loss_tensor_id = 0_n; 6 | 7 | LossTensorSource::LossTensorSource() {} 8 | 9 | loss_tensor_guid_t LossTensorSource::new_loss_tensor() { 10 | return loss_tensor_guid_t{LossTensorSource::next_available_loss_tensor_id++}; 11 | } 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/cli/cli_argument_key.variant.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "CLIArgumentKey" 3 | features = [ 4 | "eq", 5 | "hash", 6 | "fmt", 7 | ] 8 | 9 | includes = [ 10 | "", 11 | "utils/cli/cli_positional_argument_key.dtg.h", 12 | "utils/cli/cli_flag_key.dtg.h", 13 | ] 14 | 15 | [[values]] 16 | type = "::FlexFlow::CLIPositionalArgumentKey" 17 | 18 | [[values]] 19 | type = "::FlexFlow::CLIFlagKey" 20 | -------------------------------------------------------------------------------- /lib/kernels/src/kernels/reduce_kernels_cpu.cc: -------------------------------------------------------------------------------- 1 | #include "kernels/reduce_kernels_cpu.h" 2 | #include "utils/exception.h" 3 | 4 | namespace FlexFlow::Kernels::Reduce { 5 | 6 | void cpu_forward_kernel(float const *input_ptr, float *output_ptr) { 7 | NOT_IMPLEMENTED(); 8 | } 9 | 10 | void cpu_backward_kernel(float const *output_grad_ptr, float *input_grad_ptr) { 11 | NOT_IMPLEMENTED(); 12 | } 13 | 14 | } // namespace FlexFlow::Kernels::Reduce 15 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/digraph/algorithms/transitive_closure.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_DIGRAPH_ALGORITHMS_TRANSITIVE_CLOSURE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_DIGRAPH_ALGORITHMS_TRANSITIVE_CLOSURE_H 3 | 4 | #include "utils/graph/digraph/digraph_view.h" 5 | 6 | namespace FlexFlow { 7 | 8 | DiGraphView transitive_closure(DiGraphView const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/series_parallel/series_reduction.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "SeriesReduction" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/multidigraph/multidiedge.dtg.h", 12 | ] 13 | 14 | [[fields]] 15 | name = "first" 16 | type = "::FlexFlow::MultiDiEdge" 17 | 18 | [[fields]] 19 | name = "second" 20 | type = "::FlexFlow::MultiDiEdge" 21 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/zip3_strict.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/zip3_strict.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using A1 = value_type<0>; 7 | using B1 = value_type<1>; 8 | using C1 = value_type<2>; 9 | 10 | template std::vector> zip3_strict( 11 | std::vector const &, std::vector const &, std::vector const &); 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/positive_int/ceildiv.cc: -------------------------------------------------------------------------------- 1 | #include "utils/positive_int/ceildiv.h" 2 | #include "utils/exception.h" 3 | 4 | namespace FlexFlow { 5 | 6 | positive_int ceildiv(positive_int numerator, positive_int denominator) { 7 | int n = numerator.int_from_positive_int(); 8 | int d = denominator.int_from_positive_int(); 9 | 10 | int result = (n + d - 1) / d; 11 | return positive_int{result}; 12 | } 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /docs/source/python/dataloader.rst: -------------------------------------------------------------------------------- 1 | ************** 2 | Dataloader API 3 | ************** 4 | .. automodule:: flexflow.core.flexflow_cffi 5 | :noindex: 6 | 7 | Dataloader Creation 8 | =================== 9 | .. autoclass:: FFModel() 10 | :noindex: 11 | :members: create_data_loader 12 | 13 | Use Dataloader for Training 14 | =========================== 15 | .. autoclass:: SingleDataLoader() 16 | :noindex: 17 | :members: reset, next_batch -------------------------------------------------------------------------------- /lib/compiler/include/compiler/machine_mapping/transitive_reduced_pcg.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TransitiveReducedPCG" 3 | features = [] 4 | 5 | includes = [ 6 | "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h", 7 | ] 8 | 9 | [[fields]] 10 | name = "full_pcg" 11 | type = "::FlexFlow::ParallelComputationGraph" 12 | 13 | [[fields]] 14 | name = "transitive_reduction" 15 | type = "::FlexFlow::DiGraphView" 16 | 17 | -------------------------------------------------------------------------------- /lib/compiler/include/compiler/task_graph_simulator/task_execution_constraint.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TaskExecutionConstraint" 3 | features = [ 4 | ] 5 | 6 | includes = [ 7 | "utils/graph/node/node.dtg.h", 8 | "", 9 | "" 10 | ] 11 | 12 | 13 | [[fields]] 14 | name = "is_satisfied" 15 | type = "std::function const &, std::unordered_set const &)>" 16 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/element_unary_per_device_state.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ElementUnaryPerDeviceState" 3 | features = [] 4 | 5 | includes = [ 6 | "kernels/device.h", 7 | ] 8 | 9 | [[fields]] 10 | name = "inputTensor" 11 | type = "ffTensorDescriptor_t" 12 | 13 | [[fields]] 14 | name = "outputTensor" 15 | type = "ffTensorDescriptor_t" 16 | 17 | [[fields]] 18 | name = "actiDesc" 19 | type = "ffActivationDescriptor_t" 20 | -------------------------------------------------------------------------------- /lib/kernels/src/kernels/dropout_kernels_cpu.cc: -------------------------------------------------------------------------------- 1 | #include "kernels/dropout_kernels_cpu.h" 2 | #include "utils/exception.h" 3 | 4 | namespace FlexFlow::Kernels::Dropout { 5 | 6 | void cpu_forward_kernel(float const *input_ptr, float *output_ptr) { 7 | NOT_IMPLEMENTED(); 8 | } 9 | 10 | void cpu_backward_kernel(float const *output_grad_ptr, float *input_grad_ptr) { 11 | NOT_IMPLEMENTED(); 12 | } 13 | 14 | } // namespace FlexFlow::Kernels::Dropout 15 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/ops/transpose.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/ops/transpose.h" 2 | 3 | namespace FlexFlow { 4 | 5 | TensorShape get_output_shape(TransposeAttrs const &, TensorShape const &) { 6 | NOT_IMPLEMENTED(); 7 | } 8 | 9 | ParallelTensorShape get_output_shape(TransposeAttrs const &op_attrs, 10 | ParallelTensorShape const &input_shape) { 11 | NOT_IMPLEMENTED(); 12 | } 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/op-attrs/test/src/op-attrs/regularizer_attrs.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/regularizer_attrs.dtg.h" 2 | #include "test/utils/rapidcheck.h" 3 | #include 4 | 5 | using namespace ::FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | TEST_CASE("Arbitrary") { 9 | RC_SUBCASE([](RegularizerAttrs reg) { 10 | RC_ASSERT(reg.has() || reg.has()); 11 | }); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/utils/include/utils/cli/cli_get_help_message.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CLI_CLI_GET_HELP_MESSAGE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CLI_CLI_GET_HELP_MESSAGE_H 3 | 4 | #include "utils/cli/cli_spec.dtg.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::string cli_get_help_message(std::string const &program_name, 9 | CLISpec const &); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/containers/zip_with.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/zip_with.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using T1 = value_type<0>; 7 | using T2 = value_type<1>; 8 | using Result = value_type<2>; 9 | using F = std::function; 10 | 11 | template std::vector 12 | zip_with(std::vector const &, std::vector const &, F &&); 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/utils/src/utils/full_binary_tree/get_num_tree_nodes.cc: -------------------------------------------------------------------------------- 1 | #include "utils/full_binary_tree/get_num_tree_nodes.h" 2 | #include "utils/archetypes/value_type.h" 3 | 4 | namespace FlexFlow { 5 | 6 | using Tree = value_type<0>; 7 | using Parent = value_type<1>; 8 | using Leaf = value_type<2>; 9 | 10 | template int get_num_tree_nodes( 11 | Tree const &, FullBinaryTreeImplementation const &); 12 | 13 | } // namespace FlexFlow 14 | -------------------------------------------------------------------------------- /lib/utils/src/utils/tuple/visit.cc: -------------------------------------------------------------------------------- 1 | #include "utils/tuple/visit.h" 2 | #include "utils/archetypes/value_type.h" 3 | #include 4 | 5 | namespace FlexFlow { 6 | 7 | using T1 = value_type<0>; 8 | using T2 = value_type<1>; 9 | using T3 = value_type<2>; 10 | using Visitor = std::function const &)>; 11 | 12 | template void visit_tuple(std::tuple const &, Visitor &&); 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/containers/to_uppercase.cc: -------------------------------------------------------------------------------- 1 | #include "utils/containers/to_uppercase.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("to_uppercase(std::string)") { 8 | std::string input = "Hello World"; 9 | 10 | std::string result = to_uppercase(input); 11 | std::string correct = "HELLO WORLD"; 12 | 13 | CHECK(result == correct); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/compiler/include/compiler/optimizer_config.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "OptimizerConfig" 3 | features = [ 4 | "eq", 5 | "hash", 6 | "fmt", 7 | ] 8 | 9 | includes = [ 10 | ] 11 | 12 | [[fields]] 13 | name = "alpha" 14 | type = "float" 15 | 16 | [[fields]] 17 | name = "budget" 18 | type = "int" 19 | 20 | [[fields]] 21 | name = "threshold" 22 | type = "float" 23 | 24 | [[fields]] 25 | name = "max_num_ops" 26 | type = "int" 27 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/ops/transpose_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TransposeAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/ff_dim_t.h", 14 | "op-attrs/ff_dim_t.dtg.h", 15 | "op-attrs/ff_ordered/ff_ordered.h", 16 | ] 17 | 18 | [[fields]] 19 | name = "perm" 20 | type = "::FlexFlow::FFOrdered<::FlexFlow::ff_dim_t>" 21 | -------------------------------------------------------------------------------- /lib/op-attrs/src/op-attrs/parallel_dim.cc: -------------------------------------------------------------------------------- 1 | #include "op-attrs/parallel_dim.h" 2 | #include "utils/overload.h" 3 | 4 | namespace FlexFlow { 5 | 6 | int get_degree(ParallelDim const &dim) { 7 | return dim.visit(overload{ 8 | [](ShardParallelDim const &shard_dim) { return shard_dim.degree; }, 9 | [](ReplicaParallelDim const &replica_dim) { 10 | return replica_dim.degree; 11 | }}); 12 | } 13 | 14 | } // namespace FlexFlow 15 | -------------------------------------------------------------------------------- /lib/pcg/src/pcg/create_grad.cc: -------------------------------------------------------------------------------- 1 | #include "pcg/create_grad.h" 2 | #include "utils/exception.h" 3 | 4 | namespace FlexFlow { 5 | 6 | bool bool_from_create_grad(CreateGrad cg) { 7 | switch (cg) { 8 | case CreateGrad::YES: 9 | return true; 10 | case CreateGrad::NO: 11 | return false; 12 | default: 13 | throw mk_runtime_error(fmt::format("Unknown CreateGrad value {}", cg)); 14 | } 15 | } 16 | 17 | } // namespace FlexFlow 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/views/join_node_key.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "JoinNodeKey" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | "utils/graph/views/lr_direction.dtg.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "node" 17 | type = "::FlexFlow::Node" 18 | 19 | [[fields]] 20 | name = "direction" 21 | type = "::FlexFlow::LRDirection" 22 | -------------------------------------------------------------------------------- /lib/utils/include/utils/json/half.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_JSON_HALF_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_JSON_HALF_H 3 | 4 | #include "utils/half.h" 5 | #include 6 | 7 | namespace nlohmann { 8 | 9 | template <> 10 | struct adl_serializer { 11 | static void to_json(json &j, half x); 12 | static void from_json(json const &j, half &t); 13 | }; 14 | 15 | } // namespace nlohmann 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /lib/utils/test/common/include/test/utils/rapidcheck/some.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_TEST_COMMON_INCLUDE_TEST_UTILS_RAPIDCHECK_SOME_H 2 | #define _FLEXFLOW_LIB_UTILS_TEST_COMMON_INCLUDE_TEST_UTILS_RAPIDCHECK_SOME_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | template 9 | T some() { 10 | rc::Random r{}; 11 | return rc::gen::arbitrary()(r).value(); 12 | } 13 | 14 | } // namespace FlexFlow 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/rapidcheck/variant.cc: -------------------------------------------------------------------------------- 1 | #include "utils/rapidcheck/variant.h" 2 | #include "test/utils/rapidcheck.h" 3 | #include 4 | 5 | using namespace ::FlexFlow; 6 | 7 | TEST_SUITE(FF_TEST_SUITE) { 8 | TEST_CASE("Arbitrary") { 9 | RC_SUBCASE("valid type", [](std::variant v) { 10 | return std::holds_alternative(v) || std::holds_alternative(v); 11 | }); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/compiler/include/compiler/cost_estimator/runtime_only_op_cost_metrics.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "RuntimeOnlyOpCostMetrics" 3 | features = [ 4 | "eq", 5 | "fmt", 6 | "hash", 7 | ] 8 | 9 | includes = [ 10 | "utils/units/milliseconds_t.h", 11 | ] 12 | 13 | [[fields]] 14 | name = "forward_runtime" 15 | type = "::FlexFlow::milliseconds_t" 16 | 17 | [[fields]] 18 | name = "backward_runtime" 19 | type = "::FlexFlow::milliseconds_t" 20 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/tensor_accessor_reductions.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_KERNELS_INCLUDE_KERNELS_TENSOR_ACCESSOR_REDUCTIONS_H 2 | #define _FLEXFLOW_LIB_KERNELS_INCLUDE_KERNELS_TENSOR_ACCESSOR_REDUCTIONS_H 3 | 4 | #include "kernels/accessor.h" 5 | 6 | namespace FlexFlow { 7 | 8 | bool tensor_accessor_all(GenericTensorAccessorR const &); 9 | bool tensor_accessor_any(GenericTensorAccessorR const &); 10 | 11 | } // namespace FlexFlow 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /lib/op-attrs/include/op-attrs/shard_parallel_dim.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "ShardParallelDim" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "utils/positive_int/positive_int.h", 14 | ] 15 | 16 | [[fields]] 17 | name = "size" 18 | type = "::FlexFlow::positive_int" 19 | 20 | [[fields]] 21 | name = "degree" 22 | type = "::FlexFlow::positive_int" 23 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/optimizer_attrs.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_PCG_OPTIMIZER_ATTRS_H 2 | #define _FLEXFLOW_PCG_OPTIMIZER_ATTRS_H 3 | 4 | #include "pcg/optimizer_attrs.dtg.h" 5 | #include "utils/nonnegative_int/nonnegative_int.h" 6 | 7 | namespace FlexFlow { 8 | 9 | OptimizerAttrs get_optimizer_attrs_for_next_iter(OptimizerAttrs const &old); 10 | nonnegative_int get_num_optimizer_tensors(OptimizerAttrs const &); 11 | 12 | } // namespace FlexFlow 13 | 14 | #endif 15 | -------------------------------------------------------------------------------- /lib/substitutions/include/substitutions/tensor_pattern/tensor_attribute_list_size.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorAttributeListSize" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "rapidcheck", 8 | "json", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "substitutions/tensor_pattern/tensor_attribute_key.dtg.h", 14 | ] 15 | 16 | 17 | [[fields]] 18 | name = "attribute_key" 19 | type = "::FlexFlow::TensorAttributeKey" 20 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/task_arg_spec.variant.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TaskArgSpec" 3 | features = [ 4 | "eq", 5 | "fmt", 6 | "hash" 7 | ] 8 | 9 | includes = [ 10 | "task-spec/concrete_arg_spec.h", 11 | "task-spec/runtime_arg_ref.h" 12 | ] 13 | 14 | [[values]] 15 | type = "::FlexFlow::ConcreteArgSpec" 16 | key = "concrete_arg_spec" 17 | 18 | [[values]] 19 | type = "::FlexFlow::RuntimeArgRefSpec" 20 | key = "runtime_arg_ref" 21 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/all_of.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ALL_OF_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ALL_OF_H 3 | 4 | namespace FlexFlow { 5 | 6 | template 7 | bool all_of(C const &c, F const &f) { 8 | for (auto const &v : c) { 9 | if (!f(v)) { 10 | return false; 11 | } 12 | } 13 | return true; 14 | } 15 | 16 | } // namespace FlexFlow 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/any_of.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ANY_OF_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ANY_OF_H 3 | 4 | namespace FlexFlow { 5 | 6 | template 7 | bool any_of(C const &c, F const &f) { 8 | for (auto const &v : c) { 9 | if (f(v)) { 10 | return true; 11 | } 12 | } 13 | return false; 14 | } 15 | 16 | } // namespace FlexFlow 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/reversed.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_REVERSED_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_REVERSED_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | template 9 | std::vector reversed(std::vector const &t) { 10 | std::vector result(std::crbegin(t), std::crend(t)); 11 | return result; 12 | } 13 | 14 | } // namespace FlexFlow 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/multidigraph/algorithms/get_edges.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_MULTIDIGRAPH_ALGORITHMS_GET_EDGES_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_MULTIDIGRAPH_ALGORITHMS_GET_EDGES_H 3 | 4 | #include "utils/graph/multidigraph/multidigraph_view.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::unordered_set get_edges(MultiDiGraphView const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/undirected/algorithms/get_edges.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_UNDIRECTED_ALGORITHMS_GET_EDGES_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_GRAPH_UNDIRECTED_ALGORITHMS_GET_EDGES_H 3 | 4 | #include "utils/graph/undirected/undirected_graph_view.h" 5 | 6 | namespace FlexFlow { 7 | 8 | std::unordered_set get_edges(UndirectedGraphView const &); 9 | 10 | } // namespace FlexFlow 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/kernels/include/kernels/reduce_kernels_cpu.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_KERNELS_INCLUDE_KERNELS_REDUCE_KERNELS_CPU_H 2 | #define _FLEXFLOW_LIB_KERNELS_INCLUDE_KERNELS_REDUCE_KERNELS_CPU_H 3 | 4 | namespace FlexFlow::Kernels::Reduce { 5 | 6 | void cpu_forward_kernel(float const *input_ptr, float *output_ptr); 7 | 8 | void cpu_backward_kernel(float const *output_grad_ptr, float *input_grad_ptr); 9 | 10 | } // namespace FlexFlow::Kernels::Reduce 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /lib/pcg/include/pcg/tensor_attrs.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "TensorAttrs" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "json", 8 | "rapidcheck", 9 | "fmt", 10 | ] 11 | 12 | includes = [ 13 | "op-attrs/tensor_shape.dtg.h", 14 | "pcg/create_grad.dtg.h", 15 | ] 16 | 17 | [[fields]] 18 | name = "shape" 19 | type = "::FlexFlow::TensorShape" 20 | 21 | [[fields]] 22 | name = "create_grad" 23 | type = "::FlexFlow::CreateGrad" 24 | -------------------------------------------------------------------------------- /lib/pcg/src/pcg/file_format/v1/v1_parallel_computation_graph.cc: -------------------------------------------------------------------------------- 1 | #include "pcg/file_format/v1/v1_parallel_computation_graph.h" 2 | #include "pcg/file_format/v1/graphs/v1_labelled_dataflow_graph.h" 3 | 4 | namespace FlexFlow { 5 | 6 | V1ParallelComputationGraph to_v1(ParallelComputationGraph const &g) { 7 | return V1ParallelComputationGraph{ 8 | to_v1(g.raw_graph), 9 | }; 10 | } 11 | 12 | } // namespace FlexFlow 13 | -------------------------------------------------------------------------------- /lib/task-spec/include/task-spec/tensor_sub_slot_id_t.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "tensor_sub_slot_id_t" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "task-spec/tensor_type.dtg.h", 12 | "task-spec/slot_id_t.dtg.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "slot_id" 17 | type = "::FlexFlow::slot_id_t" 18 | 19 | [[fields]] 20 | name = "tensor_type" 21 | type = "::FlexFlow::TensorType" 22 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/all_are_true.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ALL_ARE_TRUE_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ALL_ARE_TRUE_H 3 | 4 | namespace FlexFlow { 5 | 6 | template 7 | bool all_are_true(Container const &c) { 8 | bool result = true; 9 | for (bool b : c) { 10 | result &= b; 11 | } 12 | return result; 13 | } 14 | 15 | } // namespace FlexFlow 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /lib/utils/include/utils/containers/items.h: -------------------------------------------------------------------------------- 1 | #ifndef _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ITEMS_H 2 | #define _FLEXFLOW_LIB_UTILS_INCLUDE_UTILS_CONTAINERS_ITEMS_H 3 | 4 | #include 5 | 6 | namespace FlexFlow { 7 | 8 | template 9 | std::unordered_set> 10 | items(C const &c) { 11 | return {c.begin(), c.end()}; 12 | } 13 | 14 | } // namespace FlexFlow 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /lib/utils/include/utils/graph/dataflow_graph/dataflow_input.struct.toml: -------------------------------------------------------------------------------- 1 | namespace = "FlexFlow" 2 | name = "DataflowInput" 3 | features = [ 4 | "eq", 5 | "ord", 6 | "hash", 7 | "fmt", 8 | ] 9 | 10 | includes = [ 11 | "utils/graph/node/node.dtg.h", 12 | "utils/nonnegative_int/nonnegative_int.h", 13 | ] 14 | 15 | [[fields]] 16 | name = "node" 17 | type = "::FlexFlow::Node" 18 | 19 | [[fields]] 20 | name = "idx" 21 | type = "::FlexFlow::nonnegative_int" 22 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/node/graph_view.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/node/graph_view.h" 2 | 3 | namespace FlexFlow { 4 | 5 | GraphView::GraphView(cow_ptr_t ptr) : ptr(ptr) {} 6 | 7 | std::unordered_set GraphView::query_nodes(NodeQuery const &g) const { 8 | return this->ptr->query_nodes(g); 9 | } 10 | 11 | bool is_ptr_equal(GraphView const &lhs, GraphView const &rhs) { 12 | return lhs.ptr == rhs.ptr; 13 | } 14 | 15 | } // namespace FlexFlow 16 | -------------------------------------------------------------------------------- /lib/utils/src/utils/graph/open_dataflow_graph/algorithms/are_isomorphic.cc: -------------------------------------------------------------------------------- 1 | #include "utils/graph/open_dataflow_graph/algorithms/are_isomorphic.h" 2 | #include "utils/graph/open_dataflow_graph/algorithms/find_isomorphism.h" 3 | 4 | namespace FlexFlow { 5 | 6 | bool are_isomorphic(OpenDataflowGraphView const &src, 7 | OpenDataflowGraphView const &dst) { 8 | return find_isomorphism(src, dst).has_value(); 9 | } 10 | 11 | } // namespace FlexFlow 12 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/fmt/map.cc: -------------------------------------------------------------------------------- 1 | #include "utils/fmt/map.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("fmt::to_string(std::map)") { 8 | std::map input = {{0, 10}, {1, 1}, {3, 5}, {2, 8}}; 9 | std::string result = fmt::to_string(input); 10 | std::string correct = "{{0, 10}, {1, 1}, {2, 8}, {3, 5}}"; 11 | CHECK(result == correct); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/utils/test/src/utils/nonnegative_int/num_elements.cc: -------------------------------------------------------------------------------- 1 | #include "utils/nonnegative_int/num_elements.h" 2 | #include 3 | 4 | using namespace ::FlexFlow; 5 | 6 | TEST_SUITE(FF_TEST_SUITE) { 7 | TEST_CASE("num_elements") { 8 | std::vector input = {-1, 3, 3, 1}; 9 | 10 | nonnegative_int result = num_elements(input); 11 | nonnegative_int correct = nonnegative_int{4}; 12 | 13 | CHECK(result == correct); 14 | } 15 | } 16 | --------------------------------------------------------------------------------