intel / intel/graph-compiler

why allocation scope is introduced ?

Open
#430 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
54
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hi,
I looked into https://github.com/intel/graph-compiler/blob/ef3d150ad591dc9ff3c86686341c2e7ce007695d/docs/memref_schedule.md and understood how allocator works.

But i don't understand why allocation scope is introduced.
Here is dupmed IR,
```
func.func @nested_forall(%arg0: memref<2xf32>) attributes {__mergealloc_scope = 94435173533712 : i64} {
%c0 = arith.constant 0 : index
%c2 = arith.constant 2 : index
%c4 = arith.constant 4 : index
%c16 = arith.constant 16 : index
%alloc = memref.alloc() {__mergealloc_lifetime = array} : memref<2xf32>
memref.copy %arg0, %alloc : memref<2xf32> to memref<2xf32>
scf.forall (%arg1) = (%c0) to (%c16) step (%c2) {
%alloc_0 = memref.alloc() {__mergealloc_lifetime = array} : memref<4xf32>
%alloc_1 = memref.alloc() {__mergealloc_lifetime = array} : memref<8xf32>
scf.forall (%arg2) in (%c4) {
"test.source"(%alloc) : (memref<2xf32>) -> ()
"test.source"(%alloc_1) : (memref<8xf32>) -> ()
%alloc_2 = memref.alloc() {__mergealloc_lifetime = array} : memref<16xf32>
"test.source"(%alloc_2) : (memref<16xf32>) -> ()
} {__mergealloc_scope = 94435173605248 : i64}
"test.source"(%alloc) : (memref<2xf32>) -> ()
"test.source"(%alloc_0) : (memref<4xf32>) -> ()
} {__mergealloc_scope = 94435173478560 : i64}
return
}
```
there are 3 allocation scopes.

However, there is only 1 physical memory.
so i expect there is only 1 memref.alloc op in the whole IR.
is it reasonable?

Hope some one can help me out.
Thank you very Much!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.