WebGPU Kernels
CPU STFT 결과를 받아 conventional delay-and-sum(DAS)을 WebGPU로 실행합니다. backend: "auto"는
WebGPU unavailable, device limit, validation/OOM, device-loss 같은 운용 오류에서만 CPU 기준 구현으로
한 번 fallback합니다. backend: "webgpu"는 오류를 숨기지 않으며, 취소와 잘못된 입력도 fallback하지
않습니다.
계산 구조
das.wgsl.js는 두 compute pass를 제공합니다.
compute_steering:(bin, point, microphone)별 보정된 complex steering vector를 한 번 계산compute_das: 모든 STFT frame에서 steering을 재사용해 frame 평균 power 계산
평면 scan 순서, phase 부호, 감도/위상 보정, complex multiply, bin 평균과 peak normalization은 CPU
기준 구현과 동일합니다. GPU 결과를 읽은 뒤 band 조합과 정규화는 finalizeDasBands()를 함께
사용하므로 raw map과 display map의 의미도 같습니다.
장치 한도와 메모리
실행기는 하드코딩한 GPU 크기를 믿지 않고 device.limits를 조회합니다. steering buffer는 기본
64 MiB, 전체 활성 GPU working set은 기본 256 MiB 이하가 되도록 분할합니다. CPU FFT 재계산을
피하기 위해 가능한 bin batch를 유지하고 steering이 커지면 point를 먼저 chunk합니다. output storage와
MAP_READ staging buffer는 WebGPU usage 규칙에 따라 분리합니다.
장치 초기화, WGSL getCompilationInfo(), async pipeline 생성, validation/OOM/internal error scope,
device.lost, uncapturederror, readback 실패를 각각 처리합니다. 관련 기준은 최신
WebGPU specification과
WGSL floating-point accuracy를 따릅니다.
검증과 benchmark
/tests/: CPU/GPU 교차검증 또는 WebGPU가 없는 환경의 실제 CPU fallback/benchmarks/webgpu-scaling.html: 192채널 fixture를 예열한 뒤 50²/100²/200² 각각 3회 측정하고 JSON 저장docs/benchmarks/webgpu-intel-gen9-2026-08-28.json: Intel Gen9에서 기록한 기준 실측
실측의 gpuWallMs는 이미 queue에 넣은 input transfer의 완료 대기 + 두 compute pass + readback
wall-clock입니다. host packing과 writeBuffer() 호출은 그 타이머 직전이며, totalMs에는 이 작업과
장치/pipeline 초기화, CPU STFT도 포함됩니다. GPU timestamp query는 필수 기능이 아니므로 지원되지
않는 장치도 동일한 계산 경로를 쓸 수 있습니다.