b0nes164 / ShaderOneSweep

A compute shader implementation of the OneSweep sorting algorithm.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NOTICE: This repository has been archived.

This repository has been archived. The development and maintenance of its contents have been moved to https://github.com/b0nes164/GPUSorting.

ShaderOneSweep

This project is an HLSL compute shader implementation of the current state-of-the-art GPU sorting algorithm, Adinets and Merrill's OneSweep, an LSD radix sort that uses Merrill and Garland's Chained Scan with Decoupled Lookback to reduce the overall global data movement during a digit-binning pass from $3n$ to $2n$.

Given an input size of $2^{28}$ 32-bit uniform random keys and a 2080 Super, this implementation achieves a harmonic mean performance of 9.55 G keys/sec as opposed to the 10.9 G keys/sec achieved in the CUDA CUB library.

To Use This Project

  1. Download or clone the repository.
  2. Drag the contents of src into a desired folder within a Unity project.
  3. Each sort has a compute shader and a dispatcher. Attach the desired sort's dispatcher to an empty game object. All sort dispatchers are named SortNameHere.cs.
  4. Attach the matching compute shader to the game object. All compute shaders are named SortNameHere.compute. The dispatcher will return an error if you attach the wrong shader.
  5. Ensure the slider is set to a non-zero value.

Strongly Suggested Reading and Bibliography

About

A compute shader implementation of the OneSweep sorting algorithm.

License:MIT License


Languages

Language:HLSL 73.4%Language:C# 26.6%