Bonjour tout le monde !
J'utilise en ce moment l'outil VTune pour profiler un code afin de détecter des problèmes "subtils". Dans le cas qui me préoccupe, j'ai un problème de "64K aliasing" qui est décrit ainsi :
Quelques solutions sont aussi données :Case 1: 64K Aliasing caused by code mostly made up of loads. Loads can compete with other loads for a load request buffer. If most of the 64K aliasing events are by code that is almost entirely loads (as opposed to loads intertwined with stores) then the performance impact for this case is rather insignificant.
Recommendation: Move on to other performance issues. Collect data on secondary events for tuning if you have not already done so.
Case 2: 64K Aliasing caused by code with loads mixed with stores. Loads that need a request buffer can get stuck behind a store. The store has to retire and get kicked out of the cache before the load can proceed. If most of the 64K aliasing events are caused by code that has intertwined loads and stores then the performance impact in this situation is significant.
Try doing multiple loads and then multiple stores to avoid the significant penalty.
One way to implement a memory allocator to avoid aliasing is to allocate more than enough space and pad. For example, allocate structures that are 68KB instead of 64KB, or have the allocator pad and return random offsets that are a multiple of 128 bytes.
When declaring multiple arrays that are referenced with the same index and are each a multiple of 64KB, pad them to avoid declaring them contiguously. Padding can be accomplished by either intervening declarations of other variables, or by artificially increasing the dimension of the array.
Voici maintenant mon cas personnel. J'ai une fonction, à qui je passe un pointeur en argument (sur un short*) et qui va réécrire ensuite les données, après traitement, via le même pointeur.
J'ai un problème de 64k aliasing au début du programme, au chargement des données, et à la fin, lors de l'écriture.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 void mafonction(short *src, int alpha, int beta) { int p0 = src[-4]; int p1 = src[-3]; int p2 = src[-2]; int p3 = src[-1]; int p4 = src[0]; int p5 = src[1]; int p6 = src[2]; int p7 = src[3]; /* Un tas de traitements complexes :) */ src[-4] = p0_modif; /* etc. */ }
Il doit exister une façon simple de s'en sortir, mais j'avoue ne pas bien voir...
Merci d'avance de votre réponse !
Partager