llvm / llvm/llvm-project

[AMDGPU] HIP miscompilation bug (returning aggregate union types across functions)

Open
#198,603 2 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/177235f9408af9874f99034d159cef06)

How to reproduce:

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

Compare output values:
Bug (-O1): 50331648
Ref (-O0): 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.