mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
d812222061
commit
58e4076620
|
@ -307,7 +307,7 @@ _vifT __fi void dVifUnpack(const u8* data, bool isFill) {
|
||||||
const u8 upkType = (vif.cmd & 0x1f) | (vif.usn << 5);
|
const u8 upkType = (vif.cmd & 0x1f) | (vif.usn << 5);
|
||||||
const int doMask = isFill? 1 : (vif.cmd & 0x10);
|
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
|
// Performance note: initial code was using u8/u16 field of the struct
|
||||||
// directly. However reading back the data (as u32) in HashBucket.find
|
// directly. However reading back the data (as u32) in HashBucket.find
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
// nVifBlock - Ordered for Hashing; the 'num' and 'upkType' fields are
|
// nVifBlock - Ordered for Hashing; the 'num' and 'upkType' fields are
|
||||||
// used as the hash bucket selector.
|
// used as the hash bucket selector.
|
||||||
union __aligned16 nVifBlock {
|
union nVifBlock {
|
||||||
// Warning: order depends on the newVifDynaRec code
|
// Warning: order depends on the newVifDynaRec code
|
||||||
struct {
|
struct {
|
||||||
u8 num; // [00] Num Field
|
u8 num; // [00] Num Field
|
||||||
|
@ -85,7 +85,8 @@ public:
|
||||||
u32 size = bucket_size( dataPtr );
|
u32 size = bucket_size( dataPtr );
|
||||||
|
|
||||||
// Warning there is an extra +1 due to the empty cell
|
// 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(
|
throw Exception::OutOfMemory(
|
||||||
wxsFormat(L"HashBucket Chain (bucket size=%d)", size+2)
|
wxsFormat(L"HashBucket Chain (bucket size=%d)", size+2)
|
||||||
);
|
);
|
||||||
|
@ -121,7 +122,7 @@ public:
|
||||||
|
|
||||||
// Allocate an empty cell for all buckets
|
// Allocate an empty cell for all buckets
|
||||||
for (auto& bucket : m_bucket) {
|
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(
|
throw Exception::OutOfMemory(
|
||||||
wxsFormat(L"HashBucket Chain (bucket size=%d)", 1)
|
wxsFormat(L"HashBucket Chain (bucket size=%d)", 1)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue