Skip to content

Commit

Permalink
#0: Fix conv_transpose2d initting wrong compute_kernel_config variant (
Browse files Browse the repository at this point in the history
…#15987)

### Ticket
None

### Problem description
Found that conv_transpose2d is initializing a compute_kernel_config for
GS even on WH arch.

### What's changed
Follow what conv2d does

### Checklist
- [ ] [Post commit
CI](https://github.com/tenstorrent/tt-metal/actions/runs/12309784960)
  • Loading branch information
ayerofieiev-tt authored Dec 13, 2024
1 parent 28184de commit cf69213
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ttnn/cpp/ttnn/operations/conv/conv2d/conv2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Result conv2d(
(conv_config.weights_dtype == DataType::BFLOAT8_B || conv_config.weights_dtype == DataType::BFLOAT16) &&
conv_config.output_layout == Layout::ROW_MAJOR && ((elem_size * in_channels) % (16 * num_cores_c)) == 0;

DeviceComputeKernelConfig compute_config = compute_config_.value_or( init_device_compute_kernel_config(
DeviceComputeKernelConfig compute_config = compute_config_.value_or(init_device_compute_kernel_config(
device->arch(),
std::nullopt,
MathFidelity::HiFi4,
Expand Down
18 changes: 16 additions & 2 deletions ttnn/cpp/ttnn/operations/conv/conv2d/prepare_conv2d_weights.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,14 @@ ttnn::Tensor prepare_conv_weights(
const std::optional<const DeviceComputeKernelConfig>& compute_config_) {
TT_FATAL(!ttnn::is_tensor_on_device_or_multidevice(weight_tensor), "Error: weight tensor must be on host for preparation.");
Conv2dConfig conv_config = conv_config_.value_or(Conv2dConfig());
DeviceComputeKernelConfig compute_config = compute_config_.value_or(DeviceComputeKernelConfig());
DeviceComputeKernelConfig compute_config = compute_config_.value_or(init_device_compute_kernel_config(
device->arch(),
std::nullopt,
MathFidelity::HiFi4,
true,
false,
false
));
const bool mm_conv = use_matmul_for_1x1_conv(kernel_size, stride, padding, dilation, groups);
const uint32_t output_height = ((input_height - kernel_size[0] - ((kernel_size[0] - 1 ) * (dilation[0] - 1)) + 2 * padding[0]) / stride[0]) + 1;
const uint32_t output_width =
Expand Down Expand Up @@ -382,7 +389,14 @@ ttnn::Tensor prepare_conv_bias(
((input_width - kernel_size[1] - ((kernel_size[0] - 1) * (dilation[0] - 1)) + 2 * padding[1]) / stride[1]) + 1;

Conv2dConfig conv_config = conv_config_.value_or(Conv2dConfig());
DeviceComputeKernelConfig compute_config = compute_config_.value_or(DeviceComputeKernelConfig());
DeviceComputeKernelConfig compute_config = compute_config_.value_or(init_device_compute_kernel_config(
device->arch(),
std::nullopt,
MathFidelity::HiFi4,
true,
false,
false
));
auto opt_conv_op_block_config = get_opt_block_config(
mm_conv,
in_channels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ Result conv_transpose2d(
const std::optional<const DeviceComputeKernelConfig>& compute_config_,
const std::optional<const MemoryConfig>& memory_config ) {
Conv2dConfig conv_config = conv_config_.value_or(Conv2dConfig());
DeviceComputeKernelConfig compute_config = compute_config_.value_or(DeviceComputeKernelConfig());

DeviceComputeKernelConfig compute_config = compute_config_.value_or(init_device_compute_kernel_config(
device->arch(),
std::nullopt,
MathFidelity::HiFi4,
true,
false,
false
));

//Inverse of sliding_window.get_output_shape()
SlidingWindowConfig sliding_window_config = SlidingWindowConfig{
Expand Down

0 comments on commit cf69213

Please sign in to comment.