Skip to content

Commit 8b50af0

Browse files
committed
nested namespace in cuda runtime
use nested namespace in cuda runtime Differential Revision: [D84201518](https://our.internmc.facebook.com/intern/diff/D84201518/) [ghstack-poisoned]
1 parent 9ec3de5 commit 8b50af0

File tree

10 files changed

+22
-61
lines changed

10 files changed

+22
-61
lines changed

backends/cuda/runtime/cuda_backend.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
#include <executorch/backends/cuda/runtime/shims/memory.h>
2727
#include <executorch/backends/cuda/runtime/utils.h>
2828

29-
namespace executorch {
30-
namespace backends {
31-
namespace cuda {
29+
namespace executorch::backends::cuda {
3230

3331
#define LOAD_SYMBOL(name, handle) \
3432
do { \
@@ -335,14 +333,13 @@ class ET_EXPERIMENTAL CudaBackend final
335333
}
336334
};
337335

338-
} // namespace cuda
336+
} // namespace executorch::backends::cuda
339337

338+
namespace executorch::backends {
340339
namespace {
341340
auto cls = cuda::CudaBackend();
342341
executorch::runtime::Backend backend{"CudaBackend", &cls};
343342
static executorch::runtime::Error success_with_compiler =
344343
register_backend(backend);
345344
} // namespace
346-
347-
} // namespace backends
348-
} // namespace executorch
345+
} // namespace executorch::backends

backends/cuda/runtime/guard.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
#include <executorch/backends/cuda/runtime/guard.h>
1010
#include <executorch/runtime/platform/log.h>
1111

12-
namespace executorch {
13-
namespace backends {
14-
namespace cuda {
12+
namespace executorch::backends::cuda {
1513

1614
namespace {
1715
// Thread-local stream storage (private to this file)
@@ -146,6 +144,4 @@ Result<CUDAStreamGuard> CUDAStreamGuard::create(
146144
return stream_guard;
147145
}
148146

149-
} // namespace cuda
150-
} // namespace backends
151-
} // namespace executorch
147+
} // namespace executorch::backends::cuda

backends/cuda/runtime/guard.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
#include <executorch/runtime/core/result.h>
1515
#include <cstdint>
1616

17-
namespace executorch {
18-
namespace backends {
19-
namespace cuda {
17+
namespace executorch::backends::cuda {
2018

2119
using executorch::runtime::Error;
2220
using executorch::runtime::Result;
@@ -190,6 +188,4 @@ class CUDAStreamGuard {
190188
DeviceIndex device_index_;
191189
};
192190

193-
} // namespace cuda
194-
} // namespace backends
195-
} // namespace executorch
191+
} // namespace executorch::backends::cuda

backends/cuda/runtime/shims/cuda_guard.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
#include <executorch/backends/cuda/runtime/shims/cuda_guard.h>
1010

11-
namespace executorch {
12-
namespace backends {
13-
namespace cuda {
11+
namespace executorch::backends::cuda {
1412

1513
extern "C" {
1614

@@ -104,6 +102,4 @@ AOTITorchError aoti_torch_get_current_cuda_stream(
104102

105103
} // extern "C"
106104

107-
} // namespace cuda
108-
} // namespace backends
109-
} // namespace executorch
105+
} // namespace executorch::backends::cuda

backends/cuda/runtime/shims/cuda_guard.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include <executorch/backends/cuda/runtime/guard.h>
1414
#include <cstdint>
1515

16-
namespace executorch {
17-
namespace backends {
18-
namespace cuda {
16+
namespace executorch::backends::cuda {
1917

2018
using executorch::backends::aoti::AOTITorchError;
2119

@@ -99,6 +97,4 @@ AOTITorchError aoti_torch_get_current_cuda_stream(
9997

10098
} // extern "C"
10199

102-
} // namespace cuda
103-
} // namespace backends
104-
} // namespace executorch
100+
} // namespace executorch::backends::cuda

backends/cuda/runtime/shims/memory.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
#include <unordered_set>
2020
#include <vector>
2121

22-
namespace executorch {
23-
namespace backends {
24-
namespace cuda {
22+
namespace executorch::backends::cuda {
2523

2624
using executorch::aten::SizesType;
2725
using executorch::aten::StridesType;
@@ -659,6 +657,4 @@ AOTITorchError aoti_torch__reinterpret_tensor(
659657

660658
} // extern "C"
661659

662-
} // namespace cuda
663-
} // namespace backends
664-
} // namespace executorch
660+
} // namespace executorch::backends::cuda

backends/cuda/runtime/shims/memory.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
#include <executorch/backends/aoti/common_shims.h>
1313
#include <cstdint>
1414

15-
namespace executorch {
16-
namespace backends {
17-
namespace cuda {
15+
namespace executorch::backends::cuda {
1816

1917
using executorch::backends::aoti::AOTITorchError;
2018
using executorch::backends::aoti::Tensor;
@@ -145,6 +143,4 @@ aoti_torch_copy_(Tensor* self, Tensor* src, int32_t non_blocking);
145143
void clear_all_tensors();
146144
} // extern "C"
147145

148-
} // namespace cuda
149-
} // namespace backends
150-
} // namespace executorch
146+
} // namespace executorch::backends::cuda

backends/cuda/runtime/shims/tensor_attribute.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
#include <executorch/backends/cuda/runtime/shims/tensor_attribute.h>
1010

11-
namespace executorch {
12-
namespace backends {
13-
namespace cuda {
11+
namespace executorch::backends::cuda {
1412

1513
extern "C" {
1614

@@ -31,6 +29,4 @@ int32_t aoti_torch_device_type_cuda() {
3129

3230
} // extern "C"
3331

34-
} // namespace cuda
35-
} // namespace backends
36-
} // namespace executorch
32+
} // namespace executorch::backends::cuda

backends/cuda/runtime/shims/tensor_attribute.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
#include <executorch/runtime/core/error.h>
1313
#include <cstdint>
1414

15-
namespace executorch {
16-
namespace backends {
17-
namespace cuda {
15+
namespace executorch::backends::cuda {
1816

1917
// Common using declarations for ExecutorTorch types
2018
using executorch::runtime::Error;
@@ -35,6 +33,4 @@ int32_t aoti_torch_device_type_cuda();
3533

3634
} // extern "C"
3735

38-
} // namespace cuda
39-
} // namespace backends
40-
} // namespace executorch
36+
} // namespace executorch::backends::cuda

backends/cuda/runtime/utils.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
#define ET_CUDA_KERNEL_LAUNCH_CHECK_OR_RETURN_ERROR() \
3535
ET_CUDA_CHECK_OR_RETURN_ERROR(cudaGetLastError())
3636

37-
namespace executorch {
38-
namespace backends {
39-
namespace cuda {
37+
namespace executorch::backends::cuda {
4038

4139
// Enum for supported data types in et-cuda backend
4240
enum class SupportedDTypes : int32_t {
@@ -125,6 +123,4 @@ inline AOTITorchError validate_dtype(int32_t dtype) {
125123
}
126124
} // extern "C"
127125

128-
} // namespace cuda
129-
} // namespace backends
130-
} // namespace executorch
126+
} // namespace executorch::backends::cuda

0 commit comments

Comments
 (0)