Skip to content

Commit

Permalink
Update namespace from at::native::vulkan to vkcompute (#2798)
Browse files Browse the repository at this point in the history
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`.

bypass-github-export-checks

Reviewed By: jorgep31415

Differential Revision: D55608083

fbshipit-source-id: bfe7564359b19daf4356c54d9a2c0e967171d25f
  • Loading branch information
SS-JIA authored and facebook-github-bot committed Apr 2, 2024
1 parent a6e7317 commit c06c89f
Show file tree
Hide file tree
Showing 72 changed files with 176 additions and 564 deletions.
2 changes: 1 addition & 1 deletion backends/vulkan/runtime/VulkanBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace executor {
namespace vulkan {
namespace {

using namespace at::native::vulkan;
using namespace vkcompute;

// Flatbuffer types
using VkGraphPtr = const vkgraph::VkGraph*;
Expand Down
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#include <sstream>
#include <utility>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

PhysicalDevice::PhysicalDevice(VkPhysicalDevice physical_device_handle)
Expand Down Expand Up @@ -444,6 +442,4 @@ std::ostream& operator<<(std::ostream& os, const Adapter& adapter) {
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
12 changes: 2 additions & 10 deletions backends/vulkan/runtime/api/Adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

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

#ifdef USE_VULKAN_API

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

#include <executorch/backends/vulkan/runtime/api/Pipeline.h>
Expand All @@ -22,9 +20,7 @@
#include <mutex>
#include <ostream>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

struct PhysicalDevice final {
Expand Down Expand Up @@ -218,8 +214,4 @@ class Adapter final {
};

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at

#endif /* USE_VULKAN_API */
} // namespace vkcompute
4 changes: 0 additions & 4 deletions backends/vulkan/runtime/api/Allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

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

#ifdef USE_VULKAN_API

#define VMA_VULKAN_VERSION 1000000

#ifdef USE_VULKAN_WRAPPER
Expand Down Expand Up @@ -60,5 +58,3 @@
#ifdef __clang__
#pragma clang diagnostic pop
#endif /* __clang__ */

#endif /* USE_VULKAN_API */
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@

#include <mutex>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

//
Expand Down Expand Up @@ -448,6 +446,4 @@ void CommandPool::allocate_new_batch(const uint32_t count) {
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
12 changes: 2 additions & 10 deletions backends/vulkan/runtime/api/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

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

#ifdef USE_VULKAN_API

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

#include <executorch/backends/vulkan/runtime/api/Descriptor.h>
Expand All @@ -20,9 +18,7 @@
#include <executorch/backends/vulkan/runtime/api/Shader.h>
#include <executorch/backends/vulkan/runtime/api/Utils.h>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

class CommandBuffer final {
Expand Down Expand Up @@ -170,8 +166,4 @@ class CommandPool final {
};

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at

#endif /* USE_VULKAN_API */
} // namespace vkcompute
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
#define VULKAN_QUERY_POOL_SIZE 4096u
#endif

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

Context::Context(size_t adapter_i, const ContextConfig& config)
Expand Down Expand Up @@ -230,6 +228,4 @@ UniformParamsBuffer& UniformParamsBuffer::operator=(
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
12 changes: 2 additions & 10 deletions backends/vulkan/runtime/api/Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

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

#ifdef USE_VULKAN_API

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

#include <executorch/backends/vulkan/runtime/api/Adapter.h>
Expand All @@ -24,9 +22,7 @@
#include <executorch/backends/vulkan/runtime/api/Shader.h>
#include <executorch/backends/vulkan/runtime/api/Utils.h>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

struct ContextConfig final {
Expand Down Expand Up @@ -560,8 +556,4 @@ inline bool Context::submit_compute_job(
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at

#endif /* USE_VULKAN_API */
} // namespace vkcompute
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/Descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
#include <algorithm>
#include <utility>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

//
Expand Down Expand Up @@ -290,6 +288,4 @@ void DescriptorPool::flush() {
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
12 changes: 2 additions & 10 deletions backends/vulkan/runtime/api/Descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@

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

#ifdef USE_VULKAN_API

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

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

#include <unordered_map>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

class DescriptorSet final {
Expand Down Expand Up @@ -141,8 +137,4 @@ class DescriptorPool final {
};

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at

#endif /* USE_VULKAN_API */
} // namespace vkcompute
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/Exception.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

#include <sstream>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

#define VK_RESULT_CASE(code) \
Expand Down Expand Up @@ -80,6 +78,4 @@ Error::Error(SourceLocation source_location, const char* cond, std::string msg)
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
36 changes: 14 additions & 22 deletions backends/vulkan/runtime/api/Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#pragma once
// @lint-ignore-every CLANGTIDY facebook-hte-BadMemberName
#ifdef USE_VULKAN_API

#include <exception>
#include <ostream>
Expand All @@ -18,37 +17,34 @@
#include <executorch/backends/vulkan/runtime/api/StringUtil.h>
#include <executorch/backends/vulkan/runtime/api/vk_api.h>

#define VK_CHECK(function) \
do { \
const VkResult result = (function); \
if (VK_SUCCESS != result) { \
throw ::at::native::vulkan::api::Error( \
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
::at::native::vulkan::api::concat_str( \
#function, " returned ", result)); \
} \
#define VK_CHECK(function) \
do { \
const VkResult result = (function); \
if (VK_SUCCESS != result) { \
throw ::vkcompute::api::Error( \
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
::vkcompute::api::concat_str(#function, " returned ", result)); \
} \
} while (false)

#define VK_CHECK_COND(cond, ...) \
do { \
if (!(cond)) { \
throw ::at::native::vulkan::api::Error( \
throw ::vkcompute::api::Error( \
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
#cond, \
::at::native::vulkan::api::concat_str(__VA_ARGS__)); \
::vkcompute::api::concat_str(__VA_ARGS__)); \
} \
} while (false)

#define VK_THROW(...) \
do { \
throw ::at::native::vulkan::api::Error( \
throw ::vkcompute::api::Error( \
{__func__, __FILE__, static_cast<uint32_t>(__LINE__)}, \
::at::native::vulkan::api::concat_str(__VA_ARGS__)); \
::vkcompute::api::concat_str(__VA_ARGS__)); \
} while (false)

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

std::ostream& operator<<(std::ostream& out, const VkResult loc);
Expand Down Expand Up @@ -82,8 +78,4 @@ class Error : public std::exception {
};

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at

#endif /* USE_VULKAN_API */
} // namespace vkcompute
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

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

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

//
Expand Down Expand Up @@ -343,6 +341,4 @@ void ComputePipelineCache::purge() {
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
12 changes: 2 additions & 10 deletions backends/vulkan/runtime/api/Pipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

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

#ifdef USE_VULKAN_API

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

#include <executorch/backends/vulkan/runtime/api/Resource.h>
Expand All @@ -20,9 +18,7 @@
#include <mutex>
#include <unordered_map>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

struct PipelineBarrier final {
Expand Down Expand Up @@ -205,8 +201,4 @@ class ComputePipelineCache final {
//

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at

#endif /* USE_VULKAN_API */
} // namespace vkcompute
8 changes: 2 additions & 6 deletions backends/vulkan/runtime/api/QueryPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
#include <iostream>
#include <utility>

namespace at {
namespace native {
namespace vulkan {
namespace vkcompute {
namespace api {

namespace {
Expand Down Expand Up @@ -286,6 +284,4 @@ size_t QueryPool::shader_logs_entry_count() {
}

} // namespace api
} // namespace vulkan
} // namespace native
} // namespace at
} // namespace vkcompute
Loading

0 comments on commit c06c89f

Please sign in to comment.