From 449874356d2bf6dc08655f102534bc0c1a189651 Mon Sep 17 00:00:00 2001 From: Exusial Date: Wed, 26 Feb 2025 16:21:30 +0800 Subject: [PATCH 1/2] debug. --- python/jittor/src/mem/allocator/cuda_dual_allocator.h | 2 +- python/jittor/src/mem/allocator/sfrl_allocator.h | 2 +- python/jittor/src/mem/allocator/temp_allocator.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python/jittor/src/mem/allocator/cuda_dual_allocator.h b/python/jittor/src/mem/allocator/cuda_dual_allocator.h index 0cc94a31..b0be66c8 100644 --- a/python/jittor/src/mem/allocator/cuda_dual_allocator.h +++ b/python/jittor/src/mem/allocator/cuda_dual_allocator.h @@ -30,7 +30,7 @@ EXTERN_LIB bool no_cuda_error_when_free; struct CudaDualAllocator : Allocator { //for recycle block_id - static const size_t ID_LIMIT = 1 << 16; + static const size_t ID_LIMIT = 1 << 20; int n_free_ids; int free_ids[ID_LIMIT]; DualAllocation allocations[ID_LIMIT]; diff --git a/python/jittor/src/mem/allocator/sfrl_allocator.h b/python/jittor/src/mem/allocator/sfrl_allocator.h index 2bd9a170..3d409e41 100644 --- a/python/jittor/src/mem/allocator/sfrl_allocator.h +++ b/python/jittor/src/mem/allocator/sfrl_allocator.h @@ -36,7 +36,7 @@ struct CachingBlockPool { //start from 1 static size_t tot_block_id; static std::unique_ptr occupied_id_mapper; - static const size_t ID_LIMIT = 1 << 18; + static const size_t ID_LIMIT = 1 << 21; pair get_key(CachingBlock* block); diff --git a/python/jittor/src/mem/allocator/temp_allocator.h b/python/jittor/src/mem/allocator/temp_allocator.h index 08dc0994..ce2cd3b5 100644 --- a/python/jittor/src/mem/allocator/temp_allocator.h +++ b/python/jittor/src/mem/allocator/temp_allocator.h @@ -23,7 +23,7 @@ struct TempCachingBlock { struct TempAllocator : Allocator { static const size_t ALIGN_SIZE = 512; - static const size_t ID_LIMIT = 1 << 18; + static const size_t ID_LIMIT = 1 << 21; static vector temp_allocators; Allocator* underlying; size_t cache_blocks_limit, used_memory, unused_memory; From 45465befd30211585c50e9cd5b6919485db2ebc0 Mon Sep 17 00:00:00 2001 From: Exusial Date: Tue, 22 Apr 2025 20:16:43 +0800 Subject: [PATCH 2/2] fix histc. --- python/jittor/misc.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/jittor/misc.py b/python/jittor/misc.py index 90f426e7..46ea7cea 100644 --- a/python/jittor/misc.py +++ b/python/jittor/misc.py @@ -2229,10 +2229,9 @@ def histc(input, bins, min=0., max=0.): if bins <= 0: raise RuntimeError(f"bins must be > 0, but got {bins}") bin_length = (max - min) / bins - histc = jt.floor((input[jt.logical_and(input >= min, input <= max)] - min) / bin_length).int().reshape(-1) + histc = jt.floor((input[jt.logical_and(input >= min, input < max)] - min) / bin_length).int().reshape(-1) hist = jt.ones_like(histc).float().reindex_reduce("add", [bins,], ["@e0(i0)"], extras=[histc]) - if hist.sum() != histc.shape[0]: - hist[-1] += 1 + hist[-1] += input[input == max].shape[0] return hist def peek_s(x):