deleteFunc Class — pytorch Architecture
Architecture documentation for the deleteFunc class in CachingHostAllocator.h from the pytorch codebase.
Entity Profile
Source Code
aten/src/ATen/core/CachingHostAllocator.h lines 997–1054
template <typename T, c10::DeleterFnPtr deleteFunc>
struct CachingHostAllocatorInterface : public HostAllocator {
CachingHostAllocatorInterface() : impl_(std::make_unique<T>()) {}
at::DataPtr allocate(size_t size) override {
auto ptr_and_ctx = impl_->allocate(size);
return {
ptr_and_ctx.first,
ptr_and_ctx.second,
deleteFunc, // Use the template parameter deleter function
at::DeviceType::CPU};
}
void free(void* ctx) {
impl_->free(ctx);
}
bool record_event(void* ptr, void* ctx, c10::Stream stream) override {
return impl_->record_event(ptr, ctx, stream);
}
void empty_cache() override {
impl_->empty_cache();
}
void copy_data(void* dest, const void* src, std::size_t count)
const override {
impl_->copy_data(dest, src, count);
}
HostStats get_stats() override {
return impl_->getStats();
}
void reset_accumulated_stats() override {
impl_->resetAccumulatedStats();
}
void reset_peak_stats() override {
impl_->resetPeakStats();
}
void begin_allocate_to_pool(
c10::MempoolId_t pool_id,
std::function<bool(c10::Stream)> filter) override {
impl_->begin_allocate_to_pool(pool_id, std::move(filter));
}
void end_allocate_to_pool(c10::MempoolId_t pool_id) override {
impl_->end_allocate_to_pool(pool_id);
}
void release_pool(c10::MempoolId_t pool_id) override {
impl_->release_pool(pool_id);
}
std::unique_ptr<T> impl_;
};
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free