vibespatial.kernels.constructive.line_merge

NVRTC kernels for line_merge: merge connected LineStrings into longer chains.

ADR-0033: Tier 1 NVRTC for geometry-specific inner loops (endpoint graph construction and chain-following). Tier 3a CCCL for prefix sum (offset computation).

ADR-0002: CONSTRUCTIVE class – fp64 uniform precision. Coordinates are exact subsets of input (no arithmetic on coordinate values), so the precision plan stays fp64 on all devices.

Two-pass count-scatter architecture:
Pass 1 (count): One thread per geometry row. Builds an in-register

endpoint adjacency graph, follows chains, and counts the total number of output coordinates.

Pass 2 (scatter): Same graph-walk logic, but writes coordinates into

pre-allocated output buffers at the offsets computed by prefix sum.

The line-merge graph per geometry is small (bounded by MAX_SEGMENTS), so all adjacency data fits in thread-local arrays. No shared memory needed.

Attributes

Module Contents

vibespatial.kernels.constructive.line_merge.MAX_SEGMENTS = 256
vibespatial.kernels.constructive.line_merge.MAX_COORDS = 8192
vibespatial.kernels.constructive.line_merge.LINE_MERGE_KERNEL_NAMES: tuple[str, Ellipsis] = ('line_merge_count', 'line_merge_scatter')