summaryrefslogtreecommitdiff
path: root/libgomp/ompd-support.h
blob: 39d55161132c747486e76f6c1c6f9c4302a7ecda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/* Copyright (C) The GNU Toolchain Authors.
   Contributed by Mohamed Atef <mohamedatef1698@gmail.com>.
   This file is part of the GNU Offloading and Multi Processing Library
   (libgomp).
   Libgomp is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3, or (at your option)
   any later version.
   Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
   more details.
   Under Section 7 of GPL version 3, you are granted additional
   permissions described in the GCC Runtime Library Exception, version
   3.1, as published by the Free Software Foundation.
   You should have received a copy of the GNU General Public License and
   a copy of the GCC Runtime Library Exception along with this program;
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   <http://www.gnu.org/licenses/>.  */

/* This file contains the runtime support for gompd.  */

#ifndef _OMPD_SUPPORT_H
#define _OMPD_SUPPORT_H

#include "omp-tools.h"
#include "plugin-suffix.h"
#include "libgomp.h"
#include <pthread.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>

#ifdef __ELF__
#define ompd_dll_locations_valid() \
  __asm__ __volatile__ (".globl ompd_dll_locations_valid\n\t" \
                        "ompd_dll_locations_valid:")
#define ompd_bp_parallel_begin() \
  __asm__ __volatile__ (".globl ompd_bp_parallel_begin\n\t" \
                        "ompd_bp_parallel_begin:")
#define ompd_bp_parallel_end() \
  __asm__ __volatile__ (".globl ompd_bp_parallel_end\n\t" \
                        "ompd_bp_parallel_end:")
#define ompd_bp_task_begin() \
  __asm__ __volatile__ (".globl ompd_bp_task_begin\n\t" \
                        "ompd_bp_task_begin:")
#define ompd_bp_task_end() \
  __asm__ __volatile__ (".globl ompd_bp_task_end\n\t" \
                        "ompd_bp_task_end:")
#define ompd_bp_thread_begin() \
  __asm__ __volatile__ (".globl ompd_bp_thread_begin\n\t" \
                        "ompd_bp_thread_begin:")
#define ompd_bp_thread_end() \
  __asm__ __volatile__ (".globl ompd_bp_thread_end\n\t" \
                        "ompd_bp_thread_end:")
#define ompd_bp_device_begin() \
  __asm__ __volatile__ (".globl ompd_bp_device_begin\n\t" \
                        "ompd_bp_device_end:")
#define ompd_bp_device_end() \
  __asm__ __volatile__ (".globl ompd_bp_device_end\n\t" \
                        "ompd_bp_device_end:")
#endif /* __ELF__ */

#ifdef HAVE_ATTRIBUTE_VISIBILITY
#pragma GCC visibility push(hidden)
#endif

void gompd_load (void);
extern __UINT64_TYPE__ gompd_state;

#define OMPD_ENABLED 0x1

#define GOMPD_FOREACH_ACCESS(gompd_access) \
  gompd_access (gomp_task_icv, nthreads_var) \
  gompd_access (gomp_task_icv, run_sched_var) \
  gompd_access (gomp_task_icv, run_sched_chunk_size) \
  gompd_access (gomp_task_icv, default_device_var) \
  gompd_access (gomp_task_icv, thread_limit_var) \
  gompd_access (gomp_task_icv, dyn_var) \
  gompd_access (gomp_task_icv, bind_var) \
  gompd_access (gomp_thread, task) \
  gompd_access (gomp_thread_pool, threads) \
  gompd_access (gomp_thread, ts) \
  gompd_access (gomp_team_state, team_id) \
  gompd_access (gomp_task, icv)

#define GOMPD_SIZES(gompd_size) \
  gompd_size (gomp_thread) \
  gompd_size (gomp_task_icv) \
  gompd_size (gomp_task)

#ifdef HAVE_ATTRIBUTE_VISIBILITY
#pragma GCC visibility pop
#endif

#endif /* _OMPD_SUPPORT_H */