[Lucene] confusion in posting encoding

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lucene] confusion in posting encoding

陆徐刚
Hi Adrien,

I have some confusion about the method collapse8(long[ ] arr) in ForUtil class




On line 85, the loop times are 16, because there are 128 elements in arr, and eight elements were processed at a time.

My question is why not choose the elements in order , like in the first loop, arr[0] ~ arr[7] were chosen, in the second loop,  arr[8] ~ arr[15] were chosen … 

Is it cause the compiler cann’t generate SIMD instructions or just something else?

Could you help me find the answer here?
Reply | Threaded
Open this post in threaded view
|

Re: [Lucene] confusion in posting encoding

Adrien Grand
Hello,

It is indeed because I could get the compiler to use SIMD instructions with the loop written this way.

On Wed, Jan 13, 2021 at 11:29 AM LuXugang <[hidden email]> wrote:
Hi Adrien,

I have some confusion about the method collapse8(long[ ] arr) in ForUtil class




On line 85, the loop times are 16, because there are 128 elements in arr, and eight elements were processed at a time.

My question is why not choose the elements in order , like in the first loop, arr[0] ~ arr[7] were chosen, in the second loop,  arr[8] ~ arr[15] were chosen … 

Is it cause the compiler cann’t generate SIMD instructions or just something else?

Could you help me find the answer here?


--
Adrien
Reply | Threaded
Open this post in threaded view
|

Re: [Lucene] confusion in posting encoding

陆徐刚
Thanks for your answer, Adrien.

2021年1月13日 下午9:26,Adrien Grand <[hidden email]> 写道:

Hello,

It is indeed because I could get the compiler to use SIMD instructions with the loop written this way.

On Wed, Jan 13, 2021 at 11:29 AM LuXugang <[hidden email]> wrote:
Hi Adrien,

I have some confusion about the method collapse8(long[ ] arr) in ForUtil class

<粘贴的图形-1.png>


On line 85, the loop times are 16, because there are 128 elements in arr, and eight elements were processed at a time.

My question is why not choose the elements in order , like in the first loop, arr[0] ~ arr[7] were chosen, in the second loop,  arr[8] ~ arr[15] were chosen … 

Is it cause the compiler cann’t generate SIMD instructions or just something else?

Could you help me find the answer here?


--
Adrien