-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Problem with ARMv7 (cblas_ddot) #1168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I may be wrong but I think for ARM_SOFTFP_ABI=1 you will need to checkout the "arm_soft_fp_abi" branch, as current "develop" and all releases have hardfp code for ARMv7 only. |
Hi @martin-frbg, Thank for reply. I use OpenBLAS from arm_soft_fp_abi branch actually. I test it on my Samsung Note 3, which has specs as following. processor : 1 processor : 2 processor : 3 Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt Hardware : Qualcomm MSM8974 If I build it for ARMV8, can it be run on my device? I am afraid, it cannot be run. For your information, I use the following flags when I build my executable file:
I think there are something bug for cblas_ddot, but I am not sure. I am not expert on assembly code. Thanks, |
Indeed it seems to be 32bit armv7 only, and unfortunately it also looks as if xianyi has not gotten around to doing the softfp implementation of ddot on that branch yet, only sdot. |
Looking at the diff for that change to sdot.vfp it seems the "only" change is a vmov of the result to a different register, so perhaps you could try copying the single line from the "ifdef DSDOT" case of sdot.vfp to the equivalent position at the end of ddot.vfp... |
Hi @martin-frbg, I tried to modified ddot.vfp.S in kernel/arm directory by referring sdot.vfp.S as the following. #if defined(DDDOT)
#ifdef ARM_SOFTFP_ABI #else
#ifdef ARM_SOFTFP_ABI
And tried to rebuild openblas library for ARMv7, but the error still similar like I mentioned in first question. Do I just need to modified ddot_vfp.S file or other files need to modified too? Thanks, |
Sorry, to clarify my idea was to copy just the
from lines 335 to 337 of xianyi's sdot_vfp.S and put it after the |
Hi @martin-frbg, After I add the line as your suggestion in ddot_vfp.S file, the error is solved now. But now, I get Segmentation fault when run executable file. I use the following command to build OpenBLAS library then I get segmentation fault as error. make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 ARM_SOFTFP_ABI=1 libs If I use the below command: I got this message: Maybe you have any suggestion about the issue. Thanks, |
Do you get any indication where in the code the segmentation fault occurs (i.e., is it in the ddot_vfp.S that we just changed, or is it unrelated) ? |
Hi @martin-frbg, I did not get any indication where in the code the segmentation fault occur. I think it does not related with ddot_vfp.S anymore. I tried to build with USE_THREAD=0 but I also get segmentation fault. I also try to build with OPENBLAS_NUM_THREADS=8 (because my phone's core is 4) but I also get segmentation fault. I don't know how to debug the error from mobile device. I just use the following command to debug error. adb shell logcat | ndk-stack -sym $PROJECT_PATH/obj/local/armeabi and shown the following error: ********** Crash dump: ********** I think that there does not show important information. Do you think I only need to modified ddot_vfp.S file or need to modified other files? Thanks, |
You could try building OpenBLAS with debugging symbols, perhaps this will show function names instead of raw addresses in the dump. Looking at how LAPACK dpotf2 does a Cholesky factorization, |
@misbullah what version openblas do you use?the develop version or master?I use 0.2.19 version can not test normally |
@ctgushiwei what do you mean by cannot test normally? I use 0.2.19 OpenBLAS with master version. Currently, I still cannot use OpenBLAS on ARMv7 for some matrix operation like Cholesky factorization. Thanks, |
I am with the exactly same problem. I had the Cholesky decomposition failure in Kaldi, and after the suggested edit in ddot.vfp.S, I am having a segmentation fault. I am putting the gdb backtrace here and I will try to compile the executable with debugging symbols later, since I'm not exactly well-versed in Android development.
Just for the record, I'm trying to compile OpenBLAS in the arm_soft_fp_abi branch. |
The few commits to the arm_soft_fp_abi branch are for single precision calculations only, and ddot is/was the only case where it is trivial to copy the required change (as there is special code in sdot for doing the calculation with doubles as well, and xianyi already changed it for soft fp). Everything else needs a developer with some knowledge of ARM assembly (which I am not) |
@misbullah I can compiled 0.2.19 release version successfully ,but when i test cblas_sgemm,i go to segmentation error. i have known the reason,the code at openblas_0.2.19/kernel/ can not compile to .o file,i do not know how to solve this problem |
Hi,
Recently, I used OpenBLAS with Kaldi Toolkit for Android.
I can use OpenBLAS for Intel ATOM platform and get desired result from Kaldi.
When, I build OpenBLAS for armv7-a, there is no error but I get error when I run the executable file.
The error is shown in the following.
LOG (dnn_batch_static:void kaldi::IvectorExtractor::ComputeDerivedVars()():ivector/ivector-extractor.cc:183) Computing derived variables for iVector extractor
WARNING (dnn_batch_static:void kaldi::TpMatrix::Cholesky(const kaldi::SpMatrix&) with Real = double:matrix/tp-matrix.cc:110) Cholesky decomposition failed. Maybe matrix is not positive definite. Throwing error
terminate called after throwing an instance of 'std::runtime_error'
what(): Cholesky decomposition failed.
Aborted
I trace matrix/tp-matrix.cc code, then I found that the error was happened from this template:
template
void TpMatrix::Cholesky(const SpMatrix &orig) {
KALDI_ASSERT(orig.NumRows() == this->NumRows());
MatrixIndexT n = this->NumRows();
this->SetZero();
Real *data = this->data_, *jdata = data; // start of j'th row of matrix.
const Real *orig_jdata = orig.Data(); // start of j'th row of matrix.
for (MatrixIndexT j = 0; j < n; j++, jdata += j, orig_jdata += j) {
Real *kdata = data; // start of k'th row of matrix.
Real d(0.0);
for (MatrixIndexT k = 0; k < j; k++, kdata += k) {
Real s = cblas_Xdot(k, kdata, 1, jdata, 1);
// (*this)(j, k) = s = (orig(j, k) - s)/(this)(k, k);
jdata[k] = s = (orig_jdata[k] - s)/kdata[k];
d = d + ss;
}
// d = orig(j, j) - d;
d = orig_jdata[j] - d;
}
}
Then I check cblas_Xdot function which is defined in the cblas-wrapper.h file:
inline double cblas_Xdot(const int N, const double *const X,
const int incX, const double *const Y,
const int incY) {
return cblas_ddot(N, X, incX, Y, incY);
}
I think that the cblas_ddot is call from OpenBLAS library which related with floating-point value. When I build library for Intel ATOM, the problem did not happened. It happened only for ARMv7-a
I use the following command to build OpenBLAS for ARMv7-a
make TARGET=ARMV7 HOSTCC=gcc CC=arm-linux-androideabi-gcc NOFORTRAN=1 NUM_THREADS=4 ARM_SOFTFP_ABI=1 libs
I use -mfpu=neon for compile my executable file in Kaldi.
How can I solve this problem.
Thanks,
Alim
The text was updated successfully, but these errors were encountered: