File tree 2 files changed +15
-8
lines changed
2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -162,9 +162,9 @@ jobs:
162
162
- run :
163
163
name : Submodule checkout
164
164
command : git submodule update --init --recursive
165
- # - restore_cache:
166
- # keys:
167
- # - build-dependencies-{{ checksum "get_deps.sh" }}
165
+ - restore_cache :
166
+ keys :
167
+ - build-dependencies-{{ checksum "get_deps.sh" }}
168
168
# If no exact match is found will get dependencies from source
169
169
- setup-automation
170
170
- run :
Original file line number Diff line number Diff line change @@ -33,20 +33,27 @@ const OrtMemoryInfo *AllocatorInfo(const OrtAllocator *allocator) {
33
33
}
34
34
35
35
void * AllocatorAlloc (OrtAllocator * ptr , size_t size ) {
36
+
36
37
(void )ptr ;
37
- void * p = RedisModule_Alloc (size );
38
- size_t allocated_size = RedisModule_MallocSize (p );
38
+ int offset = 31 + sizeof (void * );
39
+ void * p1 = (void * )RedisModule_Alloc (size + offset );
40
+ size_t allocated_size = RedisModule_MallocSize (p1 );
39
41
atomic_fetch_add (& OnnxMemory , allocated_size );
40
42
atomic_fetch_add (& OnnxMemoryAccessCounter , 1 );
41
- return p ;
43
+ void * * p2 = (void * * )(((uintptr_t )(p1 ) + offset ) & (~31 ));
44
+ p2 [-1 ] = p1 ;
45
+ return p2 ;
42
46
}
43
47
44
48
void AllocatorFree (OrtAllocator * ptr , void * p ) {
45
49
(void )ptr ;
46
- size_t allocated_size = RedisModule_MallocSize (p );
50
+ if (p == NULL )
51
+ return ;
52
+ void * p1 = ((void * * )p )[-1 ];
53
+ size_t allocated_size = RedisModule_MallocSize (p1 );
47
54
atomic_fetch_sub (& OnnxMemory , allocated_size );
48
55
atomic_fetch_add (& OnnxMemoryAccessCounter , 1 );
49
- return RedisModule_Free (p );
56
+ return RedisModule_Free (p1 );
50
57
}
51
58
52
59
unsigned long long RAI_GetMemoryInfoORT () { return OnnxMemory ; }
You can’t perform that action at this time.
0 commit comments