chore: 改名同步 TransPyV -> ViperC(源码/配置内的纯替换)

This commit is contained in:
TermiNexus committed 2026-10-12 15:06:50 +08:00
1 parent 33d91e5d17
commit 85b89b6e8d
16 files changed
+314 -314

No files matched your search

+2 -2
View File
@@ -108,7 +108,7 @@ out[i] = a[i] * b[i] + c[i] # 元素独立, 单趟融合乘加; 每元素
| 文件 | 说明 |
| --- | --- |
| `project.vpj` | Viper 工程配置(产物 `.tpv_build/output/app.exe`) |
| `project.vpj` | Viper 工程配置(产物 `__vpcbuild__/output/app.exe`) |
| `App/main.vp` | Viper 实现: 8 个内核(FMA/ADD/MUL/SQRT × SIMD/原生) + 线程绑定 + QPC/周期双计时 + 进程内多 run; 自解析命令行 `[runs] [len] [iters] [mode]`(GetCommandLineA, 不依赖 sys/memhub) |
| `bench_c.c` | 手写 C: 裸数组 + **全指针 `__restrict`**(fill/内核/校验和/local 指针都加) + noinline, `-O2 -mavx2 -mfma -ffp-contract=fast` 自动向量化单趟 FMA |
| `bench_cpp.cpp` | 手写 C++: `std::vector` + `__restrict`, 同口径(`-O2 -mavx2 -mfma -ffp-contract=fast`) |
@@ -131,7 +131,7 @@ out[i] = a[i] * b[i] + c[i] # 元素独立, 单趟融合乘加; 每元素
### 5.1 构建 Viper 部分(一次性)
在本工程目录(`ViperSpeedBenchmark/`)用你惯用的 tpv 方式构建 `project.vpj`,
产物应为 `.tpv_build/output/app.exe`。若未构建, `run_bench.py` 会提示并**跳过
产物应为 `__vpcbuild__/output/app.exe`。若未构建, `run_bench.py` 会提示并**跳过
全部 Viper 内核变体** 继续其它实现。
> **改了 `App/main.vp` 或 `includes/vipersimd.vp` 后必须重建**, 否则任一 Viper
+1 -1
View File
@@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "同内核多实现测速基准: out[i]=a[i]*b[i]+c[i] (len=16384, iters=65536, 每次run≈2.147e9 flops; 工作集512KiB 常驻私有L2)。Viper 侧第4个命令行参数 mode 可切 8 个内核: FMA/ADD/MUL/SQRT 各一对 SIMD(simd_*_array) 与 原生(scalar_*_array), 用于 SIMD 加速比对照; mode=0 的 FMA SIMD 与 C/C++/Python 对齐",
"source_dir": "./App",
"build_dir": "./.tpv_build",
"build_dir": "./__vpcbuild__",
"compiler": {
"cmd": "llc",
"flags": [
+5 -5
View File
@@ -188,7 +188,7 @@ NATIVE_FLAGS = ["-O2", "-mavx2", "-mfma", "-ffp-contract=fast"]
# Viper 内核实现名 -> (传给 app.exe 的第 4 个参数 mode, 显示名)。
# 全部共用同一个 .tpv_build/output/app.exe, 只差这一个 mode 参数 —— 除"跑哪份内核"
# 全部共用同一个 __vpcbuild__/output/app.exe, 只差这一个 mode 参数 —— 除"跑哪份内核"
# 外没有任何差异, 这是 SIMD vs 原生 对照可信的前提(见 App/main.vp 的 KERNEL_* 常量)。
# 命名规则: `<op>` = SIMD, `scalar_<op>` = 同操作的标量(原生)对照。
VIPER_KERNELS = [
@@ -257,7 +257,7 @@ def iters_for(size):
def viper_exe(root):
return root / ".tpv_build" / "output" / "app.exe"
return root / "__vpcbuild__" / "output" / "app.exe"
# ------------------------------------------------------------
@@ -431,7 +431,7 @@ def build_arg_parser():
p.add_argument("--py-mode", default=None, choices=["auto", "numpy", "pure"],
help="覆盖 bench_py.py 的运行模式(auto/numpy/pure)")
p.add_argument("--viper-exe", default=None,
help="覆盖 Viper 产物路径(默认 .tpv_build/output/app.exe)")
help="覆盖 Viper 产物路径(默认 __vpcbuild__/output/app.exe)")
p.add_argument("--flops-check", action="store_true",
help="核对 RESULT 行的 flops 字段是否与 CFG 总运算量一致, "
"并报告 flops≈2e9(时长≈1s)的行占比及降规模提示")
@@ -536,7 +536,7 @@ def main(argv=None):
+ ", ".join(f"{n}(mode={VIPER_MODE[n]})" for n in viper_wanted))
else:
emit(f"[viper] 未找到 Viper 产物: {vpy_exe}")
emit(" 请先在本工程目录用 tpv 构建 project.vpj(生成 .tpv_build/output/app.exe),")
emit(" 请先在本工程目录用 tpv 构建 project.vpj(生成 __vpcbuild__/output/app.exe),")
emit(" 本次将跳过全部 Viper 内核变体。")
# ---- 逐尺寸 × 逐实现跑测(每组=一次进程启动) ----
@@ -804,7 +804,7 @@ def main(argv=None):
f" | [{lab_other}] {other_us:>11.3f} us {gfl(other_us):>8.3f} GFLOPS"
f" | {aff_txt} | {'PASS' if st['passed'] else 'FAIL'}")
if not any(im == "viper" for (_, im) in results):
emit(" (viper 已跳过: 请先构建 .tpv_build/output/app.exe)")
emit(" (viper 已跳过: 请先构建 __vpcbuild__/output/app.exe)")
for impl, note in compile_notes:
emit(f" ({impl} 已跳过: 编译失败, 见上方)")
emit("=" * 78)