Skip to content

Commit

Permalink
[cker] Fix casting warning
Browse files Browse the repository at this point in the history
This commit fixes a casting warning in the analyzer.

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh committed Aug 28, 2024
1 parent 109d223 commit 2c18fd1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions compute/cker/include/cker/eigen/depthwise_conv_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ template <typename T> struct DepthwiseConv2DKernel
typedef typename Eigen::internal::packet_traits<T>::type Packet;
static const int64_t kPacketSize = (sizeof(Packet) / sizeof(T));

const int64_t filter_spatial_size = filter_rows * filter_cols;
const int64_t filter_spatial_size = static_cast<int64_t>(filter_rows) * filter_cols;
const int64_t output_scalar_size = out_depth % kPacketSize;
const int64_t output_vectorized_size = (out_depth / kPacketSize) * kPacketSize;
const int64_t base_output_index = (out_r * out_cols + out_c) * out_depth;
Expand Down Expand Up @@ -458,9 +458,9 @@ template <typename T> struct LaunchDepthwiseConvOp<CPUDevice, T>
assert(cur_id >= 0 && cur_id < d.numThreads() + 1);

static const int64_t kPacketSize = (sizeof(Packet) / sizeof(T));
const int64_t input_image_size = in_rows * in_cols * in_depth;
const int64_t output_image_size = out_rows * out_cols * out_depth;
const int64_t filter_spatial_size = filter_rows * filter_cols;
const int64_t input_image_size = static_cast<int64_t>(in_rows) * in_cols * in_depth;
const int64_t output_image_size = static_cast<int64_t>(out_rows) * out_cols * out_depth;
const int64_t filter_spatial_size = static_cast<int64_t>(filter_rows) * filter_cols;
const int64_t padded_filter_inner_dim_size =
((out_depth + kPacketSize - 1) / kPacketSize) * kPacketSize;
const int64_t padded_filter_size = filter_spatial_size * padded_filter_inner_dim_size;
Expand Down Expand Up @@ -491,7 +491,7 @@ template <typename T> struct LaunchDepthwiseConvOp<CPUDevice, T>
}
};

const int64_t total_shards = batch * out_rows;
const int64_t total_shards = static_cast<int64_t>(batch) * out_rows;

// Empirically tested to give reasonable performance boosts at batch size 1
// without reducing throughput at batch size 32.
Expand All @@ -501,8 +501,8 @@ template <typename T> struct LaunchDepthwiseConvOp<CPUDevice, T>
// flops/loads/stores required to compute one shard.
const int64_t shard_cost = kCostMultiplier * out_cols * out_depth;

const int64_t input_bytes = in_rows * in_cols * in_depth * sizeof(T);
const int64_t output_bytes = out_rows * out_cols * out_depth * sizeof(T);
const int64_t input_bytes = static_cast<int64_t>(in_rows) * in_cols * in_depth * sizeof(T);
const int64_t output_bytes = static_cast<int64_t>(out_rows) * out_cols * out_depth * sizeof(T);
const Eigen::TensorOpCost cost(input_bytes, output_bytes, shard_cost);
d.parallelFor(total_shards, cost, shard);
}
Expand Down

0 comments on commit 2c18fd1

Please sign in to comment.