[all-commits] [llvm/llvm-project] dbd7ba: [openmp] Annotate tmp variables with omp_thread_me...
Jon Chesterfield via All-commits
all-commits at lists.llvm.org
Wed Aug 18 18:22:33 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dbd7bad9ad9bc32538e324417c23387bf4ac7747
https://github.com/llvm/llvm-project/commit/dbd7bad9ad9bc32538e324417c23387bf4ac7747
Author: Jon Chesterfield <jonathanchesterfield at gmail.com>
Date: 2021-08-19 (Thu, 19 Aug 2021)
Changed paths:
M clang/lib/Headers/__clang_hip_math.h
A clang/test/Headers/Inputs/include/omp.h
Log Message:
-----------
[openmp] Annotate tmp variables with omp_thread_mem_alloc
Fixes miscompile of calls into ocml. Bug 51445.
The stack variable `double __tmp` is moved to dynamically allocated shared
memory by CGOpenMPRuntimeGPU. This is usually fine, but when the variable
is passed to a function that is explicitly annotated address_space(5) then
allocating the variable off-stack leads to a miscompile in the back end,
which cannot decide to move the variable back to the stack from shared.
This could be fixed by removing the AS(5) annotation from the math library
or by explicitly marking the variables as thread_mem_alloc. The cast to
AS(5) is still a no-op once IR is reached.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D107971
More information about the All-commits
mailing list