同步操作将从 Gitee 极速下载/Halide 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "HalideRuntime.h"#include "runtime_internal.h"#include "scoped_mutex_lock.h"namespace Halide {namespace Runtime {namespace Internal {WEAK bool halide_reuse_device_allocations_flag = true;WEAK halide_mutex allocation_pools_lock;WEAK halide_device_allocation_pool *device_allocation_pools = nullptr;} // namespace Internal} // namespace Runtime} // namespace Halideextern "C" {WEAK int halide_reuse_device_allocations(void *user_context, bool flag) {halide_reuse_device_allocations_flag = flag;int err = 0;if (!flag) {ScopedMutexLock lock(&allocation_pools_lock);for (halide_device_allocation_pool *p = device_allocation_pools; p != nullptr; p = p->next) {int ret = p->release_unused(user_context);if (ret) {err = ret;}}}return err;}/** Determines whether on device_free the memory is returned* immediately to the device API, or placed on a free list for future* use. Override and switch based on the user_context for* finer-grained control. By default just returns the value most* recently set by the method above. */WEAK bool halide_can_reuse_device_allocations(void *user_context) {return halide_reuse_device_allocations_flag;}WEAK void halide_register_device_allocation_pool(struct halide_device_allocation_pool *pool) {ScopedMutexLock lock(&allocation_pools_lock);pool->next = device_allocation_pools;device_allocation_pools = pool;}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。