Add missing OpenMP 4.5 device entries to stubs library.

llvm-svn: 271006
This commit is contained in:
Jonathan Peyton 2016-05-27 15:51:14 +00:00
parent 2494e8a6a2
commit 50eae7f8b2
3 changed files with 119 additions and 10 deletions

View File

@ -497,6 +497,11 @@ kmp_set_warnings_off 780
omp_get_cancellation 867
kmp_get_cancellation_status 868
omp_is_initial_device 869
%ifdef stub
omp_set_default_device 879
omp_get_default_device 880
omp_get_num_devices 881
%endif
%endif # OMP_40
# OpenMP 41
@ -511,6 +516,16 @@ kmp_set_warnings_off 780
omp_get_place_num 876
omp_get_partition_num_places 877
omp_get_partition_place_nums 878
%ifdef stub
omp_get_initial_device 882
omp_target_alloc 883
omp_target_free 884
omp_target_is_present 885
omp_target_memcpy 886
omp_target_memcpy_rect 887
omp_target_associate_ptr 888
omp_target_disassociate_ptr 889
%endif
%endif # OMP_41
%ifndef stub

View File

@ -887,20 +887,17 @@ xexpand(FTN_GET_TEAM_NUM)( void )
#endif
}
#if KMP_MIC || KMP_OS_DARWIN
static int __kmp_default_device = 0;
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
int FTN_STDCALL
FTN_GET_DEFAULT_DEVICE( void )
{
return __kmp_default_device;
return 0;
}
void FTN_STDCALL
FTN_SET_DEFAULT_DEVICE( int KMP_DEREF arg )
{
__kmp_default_device = KMP_DEREF arg;
}
int FTN_STDCALL
@ -909,7 +906,7 @@ FTN_GET_NUM_DEVICES( void )
return 0;
}
#endif // KMP_MIC || KMP_OS_DARWIN
#endif // KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#if ! KMP_OS_LINUX
@ -939,6 +936,63 @@ xexpand(FTN_IS_INITIAL_DEVICE)( void )
#endif // OMP_40_ENABLED
#if OMP_41_ENABLED && defined(KMP_STUB)
// OpenMP 4.5 entries for stubs library
int FTN_STDCALL
FTN_GET_INITIAL_DEVICE(void)
{
return -1;
}
// As all *target* functions are C-only parameters always passed by value
void * FTN_STDCALL
FTN_TARGET_ALLOC(size_t size, int device_num)
{
return 0;
}
void FTN_STDCALL
FTN_TARGET_FREE(void * device_ptr, int device_num)
{
}
int FTN_STDCALL
FTN_TARGET_IS_PRESENT(void * ptr, int device_num)
{
return 0;
}
int FTN_STDCALL
FTN_TARGET_MEMCPY(void *dst, void *src, size_t length, size_t dst_offset,
size_t src_offset, int dst_device, int src_device)
{
return -1;
}
int FTN_STDCALL
FTN_TARGET_MEMCPY_RECT(void *dst, void *src, size_t element_size, int num_dims,
const size_t *volume, const size_t *dst_offsets,
const size_t *src_offsets, const size_t *dst_dimensions,
const size_t *src_dimensions, int dst_device, int src_device)
{
return -1;
}
int FTN_STDCALL
FTN_TARGET_ASSOCIATE_PTR(void *host_ptr, void *device_ptr, size_t size,
size_t device_offset, int device_num)
{
return -1;
}
int FTN_STDCALL
FTN_TARGET_DISASSOCIATE_PTR(void *host_ptr, int device_num)
{
return -1;
}
#endif // OMP_41_ENABLED && defined(KMP_STUB)
#ifdef KMP_STUB
typedef enum { UNINIT = -1, UNLOCKED, LOCKED } kmp_stub_lock_t;
#endif /* KMP_STUB */

View File

@ -101,7 +101,7 @@
#define FTN_GET_WTICK omp_get_wtick
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device
#define FTN_GET_NUM_DEVICES omp_get_num_devices
@ -122,6 +122,16 @@
#define FTN_GET_PLACE_NUM omp_get_place_num
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device
#define FTN_TARGET_ALLOC omp_target_alloc
#define FTN_TARGET_FREE omp_target_free
#define FTN_TARGET_IS_PRESENT omp_target_is_present
#define FTN_TARGET_MEMCPY omp_target_memcpy
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr
# endif
#endif
#endif /* KMP_FTN_PLAIN */
@ -208,7 +218,7 @@
#define FTN_GET_WTICK omp_get_wtick_
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE omp_get_default_device_
#define FTN_SET_DEFAULT_DEVICE omp_set_default_device_
#define FTN_GET_NUM_DEVICES omp_get_num_devices_
@ -230,6 +240,16 @@
#define FTN_GET_PLACE_NUM omp_get_place_num_
#define FTN_GET_PARTITION_NUM_PLACES omp_get_partition_num_places_
#define FTN_GET_PARTITION_PLACE_NUMS omp_get_partition_place_nums_
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE omp_get_initial_device_
#define FTN_TARGET_ALLOC omp_target_alloc_
#define FTN_TARGET_FREE omp_target_free_
#define FTN_TARGET_IS_PRESENT omp_target_is_present_
#define FTN_TARGET_MEMCPY omp_target_memcpy_
#define FTN_TARGET_MEMCPY_RECT omp_target_memcpy_rect_
#define FTN_TARGET_ASSOCIATE_PTR omp_target_associate_ptr_
#define FTN_TARGET_DISASSOCIATE_PTR omp_target_disassociate_ptr_
# endif
#endif
#endif /* KMP_FTN_APPEND */
@ -316,7 +336,7 @@
#define FTN_GET_WTICK OMP_GET_WTICK
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES
@ -338,6 +358,16 @@
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC
#define FTN_TARGET_FREE OMP_TARGET_FREE
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR
# endif
#endif
#endif /* KMP_FTN_UPPER */
@ -424,7 +454,7 @@
#define FTN_GET_WTICK OMP_GET_WTICK_
#if OMP_40_ENABLED
#if KMP_MIC || KMP_OS_DARWIN
#if KMP_MIC || KMP_OS_DARWIN || defined(KMP_STUB)
#define FTN_GET_DEFAULT_DEVICE OMP_GET_DEFAULT_DEVICE_
#define FTN_SET_DEFAULT_DEVICE OMP_SET_DEFAULT_DEVICE_
#define FTN_GET_NUM_DEVICES OMP_GET_NUM_DEVICES_
@ -446,6 +476,16 @@
#define FTN_GET_PLACE_NUM OMP_GET_PLACE_NUM_
#define FTN_GET_PARTITION_NUM_PLACES OMP_GET_PARTITION_NUM_PLACES_
#define FTN_GET_PARTITION_PLACE_NUMS OMP_GET_PARTITION_PLACE_NUMS_
# ifdef KMP_STUB
#define FTN_GET_INITIAL_DEVICE OMP_GET_INITIAL_DEVICE_
#define FTN_TARGET_ALLOC OMP_TARGET_ALLOC_
#define FTN_TARGET_FREE OMP_TARGET_FREE_
#define FTN_TARGET_IS_PRESENT OMP_TARGET_IS_PRESENT_
#define FTN_TARGET_MEMCPY OMP_TARGET_MEMCPY_
#define FTN_TARGET_MEMCPY_RECT OMP_TARGET_MEMCPY_RECT_
#define FTN_TARGET_ASSOCIATE_PTR OMP_TARGET_ASSOCIATE_PTR_
#define FTN_TARGET_DISASSOCIATE_PTR OMP_TARGET_DISASSOCIATE_PTR_
# endif
#endif
#endif /* KMP_FTN_UAPPEND */