public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Andrew Stubbs <ams@codesourcery.com>, <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v3 1/3] libgomp, nvptx: low-latency memory allocator
Date: Tue, 5 Dec 2023 12:25:58 +0100	[thread overview]
Message-ID: <efb9cc01-33b3-4c5e-b07d-2986e5a52da9@codesourcery.com> (raw)
In-Reply-To: <20231203003224.1638841-2-ams@codesourcery.com>

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

  parent reply	other threads:[~2023-12-05 11:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03  0:32 [PATCH v3 0/3] libgomp: OpenMP low-latency omp_alloc Andrew Stubbs
2023-12-03  0:32 ` [PATCH v3 1/3] libgomp, nvptx: low-latency memory allocator Andrew Stubbs
2023-12-04 16:04   ` Tobias Burnus
2023-12-05 15:39     ` Andrew Stubbs
2023-12-05 17:13       ` Tobias Burnus
2023-12-05 11:25   ` Tobias Burnus [this message]
2023-12-03  0:32 ` [PATCH v3 2/3] openmp, nvptx: low-lat memory access traits Andrew Stubbs
2023-12-03  0:32 ` [PATCH v3 3/3] amdgcn, libgomp: low-latency allocator Andrew Stubbs
2023-12-04 15:34 ` [PATCH v3 0/3] libgomp: OpenMP low-latency omp_alloc Tobias Burnus
2023-12-04 15:53   ` Tobias Burnus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efb9cc01-33b3-4c5e-b07d-2986e5a52da9@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=ams@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).