-
Notifications
You must be signed in to change notification settings - Fork 0
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
英雄帖:Make Sagemath work on LoongArch #53
Comments
通过一些非常 Dirty 的 Hack ,勉强 Workaround 掉了 Tachyon 的问题,看看下面还能有啥包需要调整。 |
更新进度: make test 有失败 失败部分的摘要
ell_rational_field.py 失败的完整日志
abvar.py 失败的完整日志
submodule.py 失败的完整日志
sympow.py 失败的完整日志
简单观察发现和 sympow 这个组件有关,尝试直接编译运行 sympow 编译运行日志
发现不能正常编译运行,先睡觉了,明天再研究 |
找到问题了,构建 sympow 时会自动开启 相关代码 /* David Kirkby 21st August 2010
Licenced under the GPL version 2 or at your option any later version.
Set the FPU's precision control to 53 bits (double precision) instead of
the default 64-bits (extended precision). I've commented it fairly
liberally, with the hope it's helpful if anyone needs to edit it.
Note, the extended precision uses 80 bits in total,
of which 64 are for the mantissa.
Double precsion uses 64 bits in total, but ony 53 are
for the mantissa.
The precision is set by bits 8 and 9 of the Control Word in the floating
point processor. The Control word has 16 bits.
Data taken from The 80387 Programmer's reference Manual, Intel,
1987.
00 = 24-bits (single precision)
01 = reserved (or at least it was at the time the 387 was released)
10 = 53-bits (double precision)
11 = 64-bits (extended precision).
FLDCW is an x86 instruction to "Load the Control Word"
FNSTCW is an x88 instruction to "Store FPU Control Word"
It does so without checking for pending unmasked floating-point
exceptions. (A similar FSTCW checks for them first).
*/
/*
* Rrefreshed and revisited for Debian on behalf of the Debian Science Team
* by Jerome Benoit <[email protected]>, 2014-10-07.
*/
#if defined(ISOC99_FENV)
#include <fenv.h>
#elif defined(FPUCONTROLH)
#include <fpu_control.h>
#define ADHOC__FPU_OR_MASK_EXTENDED (((fpu_control_t)(0x1) << 8) | ((fpu_control_t)(0x1) << 9))
#define ADHOC__FPU_AND_MASK_DOUBLE (~((fpu_control_t)(0x1) << 8))
#elif defined(x86)
#define _SET_FPU_CONTROL_WORD(x) asm volatile ("fldcw %0": :"m" (x));
#define _READ_FPU_CONTROL_WORD(x) asm volatile ("fnstcw %0":"=m" (x));
#else
#endif
void fpu_53bits()
{
#if defined(ISOC99_FENV)
fesetprec(FE_DBLPREC);
#elif defined(FPUCONTROLH)
fpu_control_t fpu_control=_FPU_DEFAULT;
_FPU_GETCW(fpu_control);
fpu_control|=ADHOC__FPU_OR_MASK_EXTENDED;
fpu_control&=ADHOC__FPU_AND_MASK_DOUBLE;
_FPU_SETCW(fpu_control);
#elif defined(x86)
/* The control word is 16 bits, numbered 0 to 15 */
volatile unsigned short control_word;
_READ_FPU_CONTROL_WORD(control_word); /* Read the FPU control word */
control_word=control_word & 0xfeff; /* Set bit 8 = 0 */
control_word=control_word | 0x200; /* Set bit 9 = 1 */
_SET_FPU_CONTROL_WORD(control_word); /* Force double-precision, 53-bit mantissa */
#endif
} 去掉这个选项重新构建即可通过以上几个 test。 目前没有比较好的 patch 方法,有 idea 可以直接回复。 |
同时发现了 clang 和 gcc 不一致的行为,分别运行
gcc 没有输出 clang 输出
|
https://sourceware.org/pipermail/libc-alpha/2024-April/156376.html |
设备在学校,五一假期期间估计没啥进度,等节后开始研究进一步的补丁和打包。 |
最近事情比较多,在参考其他发行版研究打包格式和 sage 运行所需要的环境变量。 |
喜报,现在 https://github.com/lwzhenglittle/sage-loongarch 已经可以在龙芯上构建了,只需:
构建完成后即可在项目根目录下执行 目前正在测试 |
Clang inline-asm parser does not allow using "$r0" in movfcsr2gr/movgr2fcsr, so everything using _FPU_{GET,SET}CW is now failing to build with Clang on LoongArch. As we now requires Binutils >= 2.41 which supports using "$fcsr0" here, use it instead of "$r0" to fix the issue. Link: loongson-community/discussions#53 (comment) Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353 Signed-off-by: Xi Ruoyao <[email protected]>
Clang inline-asm parser does not allow using "$r0" in movfcsr2gr/movgr2fcsr, so everything using _FPU_{GET,SET}CW is now failing to build with Clang on LoongArch. As we now requires Binutils >= 2.41 which supports using "$fcsr0" here, use it instead of "$r0" to fix the issue. Link: loongson-community/discussions#53 (comment) Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4142b2368353 Signed-off-by: Xi Ruoyao <[email protected]>
Sagemath 简介
SageMath(简称Sage)是一个开源的数学软件系统,旨在提供一个包含数学软件的完整环境,以便于数学建模、数值计算、符号计算和数据可视化等任务。它集成了多个数学软件包和工具,如NumPy、SciPy、SymPy、Matplotlib等,同时提供了一个Python编程接口。
SageMath 的目标是为数学家、科学家和工程师提供一个统一的平台,使他们能够进行各种复杂的数学计算和研究。SageMath 支持大量的数学领域,包括代数、数论、几何、拓扑学、概率论等等。
SageMath 是免费开源软件,用户可以自由地使用、修改和分发它。
情况说明
Repo: https://github.com/lwzhenglittle/sage-loongarch
Upstream: https://github.com/sagemath/sage
目前正在使用 AOSC OS 在 3A5000 上尝试构建 Sagemath,正在把一些构建相关的 patch 推到 lwzhenglittle/sage-loongarch,起码让构建系统能够正常运行(目前还没推)。
Sagemath 本身自带一套 “SPKG” 系统,用于管理其第三方依赖库,目前尝试使用其自带的 SPKG 进行依赖补全,而不是使用发行版软件源中的依赖包。
目前遇到的问题
相关日志文件,脚本文件:
Sagemath 提供的用于构建 Tachyon 的脚本
Tachyon 的 Makefile
Sagemath 构建系统提供的失败日志
The text was updated successfully, but these errors were encountered: