Mike Sherwin wrote: ↑Wed Dec 08, 2021 5:25 pm
Thanks guys! I have gotten it down to only two errors. Those should go away when the bit scans are replaced by __builtin_clzll(bb). But I suspect the compiler took an early out. There are probably many more errors to find. As far as Whole Program Optimization it works now under 2022 and produces a slightly faster executable. Microsoft fixed my bug, lol. Really sorry to see 20% slower performance for Colossus.
You should take a look at the new C++20 <bit> header - std::countl_zero and std::countr_zero instead of the builtin functions are the way to go.
Mike Sherwin wrote: ↑Wed Dec 08, 2021 5:25 pm
Thanks guys! I have gotten it down to only two errors. Those should go away when the bit scans are replaced by __builtin_clzll(bb). But I suspect the compiler took an early out. There are probably many more errors to find. As far as Whole Program Optimization it works now under 2022 and produces a slightly faster executable. Microsoft fixed my bug, lol. Really sorry to see 20% slower performance for Colossus.
You should take a look at the new C++20 <bit> header - std::countl_zero and std::countr_zero instead of the builtin functions are the way to go.
Chessnut1071 wrote: ↑Wed Dec 08, 2021 2:50 pm
????? How did you get bit scan forward working in C#, or, were you using C++? I too am disappointed in VS2022, Perhaps we should all tell Microsoft what we need and ask them to revise immediately, if not sooner.
Bill, what's the disconnect here? We've provided an answer multiple times. Use System.Numerics.BitOperations in .NET 5 or 6. Have you tried that? Do you receive a specific error message?
Mike Sherwin wrote: ↑Tue Dec 07, 2021 4:52 am
Today I downloaded MSVC 2022 and enabled the clang option. I wrote a little first program just to see if it will work for me. It ran just fine despite the compiler giving 3 diagnostic errors. I really don't want my code littered with false errors. I'm wondering just how many of these type idiosyncrasies there would be in a fully developed chess engine? However, from what I've seen it appears that clang produces faster executables. And that would be compelling if it were not for non chess engine examples running just slightly slower than standard MSVC in many cases. But, also Mar (and I think Gerd) said that clang understands my SISSY bitboard code much better than other top compilers which can make a sizeable difference in n/s. When Bricabrac was compiled with clang there were 1193 actual errors and it would not compile. So where does this leave me? idk, please help!
Side note: In MSVC 2019 I had to turn off Whole Program Optimization because every so many games it would flake out and become buggy. In MSVC 2022 Whole Program Optimization works just fine.
I also tried VS2022 recently, hoping that the Clang compiler might be a quick win.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one
YMMV!
Just having a look at this now.. What's a good set of optimise-for-speed flags for clang? Can I do PGO like I do with MSVC?
Mike Sherwin wrote: ↑Tue Dec 07, 2021 4:52 am
Today I downloaded MSVC 2022 and enabled the clang option. I wrote a little first program just to see if it will work for me. It ran just fine despite the compiler giving 3 diagnostic errors. I really don't want my code littered with false errors. I'm wondering just how many of these type idiosyncrasies there would be in a fully developed chess engine? However, from what I've seen it appears that clang produces faster executables. And that would be compelling if it were not for non chess engine examples running just slightly slower than standard MSVC in many cases. But, also Mar (and I think Gerd) said that clang understands my SISSY bitboard code much better than other top compilers which can make a sizeable difference in n/s. When Bricabrac was compiled with clang there were 1193 actual errors and it would not compile. So where does this leave me? idk, please help!
Side note: In MSVC 2019 I had to turn off Whole Program Optimization because every so many games it would flake out and become buggy. In MSVC 2022 Whole Program Optimization works just fine.
I also tried VS2022 recently, hoping that the Clang compiler might be a quick win.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one
YMMV!
Just having a look at this now.. What's a good set of optimise-for-speed flags for clang? Can I do PGO like I do with MSVC?
Yes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast code clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
Mike Sherwin wrote: ↑Tue Dec 07, 2021 4:52 am
Today I downloaded MSVC 2022 and enabled the clang option. I wrote a little first program just to see if it will work for me. It ran just fine despite the compiler giving 3 diagnostic errors. I really don't want my code littered with false errors. I'm wondering just how many of these type idiosyncrasies there would be in a fully developed chess engine? However, from what I've seen it appears that clang produces faster executables. And that would be compelling if it were not for non chess engine examples running just slightly slower than standard MSVC in many cases. But, also Mar (and I think Gerd) said that clang understands my SISSY bitboard code much better than other top compilers which can make a sizeable difference in n/s. When Bricabrac was compiled with clang there were 1193 actual errors and it would not compile. So where does this leave me? idk, please help!
Side note: In MSVC 2019 I had to turn off Whole Program Optimization because every so many games it would flake out and become buggy. In MSVC 2022 Whole Program Optimization works just fine.
I also tried VS2022 recently, hoping that the Clang compiler might be a quick win.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one
YMMV!
Just having a look at this now.. What's a good set of optimise-for-speed flags for clang? Can I do PGO like I do with MSVC?
Yes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast code clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
Mike Sherwin wrote: ↑Tue Dec 07, 2021 4:52 am
Today I downloaded MSVC 2022 and enabled the clang option. I wrote a little first program just to see if it will work for me. It ran just fine despite the compiler giving 3 diagnostic errors. I really don't want my code littered with false errors. I'm wondering just how many of these type idiosyncrasies there would be in a fully developed chess engine? However, from what I've seen it appears that clang produces faster executables. And that would be compelling if it were not for non chess engine examples running just slightly slower than standard MSVC in many cases. But, also Mar (and I think Gerd) said that clang understands my SISSY bitboard code much better than other top compilers which can make a sizeable difference in n/s. When Bricabrac was compiled with clang there were 1193 actual errors and it would not compile. So where does this leave me? idk, please help!
Side note: In MSVC 2019 I had to turn off Whole Program Optimization because every so many games it would flake out and become buggy. In MSVC 2022 Whole Program Optimization works just fine.
I also tried VS2022 recently, hoping that the Clang compiler might be a quick win.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one
YMMV!
Just having a look at this now.. What's a good set of optimise-for-speed flags for clang? Can I do PGO like I do with MSVC?
Yes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast code clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
Mike Sherwin wrote: ↑Tue Dec 07, 2021 4:52 am
Today I downloaded MSVC 2022 and enabled the clang option. I wrote a little first program just to see if it will work for me. It ran just fine despite the compiler giving 3 diagnostic errors. I really don't want my code littered with false errors. I'm wondering just how many of these type idiosyncrasies there would be in a fully developed chess engine? However, from what I've seen it appears that clang produces faster executables. And that would be compelling if it were not for non chess engine examples running just slightly slower than standard MSVC in many cases. But, also Mar (and I think Gerd) said that clang understands my SISSY bitboard code much better than other top compilers which can make a sizeable difference in n/s. When Bricabrac was compiled with clang there were 1193 actual errors and it would not compile. So where does this leave me? idk, please help!
Side note: In MSVC 2019 I had to turn off Whole Program Optimization because every so many games it would flake out and become buggy. In MSVC 2022 Whole Program Optimization works just fine.
I also tried VS2022 recently, hoping that the Clang compiler might be a quick win.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one
YMMV!
Just having a look at this now.. What's a good set of optimise-for-speed flags for clang? Can I do PGO like I do with MSVC?
Yes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast code clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
Chessnut1071 wrote: ↑Wed Dec 08, 2021 2:50 pm
????? How did you get bit scan forward working in C#, or, were you using C++? I too am disappointed in VS2022, Perhaps we should all tell Microsoft what we need and ask them to revise immediately, if not sooner.
Bill, what's the disconnect here? We've provided an answer multiple times. Use System.Numerics.BitOperations in .NET 5 or 6. Have you tried that? Do you receive a specific error message?
CSO2034, BitOperations does not exist in the namespace System,Numerics
I'm just getting used to this new VS, using VS2022 N3t 7.3. I have a work around that's a 64-cycle loop which works but way too slow for what I need.
Chessnut1071 wrote: ↑Wed Dec 08, 2021 2:50 pm
????? How did you get bit scan forward working in C#, or, were you using C++? I too am disappointed in VS2022, Perhaps we should all tell Microsoft what we need and ask them to revise immediately, if not sooner.
Bill, what's the disconnect here? We've provided an answer multiple times. Use System.Numerics.BitOperations in .NET 5 or 6. Have you tried that? Do you receive a specific error message?
CSO2034, BitOperations does not exist in the namespace System,Numerics
I'm just getting used to this new VS, using VS2022 N3t 7.3. I have a work around that's a 64-cycle loop which works but way too slow for what I need.