mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
THC: Cleanup dead code (#64441)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64441 Test Plan: Imported from OSS Reviewed By: gchanan Differential Revision: D30735342 Pulled By: ngimel fbshipit-source-id: 84ab36f7aec6b8cd7f1f34c19a58a382c06ad68d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
db692ec0b3
commit
c19bd05e84
@ -394,8 +394,6 @@ filegroup(
|
||||
"aten/src/THC/THCStorageCopy.cu.cc",
|
||||
"aten/src/THC/THCTensor.cu.cc",
|
||||
"aten/src/THC/THCTensorCopy.cu.cc",
|
||||
"aten/src/THC/THCTensorMath.cu.cc",
|
||||
"aten/src/THC/THCTensorMathPairwise.cu.cc",
|
||||
"aten/src/THC/THCTensorMathScan.cu.cc",
|
||||
"aten/src/THC/THCTensorScatterGather.cu.cc",
|
||||
"aten/src/THC/THCTensorSort.cu.cc",
|
||||
|
@ -17,10 +17,7 @@ set(ATen_CUDA_SRCS ${ATen_CUDA_SRCS}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCStorageCopy.cu
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCTensor.cu
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCTensorCopy.cu
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCTensorMath.cu
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCTensorMathMagma.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCTensorMathPairwise.cu
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/THCTensorMathReduce.cu
|
||||
PARENT_SCOPE)
|
||||
|
||||
install(FILES
|
||||
@ -33,7 +30,6 @@ install(FILES
|
||||
THCTensor.h
|
||||
THCTensorCopy.h
|
||||
THCTensorCopy.hpp
|
||||
THCTensorMath.h
|
||||
THCApply.cuh
|
||||
THCReduceApplyUtils.cuh
|
||||
THCTensorMathReduce.cuh
|
||||
@ -85,8 +81,4 @@ install(FILES
|
||||
generic/THCStorageCopy.h
|
||||
generic/THCTensorCopy.cu
|
||||
generic/THCTensorCopy.h
|
||||
generic/THCTensorMath.h
|
||||
generic/THCTensorMath.cu
|
||||
generic/THCTensorMathPairwise.h
|
||||
generic/THCTensorMathPairwise.cu
|
||||
DESTINATION "${ATEN_INSTALL_INCLUDE_SUBDIR}/THC/generic")
|
||||
|
@ -11,6 +11,5 @@
|
||||
|
||||
#include <THC/THCTensor.h>
|
||||
#include <THC/THCTensorCopy.h>
|
||||
#include <THC/THCTensorMath.h>
|
||||
|
||||
#endif
|
||||
|
@ -1,39 +0,0 @@
|
||||
#include <THC/THCTensorMath.h>
|
||||
#include <THC/THCGeneral.h>
|
||||
#include <THC/THCTensorCopy.h>
|
||||
#include <THC/THCApply.cuh>
|
||||
#include <THC/THCNumerics.cuh>
|
||||
#include <THC/THCThrustAllocator.cuh>
|
||||
#include <THC/THCTensor.hpp>
|
||||
|
||||
|
||||
#include <thrust/copy.h>
|
||||
#include <thrust/count.h>
|
||||
#include <thrust/device_ptr.h>
|
||||
#include <thrust/device_vector.h>
|
||||
#include <thrust/execution_policy.h>
|
||||
#include <thrust/functional.h>
|
||||
#include <thrust/sequence.h>
|
||||
#include <thrust/iterator/transform_iterator.h>
|
||||
#include <thrust/transform.h>
|
||||
#if CUDA_VERSION >= 7000 || defined __HIP_PLATFORM_HCC__
|
||||
#include <thrust/system/cuda/execution_policy.h>
|
||||
#endif
|
||||
#include <cfloat>
|
||||
|
||||
template <typename T>
|
||||
struct TensorFillOp {
|
||||
TensorFillOp(T v) : val(v) {}
|
||||
__device__ __forceinline__ void operator()(T* v) { *v = val; }
|
||||
|
||||
const T val;
|
||||
};
|
||||
|
||||
#include <THC/generic/THCTensorMath.cu>
|
||||
#include <THC/THCGenerateAllTypes.h>
|
||||
|
||||
#include <THC/generic/THCTensorMath.cu>
|
||||
#include <THC/THCGenerateBoolType.h>
|
||||
|
||||
#include <THC/generic/THCTensorMath.cu>
|
||||
#include <THC/THCGenerateBFloat16Type.h>
|
@ -1,22 +0,0 @@
|
||||
#ifndef TH_CUDA_TENSOR_MATH_INC
|
||||
#define TH_CUDA_TENSOR_MATH_INC
|
||||
|
||||
#include <THC/THCTensor.h>
|
||||
#include <THC/THCGeneral.h>
|
||||
|
||||
#include <THC/generic/THCTensorMath.h>
|
||||
#include <THC/THCGenerateAllTypes.h>
|
||||
|
||||
#include <THC/generic/THCTensorMath.h>
|
||||
#include <THC/THCGenerateBoolType.h>
|
||||
|
||||
#include <THC/generic/THCTensorMath.h>
|
||||
#include <THC/THCGenerateBFloat16Type.h>
|
||||
|
||||
#include <THC/generic/THCTensorMathPairwise.h>
|
||||
#include <THC/THCGenerateAllTypes.h>
|
||||
|
||||
#include <THC/generic/THCTensorMathPairwise.h>
|
||||
#include <THC/THCGenerateBoolType.h>
|
||||
|
||||
#endif
|
@ -1,24 +0,0 @@
|
||||
#include <THC/THCTensorMath.h>
|
||||
#include <THC/THCGeneral.h>
|
||||
#include <TH/THHalf.h>
|
||||
#include <THC/THCTensorCopy.h>
|
||||
#include <THC/THCApply.cuh>
|
||||
#include <THC/THCNumerics.cuh>
|
||||
#include <THC/THCTensor.hpp>
|
||||
|
||||
template <typename T>
|
||||
struct TensorMulConstantOp {
|
||||
TensorMulConstantOp(T v) : val(v) {}
|
||||
__device__ __forceinline__ void operator()(T* out, T* in) {
|
||||
*out = *in * val;
|
||||
}
|
||||
|
||||
__device__ __forceinline__ void operator()(T* v) {
|
||||
*v *= val;
|
||||
}
|
||||
|
||||
const T val;
|
||||
};
|
||||
|
||||
#include <THC/generic/THCTensorMathPairwise.cu>
|
||||
#include <THC/THCGenerateBoolType.h>
|
@ -1,2 +0,0 @@
|
||||
#include <THC/THCTensorMathReduce.cuh>
|
||||
#include <THC/THCTensor.hpp>
|
@ -1,70 +0,0 @@
|
||||
#ifndef THC_GENERIC_FILE
|
||||
#define THC_GENERIC_FILE "THC/generic/THCTensorMath.cu"
|
||||
#else
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <ATen/cuda/CUDAContext.h>
|
||||
#include <ATen/MemoryOverlap.h>
|
||||
|
||||
void THCTensor_(fill)(THCState* state, THCTensor *self_, scalar_t value)
|
||||
{
|
||||
THCAssertSameGPU(THCTensor_(checkGPU)(state, 1, self_));
|
||||
|
||||
if (!THC_pointwiseApply1<scalar_t>(
|
||||
state, self_, TensorFillOp<scalar_t>(value))) {
|
||||
THArgCheck(false, 1, CUTORCH_DIM_WARNING);
|
||||
}
|
||||
|
||||
THCudaCheck(cudaGetLastError());
|
||||
}
|
||||
|
||||
void THCTensor_(zero)(THCState *state, THCTensor *self_)
|
||||
{
|
||||
THCAssertSameGPU(THCTensor_(checkGPU)(state, 1, self_));
|
||||
if (THCTensor_(isContiguous)(state, self_)) {
|
||||
THCudaCheck(cudaMemsetAsync(THCTensor_(data)(state, self_),
|
||||
0,
|
||||
sizeof(scalar_t) * THCTensor_(nElement)(state, self_),
|
||||
c10::cuda::getCurrentCUDAStream()));
|
||||
} else {
|
||||
if (!THC_pointwiseApply1<scalar_t>(
|
||||
state, self_,
|
||||
TensorFillOp<scalar_t>(ScalarConvert<int, scalar_t>::to(0)))) {
|
||||
THArgCheck(false, 1, CUTORCH_DIM_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
THCudaCheck(cudaGetLastError());
|
||||
}
|
||||
|
||||
ptrdiff_t
|
||||
THCTensor_(numel)(THCState *state, THCTensor *t)
|
||||
{
|
||||
return THCTensor_(nElement)(state, t);
|
||||
}
|
||||
|
||||
void THCTensor_(check_shape_except_dim)(THCState *state,
|
||||
THCTensor *first, THCTensor *second, int dimension, int index);
|
||||
inline void THCTensor_(check_shape_except_dim)(THCState *state,
|
||||
THCTensor *first, THCTensor *second, int dimension, int index)
|
||||
{
|
||||
int first_dims = first->dim();
|
||||
int second_dims = second->dim();
|
||||
THArgCheck(first_dims == second_dims, 0,
|
||||
"Tensors must have same number of dimensions: got %d and %d",
|
||||
first_dims, second_dims);
|
||||
for (int dim = 0; dim < first_dims; dim++) {
|
||||
if (dim == dimension) {
|
||||
continue;
|
||||
}
|
||||
int64_t first_dim_size = THCTensor_(size)(state, first, dim);
|
||||
int64_t second_dim_size = THCTensor_(size)(state, second, dim);
|
||||
THArgCheck(first_dim_size == second_dim_size, 0,
|
||||
"Sizes of tensors must match except in dimension %d. Got %lld and %lld in dimension %d (The offending index is %d)",
|
||||
dimension, (long long)first_dim_size, (long long)second_dim_size, dim, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -1,10 +0,0 @@
|
||||
#ifndef THC_GENERIC_FILE
|
||||
#define THC_GENERIC_FILE "THC/generic/THCTensorMath.h"
|
||||
#else
|
||||
|
||||
TORCH_CUDA_CU_API void THCTensor_(
|
||||
fill)(THCState* state, THCTensor* self, scalar_t value);
|
||||
TORCH_CUDA_CU_API void THCTensor_(zero)(THCState* state, THCTensor* self);
|
||||
TORCH_CUDA_CU_API ptrdiff_t THCTensor_(numel)(THCState* state, THCTensor* t);
|
||||
|
||||
#endif
|
@ -1,29 +0,0 @@
|
||||
#ifndef THC_GENERIC_FILE
|
||||
#define THC_GENERIC_FILE "THC/generic/THCTensorMathPairwise.cu"
|
||||
#else
|
||||
|
||||
#include <ATen/NamedTensorUtils.h>
|
||||
|
||||
#if !defined(THC_REAL_IS_BOOL)
|
||||
|
||||
void THCTensor_(mul)(THCState *state, THCTensor *self_, THCTensor *src_, scalar_t value)
|
||||
{
|
||||
THCAssertSameGPU(THCTensor_(checkGPU)(state, 2, self_, src_));
|
||||
if (self_ == src_) {
|
||||
if (!THC_pointwiseApply1<scalar_t>(state, self_, TensorMulConstantOp<scalar_t>(value))) {
|
||||
THArgCheck(false, 2, CUTORCH_DIM_WARNING);
|
||||
}
|
||||
} else {
|
||||
THCTensor_(resizeAs)(state, self_, src_);
|
||||
|
||||
if (!THC_pointwiseApply2<scalar_t, scalar_t>(state, self_, src_, TensorMulConstantOp<scalar_t>(value))) {
|
||||
THArgCheck(false, 2, CUTORCH_DIM_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
THCudaCheck(cudaGetLastError());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,15 +0,0 @@
|
||||
#ifndef THC_GENERIC_FILE
|
||||
#define THC_GENERIC_FILE "THC/generic/THCTensorMathPairwise.h"
|
||||
#else
|
||||
|
||||
TORCH_CUDA_CU_API int THCTensor_(
|
||||
equal)(THCState* state, THCTensor* self, THCTensor* src);
|
||||
|
||||
#if !defined(THC_REAL_IS_BOOL)
|
||||
|
||||
TORCH_CUDA_CU_API void THCTensor_(
|
||||
mul)(THCState* state, THCTensor* self, THCTensor* src, scalar_t value);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user