pytorch/c10/cuda
Yuanyuan Chen 9fff8155c3 [2/N] Fix clang-tidy readability checks (#164652)
This PR applies clang-tidy readability checks to jit sources and all headers in the code base.
`readability-redundant-inline-specifier` is suppressed because it incurs too many changes. `readability-redundant-inline-specifier` is used to detect redundant inline specifiers on function and variable declarations. There are many in-class method definitions that are marked inline.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164652
Approved by: https://github.com/Skylion007
2025-10-06 01:06:01 +00:00
..
impl Improve error message for CUDAGuardImpl, MPSGuardImpl, XPUGuardImpl (#149838) 2025-03-25 07:29:53 +00:00
test [ROCm][Windows] Fix offload gpu arch list in tests (#155212) 2025-06-05 20:30:28 +00:00
BUILD.bazel
build.bzl
CMakeLists.txt Use torch_compile_options for c10 libraries (#147821) 2025-03-18 01:54:23 +00:00
CUDAAlgorithm.h
CUDAAllocatorConfig.cpp [PyTorch Pinned Allocator] Add support of reserved pinned memory segment to avoid slow paths (#164501) 2025-10-03 18:11:27 +00:00
CUDAAllocatorConfig.h [PyTorch Pinned Allocator] Add support of reserved pinned memory segment to avoid slow paths (#164501) 2025-10-03 18:11:27 +00:00
CUDACachingAllocator.cpp [1/N] Fix clang-tidy readability checks (#164561) 2025-10-04 09:40:38 +00:00
CUDACachingAllocator.h [2/N] Fix clang-tidy readability checks (#164652) 2025-10-06 01:06:01 +00:00
CUDADeviceAssertion.h Suppress -Wunused-function for DSA (#150735) 2025-04-07 01:47:35 +00:00
CUDADeviceAssertionHost.cpp Enable -Wunused on torch targets (#150077) 2025-05-02 07:14:19 +00:00
CUDADeviceAssertionHost.h [BE] fix typos in c10/ (#156078) 2025-06-18 10:24:44 +00:00
CUDAException.cpp [BE] Preserve caller source location in the error message (#162808) 2025-09-15 13:29:43 +00:00
CUDAException.h [BE] Preserve caller source location in the error message (#162808) 2025-09-15 13:29:43 +00:00
CUDAFunctions.cpp [BE] Fix '_WIN32' is not defined warning (#162516) 2025-09-10 04:21:38 +00:00
CUDAFunctions.h check if USE_ROCM is defined (#158571) 2025-07-17 19:48:26 +00:00
CUDAGraphsC10Utils.h Add DeviceAllocator as the base device allocator (#138222) 2025-08-08 17:41:10 +00:00
CUDAGuard.h Enable more readability-redundant checks (#143963) 2024-12-30 14:49:33 +00:00
CUDAMacros.h Revert "Increase C10_COMPILE_TIME_MAX_GPUS to 128 (#144138)" 2025-01-14 19:04:12 +00:00
CUDAMallocAsyncAllocator.cpp [1/N] Fix clang-tidy readability checks (#164561) 2025-10-04 09:40:38 +00:00
CUDAMathCompat.h [Reland] [5/N] Change static functions in headers to inline (#131010) 2024-07-18 15:53:48 +00:00
CUDAMiscFunctions.cpp Use cuda error code instead of error text in get_cuda_error_help (#158688) 2025-07-21 23:34:50 +00:00
CUDAMiscFunctions.h Use cuda error code instead of error text in get_cuda_error_help (#158688) 2025-07-21 23:34:50 +00:00
CUDAStream.cpp Replace TORCH_INTERNAL_ASSERT with TORCH_CHECK (#160411) 2025-08-13 06:31:10 +00:00
CUDAStream.h
driver_api.cpp [CI] Add basic CUDA 13.0 periodic test (#161013) 2025-08-29 17:56:33 +00:00
driver_api.h Revert "[CUDA] Add experimental green context support for SM carveout (#159104)" 2025-10-03 20:15:56 +00:00
README.md

c10/cuda is a core library with CUDA functionality. It is distinguished from c10 in that it links against the CUDA library, but like c10 it doesn't contain any kernels, and consists solely of core functionality that is generally useful when writing CUDA code; for example, C++ wrappers for the CUDA C API.

Important notes for developers. If you want to add files or functionality to this folder, TAKE NOTE. The code in this folder is very special, because on our AMD GPU build, we transpile it into c10/hip to provide a ROCm environment. Thus, if you write:

// c10/cuda/CUDAFoo.h
namespace c10 { namespace cuda {

void my_func();

}}

this will get transpiled into:

// c10/hip/HIPFoo.h
namespace c10 { namespace hip {

void my_func();

}}

Thus, if you add new functionality to c10, you must also update C10_MAPPINGS torch/utils/hipify/cuda_to_hip_mappings.py to transpile occurrences of cuda::my_func to hip::my_func. (At the moment, we do NOT have a catch all cuda:: to hip:: namespace conversion, as not all cuda namespaces are converted to hip::, even though c10's are.)

Transpilation inside this folder is controlled by CAFFE2_SPECIFIC_MAPPINGS (oddly enough.) C10_MAPPINGS apply to ALL source files.

If you add a new directory to this folder, you MUST update both c10/cuda/CMakeLists.txt and c10/hip/CMakeLists.txt