Skip to content

Commit

Permalink
added proper program caching in all gather and reduce scatter
Browse files Browse the repository at this point in the history
  • Loading branch information
caixunshiren committed Jan 30, 2025
1 parent dae387e commit 433f602
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,21 @@ operation::ProgramWithCallbacks AllGatherAsync::create_program(
}

const operation::Hash AllGatherAsync::compute_program_hash(const std::vector<Tensor>& input_tensors) const {
auto input_shape = input_tensors[0].get_padded_shape();
auto input_memory_layout = input_tensors[0].get_layout();
auto input_dtype = input_tensors[0].get_dtype();
auto input_memory_config = input_tensors[0].memory_config();
return operation::hash_operation<AllGatherAsync>(
this->dim, this->num_links, this->ring_size, this->ring_index, this->output_mem_config, this->topology);
this->dim,
this->num_links,
this->ring_size,
this->ring_index,
this->output_mem_config,
this->topology,
input_shape,
input_memory_layout,
input_dtype,
input_memory_config);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,20 @@ operation::ProgramWithCallbacks ReduceScatterAsync::create_program(
}

operation::Hash ReduceScatterAsync::compute_program_hash(const std::vector<Tensor>& input_tensors) const {
auto input_shape = input_tensors[0].get_padded_shape();
auto input_memory_layout = input_tensors[0].get_layout();
auto input_dtype = input_tensors[0].get_dtype();
auto input_memory_config = input_tensors[0].memory_config();
return operation::hash_operation<ReduceScatterAsync>(
this->binary_op_type, this->scatter_dim, this->ring_size, this->ring_index, this->topology);
this->binary_op_type,
this->scatter_dim,
this->ring_size,
this->ring_index,
this->topology,
input_shape,
input_memory_layout,
input_dtype,
input_memory_config);
}

namespace {
Expand Down

0 comments on commit 433f602

Please sign in to comment.