Hi Andrew,

I now looked at the whole series - and the series LGTM,
except for some testcase issues, as outlined below.


First, I notice that there is no call to:
  omp_destroy_allocator (gpu_lowlat);

While it might make sense to leave some of the testcases
without that call for testing purpose, I think at least one
it not all (but one?) should call it for completeness/testing
purpose.

However, the real issue is:

On 03.12.23 01:32, Andrew Stubbs wrote:
      * testsuite/libgomp.c/omp_alloc-4.c: New test.
      * testsuite/libgomp.c/omp_alloc-6.c: New test.

In particular: If you run this without offloading
(not configured, -foffload=disable, or no hardware available)


Result: This will fail all over the place.
I am not sure whether some tests should remain with hostfallback.

If yes, I think you need a check whether
  omp_get_initial_device() == omp_get_default_device()
or something similar.

If not, you should expect it to fail unless
   { target offload_device }


In any case, I get with host fallback the following for the -4.c test:

62: allocate did not coalesce first two chunks
66: allocate did not split first chunk (1)
68: allocate did not split first chunk (2)
73: allocate did not coalesce middle two chunks
77: allocate did not split second chunk (1)
79: allocate did not split second chunk (2)
84: allocate did not coalesce first two chunks, reverse free
95: allocate did not coalesce second two chunks, reverse free
107: allocate did not coalesce first three chunks
111: allocate did not split first chunk (1)
115: allocate did not split first chunk (3)
121: allocate did not coalesce last three chunks
125: allocate did not split second chunk (1)
129: allocate did not split second chunk (3)
135: allocate did not coalesce first three chunks, reverse free
149: allocate did not coalesce second three chunks, reverse free
163: allocate did not coalesce first three chunks, mixed free
167: allocate did not split first chunk (1), mixed free
169: allocate did not split first chunk (2), mixed free
177: allocate did not coalesce second three chunks, mixed free
181: allocate did not split second chunk (1), mixed free
183: allocate did not split second chunk (2), mixed free
192: allocate did not coalesce all memory

And with ASAN already for:
49: allocate did not reuse first chunk
53: allocate did not reuse second chunk
57: allocate did not reuse third chunk
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1395708==ERROR: AddressSanitizer: SEGV on unknown address 0xfffffffffffffffb 
(pc 0x7ffa2f649025 bp 0xfffffffffffffffb sp 0x7ffe22a90910 T0)
...
    #4 0x401748 in main._omp_fn.0 libgomp/testsuite/libgomp.c/omp_alloc-4.c:59



And the -6 tests fails with:

72: realloc did not extend into whole next chunk
free(): invalid pointer
Segmentation fault (core dumped)

where the free() crash is at:
74          p = omp_realloc (b, size3, lowlat, lowlat);

And with ASAN it fails already with:

48: realloc did not reuse same size chunk, no space after
=================================================================
==1396453==ERROR: AddressSanitizer: heap-use-after-free on address 
0x5040000000b0 at pc 0x7f83c3ef9406 bp 0x7fffc48d7e10 sp 0x7fffc48d75d0
...
READ of size 8 at 0x5040000000b0 thread T0
...
    #5 0x401358 in main libgomp/testsuite/libgomp.c/omp_alloc-6.c:23
freed by thread T0 here:
    #1 0x7f83c459af6a in omp_realloc 
../../../repos/gcc/libgomp/config/linux/../../allocator.c:1219
previously allocated by thread T0 here:
    #1 0x7f83c459a13b in omp_aligned_alloc 
../../../repos/gcc/libgomp/config/linux/../../allocator.c:626


Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to