From 576aa7011a9467aefaacea4ac774702b21186b3f Mon Sep 17 00:00:00 2001 From: Masahiro Masuda Date: Thu, 8 Apr 2021 17:34:18 +0900 Subject: [PATCH] doc update --- src/runtime/vulkan/vulkan.cc | 5 +---- src/runtime/vulkan/vulkan_common.h | 4 +--- src/target/spirv/ir_builder.h | 15 ++++++++++++++- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/runtime/vulkan/vulkan.cc b/src/runtime/vulkan/vulkan.cc index 82c2dc0e19b8b..a8571f2cd9315 100644 --- a/src/runtime/vulkan/vulkan.cc +++ b/src/runtime/vulkan/vulkan.cc @@ -786,9 +786,7 @@ class VulkanModuleNode final : public runtime::ModuleNode { public: explicit VulkanModuleNode(std::unordered_map smap, std::unordered_map fmap, std::string source) - : smap_(smap), fmap_(fmap), source_(source), max_push_constants_(GetMaxPushConstantsSize()) { - LOG(INFO) << "VulkanModuleNode, max_push_constants: " << max_push_constants_; - } + : smap_(smap), fmap_(fmap), source_(source), max_push_constants_(GetMaxPushConstantsSize()) {} const char* type_key() const final { return "vulkan"; } @@ -898,7 +896,6 @@ class VulkanModuleNode final : public runtime::ModuleNode { size_t nbytes_scalars = num_pod * sizeof(ArgUnion64); if (nbytes_scalars > max_push_constants_) { - LOG(INFO) << "Using ubo"; push_arg_info(num_buffer, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER); } diff --git a/src/runtime/vulkan/vulkan_common.h b/src/runtime/vulkan/vulkan_common.h index 9ee28fee41c6e..e94a9fe7fa90f 100644 --- a/src/runtime/vulkan/vulkan_common.h +++ b/src/runtime/vulkan/vulkan_common.h @@ -35,9 +35,6 @@ namespace tvm { namespace runtime { namespace vulkan { -// TODO(masahi): Query this value using runtime API -#define MAX_PUSHCONSTANTS 128 - inline const char* VKGetErrorString(VkResult error) { switch (error) { case VK_SUCCESS: @@ -145,6 +142,7 @@ struct VulkanContext { bool UseImmediate() const { return descriptor_template_khr_functions.get() != nullptr; } }; +/*! \brief returns maximum push constant sizes in bytes for the target platform */ uint32_t GetMaxPushConstantsSize(); } // namespace vulkan diff --git a/src/target/spirv/ir_builder.h b/src/target/spirv/ir_builder.h index c06ec0acf341d..d096c85e20d9d 100644 --- a/src/target/spirv/ir_builder.h +++ b/src/target/spirv/ir_builder.h @@ -491,8 +491,21 @@ class IRBuilder { */ Value GetPushConstant(Value ptr_push_const, const SType& v_type, uint32_t index); - // TODO(masahi): doc + /*! + * \brief Declare POD arguments through uniform buffer. + * + * \note Only call this function once! + * \param value_types The values in the uniform buffer + * \param binding The binding locaiton in descriptor set + * \return reference to self. + */ Value DeclareUniformBuffer(const std::vector& value_types, uint32_t binding); + /*! + * \brief Get i-th uniform constant + * \param v_type The value type + * \param index The uniform index + * \return the value of uniform constant + */ Value GetUniform(Value ptr_ubo, const SType& v_type, uint32_t index); /*! * \brief Declare a new function