vif: update alignment constraint

16B alignment is now useless for nVifBlock (no more SSE)
However update the alignment of bucket to 64B. It will reduce cache miss
probability in the find loop
This commit is contained in:
Gregory Hainaut 2016-12-18 22:51:23 +01:00
parent d812222061
commit 58e4076620
2 changed files with 5 additions and 4 deletions

View File

@ -307,7 +307,7 @@ _vifT __fi void dVifUnpack(const u8* data, bool isFill) {
const u8 upkType = (vif.cmd & 0x1f) | (vif.usn << 5);
const int doMask = isFill? 1 : (vif.cmd & 0x10);
__aligned16 nVifBlock block;
nVifBlock block;
// Performance note: initial code was using u8/u16 field of the struct
// directly. However reading back the data (as u32) in HashBucket.find

View File

@ -19,7 +19,7 @@
// nVifBlock - Ordered for Hashing; the 'num' and 'upkType' fields are
// used as the hash bucket selector.
union __aligned16 nVifBlock {
union nVifBlock {
// Warning: order depends on the newVifDynaRec code
struct {
u8 num; // [00] Num Field
@ -85,7 +85,8 @@ public:
u32 size = bucket_size( dataPtr );
// Warning there is an extra +1 due to the empty cell
if( (m_bucket[b] = (nVifBlock*)pcsx2_aligned_realloc( m_bucket[b], sizeof(nVifBlock)*(size+2), 16, sizeof(nVifBlock)*(size+1) )) == NULL ) {
// Performance note: 64B align to reduce cache miss penalty in `find`
if( (m_bucket[b] = (nVifBlock*)pcsx2_aligned_realloc( m_bucket[b], sizeof(nVifBlock)*(size+2), 64, sizeof(nVifBlock)*(size+1) )) == NULL ) {
throw Exception::OutOfMemory(
wxsFormat(L"HashBucket Chain (bucket size=%d)", size+2)
);
@ -121,7 +122,7 @@ public:
// Allocate an empty cell for all buckets
for (auto& bucket : m_bucket) {
if( (bucket = (nVifBlock*)_aligned_malloc( sizeof(nVifBlock), 16 )) == nullptr ) {
if( (bucket = (nVifBlock*)_aligned_malloc( sizeof(nVifBlock), 64 )) == nullptr ) {
throw Exception::OutOfMemory(
wxsFormat(L"HashBucket Chain (bucket size=%d)", 1)
);