Skip to content

Commit bc53f11

Browse files
SS-JIAfacebook-github-bot
authored andcommitted
Update namespace from at::native::vulkan to vkcompute (#2798)
Summary: Pull Request resolved: #2798 ## Context The previous change in the stack forks the Vulkan Compute API into the ExecuTorch directory. Now that there is no longer any dependency on ATen-Vulkan, the `at::native::vulkan` namespace is deprecated in favor of `vkcompute`. Reviewed By: jorgep31415 Differential Revision: D55608083
1 parent e26e615 commit bc53f11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+177
-628
lines changed

backends/vulkan/runtime/VulkanBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace executor {
3232
namespace vulkan {
3333
namespace {
3434

35-
using namespace at::native::vulkan;
35+
using namespace vkcompute;
3636

3737
// Flatbuffer types
3838
using VkGraphPtr = const vkgraph::VkGraph*;

backends/vulkan/runtime/api/Adapter.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@
1414
#include <sstream>
1515
#include <utility>
1616

17-
namespace at {
18-
namespace native {
19-
namespace vulkan {
17+
namespace vkcompute {
2018
namespace api {
21-
2219
PhysicalDevice::PhysicalDevice(VkPhysicalDevice physical_device_handle)
2320
: handle(physical_device_handle),
2421
properties{},
@@ -444,6 +441,4 @@ std::ostream& operator<<(std::ostream& os, const Adapter& adapter) {
444441
}
445442

446443
} // namespace api
447-
} // namespace vulkan
448-
} // namespace native
449-
} // namespace at
444+
} // namespace vkcompute

backends/vulkan/runtime/api/Adapter.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
1212

13-
#ifdef USE_VULKAN_API
14-
1513
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/api/Pipeline.h>
@@ -22,11 +20,8 @@
2220
#include <mutex>
2321
#include <ostream>
2422

25-
namespace at {
26-
namespace native {
27-
namespace vulkan {
23+
namespace vkcompute {
2824
namespace api {
29-
3025
struct PhysicalDevice final {
3126
// Handle
3227
VkPhysicalDevice handle;
@@ -218,8 +213,4 @@ class Adapter final {
218213
};
219214

220215
} // namespace api
221-
} // namespace vulkan
222-
} // namespace native
223-
} // namespace at
224-
225-
#endif /* USE_VULKAN_API */
216+
} // namespace vkcompute

backends/vulkan/runtime/api/Allocator.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
1717

18-
#ifdef USE_VULKAN_API
19-
2018
#define VMA_VULKAN_VERSION 1000000
2119

2220
#ifdef USE_VULKAN_WRAPPER
@@ -60,5 +58,3 @@
6058
#ifdef __clang__
6159
#pragma clang diagnostic pop
6260
#endif /* __clang__ */
63-
64-
#endif /* USE_VULKAN_API */

backends/vulkan/runtime/api/Command.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111

1212
#include <mutex>
1313

14-
namespace at {
15-
namespace native {
16-
namespace vulkan {
14+
namespace vkcompute {
1715
namespace api {
18-
1916
//
2017
// CommandBuffer
2118
//
@@ -448,6 +445,4 @@ void CommandPool::allocate_new_batch(const uint32_t count) {
448445
}
449446

450447
} // namespace api
451-
} // namespace vulkan
452-
} // namespace native
453-
} // namespace at
448+
} // namespace vkcompute

backends/vulkan/runtime/api/Command.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
1212

13-
#ifdef USE_VULKAN_API
14-
1513
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/api/Descriptor.h>
@@ -20,11 +18,8 @@
2018
#include <executorch/backends/vulkan/runtime/api/Shader.h>
2119
#include <executorch/backends/vulkan/runtime/api/Utils.h>
2220

23-
namespace at {
24-
namespace native {
25-
namespace vulkan {
21+
namespace vkcompute {
2622
namespace api {
27-
2823
class CommandBuffer final {
2924
public:
3025
explicit CommandBuffer(VkCommandBuffer, const VkCommandBufferUsageFlags);
@@ -170,8 +165,4 @@ class CommandPool final {
170165
};
171166

172167
} // namespace api
173-
} // namespace vulkan
174-
} // namespace native
175-
} // namespace at
176-
177-
#endif /* USE_VULKAN_API */
168+
} // namespace vkcompute

backends/vulkan/runtime/api/Context.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@
2020
#define VULKAN_QUERY_POOL_SIZE 4096u
2121
#endif
2222

23-
namespace at {
24-
namespace native {
25-
namespace vulkan {
23+
namespace vkcompute {
2624
namespace api {
27-
2825
Context::Context(size_t adapter_i, const ContextConfig& config)
2926
: config_(config),
3027
// Important handles
@@ -230,6 +227,4 @@ UniformParamsBuffer& UniformParamsBuffer::operator=(
230227
}
231228

232229
} // namespace api
233-
} // namespace vulkan
234-
} // namespace native
235-
} // namespace at
230+
} // namespace vkcompute

backends/vulkan/runtime/api/Context.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
1212

13-
#ifdef USE_VULKAN_API
14-
1513
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/api/Adapter.h>
@@ -24,11 +22,8 @@
2422
#include <executorch/backends/vulkan/runtime/api/Shader.h>
2523
#include <executorch/backends/vulkan/runtime/api/Utils.h>
2624

27-
namespace at {
28-
namespace native {
29-
namespace vulkan {
25+
namespace vkcompute {
3026
namespace api {
31-
3227
struct ContextConfig final {
3328
uint32_t cmdSubmitFrequency;
3429
CommandPoolConfig cmdPoolConfig;
@@ -560,8 +555,4 @@ inline bool Context::submit_compute_job(
560555
}
561556

562557
} // namespace api
563-
} // namespace vulkan
564-
} // namespace native
565-
} // namespace at
566-
567-
#endif /* USE_VULKAN_API */
558+
} // namespace vkcompute

backends/vulkan/runtime/api/Descriptor.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@
1212
#include <algorithm>
1313
#include <utility>
1414

15-
namespace at {
16-
namespace native {
17-
namespace vulkan {
15+
namespace vkcompute {
1816
namespace api {
19-
2017
//
2118
// DescriptorSet
2219
//
@@ -290,6 +287,4 @@ void DescriptorPool::flush() {
290287
}
291288

292289
} // namespace api
293-
} // namespace vulkan
294-
} // namespace native
295-
} // namespace at
290+
} // namespace vkcompute

backends/vulkan/runtime/api/Descriptor.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,15 @@
1010

1111
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
1212

13-
#ifdef USE_VULKAN_API
14-
1513
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/api/Resource.h>
1816
#include <executorch/backends/vulkan/runtime/api/Shader.h>
1917

2018
#include <unordered_map>
2119

22-
namespace at {
23-
namespace native {
24-
namespace vulkan {
20+
namespace vkcompute {
2521
namespace api {
26-
2722
class DescriptorSet final {
2823
public:
2924
explicit DescriptorSet(VkDevice, VkDescriptorSet, ShaderLayout::Signature);
@@ -141,8 +136,4 @@ class DescriptorPool final {
141136
};
142137

143138
} // namespace api
144-
} // namespace vulkan
145-
} // namespace native
146-
} // namespace at
147-
148-
#endif /* USE_VULKAN_API */
139+
} // namespace vkcompute

backends/vulkan/runtime/api/Exception.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010

1111
#include <sstream>
1212

13-
namespace at {
14-
namespace native {
15-
namespace vulkan {
13+
namespace vkcompute {
1614
namespace api {
17-
1815
#define VK_RESULT_CASE(code) \
1916
case code: \
2017
out << #code; \
@@ -80,6 +77,4 @@ Error::Error(SourceLocation source_location, const char* cond, std::string msg)
8077
}
8178

8279
} // namespace api
83-
} // namespace vulkan
84-
} // namespace native
85-
} // namespace at
80+
} // namespace vkcompute

backends/vulkan/runtime/api/Exception.h

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

99
#pragma once
1010
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
11-
#ifdef USE_VULKAN_API
1211

1312
#include <exception>
1413
#include <ostream>
@@ -18,39 +17,35 @@
1817
#include <executorch/backends/vulkan/runtime/api/StringUtil.h>
1918
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
2019

21-
#define VK_CHECK(function) \
22-
do { \
23-
const VkResult result = (function); \
24-
if (VK_SUCCESS != result) { \
25-
throw ::at::native::vulkan::api::Error( \
26-
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
27-
::at::native::vulkan::api::concat_str( \
28-
#function, " returned ", result)); \
29-
} \
20+
#define VK_CHECK(function) \
21+
do { \
22+
const VkResult result = (function); \
23+
if (VK_SUCCESS != result) { \
24+
throw ::vkcompute::api::Error( \
25+
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
26+
::vkcompute::api::concat_str(#function, " returned ", result)); \
27+
} \
3028
} while (false)
3129

3230
#define VK_CHECK_COND(cond, ...) \
3331
do { \
3432
if (!(cond)) { \
35-
throw ::at::native::vulkan::api::Error( \
33+
throw ::vkcompute::api::Error( \
3634
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
3735
#cond, \
38-
::at::native::vulkan::api::concat_str(__VA_ARGS__)); \
36+
::vkcompute::api::concat_str(__VA_ARGS__)); \
3937
} \
4038
} while (false)
4139

4240
#define VK_THROW(...) \
4341
do { \
44-
throw ::at::native::vulkan::api::Error( \
42+
throw ::vkcompute::api::Error( \
4543
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
46-
::at::native::vulkan::api::concat_str(__VA_ARGS__)); \
44+
::vkcompute::api::concat_str(__VA_ARGS__)); \
4745
} while (false)
4846

49-
namespace at {
50-
namespace native {
51-
namespace vulkan {
47+
namespace vkcompute {
5248
namespace api {
53-
5449
std::ostream& operator<<(std::ostream& out, const VkResult loc);
5550

5651
struct SourceLocation {
@@ -82,8 +77,4 @@ class Error : public std::exception {
8277
};
8378

8479
} // namespace api
85-
} // namespace vulkan
86-
} // namespace native
87-
} // namespace at
88-
89-
#endif /* USE_VULKAN_API */
80+
} // namespace vkcompute

backends/vulkan/runtime/api/Pipeline.cpp

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

99
#include <executorch/backends/vulkan/runtime/api/Pipeline.h>
1010

11-
namespace at {
12-
namespace native {
13-
namespace vulkan {
11+
namespace vkcompute {
1412
namespace api {
15-
1613
//
1714
// Utility Functions
1815
//
@@ -343,6 +340,4 @@ void ComputePipelineCache::purge() {
343340
}
344341

345342
} // namespace api
346-
} // namespace vulkan
347-
} // namespace native
348-
} // namespace at
343+
} // namespace vkcompute

backends/vulkan/runtime/api/Pipeline.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
1212

13-
#ifdef USE_VULKAN_API
14-
1513
#include <executorch/backends/vulkan/runtime/api/vk_api.h>
1614

1715
#include <executorch/backends/vulkan/runtime/api/Resource.h>
@@ -20,11 +18,8 @@
2018
#include <mutex>
2119
#include <unordered_map>
2220

23-
namespace at {
24-
namespace native {
25-
namespace vulkan {
21+
namespace vkcompute {
2622
namespace api {
27-
2823
struct PipelineBarrier final {
2924
struct Stages final {
3025
VkPipelineStageFlags src;
@@ -205,8 +200,4 @@ class ComputePipelineCache final {
205200
//
206201

207202
} // namespace api
208-
} // namespace vulkan
209-
} // namespace native
210-
} // namespace at
211-
212-
#endif /* USE_VULKAN_API */
203+
} // namespace vkcompute

0 commit comments

Comments
 (0)