Skip to content

Commit e0538aa

Browse files
committed
Merge remote-tracking branch 'origin/ompd' into ompd-devices
Conflicts: libompd/src/TargetValue.cpp libompd/src/omp-debug.cpp
2 parents 300c218 + b34cb8c commit e0538aa

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

libompd/src/TargetValue.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,7 @@ inline int ompd_sizeof(ompd_target_prim_types_t t) {
1414
assert(t != ompd_type_max && "ompd_type_max should not be used anywhere");
1515
assert(t != ompd_type_invalid && "request size of invalid type");
1616

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]);
3418
}
3519

3620
TType &TTypeFactory::getType(ompd_address_space_context_t *context,

libompd/src/omp-debug.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ ompd_process_initialize(ompd_address_space_context_t
6868
.getValue(ompd_state);
6969
if (ret != ompd_rc_ok)
7070
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;
7180

7281
return ompd_rc_ok;
7382
}
@@ -110,8 +119,9 @@ ompd_rc_t ompd_release_address_space_handle(
110119
if (!addr_handle)
111120
return ompd_rc_bad_input;
112121

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;
115125
}
116126

117127
ompd_rc_t ompd_device_initialize(
@@ -151,8 +161,11 @@ ompd_rc_t ompd_device_initialize(
151161
if ( ret != ompd_rc_ok )
152162
continue;
153163

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;
156169
if (!device_handle)
157170
return ompd_rc_error;
158171
(*device_handle)->context = device_context;

runtime/src/ompd-specific.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ void ompd_init()
6464
OMPD_FOREACH_SIZEOF(ompd_init_sizeof)
6565
#undef ompd_init_sizeof
6666

67-
ompd_dll_locations=ompd_my_dll_locations;
68-
ompd_dll_locations_valid ();
69-
7067
const char *ompd_env_var = getenv("OMP_OMPD");
7168
if (ompd_env_var && !strcmp(ompd_env_var, "on"))
7269
{
@@ -77,6 +74,9 @@ void ompd_init()
7774
}
7875

7976
ompd_initialized = 1;
77+
ompd_dll_locations=ompd_my_dll_locations;
78+
ompd_dll_locations_valid ();
79+
8080
}
8181

8282
/*void omp_ompd_enable ( void )
@@ -90,7 +90,7 @@ void ompd_init()
9090
#endif
9191
}*/
9292

93-
void ompd_dll_locations_valid ( void ){
93+
void __attribute__((noinline)) ompd_dll_locations_valid ( void ){
9494
/* naive way of implementing hard to opt-out empty function
9595
we might want to use a separate object file? */
9696
asm ("");

0 commit comments

Comments
 (0)