Name Date Size #Lines LOC

..--

impl/H25-Apr-2025-306244

test/H25-Apr-2025-746568

BUILD.bazelH A D25-Apr-2025104 53

CMakeLists.txtH A D25-Apr-20253.1 KiB10186

CUDAAlgorithm.hH A D25-Apr-20251 KiB3228

CUDAAllocatorConfig.cppH A D25-Apr-202512.3 KiB372332

CUDAAllocatorConfig.hH A D25-Apr-20253.7 KiB12595

CUDACachingAllocator.cppH A D25-Apr-2025134.7 KiB3,8442,773

CUDACachingAllocator.hH A D25-Apr-202515.6 KiB500359

CUDADeviceAssertion.hH A D25-Apr-20254 KiB9764

CUDADeviceAssertionHost.cppH A D25-Apr-202512.4 KiB345245

CUDADeviceAssertionHost.hH A D25-Apr-20256.5 KiB16580

CUDAException.cppH A D25-Apr-20251.3 KiB4737

CUDAException.hH A D25-Apr-20254.4 KiB10168

CUDAFunctions.cppH A D25-Apr-202510.8 KiB343274

CUDAFunctions.hH A D25-Apr-20253.8 KiB11773

CUDAGraphsC10Utils.hH A D25-Apr-20252.6 KiB7856

CUDAGuard.hH A D25-Apr-202511 KiB302142

CUDAMacros.hH A D25-Apr-20251.4 KiB5232

CUDAMallocAsyncAllocator.cppH A D25-Apr-202534.4 KiB913547

CUDAMathCompat.hH A D25-Apr-20253.5 KiB153122

CUDAMiscFunctions.cppH A D25-Apr-2025691 2420

CUDAMiscFunctions.hH A D25-Apr-2025306 137

CUDAStream.cppH A D25-Apr-202512.8 KiB383248

CUDAStream.hH A D25-Apr-20259.4 KiB269114

README.mdH A D25-Apr-20251.3 KiB4431

build.bzlH A D25-Apr-20251.6 KiB6763

driver_api.cppH A D25-Apr-20251.5 KiB5342

driver_api.hH A D25-Apr-20252.4 KiB6456

README.md

1c10/cuda is a core library with CUDA functionality.  It is distinguished
2from c10 in that it links against the CUDA library, but like c10 it doesn't
3contain any kernels, and consists solely of core functionality that is generally
4useful when writing CUDA code; for example, C++ wrappers for the CUDA C API.
5
6**Important notes for developers.** If you want to add files or functionality
7to this folder, TAKE NOTE.  The code in this folder is very special,
8because on our AMD GPU build, we transpile it into c10/hip to provide a
9ROCm environment.  Thus, if you write:
10
11```
12// c10/cuda/CUDAFoo.h
13namespace c10 { namespace cuda {
14
15void my_func();
16
17}}
18```
19
20this will get transpiled into:
21
22
23```
24// c10/hip/HIPFoo.h
25namespace c10 { namespace hip {
26
27void my_func();
28
29}}
30```
31
32Thus, if you add new functionality to c10, you must also update `C10_MAPPINGS`
33`torch/utils/hipify/cuda_to_hip_mappings.py` to transpile
34occurrences of `cuda::my_func` to `hip::my_func`.  (At the moment,
35we do NOT have a catch all `cuda::` to `hip::` namespace conversion,
36as not all `cuda` namespaces are converted to `hip::`, even though
37c10's are.)
38
39Transpilation inside this folder is controlled by `CAFFE2_SPECIFIC_MAPPINGS`
40(oddly enough.)  `C10_MAPPINGS` apply to ALL source files.
41
42If you add a new directory to this folder, you MUST update both
43c10/cuda/CMakeLists.txt and c10/hip/CMakeLists.txt
44