Skip to content

Commit

Permalink
doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Apr 8, 2021
1 parent 62d19eb commit 576aa70
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/runtime/vulkan/vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -786,9 +786,7 @@ class VulkanModuleNode final : public runtime::ModuleNode {
public:
explicit VulkanModuleNode(std::unordered_map<std::string, VulkanShader> smap,
std::unordered_map<std::string, FunctionInfo> 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"; }

Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 1 addition & 3 deletions src/runtime/vulkan/vulkan_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion src/target/spirv/ir_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SType>& 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
Expand Down

0 comments on commit 576aa70

Please sign in to comment.