public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad
@ 2021-01-14 18:22 acsawdey at gcc dot gnu.org
  2021-01-14 18:34 ` [Bug target/98688] " acsawdey at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2021-01-14 18:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98688

            Bug ID: 98688
           Summary: C++ modules support does not work on PowerPC with
                    opaque MMA types vector_pair/vector_quad
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acsawdey at gcc dot gnu.org
  Target Milestone: ---

Similar to PR98645, we run into trouble if we try to compile code using
vector_pair/vector_quad using -fmodule-header:

/home/sawdey/work/gcc/trunk2/build/gcc/xg++
-B/home/sawdey/work/gcc/trunk2/build/gcc/
/home/sawdey/work/gcc/trunk2/gcc/gcc/testsuite/gcc.target/powerpc/mma-builtin-2.c
   -std=c++2a -fmodule-header  -S -o mb2.s
/home/sawdey/work/gcc/trunk2/gcc/gcc/testsuite/gcc.target/powerpc/mma-builtin-2.c:
internal compiler error: in type_node, at cp/module.cc:8779
0x10468287 trees_out::type_node(tree_node*)
        ../../gcc/gcc/cp/module.cc:8779
0x1046446b trees_out::tree_node(tree_node*)
        ../../gcc/gcc/cp/module.cc:9106
0x10467dcb trees_out::type_node(tree_node*)
        ../../gcc/gcc/cp/module.cc:8773
0x1046446b trees_out::tree_node(tree_node*)
        ../../gcc/gcc/cp/module.cc:9106
0x10465d57 trees_out::core_vals(tree_node*)
        ../../gcc/gcc/cp/module.cc:6088
0x1046783b trees_out::tree_node_vals(tree_node*)
        ../../gcc/gcc/cp/module.cc:7141
0x1046783b trees_out::fn_parms_init(tree_node*)
        ../../gcc/gcc/cp/module.cc:10037
0x10461833 trees_out::decl_value(tree_node*, depset*)
        ../../gcc/gcc/cp/module.cc:7738
0x1046e163 depset::hash::find_dependencies()
        ../../gcc/gcc/cp/module.cc:13199
0x1046eae7 module_state::write(elf_out*, cpp_reader*)
        ../../gcc/gcc/cp/module.cc:17568
0x10470313 finish_module_processing(cpp_reader*)
        ../../gcc/gcc/cp/module.cc:19747
0x103ae82f c_parse_final_cleanups()
        ../../gcc/gcc/cp/decl2.c:5178
0x1072cad7 c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1233
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

It looks like trees_out::type_node() needs to understand opaque type, and
possibly whatever reads that in needs to understand it on the way in as well.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/98688] C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad
  2021-01-14 18:22 [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad acsawdey at gcc dot gnu.org
@ 2021-01-14 18:34 ` acsawdey at gcc dot gnu.org
  2021-01-15 13:25 ` nathan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2021-01-14 18:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98688

--- Comment #1 from acsawdey at gcc dot gnu.org ---
I don't know if this is the right thing to do, but ignoring the opaque type
here make the ICE go away. I suspect I need to construct a module test case
using vector_pair/vector_quad to really test this though.


diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index d2093916c9e..3ec0b04def3 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -8831,6 +8831,10 @@ trees_out::type_node (tree type)
       }
       break;

+    case OPAQUE_TYPE:
+      /* No additional data.  */
+      break;
+
     case OFFSET_TYPE:
       tree_node (TYPE_OFFSET_BASETYPE (type));
       break;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/98688] C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad
  2021-01-14 18:22 [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad acsawdey at gcc dot gnu.org
  2021-01-14 18:34 ` [Bug target/98688] " acsawdey at gcc dot gnu.org
@ 2021-01-15 13:25 ` nathan at gcc dot gnu.org
  2021-01-15 18:01 ` acsawdey at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2021-01-15 13:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98688

Nathan Sidwell <nathan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |nathan at gcc dot gnu.org

--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
generally if you change any trees_out::$FOO you need to make a symmetrical
change in trees_in::$FOO

also, remember reading in is lazy, so you need to force some kind of name
lookup, or use -fno-module-lazy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/98688] C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad
  2021-01-14 18:22 [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad acsawdey at gcc dot gnu.org
  2021-01-14 18:34 ` [Bug target/98688] " acsawdey at gcc dot gnu.org
  2021-01-15 13:25 ` nathan at gcc dot gnu.org
@ 2021-01-15 18:01 ` acsawdey at gcc dot gnu.org
  2024-03-12 13:42 ` [Bug target/98688] [modules] " cvs-commit at gcc dot gnu.org
  2024-03-12 13:44 ` nshead at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: acsawdey at gcc dot gnu.org @ 2021-01-15 18:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98688

--- Comment #3 from acsawdey at gcc dot gnu.org ---
Yeah it's pretty clear that something needs to be output, as with that code I
get an error like this:

In module imported at mma-module-2.C:1:1:
mma_foo0: In function ‘int bar(__vector_quad*, vec_t*, __vector_pair*)’:
mma_foo0: error: failed to read compiled module cluster 2: Bad file data
mma_foo0: note: compiled module file is ‘gcm.cache/mma_foo0.gcm’
mma-module-2.C:7:5: fatal error: failed to load binding ‘::foo0@mma_foo0’
    7 |     foo0 (dst, vec, pvecp);
      |     ^~~~


This is with a little test case of two files:

export module mma_foo0;

typedef unsigned char  vec_t __attribute__((vector_size(16)));

export void
foo0 (__vector_quad *dst, vec_t *vec, __vector_pair *pvecp)
{
  __vector_quad acc;
  __vector_pair vecp0 = *pvecp;
  vec_t vec1 = vec[1];

  __builtin_mma_xvf64ger (&acc, vecp0, vec1);
  __builtin_mma_xvf64gerpp (&acc, vecp0, vec1);
  __builtin_mma_xvf64gerpn (&acc, vecp0, vec1);
  dst[0] = acc;
}

--------

typedef unsigned char  vec_t __attribute__((vector_size(16)));

int bar(__vector_quad *dst, vec_t *vec, __vector_pair *pvecp)
{
    foo0 (dst, vec, pvecp);
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/98688] [modules] does not work on PowerPC with opaque MMA types vector_pair/vector_quad
  2021-01-14 18:22 [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad acsawdey at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-01-15 18:01 ` acsawdey at gcc dot gnu.org
@ 2024-03-12 13:42 ` cvs-commit at gcc dot gnu.org
  2024-03-12 13:44 ` nshead at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-12 13:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98688

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:

https://gcc.gnu.org/g:4aa87b856067d4911de8fb66b3a27659dc75ca6d

commit r14-9439-g4aa87b856067d4911de8fb66b3a27659dc75ca6d
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Sun Mar 10 22:06:18 2024 +1100

    c++: Support target-specific nodes when streaming modules [PR111224]

    Some targets make use of POLY_INT_CSTs and other custom builtin types,
    which currently violate some assumptions when streaming. This patch adds
    support for them, such as types like Aarch64 __fp16, PowerPC __ibm128,
    and vector types thereof.

    This patch doesn't provide "full" support of AArch64 SVE, however, since
    for that we would need to support 'target' nodes (tracked in PR108080).

    Adding the new builtin types means that on Aarch64 we now have 217
    global trees created on initialisation (up from 191), so this patch also
    slightly bumps the initial size of the fixed_trees allocation to 250.

            PR c++/98645
            PR c++/98688
            PR c++/111224

    gcc/cp/ChangeLog:

            * module.cc (enum tree_tag): Add new tag for builtin types.
            (trees_out::start): POLY_INT_CSTs can be emitted.
            (trees_in::start): Likewise.
            (trees_out::core_vals): Stream POLY_INT_CSTs.
            (trees_in::core_vals): Likewise.
            (trees_out::type_node): Handle vectors with multiple coeffs.
            (trees_in::tree_node): Likewise.
            (init_modules): Register target-specific builtin types. Bump
            initial capacity slightly.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/target-aarch64-1_a.C: New test.
            * g++.dg/modules/target-aarch64-1_b.C: New test.
            * g++.dg/modules/target-powerpc-1_a.C: New test.
            * g++.dg/modules/target-powerpc-1_b.C: New test.
            * g++.dg/modules/target-powerpc-2_a.C: New test.
            * g++.dg/modules/target-powerpc-2_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
    Reviewed-by: Patrick Palka <ppalka@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug target/98688] [modules] does not work on PowerPC with opaque MMA types vector_pair/vector_quad
  2021-01-14 18:22 [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad acsawdey at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-12 13:42 ` [Bug target/98688] [modules] " cvs-commit at gcc dot gnu.org
@ 2024-03-12 13:44 ` nshead at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-03-12 13:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98688

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Assignee|nathan at gcc dot gnu.org          |nshead at gcc dot gnu.org
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED
                 CC|                            |nshead at gcc dot gnu.org

--- Comment #5 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 14.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-12 13:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 18:22 [Bug target/98688] New: C++ modules support does not work on PowerPC with opaque MMA types vector_pair/vector_quad acsawdey at gcc dot gnu.org
2021-01-14 18:34 ` [Bug target/98688] " acsawdey at gcc dot gnu.org
2021-01-15 13:25 ` nathan at gcc dot gnu.org
2021-01-15 18:01 ` acsawdey at gcc dot gnu.org
2024-03-12 13:42 ` [Bug target/98688] [modules] " cvs-commit at gcc dot gnu.org
2024-03-12 13:44 ` nshead 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).