Re: [Mesa-dev] [PATCH 1/2] gallium: Enable aarch64 NEON CPU detection.
On Wed, Jan 23, 2019 at 3:26 PM Eric Anholt wrote: > > Matt Turner writes: > > > NEON (now called ASIMD) is available on all aarch64 CPUs. It seems that > > our code was missing an aarch64 path, leading to util_cpu_caps.has_neon > > always being false on aarch64. I think that means that the NEON tiling > > code in vc4 would not be enabled on aarch64 (vc4_load_lt_image_neon, > > etc). > > --- > > I have very little clue about aarch64 ABIs, so I don't know if there's > > another case that needs to be handled -- aarch32 maybe? Does > > PIPE_ARCH_AARCH64 just mean ARMv8 and so we should check something else > > for the ABI and choose Elf{32,64} based on that? > > Do we actually need to do runtime detection? It sounds like "standard" > armv8 is guaranteed NEON: > > http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/CEGDJGGC.html I think that's right. https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html seems to agree: ‘simd’ Enable Advanced SIMD instructions. This also enables floating-point instructions. This is on by default for all possible values for options -march and -mcpu. I'll send a new patch that just sets util_cpu_caps.has_neon = true for aarch64. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] gallium: Enable aarch64 NEON CPU detection.
Matt Turner writes: > NEON (now called ASIMD) is available on all aarch64 CPUs. It seems that > our code was missing an aarch64 path, leading to util_cpu_caps.has_neon > always being false on aarch64. I think that means that the NEON tiling > code in vc4 would not be enabled on aarch64 (vc4_load_lt_image_neon, > etc). > --- > I have very little clue about aarch64 ABIs, so I don't know if there's > another case that needs to be handled -- aarch32 maybe? Does > PIPE_ARCH_AARCH64 just mean ARMv8 and so we should check something else > for the ABI and choose Elf{32,64} based on that? Do we actually need to do runtime detection? It sounds like "standard" armv8 is guaranteed NEON: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.den0024a/CEGDJGGC.html For vc4, the aarch64 build uses neon in the _base version of the tiling implementation. signature.asc Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] gallium: Enable aarch64 NEON CPU detection.
NEON (now called ASIMD) is available on all aarch64 CPUs. It seems that our code was missing an aarch64 path, leading to util_cpu_caps.has_neon always being false on aarch64. I think that means that the NEON tiling code in vc4 would not be enabled on aarch64 (vc4_load_lt_image_neon, etc). --- I have very little clue about aarch64 ABIs, so I don't know if there's another case that needs to be handled -- aarch32 maybe? Does PIPE_ARCH_AARCH64 just mean ARMv8 and so we should check something else for the ABI and choose Elf{32,64} based on that? Also, Android is not handled. src/util/u_cpu_detect.c | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 52b9ae547d4..e9cdb78e458 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -328,7 +328,7 @@ PIPE_ALIGN_STACK static inline boolean sse2_has_daz(void) #endif /* X86 or X86_64 */ -#if defined(PIPE_ARCH_ARM) +#if defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64) static void check_os_arm_support(void) { @@ -348,24 +348,36 @@ check_os_arm_support(void) util_cpu_caps.has_neon = 1; } #elif defined(PIPE_OS_LINUX) -Elf32_auxv_t aux; + +#if defined(PIPE_ARCH_ARM) +#define Elf_auxv_t Elf32_auxv_t +#elif defined(PIPE_ARCH_AARCH64) +#define Elf_auxv_t Elf64_auxv_t +#endif + +Elf_auxv_t aux; int fd; fd = open("/proc/self/auxv", O_RDONLY | O_CLOEXEC); if (fd >= 0) { - while (read(fd, , sizeof(Elf32_auxv_t)) == sizeof(Elf32_auxv_t)) { + while (read(fd, , sizeof(Elf_auxv_t)) == sizeof(Elf_auxv_t)) { if (aux.a_type == AT_HWCAP) { uint32_t hwcap = aux.a_un.a_val; +#if defined(PIPE_ARCH_ARM) util_cpu_caps.has_neon = (hwcap >> 12) & 1; +#elif defined(PIPE_ARCH_AARCH64) + util_cpu_caps.has_neon = (hwcap >> 1) & 1; +#endif break; } } close (fd); } +#undef Elf_auxv_t #endif /* PIPE_OS_LINUX */ } -#endif /* PIPE_ARCH_ARM */ +#endif /* PIPE_ARCH_ARM || PIPE_ARCH_AARCH64 */ static void get_cpu_topology(void) @@ -534,7 +546,7 @@ util_cpu_detect_once(void) } #endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */ -#if defined(PIPE_ARCH_ARM) +#if defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64) check_os_arm_support(); #endif -- 2.19.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev