In this article
Exact input/output identity is a supported alias case; a shifted overlapping range is a different contract.
An offset buffer changes the alias relationship
A compaction pipeline may compute prefix offsets with cub::DeviceScan and try to save an allocation by moving output into the input buffer. There is a crucial distinction between exactly the same range and a shifted range that overlaps only part of the input.
The current DeviceScan reference explicitly permits equal input and output iterators for the documented in-place scans, while excluding other overlap. The linked development documentation should be matched to the installed CCCL headers.
Exact identity is a specific algorithm contract
An implementation that supports in-place scanning can coordinate reads and writes for that relationship. It does not follow that writing each result into a neighboring input position is also supported. A shifted destination can overwrite data still needed elsewhere in the computation.
Draw the complete input and output ranges, including element size and offset. Pointer inequality alone does not prove separation, and membership in the same allocation does not prove supported in-place use. Treat range analysis as part of the adapter contract.
Querying scratch does not validate values
The device-wide API guide explains the traditional query/allocation/execution pattern. A null temporary-storage query determines requirements without performing the scan. Successful querying therefore cannot establish that the actual input values or application outputs are correct.
Keep the query and execution configuration consistent, including the current CUDA device. A scratch buffer and an output buffer have different ownership roles even if the application allocator supplies both.
Preserve prefix semantics while changing storage
The official exclusive-sum example separates a host reference from device execution. That comparison pattern is useful when introducing an in-place variant.
Check whether the application requires an inclusive or exclusive prefix before comparing buffers. The tensor-axis guide offers a broader reminder that matching shapes do not establish matching meanings. An offset array can have the expected length while encoding the wrong prefix convention.
Regression tests should target the alias boundary
Compare a disjoint-output reference with the documented exact in-place case across empty, short, and irregular-length inputs supported by the selected interface. Reject unsupported shifted overlap at the application boundary rather than relying on an accidental successful run.
Record the actual headers and overload in the GPU evidence record. Newer execution-environment interfaces and traditional explicit-scratch interfaces should not be mixed through assumptions copied from a different release.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.