News for hackers. Stuff that matters.
Re:All C++20 core language features with examples by jcelerier on Wednesday April 07, 2021 @02:51PM (#26729258)
> - Waiting for Cross-Platform standardized SIMD vector datatypes

which language has standardized SIMD vector datatypes ? most languages don't even have any ability to express SIMD while in C++ I can just use Vc (https://github.com/VcDevel/Vc), nsimd (https://github.com/agenium-scale/nsimd) or one of the other ton of alternatives, and have stuff that JustWorksTM on more architectures than most languages even support

- Using nonstandard extensions, libraries or home-baked solutions to run computations in parallel on many cores or on different processors than the CPU

what are the other native languages with a standardized memory model for atomics ? and, what's the problem with using libraries ? it's not like you're going to use C# or Java's built-in threadpools if you are doing any serious work, no ? Do they even have something as easy to use as https://github.com/taskflow/taskflow ?

- Debugging cross-platform code using couts, cerrs and printfs

because people never use console.log in JS or System.println in C# maybe ?

- Forced to use boost for even quite elementary operations on std::strings.

can you point to non-trivial java projects that do not use Apache Commons ? Also, the boost string algorithms are header-only so you will end up with exactly the same binaries that if it was in some std::string_algorithms namespace:

https://gcc.godbolt.org/z/43vKadbde

Re:All C++20 core language features with examples by vlovich123 on Wednesday April 07, 2021 @04:48PM (#26731037)
Most of what you said is a fair retort, but boost isn't quite as rosy as you make it seem. It's great but it has serious pitfalls which is why many C++ developers really hate it:

A) Boosts supports an enormous amount of compilers & platforms. To implement this support is an enormous amount of expensive preprocessor stuff that slows down the build & makes it hard to debug. B) Boost is inordinately template heavy (often even worse than the STL). This is paid for at compile time. Some times at runtime and/or binary size if the library maintainers don't do a good job structuring their templates so that the inlined template API calls a non-templated implementation. The first C++ talk I remember talking about this problem was about 5-7 years ago & I doubt boost has been cleaned up in its wake across the board. C) Library quality is highly variable. It's all under the boost umbrella but boost networking is different from boost filesystem, different from boost string algorithms, different from boost preprocessor, boost spirit, etc. Each library has its own unique cost impact on build, run, & code size that's hard to evaluate a priori.

Boost is like the STL on steroids but that has its own pitfalls that shouldn't be papered over. Maybe things will get better with modules. That's certainly the hope anyway.

Re:All C++20 core language features with examples by cogman10 on Wednesday April 07, 2021 @10:49PM (#26734549)
> which language has standardized SIMD vector datatypes ?

Java is getting it soonish. https://openjdk.java.net/jeps/338

Rust has it (but it's fairly platform specific) https://doc.rust-lang.org/edition-guide/rust-2018/simd-for-f...

Dart has it https://www.dartcn.com/articles/server/simd

Javascript has it https://01.org/node/1495

It's actually a bit impressive how many languages have it at this point.

> what are the other native languages with a standardized memory model for atomics

Rust, C, Go?

> It's not like you're going to use C# or Java's built-in threadpools if you are doing any serious work, no ?

Define "serious". By most metrics JVM apps run at 1->2x the speed of C++, that's really not terribly slow for a managed language. On top of that, there are a lot of places java can outperform C++ (high heap memory allocation rates). Java's threadpools and concurrency model is, IMO, superior to C++'s.

> Do they even have something as easy to use as taskflow

Several internal and external libs do. Java's completable futures, kotlin's/C#'s (and several other languages) async/await. I really don't see anything special about taskflow.

> can you point to non-trivial java projects that do not use Apache Commons

Yes? It's a fairly dated lib at this point as the JDK has pulled in a lot of the functionality there and from guava. We've got a lot of internal apps that don't have Apache commons as a dependency. I think you are behind the times in where Java as an ecosystem is now.

Re:All C++20 core language features with examples by jcelerier on Thursday April 08, 2021 @03:24AM (#26736024)
... I just checked your link and wouldn't say that any of these languages have SIMD more than C++ has it currently:

- Java: incubation stage (how is that different from https://github.com/VcDevel/std-simd). Also Java is only getting it soonish for... amd64 and aarch64 ??

- Rust: those seem to be just the normal intrinsics which are available in every C++ compiler ?

- Dart: seems to not go beyond SSE2 atm ? But it looks like the most "officially supported" of the bunch

- Javascript: seems to be some intel-specific stuff which isn't available here on any of my JS environments ?

* Standardized memory model

- Literally false for Rust : https://doc.rust-lang.org/reference/memory-model.html

- The C11 one directly comes from C++: https://stackoverflow.com/a/8877562/1495627

- The Go one does not seem to support acquire-release semantics, which makes it quite removed from e.g. ARM and NVidia hardware from what I can read here ? https://golang.org/pkg/sync/atomic/

Re:All C++20 core language features with examples by WalterBright on Wednesday April 07, 2021 @07:38PM (#26733061)
> which language has standardized SIMD vector datatypes ?

D does:

https://dlang.org/spec/simd.html

Re:All C++20 core language features with examples by aidenn0 on Wednesday April 07, 2021 @07:54PM (#26733186)
That's quite well thought out; without the compile-time checks for operations existing, you end up with code either needing to target a very small subset of the operations that are widely supported or something that is not really cross-platform -- I've seen too much of the following using what is theoretically portable code because software-fallback will typically be an order of magnitude worse than using a different set of datatypes and operators

  #if defined(__NEON__)
  "portable" SIMD goes here
  #elif defined(__ALTIVEC__)
  different "portable" SIMD goes here
  ...
Re:All C++20 core language features with examples by WalterBright on Wednesday April 07, 2021 @08:06PM (#26733282)
There was some discussion about what to do with vector types and operations that weren't supported by the hardware. We decided on compiler error instead of emulation, because the emulation would be terribly slow and the user may be unaware that he's getting emulation.

With a compiler error, the user unambiguously knows if the SIMD hardware is being used or not.

Re:All C++20 core language features with examples by nicwilson on Wednesday April 07, 2021 @08:31PM (#26733520)
> We decided on compiler error instead of emulation

DMD does that, LDC (based on LLVM) does the sensible thing and vectorises with the widest available native SIMD. No idea what GDC (based on GCC) does.

Re:All C++20 core language features with examples by mhh__ on Wednesday April 07, 2021 @11:17PM (#26734730)
Re:All C++20 core language features with examples by rbobby on Wednesday April 07, 2021 @08:56PM (#26733748)
Re:All C++20 core language features with examples by oblio on Thursday April 08, 2021 @04:15AM (#26736306)
> what's the problem with using libraries?

Spot the difference:

C++: Conan (barely adopted), vcpkg (barely adopted), single header file libraries (!!!)

Java: Maven (de facto standard), Gradle (compatible with Maven), Ivy (compatible with Maven), heck Ant (compatible with Maven).

C#: Nuget.