Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local execution e2e training #1472

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
6adb290
temporary weight adjust index
reyna-abhyankar Aug 25, 2024
61697c2
Loss function
reyna-abhyankar Aug 27, 2024
b56c046
Add cuda test for loss function
reyna-abhyankar Aug 27, 2024
f75a3d4
Format
reyna-abhyankar Aug 27, 2024
f74711f
Refactor and build optimizer kernels, op
reyna-abhyankar Aug 27, 2024
40c6252
Finish optimizer local backing
reyna-abhyankar Aug 27, 2024
ad9b9ea
Format
reyna-abhyankar Aug 27, 2024
1ddfade
E2E update test
reyna-abhyankar Aug 27, 2024
dde9496
Format
reyna-abhyankar Aug 27, 2024
59635d8
Small fixes
reyna-abhyankar Sep 11, 2024
103ef07
Format
reyna-abhyankar Sep 11, 2024
f48f9ff
Fix test and small issues
reyna-abhyankar Sep 18, 2024
189c9c8
Format
reyna-abhyankar Sep 18, 2024
d93f464
Merge branch 'repo-refactor' into local-e2e-training
reyna-abhyankar Oct 1, 2024
b5647c8
Pass tests after merge
reyna-abhyankar Oct 1, 2024
f5ff91e
Fix input/weight differentiation
reyna-abhyankar Oct 1, 2024
7470e71
Fix signature to use unified rep
reyna-abhyankar Oct 1, 2024
deece1b
Fix model training instance abstraction
reyna-abhyankar Oct 1, 2024
1d3cc94
Change subcase test name
reyna-abhyankar Oct 1, 2024
3cf5d08
Quick fixes
reyna-abhyankar Oct 16, 2024
79ef4c9
Refactor training backing and instance
reyna-abhyankar Oct 22, 2024
a73b1c3
Expose op folders publicly
reyna-abhyankar Nov 13, 2024
c6fed29
Add tensor type, operate over reduced tensor
reyna-abhyankar Nov 13, 2024
0cdfb1a
Fixes
reyna-abhyankar Jan 7, 2025
9d252b3
Remove tensor lower
reyna-abhyankar Jan 15, 2025
895c117
Add tensor and task lowering scheme
reyna-abhyankar Jan 17, 2025
411017d
Build local exec
reyna-abhyankar Jan 22, 2025
0128abb
Disaggregate local backend
reyna-abhyankar Feb 1, 2025
277f8c2
Update task binding interface and cost estimator
reyna-abhyankar Feb 1, 2025
377c6aa
Merge master into local execution
reyna-abhyankar Feb 4, 2025
8efaec7
Build
reyna-abhyankar Feb 6, 2025
1dc1398
Format
reyna-abhyankar Feb 6, 2025
17ad5c8
Split task spec files
reyna-abhyankar Feb 6, 2025
639c2c1
Delete outdated sim environment file
reyna-abhyankar Feb 6, 2025
a697044
Finish API
reyna-abhyankar Feb 13, 2025
187a8d5
Add tests for allocated and unallocated
reyna-abhyankar Feb 13, 2025
a0f8113
Fix nonnegative
reyna-abhyankar Feb 13, 2025
b1eab94
Format
reyna-abhyankar Feb 13, 2025
b532c50
Pass allocated-unallocated tests
reyna-abhyankar Feb 13, 2025
f28e5c2
Update task registry tests
reyna-abhyankar Feb 13, 2025
89752fa
Move local tensor backing to dtgen
reyna-abhyankar Feb 22, 2025
aef8ad5
Remove lowered tensor source
reyna-abhyankar Feb 22, 2025
f0a4285
Loss and update tests
reyna-abhyankar Feb 24, 2025
9047edc
Merge master
reyna-abhyankar Feb 24, 2025
350babf
Passing tests after merge issues
reyna-abhyankar Feb 24, 2025
aef7c6e
Pass gpu tests
reyna-abhyankar Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Loss and update tests
  • Loading branch information
reyna-abhyankar committed Feb 24, 2025
commit f0a4285bf4262bc793f9e4e8f4aa4e2c51d048fd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ bool is_allocated_tensor_backing_valid(
std::unordered_map<TensorTypeVariant, GenericTensorAccessorW> const &,
ArrayShape const &);

AllocatedTensors make_empty_allocated_tensors();

} // namespace FlexFlow

#endif
4 changes: 4 additions & 0 deletions lib/local-execution/src/allocated_tensors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,8 @@ bool are_allocated_tensors_valid(
are_allocated_optimizer_tensors_valid(allocated_tensors, tensor_attrs);
}

AllocatedTensors make_empty_allocated_tensors() {
return AllocatedTensors{{}, {}, {}};
}

} // namespace FlexFlow
7 changes: 1 addition & 6 deletions lib/local-execution/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ ff_add_test_executable(
NAME
local-execution-tests
SRC_PATTERNS
src/test_allocated_tensors.cc
src/test_unallocated_tensors.cc
src/test_task_registry.cc
src/test_utils.cc
src/test_local_task_arg_accessor.cc
src/test_local_tensor_backing.cc
src/*.cc
PRIVATE_INCLUDE
src/
DEPS
Expand Down
138 changes: 70 additions & 68 deletions lib/local-execution/test/src/test_local_cost_estimator.cc
Original file line number Diff line number Diff line change
@@ -1,79 +1,81 @@
// #include "doctest/doctest.h"
// #include "kernels/local_cuda_allocator.h"
// #include "kernels/managed_per_device_ff_handle.h"
// #include "local-execution/local_cost_estimator.h"
// #include "op-attrs/ops/attention.h"
// #include "op-attrs/parallel_tensor_shape.h"
// #include "pcg/computation_graph_builder.h"
// #include "test_utils.h"
#include "doctest/doctest.h"
#include "kernels/local_cuda_allocator.h"
#include "kernels/managed_per_device_ff_handle.h"
#include "local-execution/local_cost_estimator.h"
#include "op-attrs/ops/attention.h"
#include "op-attrs/parallel_tensor_shape.h"
#include "pcg/computation_graph_builder.h"
#include "test_utils.h"

// using namespace ::FlexFlow;
using namespace ::FlexFlow;

// TEST_SUITE(FF_CUDA_TEST_SUITE) {
// TEST_CASE("Local Cost Estimator") {
// // local backing initialization
// ManagedPerDeviceFFHandle managed_handle{};
TEST_SUITE(FF_CUDA_TEST_SUITE) {
TEST_CASE("Local Cost Estimator") {
// local backing initialization
ManagedPerDeviceFFHandle managed_handle{};

// RuntimeArgConfig runtime_arg_config = RuntimeArgConfig{
// DeviceSpecific<PerDeviceFFHandle>::create(managed_handle.raw_handle()),
// EnableProfiling::YES,
// ProfilingSettings{/*warmup_iters=*/0,
// /*measure_iters=*/1}};
RuntimeArgConfig runtime_arg_config = RuntimeArgConfig{
DeviceSpecific<PerDeviceFFHandle>::create(managed_handle.raw_handle()),
EnableProfiling::YES,
ProfilingSettings{/*warmup_iters=*/0,
/*measure_iters=*/1}};

// LocalCostEstimator cost_estimator =
// LocalCostEstimator{runtime_arg_config};
LocalCostEstimator cost_estimator = LocalCostEstimator{runtime_arg_config};

// SUBCASE("Estimate cost -- Attention Op") {
// int embed_dim = 32;
// int num_heads = 10;
// MultiHeadAttentionAttrs attrs = MultiHeadAttentionAttrs{
// /*embed_dim=*/embed_dim,
// /*num_heads=*/num_heads,
// /*kdim=*/embed_dim,
// /*vdim=*/embed_dim,
// /*dropout=*/0.0,
// /*bias=*/true,
// /*add_bias_kv=*/false,
// /*add_zero_attn=*/false,
// };
SUBCASE("Estimate cost -- Attention Op") {
nonnegative_int embed_dim = 32_n;
nonnegative_int num_heads = 10_n;
MultiHeadAttentionAttrs attrs = MultiHeadAttentionAttrs{
/*embed_dim=*/embed_dim,
/*num_heads=*/num_heads,
/*kdim=*/embed_dim,
/*vdim=*/embed_dim,
/*dropout=*/0.0,
/*bias=*/true,
/*add_bias_kv=*/false,
/*add_zero_attn=*/false,
};

// size_t batch_size = 40;
// size_t seq_len = 48;
// size_t feature_size = 36;
nonnegative_int batch_size = 40_n;
nonnegative_int seq_len = 48_n;
nonnegative_int feature_size = 36_n;

// DataType dtype = DataType::FLOAT;
// ParallelTensorShape inputs_shape = lift_to_parallel(TensorShape{
// TensorDims{FFOrdered<size_t>{batch_size, seq_len, feature_size}},
// DataType::FLOAT,
// });
DataType dtype = DataType::FLOAT;
ParallelTensorShape inputs_shape = lift_to_parallel(TensorShape{
TensorDims{
FFOrdered<nonnegative_int>{batch_size, seq_len, feature_size}},
DataType::FLOAT,
});

// ParallelTensorShape weights_shape = throw_if_unexpected(
// get_weights_shape(attrs, inputs_shape, inputs_shape,
// inputs_shape));
// ParallelTensorAttrs weight_attrs =
// ParallelTensorAttrs{weights_shape,
// /*sync_type=*/std::nullopt,
// /*initializer=*/std::nullopt,
// CreateGrad::YES};
ParallelTensorShape weights_shape = throw_if_unexpected(
get_weights_shape(attrs, inputs_shape, inputs_shape, inputs_shape));
ParallelTensorAttrs weight_attrs =
ParallelTensorAttrs{weights_shape,
/*sync_type=*/std::nullopt,
/*initializer=*/std::nullopt,
CreateGrad::YES};

// ParallelTensorShape output_shape = throw_if_unexpected(
// get_output_shape(attrs, inputs_shape, inputs_shape, inputs_shape));
// ParallelTensorAttrs output_attrs =
// ParallelTensorAttrs{output_shape,
// /*sync_type=*/std::nullopt,
// /*initializer=*/std::nullopt,
// CreateGrad::YES};
ParallelTensorShape output_shape = throw_if_unexpected(
get_output_shape(attrs, inputs_shape, inputs_shape, inputs_shape));
ParallelTensorAttrs output_attrs =
ParallelTensorAttrs{output_shape,
/*sync_type=*/std::nullopt,
/*initializer=*/std::nullopt,
CreateGrad::YES};

// CostDetails result = cost_estimator.estimate_cost(
// PCGOperatorAttrs{attrs},
// std::vector<ParallelTensorShape>{
// inputs_shape, inputs_shape, inputs_shape},
// std::vector<ParallelTensorAttrs>{weight_attrs},
// std::vector<ParallelTensorAttrs>{output_attrs},
// make_1d_machine_view(gpu_id_t{0}, gpu_id_t{1}));
CostDetails result = cost_estimator.estimate_cost(
PCGOperatorAttrs{attrs},
std::vector<ParallelTensorShape>{
inputs_shape, inputs_shape, inputs_shape},
std::vector<ParallelTensorAttrs>{weight_attrs},
std::vector<ParallelTensorAttrs>{output_attrs},
make_1d_machine_view(
MachineSpaceCoordinate{0_n, 0_n, DeviceType::GPU},
MachineSpecificationDimension::INTRA_NODE,
stride_t{0_n}));

// CHECK(result.total_elapsed_time > 0);
// CHECK(result.total_mem_usage > 0);
// }
// }
// }
CHECK(result.total_elapsed_time > 0);
CHECK(result.total_mem_usage > 0);
}
}
}
97 changes: 0 additions & 97 deletions lib/local-execution/test/src/test_loss_e2e.cc

This file was deleted.

Loading