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.![]()
Visual Studio 2022: just installed
Moderator: Ras
-
Mergi
- Posts: 127
- Joined: Sat Aug 21, 2021 9:55 pm
- Full name: Jen
Re: Visual Studio 2022: just installed
-
Mike Sherwin
- Posts: 965
- Joined: Fri Aug 21, 2020 1:25 am
- Location: Planet Earth, Sol system
- Full name: Michael J Sherwin
Re: Visual Studio 2022: just installed
Thanks!Mergi wrote: ↑Wed Dec 08, 2021 7:02 pmYou 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.![]()
![]()
-
emadsen
- Posts: 441
- Joined: Thu Apr 26, 2012 1:51 am
- Location: Oak Park, IL, USA
- Full name: Erik Madsen
Re: Visual Studio 2022: just installed
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?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.
Erik Madsen | My C# chess engine: https://www.madchess.net
-
silentshark
- Posts: 328
- Joined: Sat Mar 27, 2010 7:15 pm
Re: Visual Studio 2022: just installed
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?MartinBryant wrote: ↑Wed Dec 08, 2021 8:46 amI also tried VS2022 recently, hoping that the Clang compiler might be a quick win.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.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one![]()
YMMV!
-
dangi12012
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Visual Studio 2022: just installed
Yes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast codesilentshark wrote: ↑Wed Dec 08, 2021 7:38 pmJust 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?MartinBryant wrote: ↑Wed Dec 08, 2021 8:46 amI also tried VS2022 recently, hoping that the Clang compiler might be a quick win.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.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one![]()
YMMV!
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
https://stackoverflow.com/questions/144 ... d-o3-ofast
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer
-
silentshark
- Posts: 328
- Joined: Sat Mar 27, 2010 7:15 pm
Re: Visual Studio 2022: just installed
Thanks, I will give that a try. First attempt allows my to create the .exe for profiling, but on the second compile gives the errordangi12012 wrote: ↑Wed Dec 08, 2021 7:47 pmYes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast codesilentshark wrote: ↑Wed Dec 08, 2021 7:38 pmJust 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?MartinBryant wrote: ↑Wed Dec 08, 2021 8:46 amI also tried VS2022 recently, hoping that the Clang compiler might be a quick win.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.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one![]()
YMMV!
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
https://stackoverflow.com/questions/144 ... d-o3-ofast
error: Could not read profile default.profdata: no such file or directory
Hmmmm...
-
AndrewGrant
- Posts: 1960
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: Visual Studio 2022: just installed
Clang requires additional arguments than fprofile-use and fprofile-generate.silentshark wrote: ↑Wed Dec 08, 2021 8:12 pmThanks, I will give that a try. First attempt allows my to create the .exe for profiling, but on the second compile gives the errordangi12012 wrote: ↑Wed Dec 08, 2021 7:47 pmYes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast codesilentshark wrote: ↑Wed Dec 08, 2021 7:38 pmJust 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?MartinBryant wrote: ↑Wed Dec 08, 2021 8:46 amI also tried VS2022 recently, hoping that the Clang compiler might be a quick win.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.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one![]()
YMMV!
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
https://stackoverflow.com/questions/144 ... d-o3-ofast
error: Could not read profile default.profdata: no such file or directory
Hmmmm...
Example: https://github.com/TerjeKir/weiss/blob/ ... le#L37-L46
-
silentshark
- Posts: 328
- Joined: Sat Mar 27, 2010 7:15 pm
Re: Visual Studio 2022: just installed
Thanks. Also found this was a good pointer - https://clang.llvm.org/docs/UsersManual ... timizationAndrewGrant wrote: ↑Wed Dec 08, 2021 8:19 pmClang requires additional arguments than fprofile-use and fprofile-generate.silentshark wrote: ↑Wed Dec 08, 2021 8:12 pmThanks, I will give that a try. First attempt allows my to create the .exe for profiling, but on the second compile gives the errordangi12012 wrote: ↑Wed Dec 08, 2021 7:47 pmYes of course. Clang seems to create better code some of the time than MSVC. For your own machine its easy to compile fast codesilentshark wrote: ↑Wed Dec 08, 2021 7:38 pmJust 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?MartinBryant wrote: ↑Wed Dec 08, 2021 8:46 amI also tried VS2022 recently, hoping that the Clang compiler might be a quick win.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.
Although Colossus compiled first time the Clang executable was over 20% slower than the MSVC one![]()
YMMV!
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-generate
clang++ -flto -O3 -march=native -funroll-loops -std=c++20 -fprofile-use
https://stackoverflow.com/questions/144 ... d-o3-ofast
error: Could not read profile default.profdata: no such file or directory
Hmmmm...
Example: https://github.com/TerjeKir/weiss/blob/ ... le#L37-L46
-
Chessnut1071
- Posts: 313
- Joined: Tue Aug 03, 2021 2:41 pm
- Full name: Bill Beame
Re: Visual Studio 2022: just installed
CSO2034, BitOperations does not exist in the namespace System,Numericsemadsen wrote: ↑Wed Dec 08, 2021 7:10 pmBill, 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?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.
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.
-
dangi12012
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Visual Studio 2022: just installed
They do not exist? Microsoft does not lie. HERE FOR YOUChessnut1071 wrote: ↑Thu Dec 09, 2021 5:25 amCSO2034, BitOperations does not exist in the namespace System,Numericsemadsen wrote: ↑Wed Dec 08, 2021 7:10 pmBill, 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?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.
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.
https://docs.microsoft.com/en-us/dotnet ... ew=net-6.0
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer