This Question Should Be An Easy One

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: This Question Should Be An Easy One

Post by velmarin »

_mm_popcnt_u64
Visual Studio 2010
Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction popcnt. This instruction calculates the number of bits of the parameter that are set to 1.

int _mm_popcnt_u64 (
unsigned __int64 a
);
http://msdn.microsoft.com/es-es/library/bb531475.aspx

Any programmer will see what makes this statement in your code in a matter of speed.

There are many examples.

But most important is that someone could create a level names for the engines.

Perhaps George, with his strong knowledge and are happy with something.

Cheerss.
User avatar
geots
Posts: 4790
Joined: Sat Mar 11, 2006 12:42 am

Re: This Question Should Be An Easy One

Post by geots »

You see, this is what happens. Louis is extremely smart and you can't find a nicer guy. But he didn't heed my warning and he elaborated. Now he realizes his mistake I warned him about- and he got the hell out of here. I don't blame him, but now my head is left swimming with unanswered questions and I feel one of those damn headaches starting to pound. Damn.

gts
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: This Question Should Be An Easy One

Post by zullil »

The POPCNT instruction simply counts the number of bits that are set to 1 in a binary word. Engines that use bitboards gain a speed benefit from having this instruction available on the cpu. If it isn't available, then the bit counting has to be done as a sequence of instructions, which takes longer.

Other SSE instructions are also beneficial. For example, the prefetch instruction. But I'm not a chess programmer, so I'll leave it here for the experts to elaborate upon.
User avatar
velmarin
Posts: 1600
Joined: Mon Feb 21, 2011 9:48 am

Re: This Question Should Be An Easy One

Post by velmarin »

The POPCNT only count the number of bits how you say,
Just note, this is very important in a motor bitboard.
but do so in a more elaborate, or do it using the instructions in the processor, there is a difference in speed.
The same applies to the instructions _BitScanForward64
they have the first bit, or the reverse, also SSE4 instructions, all give a gain in speed.
Prefetch is important, but I do not think so significant.
User avatar
Mike S.
Posts: 1480
Joined: Thu Mar 09, 2006 5:33 am

Re: This Question Should Be An Easy One

Post by Mike S. »

CPU-Z, combined with some easy Google research as for the CPU POPCNT capabilities, will give you this knowledge. By that, you'd be independant about that and don't have to wait for message board responses whatsoever.

Alternatively, if you tell the CCC about what exactly you CPU is, I am sure people here are quickly capable to tell you if it supports POPCNT or not. I go to sleep now. :mrgreen:
Regards, Mike
User avatar
geots
Posts: 4790
Joined: Sat Mar 11, 2006 12:42 am

Re: This Question Should Be An Easy One

Post by geots »

zullil wrote:The POPCNT instruction simply counts the number of bits that are set to 1 in a binary word. Engines that use bitboards gain a speed benefit from having this instruction available on the cpu. If it isn't available, then the bit counting has to be done as a sequence of instructions, which takes longer.

Other SSE instructions are also beneficial. For example, the prefetch instruction. But I'm not a chess programmer, so I'll leave it here for the experts to elaborate upon.

You are not a programmer? You could have fooled me. :)


Thanks Louis,

george
User avatar
geots
Posts: 4790
Joined: Sat Mar 11, 2006 12:42 am

Re: This Question Should Be An Easy One

Post by geots »

Mike S. wrote:CPU-Z, combined with some easy Google research as for the CPU POPCNT capabilities, will give you this knowledge. By that, you'd be independant about that and don't have to wait for message board responses whatsoever.

Alternatively, if you tell the CCC about what exactly you CPU is, I am sure people here are quickly capable to tell you if it supports POPCNT or not. I go to sleep now. :mrgreen:

Thanks Mike, I am headed in the same direction- snooze.


george
User avatar
geots
Posts: 4790
Joined: Sat Mar 11, 2006 12:42 am

Re: This Question Should Be An Easy One

Post by geots »

velmarin wrote:The POPCNT only count the number of bits how you say,
Just note, this is very important in a motor bitboard.
but do so in a more elaborate, or do it using the instructions in the processor, there is a difference in speed.
The same applies to the instructions _BitScanForward64
they have the first bit, or the reverse, also SSE4 instructions, all give a gain in speed.
Prefetch is important, but I do not think so significant.

Thank you, Jose. You know this stuff well.


Best,

george
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: This Question Should Be An Easy One

Post by zullil »

geots wrote:
zullil wrote:The POPCNT instruction simply counts the number of bits that are set to 1 in a binary word. Engines that use bitboards gain a speed benefit from having this instruction available on the cpu. If it isn't available, then the bit counting has to be done as a sequence of instructions, which takes longer.

Other SSE instructions are also beneficial. For example, the prefetch instruction. But I'm not a chess programmer, so I'll leave it here for the experts to elaborate upon.

You are not a programmer? You could have fooled me. :)


Thanks Louis,

george
No, I'm a mathematics professor. I've written a program that play a legal game of chess, but that hardly makes me a chess programmer. Perhaps some day, after I retire.
User avatar
geots
Posts: 4790
Joined: Sat Mar 11, 2006 12:42 am

ANOTHER RELATED IMPORTANT QUESTION

Post by geots »

If I see an exe that says POPCNT.exe, how can I tell if it is 32 bit or 64bit? if it doesn't say.

AND

If the POPCNT exe loads with no problem and starts playing, does that tell me it works fine on my system, or do I need to watch it for a while?


Thanks,

george