From 7eb07da538ecc1b8937bfb5dac0d071067728397 Mon Sep 17 00:00:00 2001 From: Ashutosh Sharma Date: Wed, 10 Feb 2021 10:21:37 -0800 Subject: loop less ptranspose --- Eigen/src/Core/arch/NEON/PacketMath.h | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'Eigen/src/Core/arch/NEON/PacketMath.h') diff --git a/Eigen/src/Core/arch/NEON/PacketMath.h b/Eigen/src/Core/arch/NEON/PacketMath.h index 1f34faae0..f038a8ffb 100644 --- a/Eigen/src/Core/arch/NEON/PacketMath.h +++ b/Eigen/src/Core/arch/NEON/PacketMath.h @@ -4511,31 +4511,16 @@ EIGEN_STRONG_INLINE Eigen::half predux_max(const Packet4hf& a) { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void ptranspose(PacketBlock& kernel) { - EIGEN_ALIGN16 Eigen::half in[4][8]; + const float16x8x2_t zip16_1 = vzipq_f16(kernel.packet[0], kernel.packet[1]); + const float16x8x2_t zip16_2 = vzipq_f16(kernel.packet[2], kernel.packet[3]); - pstore(in[0], kernel.packet[0]); - pstore(in[1], kernel.packet[1]); - pstore(in[2], kernel.packet[2]); - pstore(in[3], kernel.packet[3]); + const float32x4x2_t zip32_1 = vzipq_f32(vreinterpretq_f32_f16(zip16_1.val[0]), vreinterpretq_f32_f16(zip16_2.val[0])); + const float32x4x2_t zip32_2 = vzipq_f32(vreinterpretq_f32_f16(zip16_1.val[1]), vreinterpretq_f32_f16(zip16_2.val[1])); - EIGEN_ALIGN16 Eigen::half out[4][8]; - - EIGEN_UNROLL_LOOP - for (int i = 0; i < 4; ++i) { - EIGEN_UNROLL_LOOP - for (int j = 0; j < 4; ++j) { - out[i][j] = in[j][2 * i]; - } - EIGEN_UNROLL_LOOP - for (int j = 0; j < 4; ++j) { - out[i][j + 4] = in[j][2 * i + 1]; - } - } - - kernel.packet[0] = pload(out[0]); - kernel.packet[1] = pload(out[1]); - kernel.packet[2] = pload(out[2]); - kernel.packet[3] = pload(out[3]); + kernel.packet[0] = vreinterpretq_f16_f32(zip32_1.val[0]); + kernel.packet[1] = vreinterpretq_f16_f32(zip32_1.val[1]); + kernel.packet[2] = vreinterpretq_f16_f32(zip32_2.val[0]); + kernel.packet[3] = vreinterpretq_f16_f32(zip32_2.val[1]); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void ptranspose(PacketBlock& kernel) { -- cgit v1.2.3