docs: add teaching examples and video project

This commit is contained in:
Yaossg 2026-10-11 12:29:28 +08:00
parent e93bc20b0a
commit 7a06f94577
42 changed files with 8022 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# 主线之外的实验
`flattened_position.cuh` 保存此前把 `(seed,x,z)` 展平的实现。
它已从 `cuda_steps.cu` 和默认构建移除,不再作为 03 或 Random 优化的基础。
主线只讲按 seed → 固定坐标后遍历 seed → 复用轴项。
旧测速中的 mode 31 与 03b 标签属于历史实验,见 `../results/mapping_diagnostics.json`。

View file

@ -0,0 +1,16 @@
#pragma once
// Archived experiment; excluded from the teaching sequence and normal build.
// Stage 03b (mode 31): flatten the whole (seed,x,z) product into fine work items.
template<int stage> __global__ void positionKernel(
DeviceArgs a, show::Hit* hits, unsigned long long* count
) {
const uint64_t area=a.width*a.height, total=a.seeds*area;
const uint64_t stride=uint64_t(gridDim.x)*blockDim.x;
for(uint64_t i=uint64_t(blockIdx.x)*blockDim.x+threadIdx.x;i<total;i+=stride) {
const uint64_t s=i/area, p=i%area;
const int32_t x=int32_t(int64_t(a.x0)+int64_t(p/a.height));
const int32_t z=int32_t(int64_t(a.z0)+int64_t(p%a.height));
if(show::solid<stage>(a.seed+s,x,z,a.n)) emit(a,hits,count,a.seed+s,x,z);
}
}