Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
aa1f91a
Add utils/orthotope targeting #1528
lockshaw Oct 21, 2024
24018c6
Merge remote-tracking branch 'origin/repo-refactor' into unity-machin…
lockshaw Oct 21, 2024
67dbece
Pass test for deconflict_overlapping_dims
lockshaw Oct 21, 2024
dcf2dfc
Pass initial orthotope projection tests
lockshaw Oct 23, 2024
de871f7
Start moving some machine view types over to use orthotope
lockshaw Oct 24, 2024
e258d3d
Add OneToMany, ManyToOne, and DimProjection to fix projection equalit…
lockshaw Oct 24, 2024
e635b1f
Improved OneToMany and ManyToOne, and some bidict refactoring
lockshaw Oct 27, 2024
5e774c6
Fri Dec 27 03:20:32 PM PST 2024
lockshaw Dec 27, 2024
c209348
Merge remote-tracking branch 'origin/master' into generalize-index-space
lockshaw Jan 17, 2025
b6aed07
Additional changes.
lockshaw Jan 17, 2025
b834b0a
Merge remote-tracking branch 'origin/master' into generalize-index-space
lockshaw Jan 17, 2025
79f7098
Move over to new projection infra
lockshaw Jan 22, 2025
843b84a
Merge remote-tracking branch 'origin/master' into unity-machine-view-…
lockshaw Jul 17, 2025
b081f11
Fix build errors
lockshaw Jul 27, 2025
b3d9a43
Test fixes
lockshaw Jul 29, 2025
8affbc2
Add more testing and implement more projection functions
lockshaw Jul 30, 2025
f1f6879
Format
lockshaw Jul 30, 2025
e77bd89
Start creating local-pcg-execution
lockshaw Jul 30, 2025
0468b7d
Checkpoint version with dim projections
lockshaw Aug 6, 2025
656336a
Add MinimalDimDomain and MinimalOrthotope
lockshaw Aug 24, 2025
29175a1
Fix test build
lockshaw Aug 25, 2025
b69aa76
Pre-cleanup
lockshaw Aug 27, 2025
cc53f0d
Implement new communication modeling approach
lockshaw Aug 31, 2025
fdc75a3
Fix a bunch of build errors in compiler tests
lockshaw Sep 8, 2025
6f584b3
Pass pcg and utils tests
lockshaw Sep 9, 2025
8ff06e1
Save before tackling the minimal domain issue
lockshaw Sep 10, 2025
0b6794d
Fix failing subcase of get_abstracted_tensor_set_movement_across_split
lockshaw Sep 10, 2025
e205948
Fix pcg_get_mapping_along_edge test by composing minimal dim domain m…
lockshaw Sep 12, 2025
09f5975
Refactor abstract communication modeling to get get_tensor_set_moveme…
lockshaw Sep 14, 2025
28bfce1
More test case fixing (this time for get_optimial_machine_mapping_wit…
lockshaw Sep 16, 2025
470a210
Fix machine view offset issues in optimal machine mapping algorithms
lockshaw Sep 17, 2025
74b3a31
Fix get_optimal_machine_mapping test
lockshaw Sep 27, 2025
51364c9
Fix misc other tests
lockshaw Sep 27, 2025
75e71ba
Updated MappedParallelComputationGraph with computed task dependency …
lockshaw Sep 28, 2025
a418dec
More refactoring, add plan for how we get from here to realm execution
lockshaw Oct 7, 2025
f74343f
Move training logic into task-spec and define AtomicTaskInvocation an…
lockshaw Oct 8, 2025
d8556a4
Rearchitect local-execution and local-pcg-execution
lockshaw Oct 9, 2025
c2fc542
Wire up shard bindings into local pcg execution
lockshaw Oct 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions .proj.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ has-cpu-only-benchmarks = false
has-cuda-tests = true
has-cuda-benchmarks = false

[targets.local-pcg-execution]
type = "lib"
has-cpu-only-tests = true
has-cpu-only-benchmarks = false
has-cuda-tests = false
has-cuda-benchmarks = false

[targets.models]
type = "lib"
has-cpu-only-tests = true
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ include(spdlog)
include(doctestlib) # named doctestlib to avoid a name collision with doctest.cmake in rapidcheck
include(gbenchmark)
include(libassert)
include(visit_struct)
include(CTest)
include(fmt)
include(legion)
Expand Down
16 changes: 0 additions & 16 deletions cmake/visit_struct.cmake

This file was deleted.

8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@
-DFF_USE_EXTERNAL_EXPECTED=ON \
-DFF_USE_EXTERNAL_GBENCHMARK=ON \
-DFF_USE_EXTERNAL_LIBASSERT=ON \
-DFF_USE_EXTERNAL_RANGEV3=ON \
-DFF_USE_EXTERNAL_BOOST_PREPROCESSOR=ON \
-DFF_USE_EXTERNAL_TYPE_INDEX=ON"
'';

buildInputs = builtins.concatLists [
Expand Down
1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ add_subdirectory(runtime)
add_subdirectory(op-attrs)
add_subdirectory(kernels)
add_subdirectory(local-execution)
add_subdirectory(local-pcg-execution)
add_subdirectory(task-spec)
add_subdirectory(utils)
add_subdirectory(ffi)
Expand Down
8 changes: 4 additions & 4 deletions lib/compiler/include/compiler/allowed_machine_views.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#ifndef _FLEXFLOW_COMPILER_ALLOWED_MACHINE_VIEWS_H
#define _FLEXFLOW_COMPILER_ALLOWED_MACHINE_VIEWS_H

#include "pcg/machine_specification.dtg.h"
#include "op-attrs/operator_task_space.dtg.h"
#include "pcg/machine_compute_specification.dtg.h"
#include "pcg/machine_view.dtg.h"
#include "pcg/operator_task_space.dtg.h"

namespace FlexFlow {

bool is_valid_machine_view(MachineView const &mv,
OperatorTaskSpace const &task,
MachineSpecification const &ms);
MachineComputeSpecification const &ms);

std::unordered_set<MachineView>
get_allowed_machine_views(MachineSpecification const &machine_spec,
get_allowed_machine_views(MachineComputeSpecification const &machine_spec,
OperatorTaskSpace const &task,
DeviceType device_type);

Expand Down
50 changes: 50 additions & 0 deletions lib/compiler/include/compiler/cost_estimator/communication_edge.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_COMMUNICATION_EDGE_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_COMMUNICATION_EDGE_H

#include "pcg/machine_space_coordinate.dtg.h"

namespace FlexFlow {

struct CommunicationEdge {
CommunicationEdge() = delete;

CommunicationEdge(MachineSpaceCoordinate const &src,
MachineSpaceCoordinate const &dst);

bool operator==(CommunicationEdge const &) const;
bool operator!=(CommunicationEdge const &) const;

bool operator<(CommunicationEdge const &) const;
bool operator>(CommunicationEdge const &) const;
bool operator<=(CommunicationEdge const &) const;
bool operator>=(CommunicationEdge const &) const;

MachineSpaceCoordinate const &get_src() const;
MachineSpaceCoordinate const &get_dst() const;
private:
MachineSpaceCoordinate src;
MachineSpaceCoordinate dst;
private:
std::tuple<
decltype(src) const &,
decltype(dst) const &
> tie() const;

friend struct ::std::hash<CommunicationEdge>;
};

std::string format_as(CommunicationEdge const &);
std::ostream &operator<<(std::ostream &, CommunicationEdge const &);

} // namespace FlexFlow

namespace std {

template <>
struct hash<::FlexFlow::CommunicationEdge> {
size_t operator()(::FlexFlow::CommunicationEdge const &) const;
};

}

#endif
14 changes: 14 additions & 0 deletions lib/compiler/include/compiler/cost_estimator/network_cost_model.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_NETWORK_COST_MODEL_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_NETWORK_COST_MODEL_H

#include "compiler/cost_estimator/tensor_set_movement.dtg.h"
#include "pcg/machine_specification.dtg.h"

namespace FlexFlow {

float estimate_communication_cost(MachineSpecification const &,
TensorSetMovement const &);

} // namespace FlexFlow

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

namespace FlexFlow {

bool is_pareto_optimal_in(OpCostMetrics const &,
std::unordered_set<OpCostMetrics> const &);

OpCostMetrics make_op_cost_metrics_from_runtime_only(
RuntimeOnlyOpCostMetrics const &runtime_only,
num_bytes_t const &memory_usage);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "compiler/cost_estimator/parallel_tensor_space_to_machine_space_mapping.h"
#include "op-attrs/operator_space_to_parallel_tensor_space_mapping.h"
#include "op-attrs/parallel_tensor_dim_degrees.h"
#include "utils/bidict/algorithms/exhaustive_relational_join.h"
#include <libassert/assert.hpp>
#include "op-attrs/task_space_coordinate.h"
#include "op-attrs/parallel_tensor_space_coordinate.h"
#include "utils/bidict/algorithms/transform_keys.h"
#include "utils/bidict/algorithms/transform_values.h"

namespace FlexFlow {

ParallelTensorSpaceToMachineSpaceMapping
ptensor_machine_map_from_composition(
OperatorSpaceToMachineSpaceMapping const &op_task_to_machine_space_mapping,
OperatorSpaceToParallelTensorSpaceMapping const &op_task_to_parallel_tensor_space_mapping) {
ASSERT(
op_task_to_machine_space_mapping.operator_task_space
==
get_operator_task_space_for_mapping(op_task_to_parallel_tensor_space_mapping)
);

bidict<ParallelTensorSpaceCoordinate, TaskSpaceCoordinate>
pt_to_op_coord_map =
transform_keys(
transform_values(
op_task_to_parallel_tensor_space_mapping.raw_mapping.coord_mapping.reversed(),
task_space_coordinate_from_dim_coord),
parallel_tensor_space_coord_from_dim_coord);

bidict<TaskSpaceCoordinate, MachineSpaceCoordinate>
op_to_ms_coord_map =
op_task_to_machine_space_mapping.raw_mapping;

return ParallelTensorSpaceToMachineSpaceMapping{
/*raw_mapping=*/exhaustive_relational_join(
pt_to_op_coord_map,
op_to_ms_coord_map),
/*parallel_tensor_space=*/
parallel_tensor_dim_degrees_from_dim_domain(
op_task_to_parallel_tensor_space_mapping.raw_mapping.r_domain),
};
};

} // namespace FlexFlow
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_PARALLEL_TENSOR_SPACE_TO_MACHINE_SPACE_MAPPING_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_PARALLEL_TENSOR_SPACE_TO_MACHINE_SPACE_MAPPING_H

#include "compiler/cost_estimator/parallel_tensor_space_to_machine_space_mapping.dtg.h"
#include "pcg/operator_space_to_machine_space_mapping.dtg.h"
#include "op-attrs/operator_space_to_parallel_tensor_space_mapping.dtg.h"

namespace FlexFlow {

ParallelTensorSpaceToMachineSpaceMapping
ptensor_machine_map_from_composition(
OperatorSpaceToMachineSpaceMapping const &op_task_to_machine_space_mapping,
OperatorSpaceToParallelTensorSpaceMapping const &op_task_to_parallel);

} // namespace FlexFlow

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace = "FlexFlow"
name = "ParallelTensorSpaceToMachineSpaceMapping"
features = [
"eq",
"hash",
"fmt",
]

includes = [
"op-attrs/parallel_tensor_space_coordinate.dtg.h",
"pcg/machine_space_coordinate.dtg.h",
"op-attrs/parallel_tensor_dim_degrees.dtg.h",
"utils/bidict/bidict.h",
]

[[fields]]
name = "raw_mapping"
type = "::FlexFlow::bidict<::FlexFlow::ParallelTensorSpaceCoordinate, ::FlexFlow::MachineSpaceCoordinate>"

[[fields]]
name = "parallel_tensor_space"
type = "::FlexFlow::ParallelTensorDimDegrees"
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace = "FlexFlow"
name = "SingleCommunication"
features = [
"eq",
"ord",
"hash",
"fmt",
"json",
]

includes = [
"pcg/machine_space_coordinate.dtg.h",
]

[[fields]]
name = "src_machine_coord"
type = "::FlexFlow::MachineSpaceCoordinate"

[[fields]]
name = "dst_machine_coord"
type = "::FlexFlow::MachineSpaceCoordinate"
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,16 @@ features = [
]

includes = [
"op-attrs/parallel_tensor_shape.dtg.h",
"pcg/machine_view.dtg.h",
"<unordered_set>",
"compiler/cost_estimator/communication_edge.h",
"utils/units/num_bytes_t.h",
"<unordered_map>",
]

src_includes = [
"utils/hash/unordered_set.h",
"utils/fmt/unordered_set.h",
"utils/fmt/unordered_map.h",
"utils/hash/unordered_map.h",
]

[[fields]]
name = "parallel_tensor_shape"
type = "::FlexFlow::ParallelTensorShape"

[[fields]]
name = "src_machine_views"
type = "std::unordered_set<::FlexFlow::MachineView>"

[[fields]]
name = "dst_machine_views"
type = "std::unordered_set<::FlexFlow::MachineView>"
name = "edge_to_size"
type = "std::unordered_map<::FlexFlow::CommunicationEdge, ::FlexFlow::num_bytes_t>"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

namespace FlexFlow {

TensorSetMovement get_tensor_set_movement_from_pcg_edge(
TensorSetMovement
empty_tensor_set_movement();

TensorSetMovement
get_tensor_set_movement_from_pcg_edge(
ParallelComputationGraphEdge const &edge,
ParallelComputationGraph const &pcg,
MachineView const &src_mv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ features = [
]

includes = [
"compiler/cost_estimator/single_tensor_movement.dtg.h",
"<unordered_set>",
"compiler/cost_estimator/communication_edge.h",
"utils/units/num_bytes_t.h",
"<unordered_map>",
]

src_includes = [
"utils/fmt/unordered_multiset.h",
"utils/hash/unordered_multiset.h",
"utils/fmt/unordered_map.h",
"utils/hash/unordered_map.h",
]

[[fields]]
name = "single_tensor_movements"
type = "std::unordered_multiset<::FlexFlow::SingleTensorMovement>"
name = "edge_to_size"
type = "std::unordered_map<::FlexFlow::CommunicationEdge, ::FlexFlow::num_bytes_t>"
13 changes: 0 additions & 13 deletions lib/compiler/include/compiler/graph_optimize_result.h

This file was deleted.

17 changes: 9 additions & 8 deletions lib/compiler/include/compiler/graph_optimize_result.struct.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
namespace = "FlexFlow"
name = "GraphOptimizeResult"
features = [ ]
features = [
"fmt",
]

includes = [
"compiler/machine_mapping/machine_mapping.dtg.h",
"pcg/parallel_computation_graph/parallel_computation_graph.h"
"compiler/mapped_parallel_computation_graph.dtg.h",
]

[[fields]]
name = "pcg"
type = "::FlexFlow::ParallelComputationGraph"
src_includes = [
"compiler/mapped_parallel_computation_graph.h",
]

[[fields]]
name = "machine_mapping"
type = "::FlexFlow::MachineMapping"
name = "mapped_pcg"
type = "::FlexFlow::MappedParallelComputationGraph"
Loading
Loading