Skip to content

Prefer IVF-PQ compute_similarity blockDim=512 on AMD (gfx1100) - #7

Open
konkolchin wants to merge 1 commit into
AMD-Ecosystem:release/rocmds-25.10from
konkolchin:amd-ivf-pq-prefer-blockdim-512
Open

Prefer IVF-PQ compute_similarity blockDim=512 on AMD (gfx1100)#7
konkolchin wants to merge 1 commit into
AMD-Ecosystem:release/rocmds-25.10from
konkolchin:amd-ivf-pq-prefer-blockdim-512

Conversation

@konkolchin

Copy link
Copy Markdown

Summary

  • Prefer blockDim=512 for IVF-PQ compute_similarity launches on HIP/AMD after stock occupancy auto-shrink, which under-sizes blocks on RDNA3 (gfx1100).
  • Measured on RX 7900 XTX (library IVF_PQ m=32, SIFT-1M): ~+21–26% search QPS at nprobe 8/16/32 vs stock heuristic, recall@10 unchanged; optional env HIPVS_IVF_PQ_BLOCK_THREADS still overrides when set.
  • Mid-grid hipVS/cuVS library ratio improves from ~0.48–0.50× to ~0.60–0.62× on peer GPUs (not a claim of closing the full gap).

Context

Test plan

  • Library bench on gfx1100: INDEX_TYPE=IVF_PQ M=32 — stderr shows block_threads=512; nprobe=32 QPS ~270k vs ~217k stock
  • Recall@10 ladder unchanged (~0.35 → ~0.73)
  • CI / reviewers: build libcuvs for target AMD arch and run existing IVF-PQ gtests / neighbors benches if available

Hardcode gfx1100-friendly launch default (+28-36% search QPS vs stock auto-shrink on RX 7900 XTX; recall unchanged). DXC dashboard builds pick this up after rebuild.

Co-authored-by: Cursor <cursoragent@cursor.com>
@konkolchin
konkolchin requested a review from a team August 15, 2026 10:43
}
}
}
#endif

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution and for sharing the performance results, those improvements look promising. Would you mind removing the HIPVS_IVF_PQ_BLOCK_THREADS environment-variable handling? We’d prefer not to expose an environment variable for configuring this launch parameter. Instead, the preferred block size should be derived from the device’s reported wavefront size.
Could you also update the comments to describe the device-derived policy and remove the reference to the “patch 0005” override? Thanks again for working on this optimization.

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.

3 participants