@graphty/webgpu-graph-algorithms 0.6.15 → 0.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/dist/browser.js +1 -1
- package/dist/chunks/{context-oXphO3yj.js → context-VIvatQOo.js} +61 -34
- package/dist/chunks/context-VIvatQOo.js.map +1 -0
- package/dist/node.js +1 -1
- package/dist/src/accelerator.d.ts +2 -1
- package/dist/src/accelerator.d.ts.map +1 -1
- package/dist/src/accelerator.js +53 -1
- package/dist/src/accelerator.js.map +1 -1
- package/dist/src/algorithms/all-pairs.d.ts +41 -0
- package/dist/src/algorithms/all-pairs.d.ts.map +1 -0
- package/dist/src/algorithms/all-pairs.js +181 -0
- package/dist/src/algorithms/all-pairs.js.map +1 -0
- package/dist/src/algorithms/components.d.ts +9 -1
- package/dist/src/algorithms/components.d.ts.map +1 -1
- package/dist/src/algorithms/components.js +2 -2
- package/dist/src/algorithms/components.js.map +1 -1
- package/dist/src/algorithms/label-propagation.d.ts +31 -0
- package/dist/src/algorithms/label-propagation.d.ts.map +1 -0
- package/dist/src/algorithms/label-propagation.js +254 -0
- package/dist/src/algorithms/label-propagation.js.map +1 -0
- package/dist/src/algorithms/simple-symmetric.d.ts +88 -0
- package/dist/src/algorithms/simple-symmetric.d.ts.map +1 -0
- package/dist/src/algorithms/simple-symmetric.js +347 -0
- package/dist/src/algorithms/simple-symmetric.js.map +1 -0
- package/dist/src/algorithms/triangles.d.ts +34 -0
- package/dist/src/algorithms/triangles.d.ts.map +1 -0
- package/dist/src/algorithms/triangles.js +203 -0
- package/dist/src/algorithms/triangles.js.map +1 -0
- package/dist/src/constants.d.ts +45 -0
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +45 -0
- package/dist/src/constants.js.map +1 -1
- package/dist/src/index.d.ts +8 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/kernel/prelude.d.ts.map +1 -1
- package/dist/src/kernel/prelude.js +4 -1
- package/dist/src/kernel/prelude.js.map +1 -1
- package/dist/src/kernels.d.ts +16 -4
- package/dist/src/kernels.d.ts.map +1 -1
- package/dist/src/kernels.js +223 -3
- package/dist/src/kernels.js.map +1 -1
- package/dist/src/memory/residency.js +15 -4
- package/dist/src/memory/residency.js.map +1 -1
- package/dist/src/primitives/coo-to-csr.d.ts +73 -0
- package/dist/src/primitives/coo-to-csr.d.ts.map +1 -0
- package/dist/src/primitives/coo-to-csr.js +183 -0
- package/dist/src/primitives/coo-to-csr.js.map +1 -0
- package/dist/src/primitives/group-by-key.d.ts +82 -0
- package/dist/src/primitives/group-by-key.d.ts.map +1 -0
- package/dist/src/primitives/group-by-key.js +147 -0
- package/dist/src/primitives/group-by-key.js.map +1 -0
- package/dist/src/types/accelerator.d.ts +10 -2
- package/dist/src/types/accelerator.d.ts.map +1 -1
- package/dist/src/types/all-pairs.d.ts +35 -0
- package/dist/src/types/all-pairs.d.ts.map +1 -0
- package/dist/src/types/all-pairs.js +8 -0
- package/dist/src/types/all-pairs.js.map +1 -0
- package/dist/src/types/community.d.ts +18 -0
- package/dist/src/types/community.d.ts.map +1 -0
- package/dist/src/types/community.js +5 -0
- package/dist/src/types/community.js.map +1 -0
- package/dist/src/types/structure.d.ts +27 -0
- package/dist/src/types/structure.d.ts.map +1 -0
- package/dist/src/types/structure.js +8 -0
- package/dist/src/types/structure.js.map +1 -0
- package/dist/src/wgsl/apsp-fw.wgsl.d.ts +25 -0
- package/dist/src/wgsl/apsp-fw.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/apsp-fw.wgsl.js +113 -0
- package/dist/src/wgsl/apsp-fw.wgsl.js.map +1 -0
- package/dist/src/wgsl/apsp-init.wgsl.d.ts +12 -0
- package/dist/src/wgsl/apsp-init.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/apsp-init.wgsl.js +26 -0
- package/dist/src/wgsl/apsp-init.wgsl.js.map +1 -0
- package/dist/src/wgsl/coo-emit.wgsl.d.ts +10 -0
- package/dist/src/wgsl/coo-emit.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/coo-emit.wgsl.js +33 -0
- package/dist/src/wgsl/coo-emit.wgsl.js.map +1 -0
- package/dist/src/wgsl/coo-scatter.wgsl.d.ts +15 -0
- package/dist/src/wgsl/coo-scatter.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/coo-scatter.wgsl.js +32 -0
- package/dist/src/wgsl/coo-scatter.wgsl.js.map +1 -0
- package/dist/src/wgsl/group-by-key-row.wgsl.d.ts +26 -0
- package/dist/src/wgsl/group-by-key-row.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/group-by-key-row.wgsl.js +146 -0
- package/dist/src/wgsl/group-by-key-row.wgsl.js.map +1 -0
- package/dist/src/wgsl/lpa-step.wgsl.d.ts +10 -0
- package/dist/src/wgsl/lpa-step.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/lpa-step.wgsl.js +35 -0
- package/dist/src/wgsl/lpa-step.wgsl.js.map +1 -0
- package/dist/src/wgsl/orient-flags.wgsl.d.ts +9 -0
- package/dist/src/wgsl/orient-flags.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/orient-flags.wgsl.js +21 -0
- package/dist/src/wgsl/orient-flags.wgsl.js.map +1 -0
- package/dist/src/wgsl/run-flags.wgsl.d.ts +8 -0
- package/dist/src/wgsl/run-flags.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/run-flags.wgsl.js +18 -0
- package/dist/src/wgsl/run-flags.wgsl.js.map +1 -0
- package/dist/src/wgsl/tri-intersect.wgsl.d.ts +11 -0
- package/dist/src/wgsl/tri-intersect.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/tri-intersect.wgsl.js +64 -0
- package/dist/src/wgsl/tri-intersect.wgsl.js.map +1 -0
- package/dist/webgpu-graph-algorithms.js +1819 -181
- package/dist/webgpu-graph-algorithms.js.map +1 -1
- package/package.json +4 -4
- package/src/accelerator.ts +56 -1
- package/src/algorithms/all-pairs.ts +228 -0
- package/src/algorithms/components.ts +2 -2
- package/src/algorithms/label-propagation.ts +280 -0
- package/src/algorithms/simple-symmetric.ts +409 -0
- package/src/algorithms/triangles.ts +240 -0
- package/src/constants.ts +45 -0
- package/src/index.ts +12 -1
- package/src/kernel/prelude.ts +6 -0
- package/src/kernels.ts +248 -6
- package/src/memory/residency.ts +15 -4
- package/src/primitives/coo-to-csr.ts +251 -0
- package/src/primitives/group-by-key.ts +209 -0
- package/src/types/accelerator.ts +10 -2
- package/src/types/all-pairs.ts +37 -0
- package/src/types/community.ts +18 -0
- package/src/types/structure.ts +28 -0
- package/src/wgsl/apsp-fw.wgsl.ts +112 -0
- package/src/wgsl/apsp-init.wgsl.ts +25 -0
- package/src/wgsl/coo-emit.wgsl.ts +32 -0
- package/src/wgsl/coo-scatter.wgsl.ts +31 -0
- package/src/wgsl/group-by-key-row.wgsl.ts +145 -0
- package/src/wgsl/lpa-step.wgsl.ts +34 -0
- package/src/wgsl/orient-flags.wgsl.ts +20 -0
- package/src/wgsl/run-flags.wgsl.ts +17 -0
- package/src/wgsl/tri-intersect.wgsl.ts +63 -0
- package/dist/chunks/context-oXphO3yj.js.map +0 -1
package/README.md
CHANGED
|
@@ -695,7 +695,7 @@ never relaxed silently.
|
|
|
695
695
|
|
|
696
696
|
<!-- targets-table:nvidia-lovelace-driver580 -->
|
|
697
697
|
|
|
698
|
-
Generated by `pnpm run bench:readme` from `benchmarks/results/targets.json`. Each figure is the best median the row has recorded, the baseline `bench:compare` pins: Node rows across the
|
|
698
|
+
Generated by `pnpm run bench:readme` from `benchmarks/results/targets.json`. Each figure is the best median the row has recorded, the baseline `bench:compare` pins: Node rows across the 10 session(s) of `benchmarks/results/nvidia-lovelace-driver580.json`, Chromium rows across the 3 of `benchmarks/results/nvidia-lovelace-driver0.json`.
|
|
699
699
|
|
|
700
700
|
| Id | What | Target | Measured | Status |
|
|
701
701
|
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | -------- |
|
|
@@ -722,11 +722,11 @@ Generated by `pnpm run bench:readme` from `benchmarks/results/targets.json`. Eac
|
|
|
722
722
|
| T-14 | Fruchterman-Reingold exact tier, GPU time per iteration (profiler) at 100k (`repulsion: "exact"`) | recorded | 16.322 ms | recorded |
|
|
723
723
|
| T-14 | Spring-electrical preset, GPU time per iteration (profiler) at 10k | recorded | 0.648 ms | recorded |
|
|
724
724
|
| T-14 | Spring-electrical preset, GPU time per iteration (profiler) at 100k (`repulsion: "exact"`) | recorded | 18.154 ms | recorded |
|
|
725
|
-
| T-10 | BFS direction-optimizing (`breadthFirstSearch`), wall end to end including the upload, from node 0 of the undirected RMAT at 1M / 10M (a contract on the dev box only) | <= 100 ms |
|
|
726
|
-
| T-10 | BFS top-down, the same traversal at 1M / 10M | recorded |
|
|
725
|
+
| T-10 | BFS direction-optimizing (`breadthFirstSearch`), wall end to end including the upload, from node 0 of the undirected RMAT at 1M / 10M (a contract on the dev box only) | <= 100 ms | 84.989 ms | met |
|
|
726
|
+
| T-10 | BFS top-down, the same traversal at 1M / 10M | recorded | 81.261 ms | recorded |
|
|
727
727
|
| T-10 | BFS direction-optimizing, the same traversal at 100k / 1M | recorded | 12.837 ms | recorded |
|
|
728
|
-
| T-10 | BFS on the 1000 x 1000 grid from a corner (1,999 levels), wall including the upload (a contract on the dev box only) | <= 1500 ms |
|
|
729
|
-
| T-10 | `sssp` (the near-far queue), wall end to end including the upload, random f32 weights in [0.1, 10), at 1M / 10M | recorded |
|
|
728
|
+
| T-10 | BFS on the 1000 x 1000 grid from a corner (1,999 levels), wall including the upload (a contract on the dev box only) | <= 1500 ms | 369.673 ms | met |
|
|
729
|
+
| T-10 | `sssp` (the near-far queue), wall end to end including the upload, random f32 weights in [0.1, 10), at 1M / 10M | recorded | 256.320 ms | recorded |
|
|
730
730
|
| T-10 | `sssp`, the same run at 100k / 1M | recorded | 47.421 ms | recorded |
|
|
731
731
|
|
|
732
732
|
<!-- /targets-table:nvidia-lovelace-driver580 -->
|
package/dist/browser.js
CHANGED
|
@@ -106,6 +106,14 @@ const BC_BATCH_BUDGET_FRACTION = 0.25;
|
|
|
106
106
|
const BC_MAX_BATCH = 64;
|
|
107
107
|
const BC_EDGE_PARALLEL_GAMMA = 2;
|
|
108
108
|
const BC_BACKWARD_LEVELS_PER_SUBMIT = 64;
|
|
109
|
+
const APSP_TILE = 32;
|
|
110
|
+
const APSP_MAX_DISPATCHES_PER_SUBMIT = 4096;
|
|
111
|
+
const LABEL_PROP_PASSES_PER_SUBMIT = 8;
|
|
112
|
+
const GROUP_ROW_THREAD_MAX = 32;
|
|
113
|
+
const GROUP_ROW_THREAD_LIMIT = 128;
|
|
114
|
+
const PARALLEL_MERGE_LIMIT = 65e3;
|
|
115
|
+
const GROUP_HASH_LOAD_FACTOR = 2;
|
|
116
|
+
const TRIANGLE_BINARY_SEARCH_RATIO = 32;
|
|
109
117
|
const PASSTHROUGH_FORMAT_CODES = Object.freeze(["E_GPU_INELIGIBLE", "E_UNKNOWN_NODE", "E_UNKNOWN_COLUMN", "E_COLUMN_LENGTH"]);
|
|
110
118
|
const EMPTY_DETAILS = Object.freeze({});
|
|
111
119
|
class WebGpuGraphError extends Error {
|
|
@@ -926,6 +934,9 @@ const GRID_EXTENT_FLOOR: f32 = ${wgslF32Literal(GRID_EXTENT_FLOOR)};
|
|
|
926
934
|
const GRID_BBOX_MARGIN: f32 = ${wgslF32Literal(GRID_BBOX_MARGIN)};
|
|
927
935
|
const RADIX_BINS: u32 = ${RADIX_BINS}u;
|
|
928
936
|
const RADIX_DIGIT_MASK: u32 = ${RADIX_BINS - 1}u;
|
|
937
|
+
const APSP_TILE: u32 = ${APSP_TILE}u;
|
|
938
|
+
const GROUP_HASH_LOAD_FACTOR: u32 = ${GROUP_HASH_LOAD_FACTOR}u;
|
|
939
|
+
const TRIANGLE_BINARY_SEARCH_RATIO: u32 = ${TRIANGLE_BINARY_SEARCH_RATIO}u;
|
|
929
940
|
const F32_MAX: f32 = 0x1.fffffep+127;
|
|
930
941
|
override WG: u32 = ${WORKGROUP_SIZE}u;
|
|
931
942
|
override USE_PERM: bool = false;
|
|
@@ -2637,7 +2648,8 @@ class GraphResidency {
|
|
|
2637
2648
|
/**
|
|
2638
2649
|
* Uploads (or finds) a view: outDegree / inDegree / degreeOrder / reverseDegreeOrder upload one array each;
|
|
2639
2650
|
* reverse and edgeList (P7) upload their arrays perArray, never into the arena, and are memoised per record so
|
|
2640
|
-
* a second call uploads nothing (spec 4.3). coo
|
|
2651
|
+
* a second call uploads nothing (spec 4.3). coo uploads its per-arc `src` (P11; the rest aliases the core); mate ->
|
|
2652
|
+
* E_UNSUPPORTED. packViews concatenates a
|
|
2641
2653
|
* reverse or edgeList view into ONE buffer at STORAGE_ALIGN offsets; on any other view `true` is E_UNSUPPORTED
|
|
2642
2654
|
* { option: "packViews" }.
|
|
2643
2655
|
* @param s - the snapshot
|
|
@@ -2704,10 +2716,18 @@ class GraphResidency {
|
|
|
2704
2716
|
break;
|
|
2705
2717
|
}
|
|
2706
2718
|
case "coo":
|
|
2719
|
+
this.assertNotReleased(s);
|
|
2720
|
+
this.assertNonEmpty(s);
|
|
2721
|
+
if (s.arcCount === 0) {
|
|
2722
|
+
return Object.freeze({ view: name, bindings: Object.freeze({}), scalars: Object.freeze({}) });
|
|
2723
|
+
}
|
|
2724
|
+
array = s.coo().src;
|
|
2725
|
+
bindingName = "src";
|
|
2726
|
+
break;
|
|
2707
2727
|
case "mate":
|
|
2708
|
-
throw new WebGpuGraphError("E_UNSUPPORTED",
|
|
2709
|
-
feature:
|
|
2710
|
-
hint: "outDegree, inDegree, degreeOrder, reverseDegreeOrder, reverse and edgeList are uploaded"
|
|
2728
|
+
throw new WebGpuGraphError("E_UNSUPPORTED", "the mate view is not uploaded: no kernel reads it", {
|
|
2729
|
+
feature: "view:mate",
|
|
2730
|
+
hint: "outDegree, inDegree, degreeOrder, reverseDegreeOrder, coo, reverse and edgeList are uploaded"
|
|
2711
2731
|
});
|
|
2712
2732
|
default:
|
|
2713
2733
|
throw invalid("name", name, "a view name");
|
|
@@ -3517,33 +3537,40 @@ class GpuContext {
|
|
|
3517
3537
|
}
|
|
3518
3538
|
}
|
|
3519
3539
|
export {
|
|
3520
|
-
|
|
3540
|
+
SE_SCALE_REFERENCE_NODES as $,
|
|
3541
|
+
APSP_MAX_DISPATCHES_PER_SUBMIT as A,
|
|
3521
3542
|
BufferUsage as B,
|
|
3522
|
-
|
|
3523
|
-
|
|
3543
|
+
LAYOUT_TUNING_DEFAULTS as C,
|
|
3544
|
+
EXACT_MAX_NODES as D,
|
|
3524
3545
|
EXACT_TILES_PER_PASS as E,
|
|
3525
3546
|
FUSED_FRONTIER_MAX as F,
|
|
3526
3547
|
GpuContext as G,
|
|
3527
|
-
|
|
3548
|
+
SETTLE_FLOOR_UNBOUNDED as H,
|
|
3528
3549
|
INDIRECT_ARGS_STRIDE as I,
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3550
|
+
GRID_BBOX_MARGIN as J,
|
|
3551
|
+
GRID_EXTENT_FLOOR as K,
|
|
3552
|
+
LABEL_PROP_PASSES_PER_SUBMIT as L,
|
|
3532
3553
|
MAX_WORKGROUPS_PER_DIM as M,
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3554
|
+
FR_ADAPTIVE_MAX_ITERATIONS as N,
|
|
3555
|
+
FR_START_TEMPERATURE as O,
|
|
3556
|
+
PARALLEL_MERGE_LIMIT as P,
|
|
3557
|
+
FA2_FLAG_ADAPTIVE as Q,
|
|
3537
3558
|
RADIX_BINS as R,
|
|
3538
3559
|
STATE_HEADER_BYTES as S,
|
|
3539
3560
|
TRACE_RECORD_BYTES as T,
|
|
3540
3561
|
UNIFORM_SLOT_BYTES as U,
|
|
3541
|
-
|
|
3562
|
+
SETTLE_FLOOR_FRACTION as V,
|
|
3542
3563
|
WebGpuGraphError as W,
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3564
|
+
FR_REHEAT_FRACTION as X,
|
|
3565
|
+
FR_DEFAULTS as Y,
|
|
3566
|
+
SE_DEFAULTS as Z,
|
|
3567
|
+
SETTLE_FLOOR_REFERENCE_NODES as _,
|
|
3546
3568
|
WGSL_RESERVED_WORDS as a,
|
|
3569
|
+
ARC_WINDOW_ALIGN as a0,
|
|
3570
|
+
PASSTHROUGH_FORMAT_CODES as a1,
|
|
3571
|
+
STORAGE_ALIGN as a2,
|
|
3572
|
+
WORKGROUP_SIZE as a3,
|
|
3573
|
+
isSoftwareAdapter as a4,
|
|
3547
3574
|
U32_MAX as b,
|
|
3548
3575
|
MAX_LEVELS_PER_SUBMIT as c,
|
|
3549
3576
|
deviceLostError as d,
|
|
@@ -3555,19 +3582,19 @@ export {
|
|
|
3555
3582
|
BC_BATCH_BUDGET_FRACTION as j,
|
|
3556
3583
|
BC_MAX_BATCH as k,
|
|
3557
3584
|
BC_BACKWARD_LEVELS_PER_SUBMIT as l,
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3585
|
+
APSP_TILE as m,
|
|
3586
|
+
GROUP_ROW_THREAD_MAX as n,
|
|
3587
|
+
GROUP_ROW_THREAD_LIMIT as o,
|
|
3588
|
+
GROUP_HASH_LOAD_FACTOR as p,
|
|
3589
|
+
GRID_COARSEST_SIDE as q,
|
|
3590
|
+
GRID_MIN_SIDE as r,
|
|
3591
|
+
GRID_SORT_BITS as s,
|
|
3592
|
+
FA2_DEFAULTS as t,
|
|
3593
|
+
MAX_ITERATIONS_PER_STEP as u,
|
|
3594
|
+
MAX_1D_ITEMS as v,
|
|
3595
|
+
hasErrorCode as w,
|
|
3596
|
+
FA2_FLAG_FIRST as x,
|
|
3597
|
+
PARTIAL_BYTES as y,
|
|
3598
|
+
GRID_HUB_CELL as z
|
|
3572
3599
|
};
|
|
3573
|
-
//# sourceMappingURL=context-
|
|
3600
|
+
//# sourceMappingURL=context-VIvatQOo.js.map
|