| 311 | /// Packing all useful and derived information about a kernel in a single type. |
| 312 | template <typename UnpackedUint, int kPackedBitSize, typename Arch> |
| 313 | struct KernelTraits { |
| 314 | using unpacked_type = UnpackedUint; |
| 315 | /// The integer type to work with, `unpacked_type` or an appropriate type for bool. |
| 316 | using uint_type = std::conditional_t<std::is_same_v<unpacked_type, bool>, |
| 317 | SizedUint<sizeof(bool)>, unpacked_type>; |
| 318 | using arch_type = Arch; |
| 319 | using simd_batch = xsimd::batch<uint_type, arch_type>; |
| 320 | using simd_bytes = xsimd::batch<uint8_t, arch_type>; |
| 321 | |
| 322 | static constexpr KernelShape kShape = { |
| 323 | .simd_bit_size_ = 8 * simd_bytes ::size, |
| 324 | .unpacked_bit_size_ = 8 * sizeof(UnpackedUint), |
| 325 | .packed_bit_size_ = kPackedBitSize, |
| 326 | }; |
| 327 | |
| 328 | static_assert(kShape.simd_bit_size() % kShape.unpacked_bit_size() == 0); |
| 329 | static_assert(0 < kShape.packed_bit_size()); |
| 330 | static_assert(kShape.packed_bit_size() < kShape.simd_bit_size()); |
| 331 | }; |
| 332 | |
| 333 | /// Return similar kernel traits but with a different integer unpacking type. |
| 334 | template <typename KerTraits, typename Uint> |
nothing calls this directly
no test coverage detected