e
This commit is contained in:
parent
caa90775f9
commit
de177e8896
58 changed files with 3904 additions and 2847 deletions
134
README.md
134
README.md
|
|
@ -1,70 +1,110 @@
|
|||
# Mandelbrot Deep Zoom v23
|
||||
# Mandelbrot Deep Zoom v24.1.3 — WebGPU
|
||||
|
||||
軽量な操作表示と、画素中心規約・数値field・境界AA・高精度出力を分離したマンデルブロ集合ビューアーです。無条件の「∞」表記は廃止し、現在のbit数、反復上限、未確定数を表示します。
|
||||
v23のCPU/WASM deep pixel rendererを撤去し、画素計算・field・彩色・再投影・高解像度ExportをWebGPUへ移した版です。
|
||||
|
||||
設計判断は[IMPROVEMENT_PROPOSAL.md](IMPROVEMENT_PROPOSAL.md)、実装・検証状況は[IMPLEMENTATION_REPORT.md](IMPLEMENTATION_REPORT.md)、提案ごとの対応と保留条件は[COMPLETION_AUDIT.md](COMPLETION_AUDIT.md)を参照してください。
|
||||
## 数値構成
|
||||
|
||||
## 実行
|
||||
- ViewState: BigInt固定小数点。深度に応じてbit数を自動拡張。
|
||||
- Shallow: WebGPU `f32` direct iteration。f32座標分解能に十分な余裕があるviewだけで使用。
|
||||
- Deep reference: 専用WorkerでBigInt固定小数点orbitを1本生成。referenceはview精度より64 bit高く生成し、さらに+64 bitのguard orbitでcheckpoint照合。
|
||||
- Deep pixels: WebGPU `guarded rescaled f32 perturbation`。spanはmantissa + exponentへ分離し、`1e-400`級でもpixel offsetをf32 absolute値へ潰さない。
|
||||
- Error handling: roundoff上界がescape/bounded判定へ影響し得るpixelは `FIELD_UNKNOWN` にする。UNKNOWNを内部点へ偽装しない。
|
||||
- BLA: **productionでは無効・未搭載**。旧f32量子化BLAで境界pixelのmembership反転を再現したため、再導入していない。
|
||||
|
||||
Standalone版は`index.html`、`script.js`、`kernels.js`の3ファイルを同じディレクトリに置き、`index.html`を直接開けます。
|
||||
旧v23の`Validated direct`は削除しています。v24.1.3のStrictは誤差許容閾値を厳しくする保守的GPU policyで、任意精度direct全画素証明ではありません。PNG sidecarは常に `membershipCertified:false` です。
|
||||
|
||||
配信用Hosted版はPowerShellから生成します。
|
||||
## 描画パイプライン
|
||||
|
||||
```powershell
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./scripts/build-hosted.ps1
|
||||
通常表示ではfieldをGPUに保持します。
|
||||
|
||||
```text
|
||||
BigInt ViewState
|
||||
└─ deep時: BigInt reference Worker
|
||||
↓
|
||||
WebGPU direct / guarded perturbation
|
||||
↓
|
||||
fieldMeta + fieldSmooth GPU buffers
|
||||
↓
|
||||
GPU color / optional boundary smoothing
|
||||
↓
|
||||
offscreen texture
|
||||
↓
|
||||
GPU reprojection / canvas
|
||||
```
|
||||
|
||||
生成先は`dist/hosted/`です。`dist/wasm/`も同じoriginで配信し、`_headers`相当のCOOP/COEPとWASM MIME設定を反映してください。Standalone成果物は`./scripts/build-standalone.ps1`で生成できます。
|
||||
パレット・cycle・shift・HQ変更は数値fieldを再計算せずrecolorします。pan / wheel / pinch操作中は直前frameをGPUで再投影し、settle後に新しい数値frameを計算します。
|
||||
|
||||
## v23の主要仕様
|
||||
## Export
|
||||
|
||||
- 静止時の常時RAFとDOM更新を廃止し、invalidate時だけ描画します。
|
||||
- wheel/pinch/pan中は既存frameの再投影だけを行い、110ms停止後にPreviewを1回開始します。
|
||||
- `Reprojected → Preview → Covered → Refined → Validated/検証未完了`を内部状態として分離します。
|
||||
- Coveredは選択したeffective DPRのCanvas全域を実sampleで計算します。固定2100px HQ上限はありません。
|
||||
- 全backendのpixel mappingは`(x+0.5, y+0.5)`です。
|
||||
- escape値と分類をpalette非依存fieldに保持し、色変更では集合を再計算しません。
|
||||
- `ESCAPED / INTERIOR_LIKELY / INTERIOR_PROVEN / UNRESOLVED`を区別し、未確定を内部点と同じ黒として扱いません。
|
||||
- 境界detailは2×2 subsample fieldを保持し、linear-lightでresolveします。
|
||||
- High-quality exportは指定寸法、2×2 AA、進捗、取消、JSON sidecarに対応します。現在の表示を即時保存するQuick snapshotも別操作です。
|
||||
- deep Workerは必要時に1基だけ生成し、deepを離れた時点で大容量instanceとreferenceを退役させます。
|
||||
- cacheとScreen Canvasは端末別の論理byte/pixel budgetで管理します。
|
||||
高解像度PNGは最大辺16,384 pxです。
|
||||
|
||||
処理モードの自動到達点:
|
||||
- 512×512以下のGPU tileで計算。
|
||||
- Export用GPU buffers/textures/readback bufferは固定workspaceを再利用し、tileごとの大量生成を避ける。
|
||||
- 2×2 AAは4 sampleをGPUで計算し、GPUでlinear-light resolveした後、tileにつき1回だけreadback。
|
||||
- 全画像Canvasを確保せず、scanline bandを`CompressionStream('deflate')`へ送りPNGを構築。
|
||||
- sidecar JSONへ`unresolvedSamples`を記録。
|
||||
|
||||
| モード | 自動処理 |
|
||||
|---|---|
|
||||
| 省電力 | 約1MP以下のPreviewで停止 |
|
||||
| 標準 | shallowは2〜4MP。deepは48px幅の初回測定後、約1.4秒予算へ全域gridを調整。境界AAと未確定追加反復は既定で行わない |
|
||||
| 精細 | 4〜8MPの全域描画、境界AA、境界候補の上限付き追加反復 |
|
||||
| 精度優先 | 精細処理後にP/P+64照合を含む検証 |
|
||||
`unresolvedSamples > 0`は、数値policyがそのsampleを安全に分類できなかったことを意味します。
|
||||
|
||||
## 互換構成
|
||||
## WebGPU unavailable
|
||||
|
||||
| 構成 | shallow | deep | 出力 | 備考 |
|
||||
|---|---|---|---|---|
|
||||
| Hosted + SIMD + Worker | WASM SIMD Worker | BLA/perturbation Worker | 全機能 | 推奨 |
|
||||
| Hosted + SIMDなし | scalar payload | scalar deep/BLA | 全機能 | SIMD検査後にscalarを取得 |
|
||||
| Hosted + Workerなし | main WASM | high-precision BigInt direct | 全機能、低速 | deep WASMは取得せずdirectへ移行 |
|
||||
| Standalone `file://` | 埋込WASM | 埋込Worker/WASM | 全機能 | 3ファイル、オフライン可 |
|
||||
| OffscreenCanvasなし | Canvas 2D | 同左 | 全機能 | 現行標準経路 |
|
||||
| SharedArrayBufferなし | tile/chunk取消 | tile/chunk取消 | 全機能 | 現行標準経路 |
|
||||
WebGPUが利用できない場合は浅部のみJavaScript f64 fallbackを使います。deep zoomは誤画像を出さず、「このズーム深度はWebGPUが必要です」と表示します。
|
||||
|
||||
## 検査
|
||||
WebGPU自体が存在しない場合だけ軽量な浅部JavaScript fallbackを使います。**WGSL/shader/pipeline初期化エラー時はCPU全画面fallbackへ自動移行しません**。エラーを表示して停止し、shader不具合を隠したままCPUを占有しない設計です。`webgpu` canvas contextはpipeline作成成功後に取得します。high-performance adapterが得られない場合は通常のadapter requestも再試行します。
|
||||
|
||||
固定toolchainを含む全gateは次で実行します。
|
||||
## v24.1.3 hotfix
|
||||
|
||||
```powershell
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./scripts/test-all.ps1 -RequireToolchain
|
||||
実ブラウザで発覚したWGSL parse errorを修正しました。WGSL 16.2で予約されている`meta` / `smooth`をstorage-buffer変数名に使っていたため、`fieldMeta` / `fieldSmooth`へ変更しています。全shaderをWGSL reserved-word一覧へ照合するNode gate `tests/v24-wgsl-reserved.mjs`も追加しました。
|
||||
|
||||
表示負荷も見直し、標準モードのscreen pixel budgetをdesktop約1.5M / 小型端末約0.75Mへ縮小しました(旧版は約4M / 2M)。省電力は約0.5M、精細は最大約3M、Strictは最大約2Mです。WebGPU非対応時のCPU fallbackは約0.25M pixelに制限します。
|
||||
|
||||
## Standalone
|
||||
|
||||
`index.html`, `gpu-kernels.js`, `script.js`の3ファイルで動作します。外部WGSL fetchはありません。
|
||||
|
||||
```text
|
||||
index.html
|
||||
gpu-kernels.js
|
||||
script.js
|
||||
```
|
||||
|
||||
toolchainなしでsource contractだけ確認する場合は次を実行します。
|
||||
ブラウザが`file://`上でWebGPUを許可しない構成ではlocalhost/HTTPSで開いてください。
|
||||
|
||||
```powershell
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./tests/source-contract.ps1
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File ./tests/kernel-source-contract.ps1
|
||||
## Test
|
||||
|
||||
```bash
|
||||
npm test
|
||||
npm run build
|
||||
```
|
||||
|
||||
WASM checksumは`./scripts/extract-wasm.ps1`で再生成します。Nodeテストは本体/Worker構文、WASM Module clone、数値精度、解析的内部証明、pixel mapping/contractを検査します。固定sceneは`tests/scenes.json`にあります。HTTPでworkspaceを配信すれば、`tests/browser-benchmark.html`からcold/warm描画、Covered/Refined、idle write、logical memoryをscene corpus単位で採取できます。
|
||||
`npm test`は以下を検査します。
|
||||
|
||||
WASM source buildと昇格gateは[BUILD_REPRODUCIBILITY.md](BUILD_REPRODUCIBILITY.md)を参照してください。v18の旧性能監査は履歴資料であり、v23の基準値ではありません。
|
||||
- JS syntax / source contracts
|
||||
- WGSL reserved-word token audit (`meta`, `smooth`, `ref`等を含む仕様予約語)
|
||||
- 旧C/WASM deep assetがproduction treeに残っていないこと
|
||||
- BigInt reference Worker + guard checkpoints
|
||||
- shallow f32 CPU model vs BigInt oracle
|
||||
- guarded perturbation CPU f32 model vs BigInt oracle
|
||||
- `swirly-seahorses-z12`高密度回帰と既知3反例
|
||||
- BLAがproductionから除去されていること
|
||||
- tile/pixel geometry
|
||||
- `1e-400` / `1e-1000` coordinate formatting
|
||||
- streaming PNG structure / CRC / inflate / abort
|
||||
- real-WebGPU acceptance harnessのJS syntax
|
||||
|
||||
### 実GPU acceptance
|
||||
|
||||
`tests/webgpu-acceptance.html`をWebGPU対応browserで開きます。これは実adapter上でshader compile / compute / readbackを行い、BigInt oracleと比較します。
|
||||
|
||||
必須gate:
|
||||
|
||||
- stable corpus scene: sampled `UNKNOWN = 0`
|
||||
- swirly scene: 25 sample中12以上を確定
|
||||
- `falseEscaped = 0`
|
||||
- `falseBounded = 0`
|
||||
- reference guard mismatch = 0
|
||||
- 既知dense反例で誤分類しない
|
||||
- 1× / 2×2 Export smokeの未確定sample = 0
|
||||
- uncaptured WebGPU validation error = 0
|
||||
|
||||
このリポジトリを生成した実行環境では`navigator.gpu`が公開されなかったため、実adapter gateだけは未実行です。静的/CPU-model gateの代替ではありません。
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue