/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
torch
/
include
/
ATen
/
native
/
cuda
/
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/native/cuda
mkdir
upload
Name
Size
Mode
Actions
BatchLinearAlgebraLib.h
3114
0644
edit
dl
rm
block_reduce.cuh
2549
0644
edit
dl
rm
CompositeRandomAccessor.h
929
0644
edit
dl
rm
CUDALoops.cuh
7598
0644
edit
dl
rm
CuFFTPlanCache.h
19282
0644
edit
dl
rm
CuFFTUtils.h
1892
0644
edit
dl
rm
DeviceSqrt.cuh
585
0644
edit
dl
rm
DistributionTemplates.h
27435
0644
edit
dl
rm
EmbeddingBackwardKernel.cuh
715
0644
edit
dl
rm
ForeachFunctors.cuh
16851
0644
edit
dl
rm
GridSampler.cuh
11316
0644
edit
dl
rm
im2col.cuh
6577
0644
edit
dl
rm
KernelUtils.cuh
2553
0644
edit
dl
rm
LaunchUtils.h
306
0644
edit
dl
rm
Loops.cuh
9997
0644
edit
dl
rm
Math.cuh
13840
0644
edit
dl
rm
MemoryAccess.cuh
12463
0644
edit
dl
rm
MiscUtils.h
3341
0644
edit
dl
rm
MultiTensorApply.cuh
7552
0644
edit
dl
rm
Normalization.cuh
74441
0644
edit
dl
rm
PersistentSoftmax.cuh
14635
0644
edit
dl
rm
Randperm.cuh
2114
0644
edit
dl
rm
Reduce.cuh
38784
0644
edit
dl
rm
Resize.cuh
1919
0644
edit
dl
rm
ROCmLoops.cuh
13526
0644
edit
dl
rm
SortingCommon.cuh
5688
0644
edit
dl
rm
SortingRadixSelect.cuh
11918
0644
edit
dl
rm
SortUtils.cuh
5549
0644
edit
dl
rm
TensorModeKernel.cuh
14391
0644
edit
dl
rm
UniqueCub.cuh
345
0644
edit
dl
rm
UpSample.cuh
7552
0644
edit
dl
rm
vol2col.cuh
8297
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/torch/include/ATen/native/cuda/block_reduce.cuh
(2549B)
#pragma once #include <thrust/tuple.h> #include <ATen/native/SharedReduceOps.h> #include <ATen/cuda/DeviceUtils.cuh> namespace at { namespace native { namespace cuda_utils { constexpr int kCUDABlockReduceNumThreads = 512; // Algorithmic limitation: BlockReduce does two WarpReduce calls, each // of which reduces C10_WARP_SIZE elements. So, at most // C10_WARP_SIZE**2 elements can be reduced at a time. // NOTE: This is >= the max block size on current hardware anyway (1024). constexpr int kCUDABlockReduceMaxThreads = C10_WARP_SIZE * C10_WARP_SIZE; // Sums `val` accross all threads in a warp. // // Assumptions: // - The size of each block should be a multiple of `C10_WARP_SIZE` template <typename T> __inline__ __device__ T WarpReduceSum(T val) { #pragma unroll for (int offset = (C10_WARP_SIZE >> 1); offset > 0; offset >>= 1) { val += WARP_SHFL_DOWN(val, offset); } return val; } // Sums `val` accross all threads in a block. // // Assumptions: // - Thread blocks are an 1D set of threads (indexed with `threadIdx.x` only) // - The size of each block should be a multiple of `C10_WARP_SIZE` // - `shared` should be a pointer to shared memory with size of, at least, // `sizeof(T) * number_of_warps` template <typename T> __inline__ __device__ T BlockReduceSum(T val, T* shared) { const int lid = threadIdx.x % C10_WARP_SIZE; const int wid = threadIdx.x / C10_WARP_SIZE; val = WarpReduceSum(val); __syncthreads(); if (lid == 0) { shared[wid] = val; } __syncthreads(); val = (threadIdx.x < blockDim.x / C10_WARP_SIZE) ? shared[lid] : T(0); if (wid == 0) { val = WarpReduceSum(val); } return val; } template <typename T, class ReduceOp> __inline__ __device__ T WarpReduce(T val, const ReduceOp& op) { #pragma unroll for (int offset = (C10_WARP_SIZE >> 1); offset > 0; offset >>= 1) { val = op.combine(val, op.warp_shfl_down(val, offset)); } return val; } template <typename T, class ReduceOp> __inline__ __device__ T BlockReduce(T val, const ReduceOp& op, const T& identity_element, T* shared) { const int lid = threadIdx.x % C10_WARP_SIZE; const int wid = threadIdx.x / C10_WARP_SIZE; val = WarpReduce(val, op); __syncthreads(); if (lid == 0) { shared[wid] = val; } __syncthreads(); val = (threadIdx.x < blockDim.x / C10_WARP_SIZE) ? shared[lid] : identity_element; if (wid == 0) { val = WarpReduce(val, op); } return val; } } // namespace cuda_utils } // namespace native } // namespace at
Save
cmd:
run