@graphty/webgpu-graph-algorithms 0.6.21 → 0.6.22

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.
Files changed (54) hide show
  1. package/README.md +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{context-VIvatQOo.js → context-B40Z6lV_.js} +39 -30
  4. package/dist/chunks/context-B40Z6lV_.js.map +1 -0
  5. package/dist/node.js +1 -1
  6. package/dist/src/accelerator.d.ts +1 -1
  7. package/dist/src/accelerator.d.ts.map +1 -1
  8. package/dist/src/accelerator.js +20 -1
  9. package/dist/src/accelerator.js.map +1 -1
  10. package/dist/src/algorithms/mst.d.ts +50 -0
  11. package/dist/src/algorithms/mst.d.ts.map +1 -0
  12. package/dist/src/algorithms/mst.js +245 -0
  13. package/dist/src/algorithms/mst.js.map +1 -0
  14. package/dist/src/constants.d.ts +6 -1
  15. package/dist/src/constants.d.ts.map +1 -1
  16. package/dist/src/constants.js +6 -1
  17. package/dist/src/constants.js.map +1 -1
  18. package/dist/src/index.d.ts +3 -2
  19. package/dist/src/index.d.ts.map +1 -1
  20. package/dist/src/index.js +1 -0
  21. package/dist/src/index.js.map +1 -1
  22. package/dist/src/kernel/prelude.d.ts.map +1 -1
  23. package/dist/src/kernel/prelude.js +7 -1
  24. package/dist/src/kernel/prelude.js.map +1 -1
  25. package/dist/src/kernels.d.ts +5 -2
  26. package/dist/src/kernels.d.ts.map +1 -1
  27. package/dist/src/kernels.js +58 -2
  28. package/dist/src/kernels.js.map +1 -1
  29. package/dist/src/types/accelerator.d.ts +7 -5
  30. package/dist/src/types/accelerator.d.ts.map +1 -1
  31. package/dist/src/types/structure.d.ts +17 -0
  32. package/dist/src/types/structure.d.ts.map +1 -1
  33. package/dist/src/wgsl/mst-best.wgsl.d.ts +13 -0
  34. package/dist/src/wgsl/mst-best.wgsl.d.ts.map +1 -0
  35. package/dist/src/wgsl/mst-best.wgsl.js +32 -0
  36. package/dist/src/wgsl/mst-best.wgsl.js.map +1 -0
  37. package/dist/src/wgsl/mst-link.wgsl.d.ts +14 -0
  38. package/dist/src/wgsl/mst-link.wgsl.d.ts.map +1 -0
  39. package/dist/src/wgsl/mst-link.wgsl.js +39 -0
  40. package/dist/src/wgsl/mst-link.wgsl.js.map +1 -0
  41. package/dist/webgpu-graph-algorithms.js +473 -162
  42. package/dist/webgpu-graph-algorithms.js.map +1 -1
  43. package/package.json +3 -3
  44. package/src/accelerator.ts +22 -2
  45. package/src/algorithms/mst.ts +269 -0
  46. package/src/constants.ts +6 -1
  47. package/src/index.ts +3 -1
  48. package/src/kernel/prelude.ts +7 -0
  49. package/src/kernels.ts +64 -3
  50. package/src/types/accelerator.ts +7 -3
  51. package/src/types/structure.ts +18 -0
  52. package/src/wgsl/mst-best.wgsl.ts +31 -0
  53. package/src/wgsl/mst-link.wgsl.ts +38 -0
  54. package/dist/chunks/context-VIvatQOo.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 10 session(s) of `benchmarks/results/nvidia-lovelace-driver580.json`, Chromium rows across the 3 of `benchmarks/results/nvidia-lovelace-driver0.json`.
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 11 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
  | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- | -------- |
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G as GpuContext, W as WebGpuGraphError } from "./chunks/context-VIvatQOo.js";
1
+ import { G as GpuContext, W as WebGpuGraphError } from "./chunks/context-B40Z6lV_.js";
2
2
  function navigatorGpu() {
3
3
  if (typeof navigator === "undefined") {
4
4
  return void 0;
@@ -109,6 +109,8 @@ const BC_BACKWARD_LEVELS_PER_SUBMIT = 64;
109
109
  const APSP_TILE = 32;
110
110
  const APSP_MAX_DISPATCHES_PER_SUBMIT = 4096;
111
111
  const LABEL_PROP_PASSES_PER_SUBMIT = 8;
112
+ const BORUVKA_ROUNDS_PER_SUBMIT = 4;
113
+ const F32_SIGN_BIT = 2147483648;
112
114
  const GROUP_ROW_THREAD_MAX = 32;
113
115
  const GROUP_ROW_THREAD_LIMIT = 128;
114
116
  const PARALLEL_MERGE_LIMIT = 65e3;
@@ -920,6 +922,7 @@ const PRELUDE_WGSL = (
920
922
  const INVALID_INDEX: u32 = ${INVALID_INDEX}u;
921
923
  const U32_MAX: u32 = ${U32_MAX}u;
922
924
  const F32_INF_BITS: u32 = ${F32_INF_BITS}u;
925
+ const F32_SIGN_BIT: u32 = ${F32_SIGN_BIT}u;
923
926
  const MAX_WORKGROUPS_PER_DIM: u32 = ${MAX_WORKGROUPS_PER_DIM}u;
924
927
  const EXACT_TILES_PER_PASS: u32 = ${EXACT_TILES_PER_PASS}u;
925
928
  const FA2_DIST_FLOOR: f32 = ${wgslF32Literal(FA2_DISTANCE_FLOOR)};
@@ -958,6 +961,11 @@ fn lowbias32(x0: u32) -> u32 {
958
961
  fn mask_bit(w: u32, i: u32) -> bool { return ((w >> (i & 31u)) & 1u) == 1u; }
959
962
  fn unpack_u8(w: u32, i: u32) -> u32 { return (w >> (8u * (i & 3u))) & 0xFFu; }
960
963
  fn pair_hash(i: u32, j: u32) -> u32 { return lowbias32((min(i, j) * 0x9E3779B9u) ^ max(i, j)); }
964
+ fn order_key(w: f32) -> u32 {
965
+ let raw = bitcast<u32>(w);
966
+ let bits = select(raw, 0u, raw == F32_SIGN_BIT);
967
+ return select(bits | F32_SIGN_BIT, ~bits, (bits & F32_SIGN_BIT) != 0u);
968
+ }
961
969
  fn hash_unit(h: u32) -> f32 { return f32(h >> 8u) * (1.0 / 16777216.0); }
962
970
  fn hash_dir(h: u32, dim: u32) -> vec3f {
963
971
  let phi = 6.283185307179586 * hash_unit(h);
@@ -3537,40 +3545,41 @@ class GpuContext {
3537
3545
  }
3538
3546
  }
3539
3547
  export {
3540
- SE_SCALE_REFERENCE_NODES as $,
3548
+ SETTLE_FLOOR_REFERENCE_NODES as $,
3541
3549
  APSP_MAX_DISPATCHES_PER_SUBMIT as A,
3542
3550
  BufferUsage as B,
3543
- LAYOUT_TUNING_DEFAULTS as C,
3544
- EXACT_MAX_NODES as D,
3551
+ GRID_HUB_CELL as C,
3552
+ LAYOUT_TUNING_DEFAULTS as D,
3545
3553
  EXACT_TILES_PER_PASS as E,
3546
3554
  FUSED_FRONTIER_MAX as F,
3547
3555
  GpuContext as G,
3548
- SETTLE_FLOOR_UNBOUNDED as H,
3556
+ EXACT_MAX_NODES as H,
3549
3557
  INDIRECT_ARGS_STRIDE as I,
3550
- GRID_BBOX_MARGIN as J,
3551
- GRID_EXTENT_FLOOR as K,
3558
+ SETTLE_FLOOR_UNBOUNDED as J,
3559
+ GRID_BBOX_MARGIN as K,
3552
3560
  LABEL_PROP_PASSES_PER_SUBMIT as L,
3553
3561
  MAX_WORKGROUPS_PER_DIM as M,
3554
- FR_ADAPTIVE_MAX_ITERATIONS as N,
3555
- FR_START_TEMPERATURE as O,
3562
+ GRID_EXTENT_FLOOR as N,
3563
+ FR_ADAPTIVE_MAX_ITERATIONS as O,
3556
3564
  PARALLEL_MERGE_LIMIT as P,
3557
- FA2_FLAG_ADAPTIVE as Q,
3565
+ FR_START_TEMPERATURE as Q,
3558
3566
  RADIX_BINS as R,
3559
3567
  STATE_HEADER_BYTES as S,
3560
3568
  TRACE_RECORD_BYTES as T,
3561
3569
  UNIFORM_SLOT_BYTES as U,
3562
- SETTLE_FLOOR_FRACTION as V,
3570
+ FA2_FLAG_ADAPTIVE as V,
3563
3571
  WebGpuGraphError as W,
3564
- FR_REHEAT_FRACTION as X,
3565
- FR_DEFAULTS as Y,
3566
- SE_DEFAULTS as Z,
3567
- SETTLE_FLOOR_REFERENCE_NODES as _,
3572
+ SETTLE_FLOOR_FRACTION as X,
3573
+ FR_REHEAT_FRACTION as Y,
3574
+ FR_DEFAULTS as Z,
3575
+ SE_DEFAULTS as _,
3568
3576
  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,
3577
+ SE_SCALE_REFERENCE_NODES as a0,
3578
+ ARC_WINDOW_ALIGN as a1,
3579
+ PASSTHROUGH_FORMAT_CODES as a2,
3580
+ STORAGE_ALIGN as a3,
3581
+ WORKGROUP_SIZE as a4,
3582
+ isSoftwareAdapter as a5,
3574
3583
  U32_MAX as b,
3575
3584
  MAX_LEVELS_PER_SUBMIT as c,
3576
3585
  deviceLostError as d,
@@ -3586,15 +3595,15 @@ export {
3586
3595
  GROUP_ROW_THREAD_MAX as n,
3587
3596
  GROUP_ROW_THREAD_LIMIT as o,
3588
3597
  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
3598
+ BORUVKA_ROUNDS_PER_SUBMIT as q,
3599
+ GRID_COARSEST_SIDE as r,
3600
+ GRID_MIN_SIDE as s,
3601
+ GRID_SORT_BITS as t,
3602
+ FA2_DEFAULTS as u,
3603
+ MAX_ITERATIONS_PER_STEP as v,
3604
+ MAX_1D_ITEMS as w,
3605
+ hasErrorCode as x,
3606
+ FA2_FLAG_FIRST as y,
3607
+ PARTIAL_BYTES as z
3599
3608
  };
3600
- //# sourceMappingURL=context-VIvatQOo.js.map
3609
+ //# sourceMappingURL=context-B40Z6lV_.js.map