@@ -300,45 +300,45 @@ static constexpr int DATA_SIZE_EXPANDING_THRESHOLD = 8;
300
300
// void *allocator(size_t size) { return std::aligned_alloc(64, size); }
301
301
// void deallocator(void *ptr) { std::free(ptr); }
302
302
303
- std::shared_ptr<const_cache_proxy> create_const_cache_proxy (size_t size) {
303
+ std::shared_ptr<ConstCacheProxy> createConstCacheProxy (size_t size) {
304
304
// simply allocate buffer and return
305
305
std::shared_ptr<void > base =
306
306
std::shared_ptr<void >{std::aligned_alloc (64 , size), [](void *p) {
307
307
std::free (p); }};
308
- return std::make_shared<const_cache_proxy >(base, base.get (), size, true );
308
+ return std::make_shared<ConstCacheProxy >(base, base.get (), size, true );
309
309
}
310
310
311
- size_t divide_and_ceil (size_t x, size_t y) { return (x + y - 1 ) / y; }
311
+ size_t divideAndCeil (size_t x, size_t y) { return (x + y - 1 ) / y; }
312
312
313
313
// Manager
314
- struct const_graph_tensor_cache_manager {
314
+ struct constGraphTensorCacheManager {
315
315
// dnnl_graph_compiler_context *ctx;
316
316
317
- uint64_t cached_tensor_global_id = 0 ;
317
+ uint64_t cachedTensorGlobalId = 0 ;
318
318
319
319
// singleton
320
- static std::shared_ptr<const_graph_tensor_cache_manager > get () {
321
- static std::shared_ptr<const_graph_tensor_cache_manager > c =
322
- std::make_shared<const_graph_tensor_cache_manager >();
320
+ static std::shared_ptr<constGraphTensorCacheManager > get () {
321
+ static std::shared_ptr<constGraphTensorCacheManager > c =
322
+ std::make_shared<constGraphTensorCacheManager >();
323
323
return c;
324
324
}
325
325
326
326
// alloc and set the buf_base_ and offset_ attributes of cache
327
327
std::vector<uint64_t > alloc (std::vector<size_t > buffers_size) {
328
328
size_t total_size = 0 ;
329
329
for (size_t i = 0 ; i < buffers_size.size (); i++) {
330
- total_size += divide_and_ceil (buffers_size[i], 64 ) * 64 ;
330
+ total_size += divideAndCeil (buffers_size[i], 64 ) * 64 ;
331
331
}
332
332
llvm::dbgs () << " Alloc total size: " << total_size << ' \n ' ;
333
- auto base = create_const_cache_proxy (total_size);
333
+ auto base = createConstCacheProxy (total_size);
334
334
std::vector<uint64_t > global_ids (buffers_size.size ());
335
335
size_t offset = 0 ;
336
336
for (size_t i = 0 ; i < buffers_size.size (); i++) {
337
337
llvm::dbgs () << " Alloc offset: " << offset << ' \n ' ;
338
- reg_cached_tensor (cached_tensor_global_id , base, offset);
339
- global_ids[i] = cached_tensor_global_id ;
340
- ++cached_tensor_global_id ;
341
- offset += divide_and_ceil (buffers_size[i], 64 ) * 64 ;
338
+ regCachedTensor (cachedTensorGlobalId , base, offset);
339
+ global_ids[i] = cachedTensorGlobalId ;
340
+ ++cachedTensorGlobalId ;
341
+ offset += divideAndCeil (buffers_size[i], 64 ) * 64 ;
342
342
}
343
343
return global_ids;
344
344
}
@@ -541,7 +541,7 @@ void CST::runOnOperation() {
541
541
buffersSize.push_back (
542
542
getTensorSize (dyn_cast<TensorType>(tensor.getType ())));
543
543
}
544
- auto manager = const_graph_tensor_cache_manager ::get ();
544
+ auto manager = constGraphTensorCacheManager ::get ();
545
545
SmallVector<int64_t > globalIndexes;
546
546
for (auto id : manager->alloc (buffersSize)) {
547
547
globalIndexes.push_back (id);
0 commit comments