public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc. @ 2021-09-06 9:55 tschwinge at gcc dot gnu.org 2021-09-06 9:59 ` [Bug target/102215] " jakub at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: tschwinge at gcc dot gnu.org @ 2021-09-06 9:55 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215 Bug ID: 102215 Summary: [GCN offloading] Missing '__atomic_compare_exchange_1' etc. Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: openmp Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: tschwinge at gcc dot gnu.org CC: ams at gcc dot gnu.org, jakub at gcc dot gnu.org, jules at gcc dot gnu.org Target Milestone: --- Target: GCN The recent commit 090f0d78f194e3cda23fe904016db77ea36c38fa "openmp: Improve expand_omp_atomic_pipeline" regresses GCN offloading testing as follows: [-PASS:-]{+FAIL:+} libgomp.c/../libgomp.c-c++-common/reduction-16.c (test for excess errors) [-PASS:-]{+UNRESOLVED:+} libgomp.c/../libgomp.c-c++-common/reduction-16.c [-execution test-]{+compilation failed to produce executable+} ld: error: undefined symbol: __atomic_compare_exchange_1 >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.0) >>> referenced by /tmp/cce2YauE.o:(test_char._omp_fn.0) ld: error: undefined symbol: __atomic_compare_exchange_2 >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.1) >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.0) >>> referenced by /tmp/cce2YauE.o:(test_short._omp_fn.0) collect2: error: ld returned 1 exit status mkoffload: fatal error: [...]/gcc/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status Similar for 'libgomp.c++/../libgomp.c-c++-common/reduction-16.c'. And: [-PASS:-]{+FAIL:+} libgomp.c/target-43.c (test for excess errors) [-PASS:-]{+UNRESOLVED:+} libgomp.c/target-43.c [-execution test-]{+compilation failed to produce executable+} ld: error: undefined symbol: __atomic_compare_exchange_1 >>> referenced by /tmp/cc1Kwlmj.o:(main._omp_fn.0) >>> referenced by /tmp/cc1Kwlmj.o:(main._omp_fn.0) collect2: error: ld returned 1 exit status mkoffload: fatal error: [...]/gcc/x86_64-pc-linux-gnu-accel-amdgcn-amdhsa-gcc returned 1 exit status These all do: { dg-additional-options "-foffload-options=nvptx-none=-latomic" { target { offload_target_nvptx } } } Do we now also need libatomic for GCN or should this be handled in the GCN back end? ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/102215] [GCN offloading] Missing '__atomic_compare_exchange_1' etc. 2021-09-06 9:55 [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc tschwinge at gcc dot gnu.org @ 2021-09-06 9:59 ` jakub at gcc dot gnu.org 2021-09-06 11:09 ` burnus at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2021-09-06 9:59 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So what did it do for __sync_val_compare_and_exchange_1 ? Was that expanded inline, or do we have such entrypoint somewhere outside of libatomic, something else? ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/102215] [GCN offloading] Missing '__atomic_compare_exchange_1' etc. 2021-09-06 9:55 [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc tschwinge at gcc dot gnu.org 2021-09-06 9:59 ` [Bug target/102215] " jakub at gcc dot gnu.org @ 2021-09-06 11:09 ` burnus at gcc dot gnu.org 2021-09-06 12:01 ` jakub at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: burnus at gcc dot gnu.org @ 2021-09-06 11:09 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu.org --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #1) > So what did it do for __sync_val_compare_and_exchange_1 ? > Was that expanded inline, or do we have such entrypoint somewhere outside of > libatomic, something else? For nvptx, it became more exposed as libgomp.c-c++-common/reduction-16.c required __sync_val_compare_and_swap_16 – but only on PowerPC – such that config/nvptx/atomic.c was added, which in turn required __atomic_compare_exchange_n. Cf. (libgomp) r11-3182 and (libatomic + config/nvptx/nvptx.md) r11-3145 w/ PR96898 + PR96964. GCN: It seems as everything required so far was handled inline. I did note that one could create atomic testcases which are not handled and require __atomic_ / the nonexisting libatomic library. Regarding libatomic, it is currently disabled for gcn via libatomic/configure.tgt: *) # Who are you? UNSUPPORTED=1 ;; esac I don't know what's needed to support it, but for nvptx, it were only a few lines, cf. r11-3145 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/102215] [GCN offloading] Missing '__atomic_compare_exchange_1' etc. 2021-09-06 9:55 [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc tschwinge at gcc dot gnu.org 2021-09-06 9:59 ` [Bug target/102215] " jakub at gcc dot gnu.org 2021-09-06 11:09 ` burnus at gcc dot gnu.org @ 2021-09-06 12:01 ` jakub at gcc dot gnu.org 2022-03-09 18:35 ` cvs-commit at gcc dot gnu.org 2022-03-10 12:07 ` burnus at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2021-09-06 12:01 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Actually, looking at GCN, it is inline e.g. for both: int foo (int *p) { return __sync_val_compare_and_swap_4 (p, 1, 2); } int bar (int *p) { int e = 1; __atomic_compare_exchange_4 (p, &e, 2, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); return e; } but for 1 or 2 byte atomics it is never inline: int foo (char *p) { return __sync_val_compare_and_swap_1 (p, 1, 2); } int bar (char *p) { char e = 1; __atomic_compare_exchange_1 (p, &e, 2, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); return e; } The reason why foo in the second testcase works is libgcc/config/gcn/atomic.c which defines __sync_{val,bool}_compare_and_swap_{1,2}. So, either it should also define __atomic_compare_exchange_{1,2} perhaps with calling __sync_val_compare_and_swap_{1,2} under the hood or the other way around, or the backend somewhere needs to rewrite calls to __atomic_compare_exchange_{1,2} into calls to __sync_*_compare_and_swap_{1,2}. The reason why I've changed omp-expand is that by using __atomic_* APIs one can use the user-requested memory models, and once the 5.1 atomics support is done, there will be more - weak flag too, and user specified failure memory models. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/102215] [GCN offloading] Missing '__atomic_compare_exchange_1' etc. 2021-09-06 9:55 [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc tschwinge at gcc dot gnu.org ` (2 preceding siblings ...) 2021-09-06 12:01 ` jakub at gcc dot gnu.org @ 2022-03-09 18:35 ` cvs-commit at gcc dot gnu.org 2022-03-10 12:07 ` burnus at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2022-03-09 18:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>: https://gcc.gnu.org/g:450526551dcb97b7c0513699d4333efb79b8b490 commit r12-7567-g450526551dcb97b7c0513699d4333efb79b8b490 Author: Tobias Burnus <tobias@codesourcery.com> Date: Wed Mar 9 19:34:48 2022 +0100 GCN: Implement __atomic_compare_exchange_{1,2} in libgcc [PR102215] libgcc/ChangeLog: PR target/102215 * config/gcn/atomic.c (__sync_val_compare_and_swap_##SIZE): Move a line up to non-arg-dependent value first. (__ATOMIC_COMPARE_EXCHANGE): Define + call to generate __atomic_compare_exchange_{1,2}. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/102215] [GCN offloading] Missing '__atomic_compare_exchange_1' etc. 2021-09-06 9:55 [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc tschwinge at gcc dot gnu.org ` (3 preceding siblings ...) 2022-03-09 18:35 ` cvs-commit at gcc dot gnu.org @ 2022-03-10 12:07 ` burnus at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: burnus at gcc dot gnu.org @ 2022-03-10 12:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102215 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> --- FIXED with commit r12-7567 on mainline (GCC 12). (Close as the issue was only exposed by the OpenMP change r12-3325. While supporting more atomic ops is nice, this does not imply the need to back-port it.) ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-10 12:07 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-06 9:55 [Bug target/102215] New: [GCN offloading] Missing '__atomic_compare_exchange_1' etc tschwinge at gcc dot gnu.org 2021-09-06 9:59 ` [Bug target/102215] " jakub at gcc dot gnu.org 2021-09-06 11:09 ` burnus at gcc dot gnu.org 2021-09-06 12:01 ` jakub at gcc dot gnu.org 2022-03-09 18:35 ` cvs-commit at gcc dot gnu.org 2022-03-10 12:07 ` burnus at gcc dot gnu.org
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).