Skip to content

perf: overlap patch reads in split correction, honor percentiles - #766

Merged
anna-grim merged 1 commit into
mainfrom
perf/split-correction-threading
Sep 8, 2026
Merged

perf: overlap patch reads in split correction, honor percentiles#766
anna-grim merged 1 commit into
mainfrom
perf/split-correction-threading

Conversation

@anna-grim

Copy link
Copy Markdown
Collaborator

Split-correction feature extraction read image patches synchronously with the caller's forward pass, and computed all skeleton features before issuing the first read, so neither the GPU nor the network was kept busy.

  • FeaturePipeline: launch the patch reads before computing skeleton features so the two overlap. Image features are stored after the skeleton pass, since proposal profiles are concatenated onto the skeleton-based proposal features.
  • FragmentsDataset: use the prefetch parameter, which was previously unused, to extract features for upcoming batches on a background thread. This overlaps extraction with the caller's forward pass and bounds the number of resident batches. Lower the default to 2, since each queued batch now holds its image patches in memory.
  • ImageFeatureExtractor: pin max_workers to 32, where read throughput plateaus, rather than inheriting a cpu-count-derived default.
  • Pass percentiles through to the ImageConfig that ImageFeatureExtractor builds, which dropped the caller's value and normalized with the ImageConfig default. SplitInferenceConfig now carries the value, mirroring the existing patch_shape override.
  • Store feature matrices as float32 rather than float64, halving the host-to-device transfer of image patches.

Note: split inference now normalizes with percentiles (1, 99.9), where it previously always used (1, 99.5) regardless of configuration.

Split-correction feature extraction read image patches synchronously
with the caller's forward pass, and computed all skeleton features
before issuing the first read, so neither the GPU nor the network was
kept busy.

- FeaturePipeline: launch the patch reads before computing skeleton
  features so the two overlap. Image features are stored after the
  skeleton pass, since proposal profiles are concatenated onto the
  skeleton-based proposal features.
- FragmentsDataset: use the prefetch parameter, which was previously
  unused, to extract features for upcoming batches on a background
  thread. This overlaps extraction with the caller's forward pass and
  bounds the number of resident batches. Lower the default to 2, since
  each queued batch now holds its image patches in memory.
- ImageFeatureExtractor: pin max_workers to 32, where read throughput
  plateaus, rather than inheriting a cpu-count-derived default.
- Pass percentiles through to the ImageConfig that ImageFeatureExtractor
  builds, which dropped the caller's value and normalized with the
  ImageConfig default. SplitInferenceConfig now carries the value,
  mirroring the existing patch_shape override.
- Store feature matrices as float32 rather than float64, halving the
  host-to-device transfer of image patches.

Note: split inference now normalizes with percentiles (1, 99.9), where
it previously always used (1, 99.5) regardless of configuration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@anna-grim
anna-grim merged commit 4cfc8ad into main Sep 8, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant