File tree Expand file tree Collapse file tree 3 files changed +22
-25
lines changed Expand file tree Collapse file tree 3 files changed +22
-25
lines changed Original file line number Diff line number Diff line change @@ -14,23 +14,7 @@ inline int ompd_sizeof(ompd_target_prim_types_t t) {
14
14
assert (t != ompd_type_max && " ompd_type_max should not be used anywhere" );
15
15
assert (t != ompd_type_invalid && " request size of invalid type" );
16
16
17
- switch (t) {
18
- case ompd_type_char:
19
- return TValue::type_sizes.sizeof_char ;
20
- case ompd_type_short:
21
- return TValue::type_sizes.sizeof_short ;
22
- case ompd_type_int:
23
- return TValue::type_sizes.sizeof_int ;
24
- case ompd_type_long:
25
- return TValue::type_sizes.sizeof_long ;
26
- case ompd_type_long_long:
27
- return TValue::type_sizes.sizeof_long_long ;
28
- case ompd_type_pointer:
29
- return TValue::type_sizes.sizeof_pointer ;
30
- default :
31
- break ;
32
- }
33
- return 0 ;
17
+ return (((char *)&TValue::type_sizes)[(int )t]);
34
18
}
35
19
36
20
TType &TTypeFactory::getType (ompd_address_space_context_t *context,
Original file line number Diff line number Diff line change @@ -68,6 +68,15 @@ ompd_process_initialize(ompd_address_space_context_t
68
68
.getValue (ompd_state);
69
69
if (ret != ompd_rc_ok)
70
70
return ret;
71
+ ret = callbacks->memory_alloc (sizeof (ompd_address_space_handle_t ),
72
+ (void **)(addrhandle));
73
+ if (ret != ompd_rc_ok)
74
+ return ret;
75
+ // *addrhandle = new ompd_address_space_handle_t;
76
+ if (!addrhandle)
77
+ return ompd_rc_error;
78
+ (*addrhandle)->context = context;
79
+ (*addrhandle)->kind = OMP_DEVICE_KIND_HOST;
71
80
72
81
return ompd_rc_ok;
73
82
}
@@ -110,8 +119,9 @@ ompd_rc_t ompd_release_address_space_handle(
110
119
if (!addr_handle)
111
120
return ompd_rc_bad_input;
112
121
113
- delete addr_handle;
114
- return ompd_rc_ok;
122
+ ompd_rc_t ret = callbacks->memory_free ((void *)(addr_handle));
123
+ // delete addr_handle;
124
+ return ret;
115
125
}
116
126
117
127
ompd_rc_t ompd_device_initialize (
@@ -151,8 +161,11 @@ ompd_rc_t ompd_device_initialize(
151
161
if ( ret != ompd_rc_ok )
152
162
continue ;
153
163
154
- if (cuda_ctx == (*((uint64_t *)id))) {
155
- *device_handle = new ompd_address_space_handle_t ;
164
+ if (cuda_ctx == *((uint64_t *)id)) {
165
+ ret = callbacks->memory_alloc (sizeof (ompd_address_space_handle_t ),
166
+ (void **)(device_handle));
167
+ if (ret != ompd_rc_ok)
168
+ return ret;
156
169
if (!device_handle)
157
170
return ompd_rc_error;
158
171
(*device_handle)->context = device_context;
Original file line number Diff line number Diff line change @@ -64,9 +64,6 @@ void ompd_init()
64
64
OMPD_FOREACH_SIZEOF (ompd_init_sizeof)
65
65
#undef ompd_init_sizeof
66
66
67
- ompd_dll_locations=ompd_my_dll_locations;
68
- ompd_dll_locations_valid ();
69
-
70
67
const char *ompd_env_var = getenv (" OMP_OMPD" );
71
68
if (ompd_env_var && !strcmp (ompd_env_var, " on" ))
72
69
{
@@ -77,6 +74,9 @@ void ompd_init()
77
74
}
78
75
79
76
ompd_initialized = 1 ;
77
+ ompd_dll_locations=ompd_my_dll_locations;
78
+ ompd_dll_locations_valid ();
79
+
80
80
}
81
81
82
82
/* void omp_ompd_enable ( void )
@@ -90,7 +90,7 @@ void ompd_init()
90
90
#endif
91
91
}*/
92
92
93
- void ompd_dll_locations_valid ( void ){
93
+ void __attribute__ ((noinline)) ompd_dll_locations_valid ( void ){
94
94
/* naive way of implementing hard to opt-out empty function
95
95
we might want to use a separate object file? */
96
96
asm (" " );
You can’t perform that action at this time.
0 commit comments