Skip to content

Enable renorm kernel for ROCm #203

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 2 deletions aten/src/THC/THCTensorMathReduce.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ __global__ void THCTensor_kernel_renorm(T *data,
buffer[tx] = scalar_cast<AccT>(0);
AccT norm;

#if !defined(__HIP_DEVICE_COMPILE__)
if (THCNumerics<AccT>::eq(value, scalar_cast<AccT, float>(INFINITY))) {
// get norm of axis
for (ptrdiff_t i = tx; i < size; i += step) {
Expand Down Expand Up @@ -168,7 +167,6 @@ __global__ void THCTensor_kernel_renorm(T *data,
row[i] = scalar_cast<T>(THCNumerics<AccT>::mul(val, norm));
}
}
#endif
}

template <typename T>
Expand Down
1 change: 1 addition & 0 deletions aten/src/THC/generic/THCTensorMathReduce.cu
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ THCTensor_(renorm)(THCState *state, THCTensor* self, THCTensor* src, scalar_t va
if (numel > 0) {
ptrdiff_t size = numel / THTensor_sizeLegacyNoScalars(data, 0);
dim3 grid( THTensor_sizeLegacyNoScalars(data, 0));
// NOTE: only with this specific number of threads can this work on GPUs with a warp size != 32 (such as AMD). Do not alter w/o changing buffer size in kernel.
dim3 threads(32);

THCTensor_kernel_renorm<scalar_t, accreal>
Expand Down