Skip to content

[BUG]: Race reported in CUB's WarpExchangeSmem #1892

Closed

Description

@alliepiper

Is this a duplicate?

Type of Bug

Something else

Component

CUB

Describe the bug

https://github.com/NVIDIA/cccl/actions/runs/9606424817/job/26497169981?pr=1879

  	compute-sanitizer --tool racecheck --check-device-heap yes --leak-check full --padding 512 --track-stream-ordered-races all --check-warpgroup-mma yes --require-cuda-init no --check-exit-code yes --error-exitcode 1 --nvtx true /home/coder/cccl/build/cuda12.4-gcc13/cub-cpp17/bin/cub.cpp17.test.device_run_length_encode_non_trivial_runs.lid_0
  ========= COMPUTE-SANITIZER
  ========= Error: Race reported between Write access at void cub::CUB_200500_600_700_800_NS::detail::WarpExchangeSmem<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, (int)15, (int)32>::ScatterToStriped<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, int>(const cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int> (&)[15], T1 (&)[15], T2 (&)[15])+0x2b80 in /home/coder/cccl/cub/cub/warp/specializations/warp_exchange_smem.cuh:153
  =========     and Write access at void cub::CUB_200500_600_700_800_NS::detail::WarpExchangeSmem<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, (int)15, (int)32>::ScatterToStriped<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, int>(const cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int> (&)[15], T1 (&)[15], T2 (&)[15])+0x2b50 in /home/coder/cccl/cub/cub/warp/specializations/warp_exchange_smem.cuh:153 [2 hazards]
  =========     and Write access at void cub::CUB_200500_600_700_800_NS::detail::WarpExchangeSmem<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, (int)15, (int)32>::ScatterToStriped<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, int>(const cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int> (&)[15], T1 (&)[15], T2 (&)[15])+0x2b80 in /home/coder/cccl/cub/cub/warp/specializations/warp_exchange_smem.cuh:153 [48 hazards]
  =========     and Write access at void cub::CUB_200500_600_700_800_NS::detail::WarpExchangeSmem<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, (int)15, (int)32>::ScatterToStriped<cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int>, int>(const cub::CUB_200500_600_700_800_NS::KeyValuePair<int, int> (&)[15], T1 (&)[15], T2 (&)[15])+0x2bb0 in /home/coder/cccl/cub/cub/warp/specializations/warp_exchange_smem.cuh:153 [3 hazards]
  ========= 

How to Reproduce

compute-sanitizer --tool racecheck --check-device-heap yes --leak-check full --padding 512 --track-stream-ordered-races all --check-warpgroup-mma yes --require-cuda-init no --check-exit-code yes --error-exitcode 1 --nvtx true /home/coder/cccl/build/cuda12.4-gcc13/cub-cpp17/bin/cub.cpp17.test.device_run_length_encode_non_trivial_runs.lid_0

Expected behavior

No diagnostics emitted.

Reproduction link

No response

Operating System

No response

nvidia-smi output

No response

NVCC version

No response

Activity

  1. alliepiper commented on Nov 8, 2024

    @alliepiper
    ContributorAuthor

    I think we'll need to suppress this as well.

    DeviceRLE internally performs a WarpExchange::ScatterToStriped that 'discards' items by scattering them to the same position in the output. This output location is not used, and simply serves as a way to throw away items that aren't needed in the output.

    Since the same memory location is written to multiple times, it's generating these WAW warnings.

    We could refactor the algorithm to avoid these WAW by either (a) adding a ScatterToStripedMask that lets us stencil out the discarded values, or by ensuring that each discarded element is written to a unique location in shmem (there should be enough memory allocated). However, each of these would introduce perf penalties that aren't worthwhile.

    So, we'll just suppress these.

  2. alliepiper commented on Nov 15, 2024

    @alliepiper
    ContributorAuthor

    Added a suppression #1879 .

  3. moved this from Todo to Done in CCCLon Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions