Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoguochun1995 committed Apr 9, 2024
1 parent f277255 commit 4029d2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ class AsyncResourcePoolImpl : public AsyncResourcePool<T> {
public:
void add(const T& t, std::deque<DIPUEvent>& events) override {
std::lock_guard<mutex_t> lk(mutex_);
if (events.size() > 0) {
list_.emplace_back(t, std::move(events));
} else {
list_.emplace_front(t, std::move(events));
}
list_.emplace_back(t, std::move(events));
}

T get() override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
namespace dipu {

// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
const size_t kMaxExtendSize =
get_env_or_default("DIPU_MAX_EXTEND_SIZE", 1024 << 20U);
const size_t kMaxExtendSize = get_env_or_default("DIPU_MAX_EXTEND_SIZE", 1024)
<< 20U;

class BFCachingAllocatorImpl {
public:
Expand Down Expand Up @@ -436,8 +436,8 @@ class BFCachingAllocator : public CacheAllocator {
while (!async_mem_pool()->empty()) {
if (!async_mem_pool()->ready()) {
auto now = std::chrono::steady_clock::now();
auto elasped = now - start;
if (elasped < maxWaitTime) {
auto elapsed = now - start;
if (elapsed < maxWaitTime) {
std::this_thread::yield();
continue;
}
Expand Down

0 comments on commit 4029d2d

Please sign in to comment.