How can we make progress here? I could try to produce some "Tony Tables" of diagnostic output of my modified stdx::simd. I believe it's a major productivity boost to see abbreviated / "obfuscated" diagnostics *out-of-the box* (with the possibility to opt-out). Actually, it already *is* a productivity boost to me. Understanding diagnostics has improved from
"1. ooof, I'm not going to read this, let me rather guess what the issue was 2. sh** I have to read it 3. several minutes later: I finally found the five words to understand the problem; I could use a break" to "1. right, let me check that" For reference I'll attach my stdx::simd diagnose_as patch. We could also talk about extending the feature to provide more information about the diagnose_as substition. E.g. print a list of all diagnose_as substitutions, which were used, at the end of the output stream. Or simpler, print "note: some identifiers were simplified, use -fno-diagnostics-use- aliases to see their real names". On Tuesday, 1 June 2021 21:12:18 CEST Jason Merrill wrote: > > Right, but then two of my design goals can't be met: > > > > 1. Diagnostics have an improved signal-to-noise ratio out of the box. > > > > 2. We can use replacement names that are not valid identifiers. > > This is the basic disconnect: I think that these goals are > contradictory, and that replacement names that are not valid identifiers > will just confuse users that don't know about them. > > If a user sees stdx::foo in a diagnostic and then tries to refer to > stdx::foo and gets an error, the diagnostic is not more helpful than one > that uses the fully qualified name. > > Jonathan, David, any thoughts on this issue? -- ────────────────────────────────────────────────────────────────────────── Dr. Matthias Kretz https://mattkretz.github.io GSI Helmholtz Centre for Heavy Ion Research https://gsi.de std::experimental::simd https://github.com/VcDevel/std-simd ──────────────────────────────────────────────────────────────────────────
diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h index 43331134301..8e0cceff860 100644 --- a/libstdc++-v3/include/experimental/bits/simd.h +++ b/libstdc++-v3/include/experimental/bits/simd.h @@ -80,13 +80,13 @@ using __m512d [[__gnu__::__vector_size__(64)]] = double; using __m512i [[__gnu__::__vector_size__(64)]] = long long; #endif -namespace simd_abi { +namespace simd_abi [[__gnu__::__diagnose_as__("simd_abi")]] { // simd_abi forward declarations {{{ // implementation details: -struct _Scalar; + struct [[__gnu__::__diagnose_as__("scalar")]] _Scalar; template <int _Np> - struct _Fixed; + struct [[__gnu__::__diagnose_as__("fixed_size")]] _Fixed; // There are two major ABIs that appear on different architectures. // Both have non-boolean values packed into an N Byte register @@ -105,28 +105,11 @@ template <int _UsedBytes> template <int _UsedBytes> struct _VecBltnBtmsk; -template <typename _Tp, int _Np> - using _VecN = _VecBuiltin<sizeof(_Tp) * _Np>; - -template <int _UsedBytes = 16> - using _Sse = _VecBuiltin<_UsedBytes>; - -template <int _UsedBytes = 32> - using _Avx = _VecBuiltin<_UsedBytes>; - -template <int _UsedBytes = 64> - using _Avx512 = _VecBltnBtmsk<_UsedBytes>; - -template <int _UsedBytes = 16> - using _Neon = _VecBuiltin<_UsedBytes>; - -// implementation-defined: -using __sse = _Sse<>; -using __avx = _Avx<>; -using __avx512 = _Avx512<>; -using __neon = _Neon<>; -using __neon128 = _Neon<16>; -using __neon64 = _Neon<8>; +#if defined __i386__ || defined __x86_64__ +using __sse [[__gnu__::__diagnose_as__("[SSE]")]] = _VecBuiltin<16>; +using __avx [[__gnu__::__diagnose_as__("[AVX]")]] = _VecBuiltin<32>; +using __avx512 [[__gnu__::__diagnose_as__("[AVX512]")]] = _VecBltnBtmsk<64>; +#endif // standard: template <typename _Tp, size_t _Np, typename...> @@ -364,7 +347,7 @@ namespace __detail * users link TUs compiled with different flags. This is especially important * for using simd in libraries. */ - using __odr_helper + using __odr_helper [[__gnu__::__diagnose_as__("[ODR helper]")]] = conditional_t<__machine_flags() == 0, _OdrEnforcer, _MachineFlagsTemplate<__machine_flags(), __floating_point_flags()>>; @@ -689,7 +672,7 @@ template <typename _Abi> __is_avx512_abi() { constexpr auto _Bytes = __abi_bytes_v<_Abi>; - return _Bytes <= 64 && is_same_v<simd_abi::_Avx512<_Bytes>, _Abi>; + return _Bytes <= 64 && is_same_v<simd_abi::_VecBltnBtmsk<_Bytes>, _Abi>; } // }}} diff --git a/libstdc++-v3/include/experimental/bits/simd_detail.h b/libstdc++-v3/include/experimental/bits/simd_detail.h index 78ad33f74e4..1f127cd0d52 100644 --- a/libstdc++-v3/include/experimental/bits/simd_detail.h +++ b/libstdc++-v3/include/experimental/bits/simd_detail.h @@ -36,7 +36,7 @@ { \ _GLIBCXX_BEGIN_NAMESPACE_VERSION \ namespace experimental { \ - inline namespace parallelism_v2 { + inline namespace parallelism_v2 [[__gnu__::__diagnose_as__("std\u2093")]] { #define _GLIBCXX_SIMD_END_NAMESPACE \ } \ } \