64 bit compiling again!

Discussion of chess software programming and technical issues.

Moderator: Ras

Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

64 bit compiling again!

Post by Edsel Apostol »

To the 64 bit compiling experts, I have a few questions.

I am using this in my engine:

Code: Select all

/* some basic definitions */
typedef unsigned long long u64;
typedef unsigned int u32;
typedef unsigned short u16;
typedef unsigned char u8;
typedef signed long long s64;
typedef signed int s32;
typedef signed short s16;
typedef signed char s8;

#if defined(_WIN64) || defined(_LP64)
    #define VERSION64BIT
#endif

#if defined(VERSION64BIT)
// 64 bit code here
#else
// 32 bit code here
#endif
It compiles fine but it crashes on XP64 bit running on an Athlon X2. It often crashes in the middle of search. What could be the source of the problem? Is there anything I need to add or change in the above code to make it work?

By the way, I'm using ICC 10.1.020 integrated with VS 2005.
trojanfoe

Re: 64 bit compiling again!

Post by trojanfoe »

The types look OK to me, but you might want to typedef u64 to 'unsigned __int64' on Windows platforms and 'unsigned long long' on Linux/Unix platforms. This isn't your problem though, it's just these are the correct 64-bit types for the MS/Intel compilers.

Your problem lies elsewhere I think... Why not run a debug build inside the debugger to find out where the crash is occuring?

Cheers,
Andy
Tony

Re: 64 bit compiling again!

Post by Tony »

I can only guess some SSE2 or 3 optimizations.

Tony
User avatar
Jim Ablett
Posts: 2186
Joined: Fri Jul 14, 2006 7:56 am
Location: London, England
Full name: Jim Ablett

Re: 64 bit compiling again!

Post by Jim Ablett »

If it compiles ok, I usually look for optimization problems first.

Compile only with /G7 /Os /Ob0 /Qunroll /MT

If that works, compile only with /G7 /Os /Ob1 /Qunroll /MT and inline manually

If that works, compile only with /G7 /Os /Ob2 /Qunroll /MT

Jim.
User avatar
Bo Persson
Posts: 259
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: 64 bit compiling again!

Post by Bo Persson »

trojanfoe wrote:The types look OK to me, but you might want to typedef u64 to 'unsigned __int64' on Windows platforms and 'unsigned long long' on Linux/Unix platforms. This isn't your problem though, it's just these are the correct 64-bit types for the MS/Intel compilers.
They can do long long as well, so that's really not a problem.
trojanfoe wrote:Your problem lies elsewhere I think... Why not run a debug build inside the debugger to find out where the crash is occuring?
Agreed.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: 64 bit compiling again!

Post by bob »

Bo Persson wrote:
trojanfoe wrote:The types look OK to me, but you might want to typedef u64 to 'unsigned __int64' on Windows platforms and 'unsigned long long' on Linux/Unix platforms. This isn't your problem though, it's just these are the correct 64-bit types for the MS/Intel compilers.
They can do long long as well, so that's really not a problem.
trojanfoe wrote:Your problem lies elsewhere I think... Why not run a debug build inside the debugger to find out where the crash is occuring?
Agreed.
Windows does "long long" now? For the longest they did not and I resorted to #ifdef's to solve that.
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: 64 bit compiling again!

Post by Edsel Apostol »

Hi Andy,

Windows seems to support "long long" now.

I could easily solve the problem if I have a 64 bit OS. What I did is that I compiled it with PGO, send it to my tester with 64 bit OS, then my tester sends it back to me together with the PGO files and then I recompiled it with optimizations.

The DEBUG enabled build I have sent him doesn't even produce any errors on the error file and dump file I used for debugging. It just crashed. It didn't happen immediately, it happens after somewhere on the 10th time it searched.
Edsel Apostol
Posts: 803
Joined: Mon Jul 17, 2006 5:53 am
Full name: Edsel Apostol

Re: 64 bit compiling again!

Post by Edsel Apostol »

Hi Jim,

This are the only compiling flags I've used:

Code: Select all

/O3 /Qprof-gen

/O3 /Qprof-use
They seem to be faster than any compiling flags I've used anyway in my 32bit build. I don't know why. My engine is bitboards. Maybe my code is well optimized already.
trojanfoe

Re: 64 bit compiling again!

Post by trojanfoe »

Edsel Apostol wrote:Hi Andy,

Windows seems to support "long long" now.

I could easily solve the problem if I have a 64 bit OS. What I did is that I compiled it with PGO, send it to my tester with 64 bit OS, then my tester sends it back to me together with the PGO files and then I recompiled it with optimizations.

The DEBUG enabled build I have sent him doesn't even produce any errors on the error file and dump file I used for debugging. It just crashed. It didn't happen immediately, it happens after somewhere on the
10th time it searched.
Yeah that could be a bit of a problem. I remember using CrashFinder (http://www.wintellect.com/cs/DasBlogCon ... der2.5.zip) to find where production builds were crashing, assuming you keep the .PDB file as well as the .EXE from your release builds, but I doubt you'd be able to use it from a 32-bit OS on a 64-bit EXE. You could try compiling CrashFinder for 64-bit and letting your tester give you the information. If you go down this path I would recommend you reherse a crash in a 32-bit test program (deference NULL is always a favourite) so you can direct the tester how to use it to get the results you need.

Best option though, is for you to use a 64-bit OS yourself.

Cheers,
Andy
User avatar
beachknight
Posts: 3533
Joined: Tue Jan 09, 2007 8:33 pm
Location: Antalya, Turkey

Re: 64 bit compiling again!

Post by beachknight »

Edsel Apostol wrote:Hi Andy,

[...]

It just crashed. It didn't happen immediately, it happens after somewhere on the 10th time it searched.
Hi Edsel,

I can also confirm that TL_x64 crashes at around move 10
in almost each run.

After you solve this crash issue, I'd like getting that x64 compile
for my tests.

best,
hi, merhaba, hallo HT