[llvm-bugs] [Bug 46012] New: declare target pointer cannot be accessed in target region
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 20 14:44:11 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46012
Bug ID: 46012
Summary: declare target pointer cannot be accessed in target
region
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Runtime Library
Assignee: unassignedbugs at nondot.org
Reporter: xw111luoye at gmail.com
CC: llvm-bugs at lists.llvm.org
In the following example, a pointer in declare target doesn't get the mapped
address. IBM XL works.
Clang run output:
arr omp_target_is_present 0
arr initial device address (nil)
arr host address 0x13e2f20
arr omp_target_is_present 1
arr device address inside map 0x7f9536800000
device address 0 (nil)
device address 1 (nil)
device address 2 (nil)
arr omp_target_is_present 0
arr final device address (nil)
#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
#pragma omp declare target
int * arr;
void foo(int i)
{
printf("devuce address %d %p\n", i, arr);
}
#pragma omp end declare target
int main(void)
{
// Allocate array and set to zero
int len = 3;
arr = (int *) calloc( len, sizeof(int) );
printf("arr omp_target_is_present %d\n", omp_target_is_present(arr, 0));
#pragma omp target data use_device_ptr(arr)
{
printf("arr initial device address %p\n", arr);
}
#pragma omp target data map(tofrom: arr[:len])
{
printf("arr host address %p\n", arr);
printf("arr omp_target_is_present %d\n", omp_target_is_present(arr, 0));
#pragma omp target data use_device_ptr(arr)
{
printf("arr device address inside map %p\n", arr);
}
#pragma omp target teams distribute parallel for
for( int i = 0; i < len; i++)
foo(i);
}
printf("arr omp_target_is_present %d\n", omp_target_is_present(arr, 0));
#pragma omp target data use_device_ptr(arr)
{
printf("arr final device address %p\n", arr);
}
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200520/8b6071c0/attachment.html>
More information about the llvm-bugs
mailing list