Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
b6d00f8
Add support for replicate op in distributed training
Apr 9, 2026
3405621
Add support for replicate op in distributed training
Apr 9, 2026
d033e22
remove ReplicateAttr
Apr 15, 2026
6cd7060
Add comments to realm reductions, Use existing graph methods
Apr 15, 2026
adff3ca
Merge branch 'master' into realm-parallel-operators-replicate
lockshaw May 15, 2026
c50f384
Minor PR fixes
lockshaw May 16, 2026
ac4fffc
Clean up pass expansion code
lockshaw May 16, 2026
fdf4fe5
Remove unnecessary is_replicate_attrs function
lockshaw May 16, 2026
dce15e2
Format.
elliottslaughter May 21, 2026
f2b0754
Format Realm.
elliottslaughter May 21, 2026
9d03c97
Refactor redop infrastructure and switch to Legion's redops.
elliottslaughter May 21, 2026
0d589f2
Fix build for reductions.
elliottslaughter May 21, 2026
5ef0b07
Split reduction from copy and put back device op state init code.
elliottslaughter May 21, 2026
b737517
Replicate is not a task, don't represent it as one.
elliottslaughter May 21, 2026
c536cc9
Put back the per device op state return code path.
elliottslaughter May 21, 2026
48673bc
Changes for breaking up the replicate PR testing code
lockshaw May 28, 2026
164004d
Pass replicate copy insertion test case
lockshaw May 28, 2026
032f6ba
Pass shard expansion test for fwd replicate
lockshaw May 29, 2026
9bea615
Pass shard expansion test for bwd replicate
lockshaw May 29, 2026
d7cce60
Fix other test suites
lockshaw May 29, 2026
30d0320
Change OneToMany DynamicValueAttrs mapping back to bidict
lockshaw Jun 4, 2026
768c1eb
Minor include fixes (#1655)
lockshaw Jun 5, 2026
bfbb318
Remove DeviceType from MachineSpaceCoord, move task-spec to use devic…
lockshaw May 30, 2026
aa57301
Fix usage of node device_coords.
elliottslaughter Jun 4, 2026
b2c6b3d
Fix more compile errors.
elliottslaughter Jun 4, 2026
dd16f8f
Merge branch 'master' into realm-parallel-operators-replicate
lockshaw Jun 11, 2026
43db2f3
Move unordered_set to set, unordered_map to map, and other minor fixes
lockshaw Jun 12, 2026
e4fbc04
Address PR comments
lockshaw Jun 13, 2026
9ecf61a
Format and fix checks
lockshaw Jun 13, 2026
525831b
Merge branch 'master' into device-type-agnostic-compiler-only
lockshaw Jun 13, 2026
fb7280a
Minor fix in run-model
lockshaw Jun 13, 2026
60e6f9a
Merge branch 'device-type-agnostic-compiler-only' into realm-parallel…
lockshaw Jun 16, 2026
9bab7b5
Add repeat_until_converged utility function
lockshaw May 29, 2026
a2709ac
Fix 'task-spec'-side issues in failing tests
lockshaw Jun 27, 2026
571119b
Format
lockshaw Jun 27, 2026
7b806a9
Remove dead code discovered in PR review
lockshaw Jun 27, 2026
3629063
Fix incorrect proj flake uri
lockshaw Jun 30, 2026
2488ff4
Properly abstract and implement collective interface.
elliottslaughter Jul 1, 2026
880a7dc
Minor fixes to pass cpu-ci checks
lockshaw Jul 1, 2026
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
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .proj.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ testsuite_macro = "FF_TEST_SUITE"
namespace_name = "FlexFlow"
header_extension = ".h"
doxygen = true
build_tool = "ninja"
cuda_launch_cmd = [
"nixGL",
"--",
Expand Down
81 changes: 41 additions & 40 deletions bin/run-model/src/run-model/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,46 +71,47 @@ int main(int argc, char **argv) {
char **realm_argv = realm_args.data();
RealmManager manager(&realm_argc, &realm_argv);

ControllerTaskResult result = manager.start_controller([&](RealmContext
&ctx) {
MappedParallelComputationGraph mpcg = [&]() {
std::ifstream f(mapped_pcg_json);
nlohmann::json mpcg_json = nlohmann::json::parse(f);
return from_v1(mpcg_json.get<V1MappedParallelComputationGraph>());
}();

// instantiate computation graph
OptimizerAttrs optimizer_attrs =
OptimizerAttrs{SGDOptimizerAttrs{/*lr=*/0.001,
/*momentum=*/0.9,
/*nesterov=*/false,
/*weight_decay=*/0.001}};

std::unordered_map<DynamicValueAttrs, DynamicTensorAccessor> input_tensors;

DistributedFfHandle device_handle =
create_distributed_ff_handle(ctx,
/*workSpaceSize=*/1024 * 1024,
/*allowTensorOpMathConversion=*/true);

PCGInstance pcg_instance = create_pcg_instance(
/*ctx=*/ctx,
/*mpcg=*/mpcg,
/*optimizer=*/optimizer_attrs,
/*loss=*/std::nullopt,
/*input_tensors=*/input_tensors,
/*profiling_settings=*/ProfilingSettings{0, 0},
/*device_handle=*/device_handle);

// begin training loop
int num_epochs = 5;
for (int i = 0; i < num_epochs; i++) {
perform_all_passes_for_pcg_instance(
/*instance=*/pcg_instance,
/*profiling_settings=*/ProfilingSettings{0, 1},
/*device_handle=*/device_handle);
}
});
ControllerTaskResult result =
manager.start_controller([&](RealmContext &ctx) {
MappedParallelComputationGraph mpcg = [&]() {
std::ifstream f(mapped_pcg_json);
nlohmann::json mpcg_json = nlohmann::json::parse(f);
return from_v1(mpcg_json.get<V1MappedParallelComputationGraph>());
}();

// instantiate computation graph
OptimizerAttrs optimizer_attrs =
OptimizerAttrs{SGDOptimizerAttrs{/*lr=*/0.001,
/*momentum=*/0.9,
/*nesterov=*/false,
/*weight_decay=*/0.001}};

std::map<DynamicValueAttrs, DynamicTensorAccessor> input_tensors;

DistributedFfHandle device_handle =
create_distributed_ff_handle(ctx,
/*workSpaceSize=*/1024 * 1024,
/*allowTensorOpMathConversion=*/true);

PCGInstance pcg_instance = create_pcg_instance(
/*ctx=*/ctx,
/*mpcg=*/mpcg,
/*optimizer=*/optimizer_attrs,
/*loss=*/std::nullopt,
/*input_tensors=*/input_tensors,
/*profiling_settings=*/ProfilingSettings{0, 0},
/*device_handle=*/device_handle,
/*device_type=*/DeviceType::GPU);

// begin training loop
int num_epochs = 5;
for (int i = 0; i < num_epochs; i++) {
perform_all_passes_for_pcg_instance(
/*instance=*/pcg_instance,
/*profiling_settings=*/ProfilingSettings{0, 1},
/*device_handle=*/device_handle);
}
});
result.wait();

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#define _FLEXFLOW_BIN_SP_IZATION_BENCHMARKING_INCLUDE_SP_IZATION_BENCHMARKING_DISTRIBUTIONS_H

#include "utils/graph/node/node.dtg.h"
#include <map>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <set>

namespace FlexFlow {

Expand Down Expand Up @@ -55,21 +55,19 @@ struct GaussianNoise {
};

template <typename Dist>
std::unordered_map<Node, float>
make_cost_map(std::unordered_set<Node> const &nodes,
Dist const &distribution) {
std::unordered_map<Node, float> cost_map;
std::map<Node, float> make_cost_map(std::set<Node> const &nodes,
Dist const &distribution) {
std::map<Node, float> cost_map;
for (Node const &node : nodes) {
cost_map[node] = distribution();
}
return cost_map;
}

template <typename Noise>
std::unordered_map<Node, float>
add_noise_to_cost_map(std::unordered_map<Node, float> cost_map,
Noise const &noise) {
std::unordered_map<Node, float> noisy_cost_map;
std::map<Node, float> add_noise_to_cost_map(std::map<Node, float> cost_map,
Noise const &noise) {
std::map<Node, float> noisy_cost_map;
for (auto const &[node, cost] : cost_map) {
noisy_cost_map[node] = noise() * cost;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ DiGraph make_full_taso_nasnet(size_t num_reduction_cells, size_t N) {
(i % (N + 1) == N) ? make_reduction_taso_nasnet_cell()
: make_normal_taso_nasnet_cell();
Node cell_output = get_only(get_terminal_nodes(s));
std::unordered_map<Node, Node> node_map = parallel_extend(g, s);
std::map<Node, Node> node_map = parallel_extend(g, s);
later_input = node_map.at(later_input);
earlier_input = node_map.at(earlier_input);
cell_output = node_map.at(cell_output);
Expand Down Expand Up @@ -331,8 +331,8 @@ DiGraph make_2_terminal_random_dag(size_t num_nodes, float p, size_t step) {
}
}
}
std::unordered_set<Node> sinks = get_terminal_nodes(g);
std::unordered_set<Node> sources = get_initial_nodes(g);
std::set<Node> sinks = get_terminal_nodes(g);
std::set<Node> sources = get_initial_nodes(g);
Node sink = g.add_node();
Node source = g.add_node();
for (Node s : sources) {
Expand Down
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.

1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
expect
universal-ctags
ninja
tig
])
(with pkgs.python3Packages; [
gitpython
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ includes = [
]

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

[[fields]]
Expand All @@ -35,15 +34,15 @@ type = "::FlexFlow::PCGOperatorAttrs"

[[fields]]
name = "input_shapes"
type = "std::unordered_map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"
type = "std::map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"

[[fields]]
name = "weight_shapes"
type = "std::unordered_map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"
type = "std::map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"

[[fields]]
name = "output_shapes"
type = "std::unordered_map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"
type = "std::map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"

[[fields]]
name = "optimizer_attrs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "compiler/cost_estimator/op_cost_estimate_key.dtg.h"
#include "compiler/cost_estimator/runtime_only_op_cost_estimate_key.dtg.h"
#include "pcg/device_id_t.dtg.h"
#include "pcg/machine_specification.dtg.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h"
#include "pcg/parallel_computation_graph/parallel_layer_guid_t.dtg.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "OpCostMetrics"
type = "struct"
features = [
"eq",
"ord",
"fmt",
"hash",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
namespace FlexFlow {

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

OpCostMetrics make_op_cost_metrics_from_runtime_only(
RuntimeOnlyOpCostMetrics const &runtime_only,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ includes = [
]

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

[[fields]]
Expand All @@ -28,15 +27,15 @@ type = "::FlexFlow::PCGOperatorAttrs"

[[fields]]
name = "input_shapes"
type = "std::unordered_map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"
type = "std::map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"

[[fields]]
name = "weight_shapes"
type = "std::unordered_map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"
type = "std::map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"

[[fields]]
name = "output_shapes"
type = "std::unordered_map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"
type = "std::map<::FlexFlow::TensorSlotName, ::FlexFlow::ParallelTensorShape>"

[[fields]]
name = "machine_view"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ features = [
includes = [
"compiler/cost_estimator/communication_edge.h",
"utils/units/num_bytes_t.h",
"<unordered_map>",
"<map>",
]

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

[[fields]]
name = "edge_to_size"
type = "std::unordered_map<::FlexFlow::CommunicationEdge, ::FlexFlow::num_bytes_t>"
type = "std::map<::FlexFlow::CommunicationEdge, ::FlexFlow::num_bytes_t>"
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ name = "TensorSetMovement"
type = "struct"
features = [
"eq",
"ord",
"hash",
"fmt",
]

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

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

[[fields]]
name = "edge_to_size"
type = "std::unordered_map<::FlexFlow::CommunicationEdge, ::FlexFlow::num_bytes_t>"
type = "std::map<::FlexFlow::CommunicationEdge, ::FlexFlow::num_bytes_t>"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace FlexFlow {

MachineSpaceCoordinate concretize_abstracted_device(
AbstractedDevice const &abstracted_device,
std::unordered_map<BinaryTreePath, MachineSpaceStencil> const
std::map<BinaryTreePath, MachineSpaceStencil> const
&machine_space_stencils);

} // namespace FlexFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ std::optional<CommunicationEdge>
concretize_abstracted_single_tensor_communication_edge(
AbstractedSingleTensorCommunicationEdge const &edge,
MachineSpaceStencil const &src_machine_stencil,
std::unordered_map<BinaryTreePath, MachineSpaceStencil> const
std::map<BinaryTreePath, MachineSpaceStencil> const
&dst_machine_stencils);

} // namespace FlexFlow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "AbstractedSingleTensorMovement"
type = "struct"
features = [
"eq",
"ord",
"hash",
"fmt",
"json",
Expand All @@ -11,12 +12,12 @@ features = [
includes = [
"compiler/machine_mapping/abstracted_tensor_set_movement/abstracted_single_tensor_communication_edge.dtg.h",
"utils/units/num_bytes_t.h",
"<unordered_map>",
"<map>",
]

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

[[fields]]
Expand All @@ -25,4 +26,4 @@ type = "::FlexFlow::BinaryTreePath"

[[fields]]
name = "edge_to_size"
type = "std::unordered_map<::FlexFlow::AbstractedSingleTensorCommunicationEdge, ::FlexFlow::num_bytes_t>"
type = "std::map<::FlexFlow::AbstractedSingleTensorCommunicationEdge, ::FlexFlow::num_bytes_t>"
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,21 @@

namespace FlexFlow {

std::unordered_set<BinaryTreePath>
abstracted_single_tensor_movement_get_dst_layers(
AbstractedSingleTensorMovement const &);
std::set<BinaryTreePath> abstracted_single_tensor_movement_get_dst_layers(
AbstractedSingleTensorMovement const &);

AbstractedSingleTensorMovement merge_abstracted_single_tensor_movements(
std::unordered_multiset<AbstractedSingleTensorMovement> const &);
std::multiset<AbstractedSingleTensorMovement> const &);

AbstractedSingleTensorMovement
abstracted_single_tensor_movement_from_communications(
BinaryTreePath const &src_op_tree_path,
std::unordered_set<AbstractedSingleTensorCommunication> const
&communications);
std::set<AbstractedSingleTensorCommunication> const &communications);

TensorSetMovement concretize_abstracted_single_tensor_movement(
AbstractedSingleTensorMovement const &,
std::unordered_map<BinaryTreePath, MachineSpaceStencil> const
&pre_machine_stencils,
std::unordered_map<BinaryTreePath, MachineSpaceStencil> const
&post_machine_stencils);
std::map<BinaryTreePath, MachineSpaceStencil> const &pre_machine_stencils,
std::map<BinaryTreePath, MachineSpaceStencil> const &post_machine_stencils);

} // namespace FlexFlow

Expand Down
Loading