vTensorStorage Class — pytorch Architecture
Architecture documentation for the vTensorStorage class in Tensor.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/native/vulkan/api/Tensor.h lines 28–90
class vTensorStorage final {
public:
// Do not allow empty vTensorStorage construction
vTensorStorage() = default;
vTensorStorage(
api::Context* context,
const api::StorageType storage_type,
const api::GPUMemoryLayout gpu_memory_layout,
const std::vector<int64_t>& sizes,
const api::ScalarType dtype,
const bool allocate_memory = true);
vTensorStorage(const vTensorStorage&) = delete;
vTensorStorage& operator=(const vTensorStorage&) = delete;
vTensorStorage(vTensorStorage&&) = default;
vTensorStorage operator=(vTensorStorage&&) = delete;
~vTensorStorage();
friend class vTensor;
private:
// Context
api::Context* context_{};
api::StorageType storage_type_;
// Resource sizings
api::utils::uvec3 extents_{};
int64_t buffer_length_{};
// Image Texture
mutable api::VulkanImage image_;
mutable api::VulkanBuffer buffer_;
// Last Access - used to insert memory barriers
LastAccess last_access_;
private:
// Registers underlying memory for cleanup
void flush();
// Memory barrier insertion
void transition(
api::PipelineBarrier&,
const api::PipelineStageFlags,
const api::MemoryAccessFlags);
// Validation
void verify() const;
public:
inline VkFormat texture_format() {
return image_.format();
}
void discard_and_reallocate(
const std::vector<int64_t>& gpu_sizes,
const api::GPUMemoryLayout gpu_memory_layout,
const api::ScalarType dtype);
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free