htyu wrote:

> @htyu Pretty much a drive-by question if it's convenient for you to share 
> more, how ranges are selected out of sampled values? For example, are ranges 
> the same for all workloads or dynamically generated based on the distribution 
> of size from the per-workload profile data?

We group sampled values by ranges pretty much based on the current 
`folly::memcpy` implementation:

  ```
  0 
  1 
  [2,3] 
  [4,7] 
  [8,16] 
  [17,32] 
  [33,64] 
  [65,128] 
  [129,inf] 
  ```

Values in a range share the same memcpy code, i.e, a pair of forward and 
backward copies. 

The range layout is fixed and hardcoded in LLVM. The compiler can choose to 
prioritize a specific range based on the value profile it sees. The profile is 
just like a LBR profile which is collected per service. 

So at compile time we may have such transformation:

    memcpy(src, dst, size)

=> 

```
   if (33 <= size <= 64)
      vmovups  (%rsi), %ymm0
      vmovups  -32(%rsi,%rdx), %ymm1
      vmovups  %ymm0, (%rdi)
      vmovups  %ymm1, -32(%rdi,%rdx)
   else
     call memcpy(src, dst, size)
```




https://github.com/llvm/llvm-project/pull/66825
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to