Skip to content

Commit

Permalink
Merge pull request #1 from grypp/release_70
Browse files Browse the repository at this point in the history
Flang extensions
  • Loading branch information
sscalpone authored Nov 28, 2018
2 parents 366ce74 + 816b1f1 commit 0312af6
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libomptarget/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ if(LIBOMPTARGET_CMAKE_BUILD_TYPE MATCHES debug)
add_definitions(-O0)
endif()

set(LIBOMPTARGET_FLANG_API FALSE CACHE BOOL
"Build API for Flang.")
if(${LIBOMPTARGET_FLANG_API})
add_definitions(-DFLANG_API)
libomptarget_say("Building OpenMP API for FLANG.")
endif()

include_directories(include)

# Build target agnostic offloading library.
Expand Down
30 changes: 30 additions & 0 deletions libomptarget/deviceRTLs/nvptx/src/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,36 @@ EXTERN int omp_is_initial_device(void);
EXTERN int omp_get_initial_device(void);
EXTERN int omp_get_max_task_priority(void);


#ifdef FLANG_API
EXTERN double omp_get_wtick_(void);
EXTERN double omp_get_wtime_(void);
EXTERN int omp_get_num_threads_(void);
EXTERN int omp_get_max_threads_(void);
EXTERN int omp_get_thread_limit_(void);
EXTERN int omp_get_thread_num_(void);
EXTERN int omp_get_num_procs_(void);
EXTERN int omp_in_parallel_(void);
EXTERN int omp_in_final_(void);
EXTERN int omp_get_nested_(void);
EXTERN int omp_get_max_active_levels_(void);
EXTERN int omp_get_level_(void);
EXTERN int omp_get_active_level_(void);
EXTERN int omp_get_ancestor_thread_num_(int level);
EXTERN int omp_get_team_size_(int level);
EXTERN int omp_get_default_device_(void);
EXTERN int omp_get_num_devices_(void);
EXTERN int omp_get_num_teams_(void);
EXTERN int omp_get_team_num_(void);
EXTERN void omp_get_schedule_(omp_sched_t *kind, int *modifier);
EXTERN int omp_get_initial_device_(void);
EXTERN int omp_get_max_task_priority_(void);
EXTERN int omp_get_cancellation_(void);
EXTERN int omp_get_dynamic_(void);
EXTERN void omp_lib_osnt4_(int num);
EXTERN void omp_lib_osmal4_(int level);
#endif

////////////////////////////////////////////////////////////////////////////////
// OMPTARGET_NVPTX private (debug / temportary?) interface
////////////////////////////////////////////////////////////////////////////////
Expand Down
64 changes: 64 additions & 0 deletions libomptarget/deviceRTLs/nvptx/src/libcall.cu
Original file line number Diff line number Diff line change
Expand Up @@ -460,3 +460,67 @@ EXTERN void xlf_debug_print_double(double *p) {
EXTERN void xlf_debug_print_addr(void *p) {
printf("xlf DEBUG %d): %p \n", omp_get_team_num(), p);
}


#ifdef FLANG_API
EXTERN double omp_get_wtick_(void) { return omp_get_wtick(); }

EXTERN double omp_get_wtime_(void) { return omp_get_wtime(); }

EXTERN int omp_get_num_threads_(void) { return omp_get_num_threads(); }

EXTERN int omp_get_max_threads_(void) { return omp_get_max_threads(); }

EXTERN int omp_get_thread_limit_(void) { return omp_get_thread_limit(); }

EXTERN int omp_get_thread_num_(void) { return omp_get_thread_num(); }

EXTERN int omp_get_num_procs_(void) { return omp_get_num_procs(); }

EXTERN int omp_in_parallel_(void) { return omp_in_parallel(); }

EXTERN int omp_in_final_(void) { return omp_in_final(); }

EXTERN int omp_get_nested_(void) { return omp_get_nested(); }

EXTERN int omp_get_max_active_levels_(void) {
return omp_get_max_active_levels();
}

EXTERN int omp_get_level_(void) { return omp_get_level(); }

EXTERN int omp_get_active_level_(void) { return omp_get_active_level(); }

EXTERN int omp_get_ancestor_thread_num_(int* level) {
return omp_get_ancestor_thread_num(*level);
}

EXTERN int omp_get_team_size_(int* level) { return omp_get_team_size(*level); }

EXTERN int omp_get_default_device_(void) { return omp_get_default_device(); }

EXTERN int omp_get_num_devices_(void) { return omp_get_num_devices(); }

EXTERN int omp_get_num_teams_(void) { return omp_get_num_teams(); }

EXTERN int omp_get_team_num_(void) { return omp_get_team_num(); }

EXTERN void omp_get_schedule_(omp_sched_t *kind, int *modifier) {
return omp_get_schedule(kind, modifier);
}

EXTERN int omp_get_initial_device_(void) { return omp_get_initial_device(); }

EXTERN int omp_get_max_task_priority_(void) {
return omp_get_max_task_priority();
}

EXTERN int omp_get_cancellation_(void) { return omp_get_cancellation(); }

EXTERN int omp_get_dynamic_(void) { return omp_get_dynamic(); }

EXTERN void omp_lib_osnt4_(int* num) { omp_set_num_threads(*num); }

EXTERN void omp_lib_osmal4_(int* level) { omp_set_max_active_levels(*level); }
#endif

0 comments on commit 0312af6

Please sign in to comment.