@graphty/webgpu-graph-algorithms 0.6.6 → 0.6.8

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/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G as GpuContext, W as WebGpuGraphError } from "./chunks/context-DiSr6eiz.js";
1
+ import { G as GpuContext, W as WebGpuGraphError } from "./chunks/context-Cezi7qpi.js";
2
2
  function navigatorGpu() {
3
3
  if (typeof navigator === "undefined") {
4
4
  return void 0;
@@ -2796,7 +2796,9 @@ class GraphResidency {
2796
2796
  });
2797
2797
  }
2798
2798
  /**
2799
- * One resident per array (spec 4.3: views upload in perArray mode, never into the arena).
2799
+ * One resident per array (spec 4.3: views upload in perArray mode, never into the arena). An empty array (the
2800
+ * colIdx of an edgeless directed reverse view, the src / dst of an edgeless edgeList) is skipped: spec 5.6 never
2801
+ * uploads a zero-length array, and Kernel.bind rejects a zero-size binding, so it is absent as in core().
2800
2802
  * @param record - the owning record
2801
2803
  * @param arrays - the named arrays
2802
2804
  * @param label - the buffer label prefix
@@ -2805,6 +2807,9 @@ class GraphResidency {
2805
2807
  separateArrays(record, arrays, label) {
2806
2808
  const bindings = {};
2807
2809
  for (const [name, array] of arrays) {
2810
+ if (array.byteLength === 0) {
2811
+ continue;
2812
+ }
2808
2813
  const resident = this.upload(record, array, array, `${label}:${name}`);
2809
2814
  bindings[name] = { buffer: resident.buffer, offset: 0, size: resident.byteLength, window: null };
2810
2815
  }
@@ -2818,14 +2823,19 @@ class GraphResidency {
2818
2823
  * lengths, so keying the packed buffer on `rev.rowPtr` would make the packed and the unpacked view of one
2819
2824
  * snapshot collide -- whichever was built second would get the other's buffer. The record still owns the
2820
2825
  * resident, so release(s) destroys it with the rest. Offsets are STORAGE_ALIGN-aligned because Kernel.bind
2821
- * rejects any other offset synchronously (E_INVALID_ARGUMENT { argument: "offset" }).
2826
+ * rejects any other offset synchronously (E_INVALID_ARGUMENT { argument: "offset" }). Empty arrays are left
2827
+ * out as in separateArrays; when nothing is left, nothing is uploaded.
2822
2828
  * @param record - the owning record
2823
- * @param arrays - the named arrays, in buffer order
2829
+ * @param all - the named arrays, in buffer order
2824
2830
  * @param key - the marker object the resident is keyed on
2825
2831
  * @param label - the buffer label
2826
2832
  * @returns the bindings by name, all into the one buffer
2827
2833
  */
2828
- packArrays(record, arrays, key, label) {
2834
+ packArrays(record, all, key, label) {
2835
+ const arrays = all.filter(([, array]) => array.byteLength > 0);
2836
+ if (arrays.length === 0) {
2837
+ return Object.freeze({});
2838
+ }
2829
2839
  const offsets = [];
2830
2840
  let total = 0;
2831
2841
  for (const [, array] of arrays) {
@@ -3542,4 +3552,4 @@ export {
3542
3552
  SETTLE_FLOOR_FRACTION as y,
3543
3553
  FR_REHEAT_FRACTION as z
3544
3554
  };
3545
- //# sourceMappingURL=context-DiSr6eiz.js.map
3555
+ //# sourceMappingURL=context-Cezi7qpi.js.map