From 693eb12bb6a61553850bb39c31a0bab2685189a2 Mon Sep 17 00:00:00 2001 From: Pinku Surana Date: Sat, 14 Dec 2024 13:39:21 -0800 Subject: [PATCH] Clang format --- include/flexflow/dominators.h | 2 +- include/flexflow/utils/hash_utils.h | 2 +- src/runtime/machine_view.cc | 2 +- src/runtime/parallel_tensor.cc | 2 +- src/runtime/simulator.cc | 20 ++++++++++---------- tests/unit/test_machine_view.cc | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/flexflow/dominators.h b/include/flexflow/dominators.h index 12e144faf2..d22d708ff9 100644 --- a/include/flexflow/dominators.h +++ b/include/flexflow/dominators.h @@ -8,8 +8,8 @@ #include "tl/optional.hpp" #include #include -#include #include +#include namespace FlexFlow::PCG::Utils { template > diff --git a/include/flexflow/utils/hash_utils.h b/include/flexflow/utils/hash_utils.h index ec86085b6c..9e14dfe8f0 100644 --- a/include/flexflow/utils/hash_utils.h +++ b/include/flexflow/utils/hash_utils.h @@ -1,8 +1,8 @@ #ifndef _FLEXFLOW_HASH_UTILS_H #define _FLEXFLOW_HASH_UTILS_H -#include #include +#include #include #include #include diff --git a/src/runtime/machine_view.cc b/src/runtime/machine_view.cc index 408a87ca8d..2966d56686 100644 --- a/src/runtime/machine_view.cc +++ b/src/runtime/machine_view.cc @@ -5,7 +5,7 @@ namespace FlexFlow { using namespace Legion; -const MachineView MachineView::NO_VIEW = MachineView(); +MachineView const MachineView::NO_VIEW = MachineView(); MachineView::MachineView() : device_type(MachineView::GPU), ndims(0), start_device_id(0) { diff --git a/src/runtime/parallel_tensor.cc b/src/runtime/parallel_tensor.cc index 7dc6c52442..d55187fafe 100644 --- a/src/runtime/parallel_tensor.cc +++ b/src/runtime/parallel_tensor.cc @@ -274,7 +274,7 @@ void ParallelTensorBase::attach_raw_ptr(FFConfig &config, Runtime *runtime = config.lg_hlr; AttachLauncher launcher(EXTERNAL_INSTANCE, region, region); std::vector fields(1, FID_DATA); - const Memory local_sysmem = + Memory const local_sysmem = Machine::MemoryQuery(Machine::get_machine()) .has_affinity_to(runtime->get_executing_processor(ctx)) .only_kind(Memory::SYSTEM_MEM) diff --git a/src/runtime/simulator.cc b/src/runtime/simulator.cc index 6a7f88cfb6..f6e72c79ee 100644 --- a/src/runtime/simulator.cc +++ b/src/runtime/simulator.cc @@ -501,7 +501,7 @@ CostMetrics Simulator::measure_operator_cost(Op const *op, ParallelConfig Op::view_to_pc(MachineView const &view) const { ParallelConfig config; config.device_type = (ParallelConfig::DeviceType)view.device_type; - const ParallelTensor output = this->outputs[0]; + ParallelTensor const output = this->outputs[0]; config.nDims = output->num_dims; for (int i = 0; i < config.nDims; i++) { if (output->dims[i].parallel_idx == -1) { @@ -612,14 +612,14 @@ float Simulator::estimate_xfer_cost(Op const *op, MachineView const &sink_view) { // assert(tensor->is_valid_machine_view(source_view)); // assert(tensor->is_valid_machine_view(sink_view)); - const ParallelTensor input_tensor = op->inputs[input_idx]; + ParallelTensor const input_tensor = op->inputs[input_idx]; if (input_tensor->owner_op->op_type == OP_INPUT) { return 0.0f; } if (op->is_parallel_op()) { assert(input_idx == 0); - const ParallelTensor output_tensor = op->outputs[0]; + ParallelTensor const output_tensor = op->outputs[0]; switch (op->op_type) { case OP_REPARTITION: { Repartition *rp = (Repartition *)op; @@ -632,7 +632,7 @@ float Simulator::estimate_xfer_cost(Op const *op, } case OP_COMBINE: { Combine *combine = (Combine *)op; - const ParallelTensor output_tensor = op->outputs[0]; + ParallelTensor const output_tensor = op->outputs[0]; return this->estimate_repartition_xfer_cost(combine->combine_dim, combine->combine_degree, output_tensor->get_shape(), @@ -654,7 +654,7 @@ float Simulator::estimate_xfer_cost(Op const *op, } case OP_REDUCTION: { Reduction *reduction = (Reduction *)op; - const ParallelTensor output_tensor = op->outputs[0]; + ParallelTensor const output_tensor = op->outputs[0]; ParallelTensorShape fake_output_shape = output_tensor->get_shape(); fake_output_shape.dims[reduction->reduction_dim].size *= reduction->reduction_degree; @@ -667,8 +667,8 @@ float Simulator::estimate_xfer_cost(Op const *op, } case OP_FUSED_PARALLEL: { FusedParallelOp const *fused = (FusedParallelOp const *)op; - const ParallelTensor input_tensor = op->inputs[0]; - const ParallelTensor output_tensor = op->outputs[0]; + ParallelTensor const input_tensor = op->inputs[0]; + ParallelTensor const output_tensor = op->outputs[0]; ParallelTensorShape input_shape = input_tensor->get_shape(); ParallelTensorShape output_shape = output_tensor->get_shape(); // FIXME: we currently calculate an over estimation @@ -722,7 +722,7 @@ float Simulator::estimate_xfer_cost(Op const *op, d.rect_data[i] = 0; d.rect_data[i + d.dim] = source_view.dim[i] - 1; } - const ParallelTensor input_tensor = op->inputs[input_idx]; + ParallelTensor const input_tensor = op->inputs[input_idx]; size_t total_size = data_type_size(input_tensor->data_type); for (int i = 0; i < input_tensor->num_dims; i++) { total_size *= input_tensor->dims[i].size / input_tensor->dims[i].degree; @@ -753,7 +753,7 @@ bool Op::estimate_sync_cost(Simulator *sim, } float Simulator::default_estimate_sync_cost( - const ParallelDim tensor_dims[MAX_TENSOR_DIM], + ParallelDim const tensor_dims[MAX_TENSOR_DIM], int tensor_ndims, MachineView const &view) { ParallelTensorShape tensor_shape(tensor_ndims, tensor_dims, DT_FLOAT); @@ -762,7 +762,7 @@ float Simulator::default_estimate_sync_cost( tensor_shape, view, tensor_shape.get_num_replica_dims()); } -float Simulator::default_estimate_sync_cost(const ParallelTensor tensor, +float Simulator::default_estimate_sync_cost(ParallelTensor const tensor, MachineView const &view, int num_replica_dims) { return this->default_estimate_sync_cost( diff --git a/tests/unit/test_machine_view.cc b/tests/unit/test_machine_view.cc index edf40e3534..94a9f7e3b5 100644 --- a/tests/unit/test_machine_view.cc +++ b/tests/unit/test_machine_view.cc @@ -138,7 +138,7 @@ TEST(machine_view_hash, known_collision) { mv1.start_device_id = 0; mv1.dim[0] = 32; mv1.stride[0] = 1; - + MachineView mv2; mv2.device_type = MachineView::GPU; mv2.ndims = 1;