Skip to content

Commit

Permalink
Merge branch 'master' into graph-library-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
lockshaw authored Feb 2, 2025
2 parents 2afc768 + 2b71235 commit d6f0aea
Show file tree
Hide file tree
Showing 470 changed files with 9,182 additions and 5,041 deletions.
15 changes: 8 additions & 7 deletions .github/runs-on.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
images:
dlami-x64:
runs-on-gpu-pinned:
platform: "linux"
arch: "x64"
owner: "898082745236" # AWS
name: "Deep Learning Base OSS Nvidia Driver GPU AMI (Ubuntu 22.04)*"
owner: "135269210855" # runs-on
name: "runs-on-v2.2-ubuntu22-gpu-x64-20250123194414"

runners:
gpu-nvidia:
family: ["g4dn.xlarge"]
image: dlami-x64
runs-on-cpu-pinned:
platform: "linux"
arch: "x64"
owner: "135269210855" # runs-on
name: "runs-on-v2.2-ubuntu22-full-x64-20250101080516"
8 changes: 0 additions & 8 deletions .github/workflows/helpers/free_space_on_runner_gpu.sh

This file was deleted.

9 changes: 5 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
submodules: recursive

- name: Free additional space on runner
run: ./.github/workflows/helpers/free_space_on_runner_gpu.sh
run: ./.github/workflows/helpers/free_space_on_runner.sh

- name: Install nix
uses: cachix/install-nix-action@v25
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
runs-on:
- runs-on
- family=g4dn.xlarge
- image=ubuntu22-full-x64
- image=runs-on-gpu-pinned

strategy:
max-parallel: 1
Expand All @@ -79,8 +79,9 @@ jobs:
with:
submodules: recursive

- name: free additional space on runner
run: ./.github/workflows/helpers/free_space_on_runner_gpu.sh
- name: mount ephemeral drive to nix
run: |
sudo mkdir $HOME/_work/nix && sudo mkdir /nix && sudo mount --bind $HOME/_work/nix /nix
- name: install nix
uses: cachix/install-nix-action@v25
Expand Down
17 changes: 9 additions & 8 deletions bin/export-model-arch/src/export_model_arch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "utils/cli/cli_parse.h"
#include "utils/cli/cli_parse_result.h"
#include "utils/cli/cli_spec.h"
#include "utils/graph/open_dataflow_graph/algorithms/as_dot.h"
#include "utils/graph/series_parallel/binary_sp_decomposition_tree/right_associative_binary_sp_tree_from_nary.h"
#include "utils/graph/series_parallel/get_series_parallel_decomposition.h"

Expand All @@ -21,11 +22,11 @@ using namespace ::FlexFlow;
ComputationGraph get_single_operator_computation_graph() {
ComputationGraphBuilder b;

size_t batch_size = 8;
size_t in_channels = 16;
size_t out_channels = 12;
nonnegative_int batch_size = 8_n;
nonnegative_int in_channels = 16_n;
nonnegative_int out_channels = 12_n;
TensorShape input_shape = TensorShape{
TensorDims{FFOrdered<size_t>{
TensorDims{FFOrdered<nonnegative_int>{
batch_size,
in_channels,
out_channels,
Expand Down Expand Up @@ -69,7 +70,7 @@ tl::expected<ComputationGraph, std::string>
} else if (model_name == "bert") {
return get_bert_computation_graph(get_default_bert_config());
} else if (model_name == "split_test") {
int batch_size = 8;
nonnegative_int batch_size = 8_n;
return get_split_test_computation_graph(batch_size);
} else if (model_name == "single_operator") {
return get_single_operator_computation_graph();
Expand Down Expand Up @@ -100,10 +101,10 @@ tl::expected<JsonSPModelExport, std::string>
result.value();
});

std::pair<V1ComputationGraph, bidict<int, layer_guid_t>> v1_result =
to_v1_including_node_numbering(computation_graph);
std::pair<V1ComputationGraph, bidict<nonnegative_int, layer_guid_t>>
v1_result = to_v1_including_node_numbering(computation_graph);
V1ComputationGraph v1_cg = v1_result.first;
bidict<int, layer_guid_t> layer_numbering = v1_result.second;
bidict<nonnegative_int, layer_guid_t> layer_numbering = v1_result.second;
V1BinarySPDecomposition v1_sp_decomposition =
to_v1(sp_decomposition, layer_numbering);

Expand Down
14 changes: 13 additions & 1 deletion cmake/flexflow-utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function(define_ff_vars target)
MAX_TENSOR_DIM=${FF_MAX_DIM}
MAX_NUM_TASK_REGIONS=${FF_MAX_NUM_TASK_REGIONS}
MAX_NUM_TASK_ARGUMENTS=${FF_MAX_NUM_TASK_ARGUMENTS}
# _FORTIFY_SOURCE=0
)

if (FF_GPU_BACKEND STREQUAL "cuda")
Expand All @@ -39,7 +40,18 @@ function(ff_set_cxx_properties target)
CXX_EXTENSIONS NO
)
target_compile_options(${target}
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:> "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=." # add C++ compile flags here
PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:>
"-ffile-prefix-map=${CMAKE_SOURCE_DIR}=."
"-fsanitize=undefined"
"-fno-sanitize-recover=all"
# add C++ compile flags here
)
target_link_options(${target}
PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:>
"-fsanitize=undefined"
"-fno-sanitize-recover=all"
)
endfunction()

Expand Down
14 changes: 12 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@
};
lib = pkgs.lib;

mkShell = pkgs.mkShell.override {
mkShell = attrs: pkgs.mkShell.override {
stdenv = pkgs.cudaPackages.backendStdenv;
};
} (attrs // {
hardeningDisable = ["all"]; # disable nixpkgs default compiler arguments, otherwise ubsan doesn't catch
# signed overflows due to the signedoverflow hardening setting.
# for more details, see the following (long-running) nixpkgs github issues:
# - https://github.com/NixOS/nixpkgs/issues/18995
# - https://github.com/NixOS/nixpkgs/issues/60919
});

proj = proj-repo.packages.${system}.proj;
in
Expand Down Expand Up @@ -121,6 +127,8 @@

gpu-ci = mkShell {
inputsFrom = [ ci ];
hardeningDisable = [ "all" ];

buildInputs = builtins.concatLists [
(with nixGL.packages.${system}; [
nixGLDefault
Expand All @@ -135,6 +143,8 @@
"${proj-repo.packages.${system}.proj-nvim}"
];

hardeningDisable = [ "all" ];

buildInputs = builtins.concatLists [
(with pkgs; [
clang-tools
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_OP_COST_ESTIMATE_KEY_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_OP_COST_ESTIMATE_KEY_H

#include "compiler/cost_estimator/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"

namespace FlexFlow {

OpCostEstimateKey get_mapped_op_cost_estimate_key_for_layer(
ParallelComputationGraph const &pcg,
parallel_layer_guid_t const &layer,
MachineView const &machine_view);

} // namespace FlexFlow

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ includes = [
]

[[fields]]
name = "runtime"
name = "forward_runtime"
type = "float"

[[fields]]
name = "backward_runtime"
type = "float"

[[fields]]
Expand Down
19 changes: 19 additions & 0 deletions lib/compiler/include/compiler/cost_estimator/tensor_set_movement.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_TENSOR_SET_MOVEMENT_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_TENSOR_SET_MOVEMENT_H

#include "compiler/cost_estimator/tensor_set_movement.dtg.h"
#include "pcg/machine_view.dtg.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph_edge.dtg.h"

namespace FlexFlow {

TensorSetMovement get_tensor_set_movement_from_pcg_edge(
ParallelComputationGraphEdge const &edge,
ParallelComputationGraph const &pcg,
MachineView const &src_mv,
MachineView const &dst_mv);

} // namespace FlexFlow

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#define _FLEXFLOW_COMPILER_MACHINE_MAPPING_H

#include "compiler/machine_mapping/machine_mapping.dtg.h"
#include "pcg/device_id_t.dtg.h"
#include "pcg/machine_specification.dtg.h"
#include "pcg/operator_task_space.dtg.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h"

namespace FlexFlow {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef _FLEXFLOW_COMPILER_MACHINE_MAPPING_UNSTRUCTURED_DEVICE_MAPPING_H
#define _FLEXFLOW_COMPILER_MACHINE_MAPPING_UNSTRUCTURED_DEVICE_MAPPING_H

#include "compiler/machine_mapping/machine_mapping.dtg.h"
#include "compiler/machine_mapping/unstructured_device_mapping.dtg.h"
#include "pcg/machine_specification.dtg.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h"

namespace FlexFlow {

UnstructuredDeviceMapping
get_unstructured_device_mapping(MachineMapping const &machine_mapping,
MachineSpecification const &machine_spec,
ParallelComputationGraph const &pcg);

} // namespace FlexFlow

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace = "FlexFlow"
name = "UnstructuredDeviceMapping"
features = [
"eq",
# "ord",
"hash",
# "json",
# "rapidcheck",
"fmt",
]

includes = [
"pcg/parallel_computation_graph/parallel_layer_guid_t.dtg.h",
"pcg/device_id_t.dtg.h"
]

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

[[fields]]
name = "raw_device_map"
type = "std::unordered_map<::FlexFlow::parallel_layer_guid_t, std::unordered_set<::FlexFlow::device_id_t>>"
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ bool is_right_associative(ComputationGraphBinarySPDecomposition const &);
std::unordered_multiset<layer_guid_t>
get_layers(ComputationGraphBinarySPDecomposition const &);

V1BinarySPDecomposition to_v1(ComputationGraphBinarySPDecomposition const &,
bidict<int, layer_guid_t> const &layer_numbering);
V1BinarySPDecomposition
to_v1(ComputationGraphBinarySPDecomposition const &,
bidict<nonnegative_int, layer_guid_t> const &layer_numbering);

} // namespace FlexFlow

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace = "FlexFlow"
name = "InProgressTask"

features = [
"eq",
"hash",
"fmt",
"ord"
]

includes = [
"utils/graph/node/node.dtg.h"
]


[[fields]]
name = "start_time"
type = "float"

[[fields]]
name = "end_time"
type = "float"

[[fields]]
name = "node"
type = "::FlexFlow::Node"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_IN_PROGRESS_TASK_COMPARATOR_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_IN_PROGRESS_TASK_COMPARATOR_H

#include "compiler/task_graph_simulator/in_progress_task.dtg.h"
#include <tuple>

namespace FlexFlow {
struct InProgressTaskComparator {
bool operator()(InProgressTask const &lhs, InProgressTask const &rhs) const;
};
} // namespace FlexFlow

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

includes = [
"compiler/cost_estimator/op_cost_estimate_key.dtg.h",
"compiler/cost_estimator/tensor_set_movement.dtg.h",
]

[[values]]
type = "::FlexFlow::OpCostEstimateKey"
key = "operator"

[[values]]
type = "::FlexFlow::TensorSetMovement"
key = "tensor_movement"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_PCG_TASK_GRAPH_H
#define _FLEXFLOW_LIB_COMPILER_INCLUDE_COMPILER_COST_ESTIMATOR_PCG_TASK_GRAPH_H

#include "compiler/machine_mapping/machine_mapping.dtg.h"
#include "compiler/task_graph_simulator/pcg_task_graph.dtg.h"
#include "pcg/machine_specification.dtg.h"
#include "pcg/parallel_computation_graph/parallel_computation_graph.dtg.h"

namespace FlexFlow {

PCGTaskGraph get_pcg_task_graph(ParallelComputationGraph const &pcg,
MachineMapping const &machine_mapping,
MachineSpecification const &machine_spec);

} // namespace FlexFlow

#endif
Loading

0 comments on commit d6f0aea

Please sign in to comment.