Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ad892ef
Fix segmentation fault in tf.raw_ops.WriteScalarSummary on empty and …
Venkat6871 Jul 21, 2026
7414ec0
Fix GPU Pack kernel failure when autopacking 0-D scalar tensors in tf…
hasrat17 Jul 29, 2026
20064d4
Address review feedback on _autopacking_helper scalar fix
hasrat17 Jul 29, 2026
0c3bce1
Fix ConcatV2 single-element crash in scalar autopacking path
hasrat17 Jul 31, 2026
7e81a27
validate rank of params vs batch_dims in ResourceGatherOp::Compute
abolshov Jan 31, 2026
43408d9
update test case to catch ValueError
abolshov Jul 5, 2026
0e37293
add validation of batch_dims vs rank of indices and add a correspondi…
abolshov Jul 18, 2026
59e1f7d
update validation logic in ResourceGatherOp::Compute and update unit …
abolshov Aug 9, 2026
360ea8a
fix indentation
abolshov Aug 9, 2026
76da4e4
Demote GPU CheckNumerics anomaly log from LOG(ERROR) to VLOG(1)
vishwakt Aug 10, 2026
21bf1d8
Trim comment on the demoted CheckNumerics log
vishwakt Aug 10, 2026
5db7703
Restore accidentally deleted testScalarConjugateTranspose
hasrat17 Aug 11, 2026
80e5109
Validate random index shuffle rounds
GodlyDonuts Aug 13, 2026
a2ed4f3
Use type-safe round count formatting
GodlyDonuts Aug 13, 2026
0775e47
Bound random index shuffle rounds
GodlyDonuts Aug 13, 2026
018fab6
Fix out-of-bounds write in GPU bincount kernels with negative input
gauravarun Aug 25, 2026
de67fad
Combine bounds check into single unsigned comparison
gauravarun Aug 25, 2026
f448aca
Parameterize negative-input col reduce tests over int32/int64
gauravarun Aug 25, 2026
9618c6c
Zero the SparseSegment*Grad output when indices is empty
elsh04 Aug 30, 2026
057963d
Validate var and accum_update shapes in ApplyAdadeltaOp::DoValidate.
kokol16 Sep 1, 2026
d8684e3
Add ApplyAdadelta mismatched-shape regression tests.
kokol16 Sep 1, 2026
84d2f0b
Use SetZeroFunctor for the empty-indices zeroing and add a regression…
elsh04 Sep 2, 2026
24c6e61
fix: support broadcast-shaped bias with leading 1s in fused MatMul an…
adi-IL Sep 2, 2026
1953bb5
Reject RaggedGather value-count overflow instead of a heap-buffer-ove…
somtri Sep 2, 2026
2a741fd
Fix GPU Pack kernel to handle 0-D scalar inputs directly
hasrat17 Sep 4, 2026
6438edc
Fix compilation errors on non-GPU builds in GPU Pack scalar path
hasrat17 Sep 5, 2026
0c1396c
Reject negative GPU NMS output sizes
GodlyDonuts Sep 5, 2026
0701f6e
Move GPU scalar-pack logic to pack_op_gpu.cu.cc to fix build errors
hasrat17 Sep 8, 2026
66eea1c
Allow large valid index shuffle round counts
GodlyDonuts Sep 9, 2026
d39bf88
Include Abseil string concatenation header
GodlyDonuts Sep 9, 2026
3b9e909
fix(kernels): fix 32-bit signed integer overflow in Dilation GPU kernels
adi-IL Sep 15, 2026
22867ae
Restore the Apache license header in gpu_prim.h
vishwakt Sep 18, 2026
94bd739
Merge pull request #127661 from vishwakt:fix-gpu-prim-license-header
tensorflower-gardener Sep 25, 2026
e48f987
Merge pull request #126048 from gauravarun:fix-bincount-gpu-oob-negat…
tensorflower-gardener Sep 25, 2026
294e93d
Merge pull request #126937 from adi-IL:fix-dilation-gpu-integer-overflow
tensorflower-gardener Sep 25, 2026
f31030d
Merge pull request #124235 from hasrat17:fix/issue-124017-concat-scal…
tensorflower-gardener Sep 25, 2026
80cdf23
Merge pull request #109294 from abolshov:resource_gather_rank_validation
tensorflower-gardener Sep 25, 2026
908220b
Merge pull request #126688 from adi-IL:fix/fused-matmul-multidim-bias
tensorflower-gardener Sep 25, 2026
755d5b1
PR #49007: [XLA:GPU] Rewrite FP8 convolutions in all computations of …
retretor Sep 23, 2026
873b71f
PR #123156: Support int32 argmax in CPU MaxPool gradients
GodlyDonuts Sep 23, 2026
6654c6f
Merge pull request #126444 from endorphin13:sparse-segment-grad-zero-…
tensorflower-gardener Sep 25, 2026
2af9c36
Merge pull request #126702 from somtri:fix-126135-ragged-gather-value…
tensorflower-gardener Sep 25, 2026
82987dc
Sync repo state before enabling per-change Copybara migrations
mrguenther Sep 23, 2026
64890c2
Merge pull request #123672 from Venkat6871:fix-113060-write-scalar-su…
tensorflower-gardener Sep 25, 2026
f58f013
Remove `bazel analyze-profile` from CI
ddunl Sep 23, 2026
e3ab27f
Merge pull request #125002 from vishwakt:fix-check-numerics-log-spam
tensorflower-gardener Sep 25, 2026
4470f2f
[Mosaic TPU] Add some fold rules for the transpose op.
yueshengys Sep 23, 2026
bf1d7cb
[XLA] Disambiguate `kFusion` instructions in `HloCSE` `CseKey` hash b…
mkuperst Sep 23, 2026
38393df
PR #49149: [XLA:Evaluator] Include <cmath> with _USE_MATH_DEFINES in …
sakethreddypingili Sep 23, 2026
265325f
Merge pull request #125220 from GodlyDonuts:codex/validate-index-shuf…
tensorflower-gardener Sep 25, 2026
c96dc33
[Mosaic] Add n-D vector load with expanded semantics
naummo Sep 23, 2026
2e1d1af
Merge pull request #126662 from kokol16:fix/resource-applydelta
tensorflower-gardener Sep 25, 2026
be9e67c
[HLO->MHLO] Support tracing async-start across tuples and optimizatio…
yo96 Sep 23, 2026
409704b
implement BufferUses for AsyncThunks
ermilovmaxim Sep 23, 2026
5d7652e
Merge pull request #126872 from GodlyDonuts:codex/validate-gpu-nms-ou…
tensorflower-gardener Sep 25, 2026
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
2 changes: 1 addition & 1 deletion tensorflow/compiler/mlir/tf2xla/tests/legalize-tf.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -2712,7 +2712,7 @@ func.func @neg_dynamic(%arg0: tensor<?xf32>) -> tensor<?xf32> {
func.func @random_shuffle_float_vector(%arg0: tensor<2xf32>) -> tensor<2xf32> {
// CHECK: "mhlo.sort"
// CHECK: ^bb0([[KEY_LHS:%.*]]: tensor<i32>, [[KEY_RHS:%.*]]: tensor<i32>, {{.*}}: tensor<f32>, {{.*}}: tensor<f32>):
// CHECK: mhlo.compare LT, [[KEY_LHS]], [[KEY_RHS]], TOTALORDER : (tensor<i32>, tensor<i32>) -> tensor<i1>
// CHECK: mhlo.compare LT, [[KEY_LHS]], [[KEY_RHS]] : (tensor<i32>, tensor<i32>) -> tensor<i1>
%0 = "tf.RandomShuffle"(%arg0) {seed = 1 : i64, seed2 = 2 : i64} : (tensor<2xf32>) -> tensor<2xf32>
func.return %0 : tensor<2xf32>
}
Expand Down
11 changes: 8 additions & 3 deletions tensorflow/core/kernels/bincount_op_gpu.cu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.

#define EIGEN_USE_GPU

#include <type_traits>

#include "tensorflow/core/framework/op_kernel.h"
#include "tensorflow/core/framework/register_types.h"
#include "tensorflow/core/framework/tensor.h"
Expand Down Expand Up @@ -118,7 +120,8 @@ __global__ void BincountReduceKernel(const Tidx* in, T* out, const int nthreads,
const Tidx num_bins) {
GPU_1D_KERNEL_LOOP(index, nthreads) {
Tidx bin = ldg(in + index);
if (bin < num_bins) {
if (static_cast<std::make_unsigned_t<Tidx>>(bin) <
static_cast<std::make_unsigned_t<Tidx>>(num_bins)) {
out[bin] = T(1);
}
}
Expand Down Expand Up @@ -149,7 +152,8 @@ __global__ void BincountColReduceKernel(const Tidx* in, const T* weights,
const int nthreads = num_rows * num_cols;
GPU_1D_KERNEL_LOOP(index, nthreads) {
Tidx bin = ldg(in + index);
if (bin < num_bins) {
if (static_cast<std::make_unsigned_t<Tidx>>(bin) <
static_cast<std::make_unsigned_t<Tidx>>(num_bins)) {
int row = index / num_cols;
int offset = row * num_bins + bin;
if (binary_count) {
Expand Down Expand Up @@ -179,7 +183,8 @@ __global__ void BincountColReduceSharedKernel(const Tidx* in, const T* weights,
const int nthreads = num_rows * num_cols;
GPU_1D_KERNEL_LOOP(index, nthreads) {
Tidx bin = ldg(in + index);
if (bin < num_bins) {
if (static_cast<std::make_unsigned_t<Tidx>>(bin) <
static_cast<std::make_unsigned_t<Tidx>>(num_bins)) {
int row = index / num_cols;
int offset = row * num_bins + bin;
if (binary_count) {
Expand Down
6 changes: 4 additions & 2 deletions tensorflow/core/kernels/check_numerics_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ class CheckNumericsOp<GPUDevice, T> : public AsyncOpKernel {
const int is_nan = abnormality_indicators(0);
const int is_inf = abnormality_indicators(1);
if (is_nan || is_inf) {
LOG(ERROR) << "abnormal_detected_host @" << abnormality_indicators.data()
<< " = {" << is_nan << ", " << is_inf << "} " << message_;
// Not LOG(ERROR): the InvalidArgumentError set below already reports
// this to the caller, so logging per detection would duplicate it.
VLOG(1) << "abnormal_detected_host @" << abnormality_indicators.data()
<< " = {" << is_nan << ", " << is_inf << "} " << message_;

std::string anomalies;
if (is_nan && is_inf) {
Expand Down
19 changes: 14 additions & 5 deletions tensorflow/core/kernels/conv_ops_fused_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,21 @@ struct LaunchFusedConv2DOp<GPUDevice, T> {
const int64_t out_cols = GetTensorDim(*output, params.data_format, 'W');
const int64_t out_depths = GetTensorDim(*output, params.data_format, 'C');

// Bias of the following dimensions: [ output_depth ]
// Bias of the following dimensions: [ output_depth ] or [1, ..., 1,
// output_depth]
const Tensor& bias = context->input(2);
OP_REQUIRES(context, bias.dims() == 1,
absl::InvalidArgumentError(absl::StrCat(
"bias must be 1-dimensional", bias.shape().DebugString())));
OP_REQUIRES(context, bias.dim_size(0) == out_depths,
OP_REQUIRES(context, bias.dims() >= 1,
absl::InvalidArgumentError(
absl::StrCat("bias must be at least 1-dimensional, got: ",
bias.shape().DebugString())));
for (int i = 0; i < bias.dims() - 1; ++i) {
OP_REQUIRES(context, bias.dim_size(i) == 1,
absl::InvalidArgumentError(absl::StrCat(
"For bias_dims > 1, all except the last dimension "
"must be 1, got: ",
bias.shape().DebugString())));
}
OP_REQUIRES(context, bias.dim_size(bias.dims() - 1) == out_depths,
absl::InvalidArgumentError(
absl::StrCat("bias depth must be equal to out depth",
bias.shape().DebugString())));
Expand Down
225 changes: 118 additions & 107 deletions tensorflow/core/kernels/dilation_ops_gpu.cu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,28 @@ namespace {

template <typename T>
__global__ void DilationKernel(
const int32_t nthreads, const T* __restrict__ input_ptr,
const T* __restrict__ filter_ptr, int batch, int input_rows, int input_cols,
int depth, int filter_rows, int filter_cols, int output_rows,
int output_cols, int stride_rows, int stride_cols, int rate_rows,
int rate_cols, int pad_top, int pad_left, T* __restrict__ output_ptr) {
GPU_1D_KERNEL_LOOP(out_idx, nthreads) {
const int64_t nthreads, const T* __restrict__ input_ptr,
const T* __restrict__ filter_ptr, int64_t batch, int64_t input_rows,
int64_t input_cols, int64_t depth, int64_t filter_rows, int64_t filter_cols,
int64_t output_rows, int64_t output_cols, int stride_rows, int stride_cols,
int rate_rows, int rate_cols, int pad_top, int pad_left,
T* __restrict__ output_ptr) {
for (int64_t out_idx : GpuGridRangeX(nthreads)) {
// out_idx = d + depth * (w_out + output_cols * (h_out + output_rows * b))
const int d = out_idx % depth;
const int out_idx2 = out_idx / depth;
const int w_out = out_idx2 % output_cols;
const int out_idx3 = out_idx2 / output_cols;
const int h_out = out_idx3 % output_rows;
const int b = out_idx3 / output_rows;
int h_beg = h_out * stride_rows - pad_top;
int w_beg = w_out * stride_cols - pad_left;
const int64_t d = out_idx % depth;
const int64_t out_idx2 = out_idx / depth;
const int64_t w_out = out_idx2 % output_cols;
const int64_t out_idx3 = out_idx2 / output_cols;
const int64_t h_out = out_idx3 % output_rows;
const int64_t b = out_idx3 / output_rows;
int64_t h_beg = h_out * stride_rows - pad_top;
int64_t w_beg = w_out * stride_cols - pad_left;
T cur_val = Eigen::NumTraits<T>::lowest();
for (int h = 0; h < filter_rows; ++h) {
const int h_in = h_beg + h * rate_rows;
for (int64_t h = 0; h < filter_rows; ++h) {
const int64_t h_in = h_beg + h * rate_rows;
if (h_in >= 0 && h_in < input_rows) {
for (int w = 0; w < filter_cols; ++w) {
const int w_in = w_beg + w * rate_cols;
for (int64_t w = 0; w < filter_cols; ++w) {
const int64_t w_in = w_beg + w * rate_cols;
if (w_in >= 0 && w_in < input_cols) {
const T val =
input_ptr[d + depth * (w_in +
Expand All @@ -75,33 +76,33 @@ __global__ void DilationKernel(

template <typename T>
__global__ void DilationBackpropInputKernel(
const int32_t nthreads, const T* __restrict__ input_ptr,
const int64_t nthreads, const T* __restrict__ input_ptr,
const T* __restrict__ filter_ptr, const T* __restrict__ out_backprop_ptr,
int batch, int input_rows, int input_cols, int depth, int filter_rows,
int filter_cols, int output_rows, int output_cols, int stride_rows,
int stride_cols, int rate_rows, int rate_cols, int pad_top, int pad_left,
T* __restrict__ in_backprop_ptr) {
GPU_1D_KERNEL_LOOP(out_idx, nthreads) {
int64_t batch, int64_t input_rows, int64_t input_cols, int64_t depth,
int64_t filter_rows, int64_t filter_cols, int64_t output_rows,
int64_t output_cols, int stride_rows, int stride_cols, int rate_rows,
int rate_cols, int pad_top, int pad_left, T* __restrict__ in_backprop_ptr) {
for (int64_t out_idx : GpuGridRangeX(nthreads)) {
// out_idx = d + depth * (w_out + output_cols * (h_out + output_rows * b))
const int d = out_idx % depth;
const int out_idx2 = out_idx / depth;
const int w_out = out_idx2 % output_cols;
const int out_idx3 = out_idx2 / output_cols;
const int h_out = out_idx3 % output_rows;
const int b = out_idx3 / output_rows;
int h_beg = h_out * stride_rows - pad_top;
int w_beg = w_out * stride_cols - pad_left;
const int64_t d = out_idx % depth;
const int64_t out_idx2 = out_idx / depth;
const int64_t w_out = out_idx2 % output_cols;
const int64_t out_idx3 = out_idx2 / output_cols;
const int64_t h_out = out_idx3 % output_rows;
const int64_t b = out_idx3 / output_rows;
int64_t h_beg = h_out * stride_rows - pad_top;
int64_t w_beg = w_out * stride_cols - pad_left;
T cur_val = Eigen::NumTraits<T>::lowest();
int h_in_max = (h_beg < 0) ? 0 : h_beg;
int w_in_max = (w_beg < 0) ? 0 : w_beg;
int64_t h_in_max = (h_beg < 0) ? 0 : h_beg;
int64_t w_in_max = (w_beg < 0) ? 0 : w_beg;
// In the case of multiple argmax branches, we only back-propagate along the
// last branch, i.e., the one with largest value of `h * filter_cols + w`,
// similarly to the max-pooling backward routines.
for (int h = 0; h < filter_rows; ++h) {
const int h_in = h_beg + h * rate_rows;
for (int64_t h = 0; h < filter_rows; ++h) {
const int64_t h_in = h_beg + h * rate_rows;
if (h_in >= 0 && h_in < input_rows) {
for (int w = 0; w < filter_cols; ++w) {
const int w_in = w_beg + w * rate_cols;
for (int64_t w = 0; w < filter_cols; ++w) {
const int64_t w_in = w_beg + w * rate_cols;
if (w_in >= 0 && w_in < input_cols) {
const T val =
input_ptr[d + depth * (w_in +
Expand All @@ -125,33 +126,34 @@ __global__ void DilationBackpropInputKernel(

template <typename T>
__global__ void DilationBackpropFilterKernel(
const int32_t nthreads, const T* __restrict__ input_ptr,
const int64_t nthreads, const T* __restrict__ input_ptr,
const T* __restrict__ filter_ptr, const T* __restrict__ out_backprop_ptr,
int batch, int input_rows, int input_cols, int depth, int filter_rows,
int filter_cols, int output_rows, int output_cols, int stride_rows,
int stride_cols, int rate_rows, int rate_cols, int pad_top, int pad_left,
int64_t batch, int64_t input_rows, int64_t input_cols, int64_t depth,
int64_t filter_rows, int64_t filter_cols, int64_t output_rows,
int64_t output_cols, int stride_rows, int stride_cols, int rate_rows,
int rate_cols, int pad_top, int pad_left,
T* __restrict__ filter_backprop_ptr) {
GPU_1D_KERNEL_LOOP(out_idx, nthreads) {
for (int64_t out_idx : GpuGridRangeX(nthreads)) {
// out_idx = d + depth * (w_out + output_cols * (h_out + output_rows * b))
const int d = out_idx % depth;
const int out_idx2 = out_idx / depth;
const int w_out = out_idx2 % output_cols;
const int out_idx3 = out_idx2 / output_cols;
const int h_out = out_idx3 % output_rows;
const int b = out_idx3 / output_rows;
int h_beg = h_out * stride_rows - pad_top;
int w_beg = w_out * stride_cols - pad_left;
const int64_t d = out_idx % depth;
const int64_t out_idx2 = out_idx / depth;
const int64_t w_out = out_idx2 % output_cols;
const int64_t out_idx3 = out_idx2 / output_cols;
const int64_t h_out = out_idx3 % output_rows;
const int64_t b = out_idx3 / output_rows;
int64_t h_beg = h_out * stride_rows - pad_top;
int64_t w_beg = w_out * stride_cols - pad_left;
T cur_val = Eigen::NumTraits<T>::lowest();
int h_max = 0;
int w_max = 0;
int64_t h_max = 0;
int64_t w_max = 0;
// In the case of multiple argmax branches, we only back-propagate along the
// last branch, i.e., the one with largest value of `h * filter_cols + w`,
// similarly to the max-pooling backward routines.
for (int h = 0; h < filter_rows; ++h) {
const int h_in = h_beg + h * rate_rows;
for (int64_t h = 0; h < filter_rows; ++h) {
const int64_t h_in = h_beg + h * rate_rows;
if (h_in >= 0 && h_in < input_rows) {
for (int w = 0; w < filter_cols; ++w) {
const int w_in = w_beg + w * rate_cols;
for (int64_t w = 0; w < filter_cols; ++w) {
const int64_t w_in = w_beg + w * rate_cols;
if (w_in >= 0 && w_in < input_cols) {
const T val =
input_ptr[d + depth * (w_in +
Expand Down Expand Up @@ -182,23 +184,26 @@ struct Dilation<GPUDevice, T> {
typename TTypes<T, 3>::ConstTensor filter, int stride_rows,
int stride_cols, int rate_rows, int rate_cols, int pad_top,
int pad_left, typename TTypes<T, 4>::Tensor output) {
const int batch = input.dimension(0);
const int input_rows = input.dimension(1);
const int input_cols = input.dimension(2);
const int depth = input.dimension(3);

const int filter_rows = filter.dimension(0);
const int filter_cols = filter.dimension(1);

const int output_rows = output.dimension(1);
const int output_cols = output.dimension(2);

const int total_count = batch * output_rows * output_cols * depth;
GpuLaunchConfig config = GetGpuLaunchConfig(total_count, d);

const int64_t batch = input.dimension(0);
const int64_t input_rows = input.dimension(1);
const int64_t input_cols = input.dimension(2);
const int64_t depth = input.dimension(3);

const int64_t filter_rows = filter.dimension(0);
const int64_t filter_cols = filter.dimension(1);

const int64_t output_rows = output.dimension(1);
const int64_t output_cols = output.dimension(2);

const int64_t total_count = batch * output_rows * output_cols * depth;
// Occupancy-aware config: heuristic 1024-thread blocks exceed registers
// on cuda13 for these kernels (too many resources requested for launch).
absl::StatusOr<GpuLaunchConfig64> config =
GetGpuLaunchConfig64(total_count, d, DilationKernel<T>, 0, 0);
CHECK_OK(config.status()); // Crash OK
TF_CHECK_OK(GpuLaunchKernel(
DilationKernel<T>, config.block_count, config.thread_per_block, 0,
d.stream(), config.virtual_thread_count, input.data(), filter.data(),
DilationKernel<T>, config->block_count, config->thread_per_block, 0,
d.stream(), config->virtual_thread_count, input.data(), filter.data(),
batch, input_rows, input_cols, depth, filter_rows, filter_cols,
output_rows, output_cols, stride_rows, stride_cols, rate_rows,
rate_cols, pad_top, pad_left, output.data()));
Expand All @@ -213,33 +218,36 @@ struct DilationBackpropInput<GPUDevice, T> {
int stride_rows, int stride_cols, int rate_rows,
int rate_cols, int pad_top, int pad_left,
typename TTypes<T, 4>::Tensor in_backprop) {
const int batch = input.dimension(0);
const int input_rows = input.dimension(1);
const int input_cols = input.dimension(2);
const int depth = input.dimension(3);
const int64_t batch = input.dimension(0);
const int64_t input_rows = input.dimension(1);
const int64_t input_cols = input.dimension(2);
const int64_t depth = input.dimension(3);

const int filter_rows = filter.dimension(0);
const int filter_cols = filter.dimension(1);
const int64_t filter_rows = filter.dimension(0);
const int64_t filter_cols = filter.dimension(1);

const int output_rows = out_backprop.dimension(1);
const int output_cols = out_backprop.dimension(2);
const int64_t output_rows = out_backprop.dimension(1);
const int64_t output_cols = out_backprop.dimension(2);

int total_count;
GpuLaunchConfig config;
int64_t total_count;
absl::StatusOr<GpuLaunchConfig64> config;

// Initialize in_backprop with all zeros.
total_count = batch * input_rows * input_cols * depth;
config = GetGpuLaunchConfig(total_count, d);
TF_CHECK_OK(GpuLaunchKernel(SetZero<T>, config.block_count,
config.thread_per_block, 0, d.stream(),
total_count, in_backprop.data()));
config = GetGpuLaunchConfig64(total_count, d);
CHECK_OK(config.status()); // Crash OK
TF_CHECK_OK(GpuLaunchKernel(
SetZero<T>, config->block_count, config->thread_per_block, 0,
d.stream(), config->virtual_thread_count, in_backprop.data()));

// Accumulate.
total_count = batch * output_rows * output_cols * depth;
config = GetGpuLaunchConfig(total_count, d);
config = GetGpuLaunchConfig64(total_count, d,
DilationBackpropInputKernel<T>, 0, 0);
CHECK_OK(config.status()); // Crash OK
TF_CHECK_OK(GpuLaunchKernel(
DilationBackpropInputKernel<T>, config.block_count,
config.thread_per_block, 0, d.stream(), config.virtual_thread_count,
DilationBackpropInputKernel<T>, config->block_count,
config->thread_per_block, 0, d.stream(), config->virtual_thread_count,
input.data(), filter.data(), out_backprop.data(), batch, input_rows,
input_cols, depth, filter_rows, filter_cols, output_rows, output_cols,
stride_rows, stride_cols, rate_rows, rate_cols, pad_top, pad_left,
Expand All @@ -255,33 +263,36 @@ struct DilationBackpropFilter<GPUDevice, T> {
int stride_rows, int stride_cols, int rate_rows,
int rate_cols, int pad_top, int pad_left,
typename TTypes<T, 3>::Tensor filter_backprop) {
const int batch = input.dimension(0);
const int input_rows = input.dimension(1);
const int input_cols = input.dimension(2);
const int depth = input.dimension(3);
const int64_t batch = input.dimension(0);
const int64_t input_rows = input.dimension(1);
const int64_t input_cols = input.dimension(2);
const int64_t depth = input.dimension(3);

const int filter_rows = filter.dimension(0);
const int filter_cols = filter.dimension(1);
const int64_t filter_rows = filter.dimension(0);
const int64_t filter_cols = filter.dimension(1);

const int output_rows = out_backprop.dimension(1);
const int output_cols = out_backprop.dimension(2);
const int64_t output_rows = out_backprop.dimension(1);
const int64_t output_cols = out_backprop.dimension(2);

int total_count;
GpuLaunchConfig config;
int64_t total_count;
absl::StatusOr<GpuLaunchConfig64> config;

// Initialize filter_backprop with all zeros.
total_count = filter_rows * filter_cols * depth;
config = GetGpuLaunchConfig(total_count, d);
TF_CHECK_OK(GpuLaunchKernel(SetZero<T>, config.block_count,
config.thread_per_block, 0, d.stream(),
total_count, filter_backprop.data()));
config = GetGpuLaunchConfig64(total_count, d);
CHECK_OK(config.status()); // Crash OK
TF_CHECK_OK(GpuLaunchKernel(
SetZero<T>, config->block_count, config->thread_per_block, 0,
d.stream(), config->virtual_thread_count, filter_backprop.data()));

// Accumulate.
total_count = batch * output_rows * output_cols * depth;
config = GetGpuLaunchConfig(total_count, d);
config = GetGpuLaunchConfig64(total_count, d,
DilationBackpropFilterKernel<T>, 0, 0);
CHECK_OK(config.status()); // Crash OK
TF_CHECK_OK(GpuLaunchKernel(
DilationBackpropFilterKernel<T>, config.block_count,
config.thread_per_block, 0, d.stream(), config.virtual_thread_count,
DilationBackpropFilterKernel<T>, config->block_count,
config->thread_per_block, 0, d.stream(), config->virtual_thread_count,
input.data(), filter.data(), out_backprop.data(), batch, input_rows,
input_cols, depth, filter_rows, filter_cols, output_rows, output_cols,
stride_rows, stride_cols, rate_rows, rate_cols, pad_top, pad_left,
Expand Down
Loading
Loading