From 8c0113d333040f6443a3090e2a63b3b31302304d Mon Sep 17 00:00:00 2001 From: Kimish Patel Date: Tue, 15 Oct 2024 07:09:38 -0700 Subject: [PATCH 1/2] [ExecuTorch][Llama] Use Eigen blas for custom sdpa OpenBlas's implementation is not thread safe. Thus when used within parallel_for, it produces incorrect output. This has been documented in a few places like here https://github.com/OpenMathLib/OpenBLAS/issues/1441 and https://github.com/OpenMathLib/OpenBLAS/issues/2543. I tried few options to disable openblas's multithreading but none of them seemed to work. It is possible that upstream openblas has fixed this. Will validate this by pulling in latest, but in the meanwhile using eigen_blas to unblock. Differential Revision: [D64398816](https://our.internmc.facebook.com/intern/diff/D64398816/) [ghstack-poisoned] --- kernels/optimized/lib_defs.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernels/optimized/lib_defs.bzl b/kernels/optimized/lib_defs.bzl index 367c23f0813..d9721e5055d 100644 --- a/kernels/optimized/lib_defs.bzl +++ b/kernels/optimized/lib_defs.bzl @@ -144,7 +144,7 @@ def define_libs(): ( "^android-arm64.*$", [ - "fbsource//third-party/openblas:openblas", + "fbsource//arvr/third-party/eigen:eigen3_blas", ], ), ], From e74aab8c96d8e439cf332e56276bdfec3f2390bc Mon Sep 17 00:00:00 2001 From: Kimish Patel Date: Tue, 15 Oct 2024 08:24:43 -0700 Subject: [PATCH 2/2] Update on "[ExecuTorch][Llama] Use Eigen blas for custom sdpa" OpenBlas's implementation is not thread safe. Thus when used within parallel_for, it produces incorrect output. This has been documented in a few places like here https://github.com/OpenMathLib/OpenBLAS/issues/1441 and https://github.com/OpenMathLib/OpenBLAS/issues/2543. I tried few options to disable openblas's multithreading but none of them seemed to work. It is possible that upstream openblas has fixed this. Will validate this by pulling in latest, but in the meanwhile using eigen_blas to unblock. Differential Revision: [D64398816](https://our.internmc.facebook.com/intern/diff/D64398816/) [ghstack-poisoned]