llvm / llvm/llvm-project

[AMDGPU] HIP miscompilation bug (rshift of unsigned vector types)

Open
#198,601 4 comments 0 reactions 3 assignees Claimed by @kzhuravl View on GitHub
backend:AMDGPU miscompilation
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The following HIP program triggers a miscompilation bug. The output should be a deterministic value as it's UB free. The bug manifests by enabling optimisations which cause a divergence in the printed value.

Test File:
[HIPProg.hip](https://gist.github.com/ElliotBLabs/b9209d62792a2af20d1bc45190335a5a)

How to reproduce:

1. `clang++ -O0 -x hip HIPProg.hip --offload-arch=native -o O0.out`
2. `clang++ -O1 -x hip HIPProg.hip --offload-arch=native -o O1.out`
3. `./O0.out `
4. `./O1.out`

Compare output values:
Bug (-O1): ['4', '4', '4', '4']
Ref (-O0): ['0', '0', '0', '0']

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.