Pytorch Distributed

近日发现开启 pytorch 的 distributed 之后测试会变得极其慢,现来研究一下。 配置一下 export USE_DISTRIBUTED=1 和 export USE_GLOO=1

July 10, 2026 · 1 min · 11 words · xyenchi

OpenBlas 版本不一致引发的惨案

最近 pytorch RISC-V ci fail 的测试项在 openEuler RISC-V 上无法复现。 列文虎克群友在log里找到了通过环境变量导入的 minIO 账号密码,也是终于成功登上了后台拿到了log, 再也不用理会那个永远 403 forbidden 的网站。 问了一下ai agent, fail 的原因可能是 RISC-V openBlas 的 complex 支持问题。想到我一月份因为 LAPACK 的问题自己构建过 openBLAS。会 fail 的机器看起来版本确实较低,升级版本后也不会 fail 了。 只要办法肯滑坡,思想总比困难多。

July 9, 2026 · 1 min · 33 words · xyenchi

JITLink 和 RuntimeDyld

没想到上次更新已经是上个月。 llvm 中 RuntimeDyld 和 JITLink 都是 JIT 链接器。 RuntimeDyld 是早期运行时链接器,加载目标文件(ELF/MachO/COFF)、分配内存、解析symbol、执行 relocation。但 target-specific 代码太多,每个架构都要手工写 relocation patch 逻辑。 llvm 后来引入 ORC(on request compilation) v2。JITLink 是 graph-based linker

May 18, 2026 · 1 min · 26 words · xyenchi

大学习nan

近日观测到dram和冰冰对RISC-V isa manual float point部分进行了补充说明的patch。 冰冰解释了 printf 打印 float 会丢失符号位,因为有 float 转 double 的过程,但是直接printf double就没有问题。 icenowy@edelgard [ tmp ] $ gcc test.c icenowy@edelgard [ tmp ] $ ./a.out -nan icenowy@edelgard [ tmp ] $ cat test.c #include <stdio.h> union u { unsigned long i; double f; }; int main() { union u u; u.i = 0xfff0000001000000ul; printf("%f\n", u.f); return 0; } 恰好我需要修的llvm mlir测例中出现了如下内容: // CHECK-NEXT: -nan %h = arith.constant 1.0 : f64 %h_p = arith.constant 0xfff0000001000000 : f64 call @func_powff64(%h, %h_p) : (f64, f64) -> () 报错: ...

April 16, 2026 · 2 min · 344 words · xyenchi

openEuler RISC-V使用tmux乱码解决方法

添加 ~/.tmux.conf 配置文件 set -g default-terminal "xterm-256color" set -g assume-paste-time 0 set -g escape-time 0 set -g history-limit 100000 set -g terminal-overrides ',*:smcup@:rmcup@' 配置终端 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 重载一下tmux配置文件tmux source-file ~/.tmux.conf 这样其实也是根本没有debug出来root cause的囫囵吞枣解法(

April 15, 2026 · 1 min · 33 words · xyenchi

仰卧起坐

不知不觉一个月没更新,这一个月去干啥了呢? 想要修pytorch的cpuinfo里L1/L2 cache size问题,但是看不动代码。办公室退租的事情也要办了, 一堆东西不知道拿它们怎么办才好、RISC-V advocate的写文章、办活动任务、不知道明天和意外 哪个先来的突发状况。有时候觉得是不是能有心力写记录也是一种幸福的表现呢。

April 14, 2026 · 1 min · 7 words · xyenchi

一些记录

测试集发现了一个 flaot 到 int 转换的问题 python test/test_tensor_creation_ops.py TestTensorCreationCPU.test_float_to_int_conversion_nonfinite_cpu_int16 python import torch import math torch.tensor([math.inf, -math.inf, math.nan]).to(torch.int16) 结果是 tensor([-1, 0, -1], dtype=torch.int16) 在 aten/src/ATen/native/cpu/CopyKernel.cpp 中 的 copy_kernel 函数 iter.has_contiguous_first_dim() 条件为真。 python test/inductor/test_aot_inductor_arrayref.py AOTInductorTestABICompatibleCpuWithStackAllocation.test_misc_1_max_autotune_True_cpu_with_stack_allocation python test/inductor/test_cpu_select_algorithm.py TestSelectAlgorithmCPU.test_aoti_bmm_unique_identifiers_cpu_float32 python test/inductor/test_cpu_select_algorithm.py TestSelectAlgorithmCPU.test_int8_woq_mm_batch_size_17_mid_dim_1_in_features_144_out_features_1024_cpu_bfloat16 >>> L1_cache_size = torch.cpu.get_capabilities().get("l1d_cache_size", 0) >>> print(L1_cache_size) 0 >>> print(torch.cpu.get_capabilities()) {'l1d_cache_size': 0, 'num_logical_cores': 64, 'num_physical_cores': 64, 'l2_cache_size': 0, 'num_sockets': 1, 'cpu_name': '', 'architecture': 'riscv64'} 测试在读 cpuinfo 的时候读到L1 cache size是0,还有救 python test/inductor/test_binary_folding.py FreezingCpuTests.test_conv_binary_folding_cpu 看起来是精度问题,可能也得救 python test/inductor/test_compile_subprocess.py CpuTests.test_remove_noop_slice1_cpu图生成失败问题,log里建议重新跑 ...

March 9, 2026 · 2 min · 328 words · xyenchi

linalg

好几次都卡在 test_linalg 上了,跑得好慢,专门跑 python test/test_linalg.py -vv 还有报直接跑太慢了跳过的。 test_linalg_matrix_exp_analytic_cpu_complex128 (__main__.TestLinalgCPU.test_linalg_matrix_exp_analytic_cpu_complex128) ... skipped 'test is slow; run with PYTORCH_TEST_WITH_SLOW to enable test' test_linalg_matrix_exp_analytic_cpu_complex64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_analytic_cpu_complex64) ... skipped 'test is slow; run with PYTORCH_TEST_WITH_SLOW to enable test' test_linalg_matrix_exp_analytic_cpu_float32 (__main__.TestLinalgCPU.test_linalg_matrix_exp_analytic_cpu_float32) ... skipped 'test is slow; run with PYTORCH_TEST_WITH_SLOW to enable test' test_linalg_matrix_exp_analytic_cpu_float64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_analytic_cpu_float64) ... skipped 'test is slow; run with PYTORCH_TEST_WITH_SLOW to enable test' test_linalg_matrix_exp_batch_cpu_float32 (__main__.TestLinalgCPU.test_linalg_matrix_exp_batch_cpu_float32) ... ok test_linalg_matrix_exp_batch_cpu_float64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_batch_cpu_float64) ... ok test_linalg_matrix_exp_boundary_cases_cpu_complex128 (__main__.TestLinalgCPU.test_linalg_matrix_exp_boundary_cases_cpu_complex128) ... ok test_linalg_matrix_exp_boundary_cases_cpu_complex64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_boundary_cases_cpu_complex64) ... ok test_linalg_matrix_exp_boundary_cases_cpu_float32 (__main__.TestLinalgCPU.test_linalg_matrix_exp_boundary_cases_cpu_float32) ... ok test_linalg_matrix_exp_boundary_cases_cpu_float64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_boundary_cases_cpu_float64) ... ok test_linalg_matrix_exp_compare_with_taylor_cpu_complex128 (__main__.TestLinalgCPU.test_linalg_matrix_exp_compare_with_taylor_cpu_complex128) ... ok test_linalg_matrix_exp_compare_with_taylor_cpu_complex64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_compare_with_taylor_cpu_complex64) ... ok test_linalg_matrix_exp_compare_with_taylor_cpu_float32 (__main__.TestLinalgCPU.test_linalg_matrix_exp_compare_with_taylor_cpu_float32) ... ok test_linalg_matrix_exp_compare_with_taylor_cpu_float64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_compare_with_taylor_cpu_float64) ... ok test_linalg_matrix_exp_no_warnings_cpu_complex64 (__main__.TestLinalgCPU.test_linalg_matrix_exp_no_warnings_cpu_complex64) ... ok test_linalg_matrix_exp_perverse_nan_values_cpu_complex128 (__main__.TestLinalgCPU.test_linalg_matrix_exp_perverse_nan_values_cpu_complex128) ... 虽然搜到了一些 openblas 只能设置单线程的 issue,但设置了还是没用, 总是在 test_linalg_matrix_exp_perverse_nan_values_cpu_complex128 单核跑满 100% 不动了。不过 pytorch 的测试集可以设置 @slow 的 tag ,跳过这个测试。 结果又有 setuptools 需要 < 82.0.0

March 3, 2026 · 1 min · 126 words · xyenchi

rsync 制作系统镜像参数不全引发的惨案

近日使用 leader 的梯子失败,使用 ping 进行 debug。 发现 ping 居然 missing cap_net_raw+p capability or setuid 召唤了同事客服,说之前也有类似问题,重装软件包即可解决。 查看了一下原本的软件包和新装的软件包的信息,没有任何区别,包括 build 机器的 id 都一样。虽然在想要找到打包脚本的过程中遭遇了赛博鬼打墙,但是无敌的群友们还是翻出了,linux kernel 在 3.0 版本就支持了 icmp 不需要 sudo 权限。iputils 包中的 set cap 脚本只是给在构建过程中指定了需要 set cap 的情况生效。 https://github.com/iputils/iputils/blob/9900265d41e1a71f3967c6484798a2fff1ffc48b/ping/meson.build#L26 https://github.com/iputils/iputils/blob/9900265d41e1a71f3967c6484798a2fff1ffc48b/meson_options.txt#L27 于是排除了打包问题,找到了制作系统镜像的脚本,里面的 rsync 没有 X 参数,会丢失 xattr。 推荐使用 rsync -aAXH 进行完整的系统备份

March 3, 2026 · 1 min · 47 words · xyenchi

pytorch测试集缺少monkeytype

近日为 pytorch riscv 进行测试,过程中有缺少 python 包 monkeytype 的报错,但是 requirements.txt 中没有相关包。 找到 import monkeytype 的源码。 monkeytype 可以通过在运行时监控实际运行的类型信息,自动为现有的 python 代码库生成静态类型注解。 看起来影响不大,先不管。

February 26, 2026 · 1 min · 19 words · xyenchi