Rebel 15.1 problems

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

Moderator: Ras

User avatar
Eelco de Groot
Posts: 4693
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Rebel 15.1 problems

Post by Eelco de Groot »

sarona wrote: Sun Aug 21, 2022 11:28 pm
chessica wrote: Sun Aug 21, 2022 10:31 pm Hello, my CPU has the following Instructions sets: sse, sse2, sse3, sse4a, x86-64
Just curious. Did you compile the binary yourself from source? If so, did you use Visual Studio?

I recall seeing a thread from Eelco on Ed's forum where somebody encountered the same error - except this was during a compilation of Toga and not running Rebel from the commandline. It might be totally unrelated, but I thought I would mention it.

"Error C2664 'HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE)': cannot convert argument 1 from 'wchar_t [1024]' to 'LPCSTR' 1Toga D:\Downloads\1Toga\useful.cpp 170 " when trying to compile rebel or toga 4, before and after following post instructions

https://prodeo.actieforum.com/t705-not- ... tudio-2022
Hi All,

Yes, Ron is correct, that is very probably the same error, maybe it is the only one so if someone can fix it Rebel 15.1 can be compiled without any detours back to Fruit in Visual Studio 2022. That is my version, it is not the very latest update I will try later with an upgrade. I think Chris is saying above that you can try with an older version of Microsoft Visual Studio, I think Ed also still has the 2017 one? See the thread for details. But I can make Rebel 15.1 by taking the solution Ed provided with Fruit Rebel, replace everything that changed going from Fruit to Toga, it is a bit of a jigsaw puzzle but you learn something about the differences, the evolution of Fruit in the process too. I convert all the line endings back to Unix but that is not essential. Visual Studio 2022 will now compile after retargeting the solution. Make sure to use Ed's settings.

I feel like a bit of a caveman 'programmer' here and it may break with a new compiler update, but with Visual Studio 2022 it is at least guaranteed to work with the help of Ed and Chris :mrgreen:

At the moment my version is not the default so I would have to convert some search.cpp changes back again if I posted my version, but it is possible to make your own now. The sources will make an SSE version, not the faster version, but it is not very hard to change that for a more modern computer, I changed that in my version and that will probably be posted later or ask Ed or in the forum how to do it.
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
chrisw
Posts: 4749
Joined: Tue Apr 03, 2012 4:28 pm
Location: Midi-Pyrénées
Full name: Christopher Whittington

Re: Rebel 15.1 problems

Post by chrisw »

Eelco de Groot wrote: Mon Aug 22, 2022 7:45 am
sarona wrote: Sun Aug 21, 2022 11:28 pm
chessica wrote: Sun Aug 21, 2022 10:31 pm Hello, my CPU has the following Instructions sets: sse, sse2, sse3, sse4a, x86-64
Just curious. Did you compile the binary yourself from source? If so, did you use Visual Studio?

I recall seeing a thread from Eelco on Ed's forum where somebody encountered the same error - except this was during a compilation of Toga and not running Rebel from the commandline. It might be totally unrelated, but I thought I would mention it.

"Error C2664 'HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE)': cannot convert argument 1 from 'wchar_t [1024]' to 'LPCSTR' 1Toga D:\Downloads\1Toga\useful.cpp 170 " when trying to compile rebel or toga 4, before and after following post instructions

https://prodeo.actieforum.com/t705-not- ... tudio-2022
Hi All,

Yes, Ron is correct, that is very probably the same error, maybe it is the only one so if someone can fix it Rebel 15.1 can be compiled without any detours back to Fruit in Visual Studio 2022. That is my version, it is not the very latest update I will try later with an upgrade. I think Chris is saying above that you can try with an older version of Microsoft Visual Studio, I think Ed also still has the 2017 one?

Nope. A newer version of c++ (this can be set in project settings).

Possibly the code can just be junked. I think it’s legacy code for loading NN data from file, but now the engine carries the NN as part of the executable.


See the thread for details. But I can make Rebel 15.1 by taking the solution Ed provided with Fruit Rebel, replace everything that changed going from Fruit to Toga, it is a bit of a jigsaw puzzle but you learn something about the differences, the evolution of Fruit in the process too. I convert all the line endings back to Unix but that is not essential. Visual Studio 2022 will now compile after retargeting the solution. Make sure to use Ed's settings.

I feel like a bit of a caveman 'programmer' here and it may break with a new compiler update, but with Visual Studio 2022 it is at least guaranteed to work with the help of Ed and Chris :mrgreen:

At the moment my version is not the default so I would have to convert some search.cpp changes back again if I posted my version, but it is possible to make your own now. The sources will make an SSE version, not the faster version, but it is not very hard to change that for a more modern computer, I changed that in my version and that will probably be posted later or ask Ed or in the forum how to do it.
chessica
Posts: 1004
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Rebel 15.1 problems

Post by chessica »

Thanks for the tip. After that I tried to compile the sources again. Everything goes well
up to the point: "useful.cpp". Attached are the error messages:

15.1\useful.cpp(174,7): error C2664: "HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE)" : Konvertierung von Argument 1 von "wchar_t [1024]" in "LPCSTR" nicht möglich

15.1\useful.cpp(174,18): message : Die Typen, auf die verwiesen wird, sind unabhängig; die Konvertierung erfordert eine reinterpret_cast-Umwandlung, eine C-Stil-Umwandlung oder eine in Klammern gesetzte Umwandlung im Funktionsstil.

1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.20348.0\um\fileapi.h(79,1): message : Siehe Deklaration von "CreateFileA"
chessica
Posts: 1004
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Rebel 15.1 problems

Post by chessica »

Rebel wrote: Sun Aug 21, 2022 11:07 pm Maybe re-download the engine?
I have also tried this without success.
User avatar
Rebel
Posts: 7435
Joined: Thu Aug 18, 2011 12:04 pm
Full name: Ed Schröder

Re: Rebel 15.1 problems

Post by Rebel »

chessica wrote: Mon Aug 22, 2022 10:26 am
Rebel wrote: Sun Aug 21, 2022 11:07 pm Maybe re-download the engine?
I have also tried this without success.
I remember something. Since you are using SSE, did you switch from AXV2 to SSE?

In SIMD.CPP and SIMD.H you fiind:

#define USE_SSE false
#define USE_AVX2 true

Make USE_SSE true and USE_AVX2 false.
90% of coding is debugging, the other 10% is writing bugs.
User avatar
Eelco de Groot
Posts: 4693
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Rebel 15.1 problems

Post by Eelco de Groot »

Chris says it is legacy code So I just comment out the get_file_size function in useful.cpp:

Code: Select all

/*
u32 get_file_size(char* file)
{
	assert(file != NULL);

	HANDLE fh;
	LARGE_INTEGER  size;

	size_t pReturnValue;
	wchar_t wcstr[1024];
	size_t sizeInWords = 512;
	size_t count = 512;
	errno_t err;

	err = mbstowcs_s(&pReturnValue, wcstr, sizeInWords, file, count);

	fh = CreateFile(wcstr, GENERIC_READ, 0, NULL, OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL, NULL);
	if (!GetFileSizeEx(fh, &size)) {
		return FILE_SIZE_ERROR;
	}
	CloseHandle(fh);

	return (u32)size.QuadPart;
}

*/
So far it does not seem to hurt Ed :)


Build started...
1>------ Build started: Project: fruitig, Configuration: Release x64 ------
1>useful.cpp
1>fruitig.vcxproj -> C:\Users\Gebruiker\Downloads\Rebel-15.1-Master Fruitig version\Rebel-14.1-Master\fruitig\x64\Release\fruitig.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


But this is using your fruitig.sln useful.cpp ended up in a different place

Image

But it is still needed for compilation, I can not give useful.cpp some different extension. But the specific function might not be needed at all. The source code you gave already specified a SSE build so that did not have to change anymore.
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
chessica
Posts: 1004
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Rebel 15.1 problems

Post by chessica »

Part 1:
I commented out this section. After that the compilation was successful.
The EXE was generated. So far ok.

Part 2:

As shown in the attachment, this does not fix the program crash when
the calculation starts.





Rebel 15.1 UCI by Fabien Letouzey, Thomas Gaksch, Jerry Donald Watson, Chris Whittington and Ed Schroder
uci
id name Rebel 15.1
id author Fabien Letouzey, Thomas Gaksch, Jerry Donald Watson, Chris Whittington and Ed Schroder
option name Hash type spin default 128 min 4 max 16384
option name NNUE Tuner type spin default 60 min 25 max 200
option name IRR type spin default 6 min 2 max 10
option name Eval-Depth type spin default 6 min 2 max 10
option name Eval-Margin type spin default 75 min 10 max 200
option name Search Time type spin default 0 min 0 max 3600
option name Search Depth type spin default 0 min 0 max 20
option name Ponder type check default false
option name OwnBook type check default true
option name BookFile type string default performance.bin
option name MultiPV type spin default 1 min 1 max 10
option name NullMove Pruning type combo default Always var Always var Fail High var Never
option name NullMove Reduction type spin default 3 min 1 max 4
option name Razoring type check default true
option name Razoring Depth type spin default 4 min 0 max 6
option name Razoring Margin type spin default 300 min 0 max 1000
option name Razoring Decay type spin default 39 min 0 max 100
option name Evaluation Pruning type check default true
option name Evaluation Pruning Depth type spin default 5 min 0 max 6
option name History Pruning type check default true
option name History Threshold type spin default 70 min 0 max 100
option name Delta Pruning type check default true
option name Delta Margin type spin default 200 min 0 max 999
option name Quiescence Check Plies type spin default 1 min 0 max 2
option name Material type spin default 100 min 0 max 400
option name Piece Activity type spin default 100 min 0 max 400
option name Piece Square Activity type spin default 100 min 0 max 400
option name King Safety type spin default 100 min 0 max 400
option name Pawn Structure type spin default 100 min 0 max 400
option name Passed Pawns type spin default 100 min 0 max 400
option name Toga Lazy Eval type check default true
option name Toga Lazy Eval Margin type spin default 200 min 0 max 900
option name Toga Lazy Eval Mobility Margin type spin default 125 min 0 max 900
option name Toga King Pawn Endgame Bonus type spin default 30 min 0 max 100
option name Toga Rook Pawn Endgame Penalty type spin default 10 min 0 max 100
option name Threads type spin default 1 min 1 max 64
uciok
isready
readyok
ucinewgame
isready
readyok
position fen N6k/8/8/8/8/8/8/K6B w - - 0 1
go infinite
info depth 1


Image error: https://ibb.co/CQrcbwV

If i debnugging, then i get this:

#elif (USE_SSE)
int i;
int n_iterations = n_values/8;

int128 *pi = (int128*)input;
int128 *po = (int128*)output;

int128 c0 = _mm_set1_epi16(0);

for (i=0; i < n_iterations/2; i++)
{
int128 v1 = _mm_load_si128(pi++);
int128 v2 = _mm_load_si128(pi++);
int128 v8 = _mm_packs_epi16(v1, v2);
int128 s = _mm_max_epi8(v8, c0);
_mm_store_si128(po++, s);
}
#else
User avatar
Eelco de Groot
Posts: 4693
Joined: Sun Mar 12, 2006 2:40 am
Full name:   Eelco de Groot

Re: Rebel 15.1 problems

Post by Eelco de Groot »

Hi, Shredder GUI says "Ongeldige kleur aan zet" Here my own fruitig.exe immediately crashes with this FEN

So that is just as expected, but I do not get any error code like you do.

This does not crash here at least:

Rebel 15.1 UCI by Fabien Letouzey, Thomas Gaksch, Jerry Donald Watson, Chris Whittington and Ed Schroder
uci
id name Rebel 15.1
id author Fabien Letouzey, Thomas Gaksch, Jerry Donald Watson, Chris Whittington and Ed Schroder
option name Hash type spin default 128 min 4 max 16384
option name NNUE Tuner type spin default 60 min 25 max 200
option name IRR type spin default 6 min 2 max 10
option name Eval-Depth type spin default 6 min 2 max 10
option name Eval-Margin type spin default 75 min 10 max 200
option name Search Time type spin default 0 min 0 max 3600
option name Search Depth type spin default 0 min 0 max 20
option name Ponder type check default false
option name OwnBook type check default true
option name BookFile type string default performance.bin
option name MultiPV type spin default 1 min 1 max 10
option name NullMove Pruning type combo default Always var Always var Fail High var Never
option name NullMove Reduction type spin default 3 min 1 max 4
option name Razoring type check default true
option name Razoring Depth type spin default 4 min 0 max 6
option name Razoring Margin type spin default 300 min 0 max 1000
option name Razoring Decay type spin default 39 min 0 max 100
option name Evaluation Pruning type check default true
option name Evaluation Pruning Depth type spin default 5 min 0 max 6
option name History Pruning type check default true
option name History Threshold type spin default 70 min 0 max 100
option name Delta Pruning type check default true
option name Delta Margin type spin default 200 min 0 max 999
option name Quiescence Check Plies type spin default 1 min 0 max 2
option name Material type spin default 100 min 0 max 400
option name Piece Activity type spin default 100 min 0 max 400
option name Piece Square Activity type spin default 100 min 0 max 400
option name King Safety type spin default 100 min 0 max 400
option name Pawn Structure type spin default 100 min 0 max 400
option name Passed Pawns type spin default 100 min 0 max 400
option name Toga Lazy Eval type check default true
option name Toga Lazy Eval Margin type spin default 200 min 0 max 900
option name Toga Lazy Eval Mobility Margin type spin default 125 min 0 max 900
option name Toga King Pawn Endgame Bonus type spin default 30 min 0 max 100
option name Toga Rook Pawn Endgame Penalty type spin default 10 min 0 max 100
option name Threads type spin default 1 min 1 max 64
uciok
position fen N6k/8/8/8/8/8/8/K6B w - -


However if I try again Shredder does now accept the FEN you gave, and so does fruitig.exe so the FEN does not appear to be the problem. I also get output after giving 'go depth 40'

At the moment I am here but the output seems to be stalling a bit:

info depth 29 seldepth 43 time 70562 nodes 94960324 nps 1345771
info depth 30
info currmove a1b2 currmovenumber 1
info time 71015 nodes 95570000 nps 1345772 cpuload 1000
info hashfull 586
info time 72015 nodes 96980000 nps 1346664 cpuload 1000
info hashfull 589
info time 73015 nodes 98400000 nps 1347668 cpuload 1000
info hashfull 592
info time 74015 nodes 99810000 nps 1348510 cpuload 1000
info hashfull 599
info time 75015 nodes 101240000 nps 1349597 cpuload 1000
info hashfull 607
info time 76015 nodes 102680000 nps 1350786 cpuload 1000
info hashfull 616
info time 77015 nodes 104090000 nps 1351555 cpuload 1000
info hashfull 628
info time 78015 nodes 105270000 nps 1349356 cpuload 1000
info hashfull 632

No more output for a while....



but this is a modified Rebel and also AVX2 Your code seems SSE code only and it crashes (in a KBNK endgame)

Does it crash right away?


The code crash seems to be in simd.cpp that is all I can say from here. Maybe Ed can shed some light on the matter?
Debugging is twice as hard as writing the code in the first
place. Therefore, if you write the code as cleverly as possible, you
are, by definition, not smart enough to debug it.
-- Brian W. Kernighan
chessica
Posts: 1004
Joined: Thu Aug 11, 2022 11:30 pm
Full name: Esmeralda Pinto

Re: Rebel 15.1 problems

Post by chessica »

Eelco de Groot wrote: Mon Aug 22, 2022 2:27 pm


but this is a modified Rebel and also AVX2 Your code seems SSE code only and it crashes (in a KBNK endgame)

Does it crash right away?


The code crash seems to be in simd.cpp that is all I can say from here. Maybe Ed can shed some light on the matter?
No it crashes also from the start position.
Chessqueen
Posts: 5685
Joined: Wed Sep 05, 2018 2:16 am
Location: Moving
Full name: Jorge Picado

Re: Rebel 15.1 problems

Post by Chessqueen »

Eelco de Groot wrote: Mon Aug 22, 2022 7:45 am
sarona wrote: Sun Aug 21, 2022 11:28 pm
chessica wrote: Sun Aug 21, 2022 10:31 pm Hello, my CPU has the following Instructions sets: sse, sse2, sse3, sse4a, x86-64
Just curious. Did you compile the binary yourself from source? If so, did you use Visual Studio?

I recall seeing a thread from Eelco on Ed's forum where somebody encountered the same error - except this was during a compilation of Toga and not running Rebel from the commandline. It might be totally unrelated, but I thought I would mention it.

"Error C2664 'HANDLE CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE)': cannot convert argument 1 from 'wchar_t [1024]' to 'LPCSTR' 1Toga D:\Downloads\1Toga\useful.cpp 170 " when trying to compile rebel or toga 4, before and after following post instructions

https://prodeo.actieforum.com/t705-not- ... tudio-2022
Hi All,

Yes, Ron is correct, that is very probably the same error, maybe it is the only one so if someone can fix it Rebel 15.1 can be compiled without any detours back to Fruit in Visual Studio 2022. That is my version, it is not the very latest update I will try later with an upgrade. I think Chris is saying above that you can try with an older version of Microsoft Visual Studio, I think Ed also still has the 2017 one? See the thread for details. But I can make Rebel 15.1 by taking the solution Ed provided with Fruit Rebel, replace everything that changed going from Fruit to Toga, it is a bit of a jigsaw puzzle but you learn something about the differences, the evolution of Fruit in the process too. I convert all the line endings back to Unix but that is not essential. Visual Studio 2022 will now compile after retargeting the solution. Make sure to use Ed's settings.

I feel like a bit of a caveman 'programmer' here and it may break with a new compiler update, but with Visual Studio 2022 it is at least guaranteed to work with the help of Ed and Chris :mrgreen:

At the moment my version is not the default so I would have to convert some search.cpp changes back again if I posted my version, but it is possible to make your own now. The sources will make an SSE version, not the faster version, but it is not very hard to change that for a more modern computer, I changed that in my version and that will probably be posted later or ask Ed or in the forum how to do it.
Why Rebel 15.1 modified to work as AVX2 does NOT Work ?