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,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);
}
}