此页面尚未针对此版本进行翻译。英文版本为权威版本。 查看英文版本 →

GPU 编程

版本化 GPU 构件、已验证语法与当前 attested 状态。

GPU 编程

这个仓库快照现在有两个已提交的编译器 profile:

  • souc-linux-x86_64:默认 native profile
  • souc-linux-x86_64-gpu:公开 GPU profile

Self-hosted GPU 路径

默认 self-hosted 编译器(bin/souc)接受 GPU kernel 语法,并允许 kretikos 输出预定义的 artifact template:

# 输出预定义的 vec_add PTX template
kretikos emit-ptx vec_add     -o /tmp/kernel.ptx
kretikos emit-ptx vec_sub     -o /tmp/kernel.ptx
kretikos emit-ptx vec_mul     -o /tmp/kernel.ptx
kretikos emit-ptx vec_div     -o /tmp/kernel.ptx
kretikos emit-ptx vec_add_f64 -o /tmp/kernel.ptx
kretikos emit-ptx fma         -o /tmp/kernel.ptx

kretikos emit-metal vec_add          -o /tmp/kernel.metal
kretikos emit-metal ossm_oct_step    -o /tmp/kernel.metal
kretikos emit-metal sedenion_cd_step -o /tmp/kernel.metal

# 输出预定义的 vec_add_f32 CUBIN template
kretikos emit-cubin vec_add_f32 -o /tmp/kernel.cubin

# 输出 PTX+CUBIN 和 structural bundle manifest
kretikos bundle -o /tmp/kretikos-bundle

今日已验证

export SOUC_GPU_BIN="$(pwd)/artifacts/omega/souc-bin/souc-linux-x86_64-gpu"
export SOUNIO_STDLIB_PATH="$(pwd)/stdlib"

"$SOUC_GPU_BIN" info
"$SOUC_GPU_BIN" check examples/gpu.sio
"$SOUC_GPU_BIN" check tests/run-pass/gpu_launch_surface.sio
"$SOUC_GPU_BIN" build examples/kernel_matmul.sio --backend gpu -o /tmp/kernel_matmul.ptx

这说明今天公开可证明的部分是:

  • 已提交 GPU 构件启用了 GPU codegen。
  • 公开 PTX 输出路径是 build --backend gpu
  • kernel fnwith GPUGPU.launchGPU.sync 被该 GPU profile 接受。

当前公开表面

当前已验证的公开表面:

  • kernel fn
  • with GPU
  • perform GPU.launch(...)
  • perform GPU.sync()
  • 通过 build --backend gpu 输出 PTX

当前还不属于已提交公开表面:

  • gpu.thread_id.*
  • gpu.block_id.*
  • gpu.block_dim.*
  • gpu.alloc<T>(...)

后端证据

最强证据位于 artifacts/omega/

  • gpu_codegen_parity.v1.json
  • gpu_binary_attestation.v1.json
  • gpu_runtime_attest_gate.v1.json
  • gpu_public_contract.v1.json

当前 attested 计算 lanes:

  • CUDA:cuda-sm80
  • ROCm:rocm-gfx942