[all-commits] [llvm/llvm-project] 4ef658: [Clang][OpenMP] Fix mapping of structs to device (...
Gheorghe-Teodor Bercea via All-commits
all-commits at lists.llvm.org
Mon Dec 18 06:48:12 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4ef6587715bec4520332528c4a71fe5a9ac10477
https://github.com/llvm/llvm-project/commit/4ef6587715bec4520332528c4a71fe5a9ac10477
Author: Gheorghe-Teodor Bercea <doru.bercea at amd.com>
Date: 2023-12-18 (Mon, 18 Dec 2023)
Changed paths:
M clang/lib/CodeGen/CGOpenMPRuntime.cpp
A clang/test/OpenMP/map_struct_ordering.cpp
A openmp/libomptarget/test/offloading/struct_mapping_with_pointers.cpp
Log Message:
-----------
[Clang][OpenMP] Fix mapping of structs to device (#75642)
Fix mapping of structs to device.
The following example fails:
```
#include <stdio.h>
#include <stdlib.h>
struct Descriptor {
int *datum;
long int x;
int xi;
long int arr[1][30];
};
int main() {
Descriptor dat = Descriptor();
dat.datum = (int *)malloc(sizeof(int)*10);
dat.xi = 3;
dat.arr[0][0] = 1;
#pragma omp target enter data map(to: dat.datum[:10]) map(to: dat)
#pragma omp target
{
dat.xi = 4;
dat.datum[dat.arr[0][0]] = dat.xi;
}
#pragma omp target exit data map(from: dat)
return 0;
}
```
This is a rework of the previous attempt:
https://github.com/llvm/llvm-project/pull/72410
More information about the All-commits
mailing list