FuseReport
이 페이지에서

FuseReport

인터페이스, 런타임 분류

fuse 스코프에서 계획을 실행한 결과를 담은 보고서입니다.

import type { FuseReport } from 'typeshade'
import type { FuseReport } from 'typeshade/runtime'
import type { FuseReport } from 'typeshade/fuse'

설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.

구문

interface FuseReport {
readonly tier: Tier;
readonly dispatches: number;
readonly submissions: number;
readonly webgpuScratch?: { /** Newly created storage buffers acquired for scratch arrays. */ readonly allocations: number; /** The sum of those new buffers' descriptor sizes. */ readonly allocatedBytes: number; /** Existing storage buffers borrowed from the owner pool for scratch arrays. */ readonly reuses: number; /** The sum of those borrowed buffers' descriptor sizes. */ readonly reusedBytes: number; };
readonly groups: readonly { readonly calls: readonly string[]; readonly fused: boolean; /** The tier the calls of the group ran on (change 0118): every call of a fused group ran on * WebGPU, and any other group is one call. A group that ran on a later tier than the plan's * `tier`, and that has no other reason to give, says why in `why`: `b runs on the CPU, ` or * `b runs on WebGL2, `, then the reason of each tier of the owner (`configure({ prefer })`, * `createDevice({ prefer })`) before its own, in that order, joined by `; `. Each reason is * the one the `Error` of a call that no tier can run gives that tier, without the * `webgpu: `, `webgl2: ` or `cpu: ` before it. */ readonly tier: Tier; /** Device commands this group made: direct/indirect dispatches on WebGPU, draws on WebGL2, * zero on the CPU. Includes push stages, reduction folds and store-only entries. These * counts sum to the report's `dispatches`; workgroup shapes do not determine them. */ readonly dispatches: number; readonly why?: string; /** The workgroup of each dispatch the group made on WebGPU, as `[n, 1, 1]`, in dispatch * order. A fused group or a single-loop call has one entry. A lone call of a function with * more than one loop has one entry per loop: a map loop then a reducing loop gives * `[[64,1,1],[256,1,1]]`. The fold levels of a reduction are not entries; they run at the * size of their reducing loop. The entry that stores after a function's loops adds none * (change 0094), so a function with no loop has `[]`. Absent exactly when the group does not * run on WebGPU. */ readonly workgroupShapes?: readonly (readonly [number, number, number])[]; /** The GPU time of the group's compute passes, in nanoseconds, as the device measured it with * timestamp queries (`timestamp-query`). Gaps between passes are in no group's time. The * browser may round each timestamp to a coarser step. Absent when the device did not measure * it: no `timestamp-query` feature, a group that does not run on WebGPU, or a failed read of * the timestamps. It is not 0 in those cases. */ readonly gpuTime?: number; /** Present, and `true`, for the group of an entry call whose workgroup count a * `Resident<Uint32Array>` holds, `entry(bindings, { indirect, offset? })` (change 0075). * Such a call is a group of its own. On WebGPU `dispatches` counts its dispatch once, whatever * the counts hold, since the plan does not read them. The CPU tier and WebGL2 read them from * the host copy when the call runs, and run nothing for a count with a 0 in it. */ readonly indirect?: true; }[];
readonly chunk?: { readonly key: string; readonly units: number; readonly elapsedMs: number; };
}

설명

디스패치와 제출 개수는 계획이 장치에 보낸 호출을 나타냅니다. dispatches는 WebGPU의 디스패치 하나 또는 WebGL2의 드로 하나입니다. submissions는 queue.submit 한 번이며, 계획이 필요로 한 Resident 읽기도 포함됩니다. webgpuScratch는 계획의 스크래치 배열을 위해 확보한 스토리지를 따로 기록합니다.

typeshade/fuse, typeshade/runtime, 패키지 루트가 모두 내보냅니다(변경 0071, 수정안 2). 그래서 보고서를 다루는 호스트는 플래너를 가져오지 않고도 타입을 붙일 수 있습니다.

인스턴스 속성

tier읽기 전용 Tier

계획의 호출 가운데 실행된 가장 앞선 tier이며, 곧 그룹들의 tier 가운데 가장 앞선 값입니다. 순서는 WebGPU, WebGL2, CPU tier이며, 어떤 호출도 장치에서 실행되지 않으면 'cpu'입니다. 각 호출은 configure({ prefer })의 tier 가운데 실행할 수 있는 첫 번째 tier에서 실행됩니다. 스코프 밖의 호출이 그렇게 실행되는 것과 같습니다.

dispatches읽기 전용 number

계획이 만든 디스패치 수입니다. CPU tier에서는 없습니다.

submissions읽기 전용 number

계획이 WebGPU 큐에 명령을 넘긴 횟수입니다. 다른 tier에서는 없습니다. 호출이 모두 WebGPU에서 실행되는 스코프는 1입니다. reduce하는 호출도 여기에 들어갑니다. 리덕션의 루프, 부분 결과를 접는 디스패치, 접은 값을 복사하는 작업이 모두 그 제출 하나에 담깁니다. WebGL2나 CPU tier에서 실행되는 호출은 배열을 호스트에서 읽으므로, 계획이 그 전에 들고 있는 값을 먼저 제출합니다. 그 호출이 필요로 하는 Resident를 디바이스에서 읽는 일도 제출 하나씩입니다.

webgpuScratch선택 사항읽기 전용 { /** Newly created storage buffers acquired for scratch arrays. */ readonly allocations: number; /** The sum of those new buffers' descriptor sizes. */ readonly allocatedBytes: number; /** Existing storage buffers borrowed from the owner pool for scratch arrays. */ readonly reuses: number; /** The sum of those borrowed buffers' descriptor sizes. */ readonly reusedBytes: number; }

이 계획의 스크래치 배열을 위해 확보한 WebGPU 스토리지입니다(변경 0128). 런타임이 새로 만드는 보고서에는 0인 값을 포함해 카운터 네 개가 항상 들어 있습니다. 이전 보고서나 직접 만든 보고서에 이 항목이 없으면 알 수 없다는 뜻입니다. 바이트 수는 레이아웃 패딩을 포함한 버퍼 디스크립터의 크기이며, 실제 GPU 힙 사용량이 아닙니다. 일반 resident, 리덕션의 부분 결과, 스테이징, 유니폼, WebGL2나 호스트의 저장 공간은 세지 않습니다.

groups읽기 전용 readonly { readonly calls: readonly string[]; readonly fused: boolean; /** The tier the calls of the group ran on (change 0118): every call of a fused group ran on * WebGPU, and any other group is one call. A group that ran on a later tier than the plan's * `tier`, and that has no other reason to give, says why in `why`: `b runs on the CPU, ` or * `b runs on WebGL2, `, then the reason of each tier of the owner (`configure({ prefer })`, * `createDevice({ prefer })`) before its own, in that order, joined by `; `. Each reason is * the one the `Error` of a call that no tier can run gives that tier, without the * `webgpu: `, `webgl2: ` or `cpu: ` before it. */ readonly tier: Tier; /** Device commands this group made: direct/indirect dispatches on WebGPU, draws on WebGL2, * zero on the CPU. Includes push stages, reduction folds and store-only entries. These * counts sum to the report's `dispatches`; workgroup shapes do not determine them. */ readonly dispatches: number; readonly why?: string; /** The workgroup of each dispatch the group made on WebGPU, as `[n, 1, 1]`, in dispatch * order. A fused group or a single-loop call has one entry. A lone call of a function with * more than one loop has one entry per loop: a map loop then a reducing loop gives * `[[64,1,1],[256,1,1]]`. The fold levels of a reduction are not entries; they run at the * size of their reducing loop. The entry that stores after a function's loops adds none * (change 0094), so a function with no loop has `[]`. Absent exactly when the group does not * run on WebGPU. */ readonly workgroupShapes?: readonly (readonly [number, number, number])[]; /** The GPU time of the group's compute passes, in nanoseconds, as the device measured it with * timestamp queries (`timestamp-query`). Gaps between passes are in no group's time. The * browser may round each timestamp to a coarser step. Absent when the device did not measure * it: no `timestamp-query` feature, a group that does not run on WebGPU, or a failed read of * the timestamps. It is not 0 in those cases. */ readonly gpuTime?: number; /** Present, and `true`, for the group of an entry call whose workgroup count a * `Resident<Uint32Array>` holds, `entry(bindings, { indirect, offset? })` (change 0075). * Such a call is a group of its own. On WebGPU `dispatches` counts its dispatch once, whatever * the counts hold, since the plan does not read them. The CPU tier and WebGL2 read them from * the host copy when the call runs, and run nothing for a count with a 0 in it. */ readonly indirect?: true; }[]

호출의 그룹이 순서대로 나열됩니다. 각 그룹은 커널 함수의 이름으로 표시됩니다. fused인 그룹은 루프 디스패치 하나를 함께 쓰며, 리덕션을 접는 디스패치가 더해집니다. why에는 작성한 코드에 대응하는 용어로 그룹이 앞 그룹과 왜 구분되는지, 또는 왜 계획의 tier보다 뒤의 tier에서 실행되었는지가 적힙니다(그룹의 tier 참고). 적을 내용이 없는 그룹에서는 이 항목이 빠집니다.

chunk선택 사항읽기 전용 { readonly key: string; readonly units: number; readonly elapsedMs: number; }

계획이 실행한 긴 커널의 청크입니다(변경 0074). 계획이 device.fuse(body, { chunk })였을 때만 있습니다. key와 units는 그 청크의 값입니다. elapsedMs는 계획이 시작한 때부터 펜스(device.wait())까지 걸린 실제 시간을 밀리초로 잰 값입니다. 디바이스는 이 값으로 key의 처리 속도를 갱신합니다.

소스

src/core/fuse-report.ts, 19행, 커밋 af54ddad5 기준

이 페이지 편집 문제 보고