Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Passing some memory boundary values to 'prefetcht*' instructions

SergeyKostrov
Valued Contributor II
1,873 Views
What happens if some memory boundary values, like 0x00000000 or 0xFFFFFFFF, are passed to 'prefetcht*' instructions on a 32-bit platform?

Here is an example:

...
_mm_prefetch( 0xFFFFFFFF, _MM_HINT_T0);
...

Best regards,
Sergey
0 Kudos
1 Solution
Patrick_F_Intel1
Employee
1,873 Views
Hello Sergey,
Sorry for the delay.

The prefetch* instructions will not raise an exception for an invalid address but there will be a slight performance penalty.
The penalty varies on existing processors, but it derives from the need to walk the page tables in order to determine that a given address is invalid.
Note that SDM instruction set reference does not list the #PF (invalid address) exception for the prefetch* instructions indicating that this instruction doesn't raise the #PF exception.

I hope this helps,
Pat

View solution in original post

0 Kudos
6 Replies
Patrick_F_Intel1
Employee
1,873 Views
Hello Sergey,
I did a quick test on 64bit windows platform andthe exceptions don't getdelivered back to my program.
I did a loop of:
xor rax,rax
prefetcht0 [rax]

I think the exceptions get squished (not delivered back to the app) but there is a penalty.
The performance seems to be about equal to a trip to memory per reference on my "processor formerly codenamed Westmere"-based laptop.
I will check with others after the holidays.
Pat
0 Kudos
SergeyKostrov
Valued Contributor II
1,873 Views
...
I will check with others after the holidays.
Pat


Thank you, Patrick, and Merry Christmas!

PS: It would be good to see more technical details later...

0 Kudos
Patrick_F_Intel1
Employee
1,873 Views

Merry Christmas and happy holidays to you too!

0 Kudos
SergeyKostrov
Valued Contributor II
1,873 Views
>>xor rax,rax
>>prefetcht0 [rax]
>>
>>I think the exceptions get squished (not delivered back to the app) but there is a penalty.

Hi Patrick, I simply would like to follow up. You mentioned some exceptions. Do you mean
some internal CPU exceptions, or some exceptions from anoperating system?

Could provide a little bit more technicaldetails, please?

Best regards,
Sergey
0 Kudos
Patrick_F_Intel1
Employee
1,874 Views
Hello Sergey,
Sorry for the delay.

The prefetch* instructions will not raise an exception for an invalid address but there will be a slight performance penalty.
The penalty varies on existing processors, but it derives from the need to walk the page tables in order to determine that a given address is invalid.
Note that SDM instruction set reference does not list the #PF (invalid address) exception for the prefetch* instructions indicating that this instruction doesn't raise the #PF exception.

I hope this helps,
Pat
0 Kudos
k_sarnath
Beginner
1,873 Views
Just to add:

This is because an invalid address will not be present in the TLB(Supfast bufferfor Vto P translation).
So, the TLB miss will cause the page-table walk and hence the penalty..
0 Kudos
Reply