public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
@ 2014-12-03 14:56 ` dmalcolm at gcc dot gnu.org
  2014-12-03 15:12 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-03 14:56 UTC (permalink / raw)
  To: gcc-bugs

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

dmalcolm at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-12-03
     Ever confirmed|0                           |1


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

* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
  2014-12-03 14:56 ` [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases dmalcolm at gcc dot gnu.org
@ 2014-12-03 15:12 ` rguenth at gcc dot gnu.org
  2014-12-03 16:10 ` dmalcolm at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-03 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Huh, I think you rather want a "stable" introspection (plugin) API.  Like the
treeish one that was proposed at some point but never was finished up.  The
JIT should provide the modification API only.


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

* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
  2014-12-03 14:56 ` [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases dmalcolm at gcc dot gnu.org
  2014-12-03 15:12 ` rguenth at gcc dot gnu.org
@ 2014-12-03 16:10 ` dmalcolm at gcc dot gnu.org
  2014-12-04 21:58 ` dmalcolm at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-03 16:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from dmalcolm at gcc dot gnu.org ---
(In reply to Richard Biener from comment #1)
> Huh, I think you rather want a "stable" introspection (plugin) API.  Like the
> treeish one that was proposed at some point but never was finished up.  The
> JIT should provide the modification API only.

Perhaps eventually, but that would involve a *lot* of changes:
  (A) writing this new API
  (B) having it be usable from the JIT API
  (C) probably other things I haven't thought of yet.

I hope to tackle (A) and (B) in the gcc 6 timeframe.

In the meantime, I have a mostly-working way of getting at the dumps via a new
gcc_jit_context_enable_dump entrypoint, which looks like this:

static char *trig_sincos_dump;
static char *trig_statistics_dump;

static void
create_test_of_builtin_trig (gcc_jit_context *ctxt)
{
  /* snip */
  gcc_jit_context_enable_dump (ctxt,
                   "tree-sincos",
                   &trig_sincos_dump);
  gcc_jit_context_enable_dump (ctxt,
                   "statistics",
                   &trig_statistics_dump);
  /* snip */
}

static void
verify_test_of_builtin_trig (gcc_jit_context *ctxt, gcc_jit_result *result)
{
  /* snip */
  /* PR jit/64020:
     The "sincos" pass merges sin/cos calls into the cexpi builtin.
     Verify that a dump of the "sincos" pass was provided, and that it
     shows a call to the cexpi builtin on a SSA name of "theta".  */
  CHECK_NON_NULL (trig_sincos_dump);
  CHECK_STRING_CONTAINS (trig_sincos_dump, " = __builtin_cexpi (theta_");
  free (trig_sincos_dump);

  /* Similarly, verify that the statistics dump was provided, and that
     it shows the sincos optimization.  */
  CHECK_NON_NULL (trig_statistics_dump);
  CHECK_STRING_CONTAINS (
    trig_statistics_dump,
    "sincos \"sincos statements inserted\" \"test_of_builtin_trig\" 1");
  free (trig_statistics_dump);
}

I'm also experimenting with an API of capturing/verifying statistics:
  gcc_jit_context_set_bool_option (ctxt,
                   GCC_JIT_BOOL_OPTION_GATHER_STATISTICS,
                   1);
where the verify hook has:
  /* We expect exactly one sincos statement to be inserted.  */
  int sincos_count =
    gcc_jit_result_get_int_statistic (result,
                      "sincos statements inserted");
  if (sincos_count == 1)
    pass ("%s: %i sincos statements inserted", test, sincos_count);
  else
    fail ("%s: %i sincos statements inserted", test, sincos_count);

(again, I have this mostly working already, but it might be nice to provide a
richer querying API e.g. for narrowing things down e.g. to a particular
function).


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

* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2014-12-03 16:10 ` dmalcolm at gcc dot gnu.org
@ 2014-12-04 21:58 ` dmalcolm at gcc dot gnu.org
  2014-12-09 15:25 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-04 21:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Patches posted as:
  * https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00466.html
(non-JIT part, needs review)

  * https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00467.html (JIT-specific
part)


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

* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-12-04 21:58 ` dmalcolm at gcc dot gnu.org
@ 2014-12-09 15:25 ` dmalcolm at gcc dot gnu.org
  2014-12-09 15:36 ` dmalcolm at gcc dot gnu.org
  2014-12-09 15:39 ` dmalcolm at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-09 15:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Tue Dec  9 15:25:11 2014
New Revision: 218520

URL: https://gcc.gnu.org/viewcvs?rev=218520&root=gcc&view=rev
Log:
PR jit/64166: Add methods to gcc::dump_manager needed by JIT testing

gcc/ChangeLog:
    PR jit/64166
    * dumpfile.c (gcc::dump_manager::get_dump_file_info_by_switch):
    New function.
    (gcc::dump_manager::get_dump_file_name): Split out bulk of
    implementation into a new overloaded variant taking a
    dump_file_info *.
    * dumpfile.h (gcc::dump_manager::get_dump_file_info_by_switch):
    New function.
    (gcc::dump_manager::get_dump_file_name): New overloaded variant of
    this function, taking a dump_file_info *.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dumpfile.c
    trunk/gcc/dumpfile.h


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

* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-12-09 15:25 ` dmalcolm at gcc dot gnu.org
@ 2014-12-09 15:36 ` dmalcolm at gcc dot gnu.org
  2014-12-09 15:39 ` dmalcolm at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-09 15:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Author: dmalcolm
Date: Tue Dec  9 15:35:39 2014
New Revision: 218521

URL: https://gcc.gnu.org/viewcvs?rev=218521&root=gcc&view=rev
Log:
PR jit/64166: Add API entrypoint gcc_jit_context_enable_dump

gcc/jit/ChangeLog:
    PR jit/64166
    * docs/topics/contexts.rst (Debugging): Add description of
    gcc_jit_context_enable_dump.
    * docs/_build/texinfo/libgccjit.texi: Regenerate.
    * jit-playback.c: Include context.h.
    (class auto_argvec): New class.
    (auto_argvec::~auto_argvec): New function.
    (gcc::jit::playback::context::compile): Convert fake_args to be
    an auto_argvec, so that it can contain dynamically-allocated
    strings.   Construct a vec of all requested dumps, and pass it to
    make_fake_args.  Extract requested dumps between the calls to
    toplev::main and toplev::finalize.
    (gcc::jit::playback::context::make_fake_args): Convert param
    "argvec" to be a vec <char *>, and gain a "requested_dumps"
    param.  Convert to dynamically-allocated arg strings by converting
    ADD_ARG to take a copy of the arg, and add ADD_ARG_TAKE_OWNERSHIP
    for args that are already a copy.  Add args for all requested dumps.
    (gcc::jit::playback::context::extract_any_requested_dumps): New
    function.
    (gcc::jit::playback::context::read_dump_file): New function.
    * jit-playback.h (gcc::jit::playback::context::make_fake_args):
    Convert param "argvec" to be a vec <char *>, and gain a
    "requested_dumps" param.
    (gcc::jit::playback::context::extract_any_requested_dumps): New
    function.
    (gcc::jit::playback::context::read_dump_file): New function.
    * jit-recording.c (gcc::jit::recording::context::enable_dump): New
    function.
    (gcc::jit::recording::context::get_all_requested_dumps): New
    function.
    * jit-recording.h (gcc::jit::recording::requested_dump): New
    struct.
    (gcc::jit::recording::context::enable_dump): New function.
    (gcc::jit::recording::context::get_all_requested_dumps): New
    function.
    (gcc::jit::recording::context::m_requested_dumps): New field.
    * libgccjit.c (gcc_jit_context_enable_dump): New API entrypoint.
    * libgccjit.h (gcc_jit_context_enable_dump): New API entrypoint.
    * libgccjit.map (gcc_jit_context_enable_dump): New API entrypoint.

gcc/testsuite/ChangeLog:
    PR jit/64166
    PR jit/64020
    * jit.dg/harness.h (CHECK_STRING_CONTAINS): New macro.
    (check_string_contains): New function.
    * jit.dg/test-error-unrecognized-dump.c: New file.
    * jit.dg/test-functions.c (trig_sincos_dump): New variable.
    (trig_statistics_dump): New variable.
    (create_test_of_builtin_trig): Enable dumping of "sincos" and
    "statistics" into "trig_sincos_dump" and "trig_statistics_dump".
    (verify_test_of_builtin_trig): Verify the sincos and statistics
    dumps.
    * jit.dg/test-sum-of-squares.c (dump_vrp1): New variable.
    (create_code): Enable dumping of "tree-vrp1" into dump_vrp1.
    (verify_code): Verify the tree-vrp1 dump.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/jit/docs/_build/texinfo/libgccjit.texi
    trunk/gcc/jit/docs/topics/contexts.rst
    trunk/gcc/jit/jit-playback.c
    trunk/gcc/jit/jit-playback.h
    trunk/gcc/jit/jit-recording.c
    trunk/gcc/jit/jit-recording.h
    trunk/gcc/jit/libgccjit.c
    trunk/gcc/jit/libgccjit.h
    trunk/gcc/jit/libgccjit.map
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/jit.dg/harness.h
    trunk/gcc/testsuite/jit.dg/test-functions.c
    trunk/gcc/testsuite/jit.dg/test-sum-of-squares.c


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

* [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases
       [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-12-09 15:36 ` dmalcolm at gcc dot gnu.org
@ 2014-12-09 15:39 ` dmalcolm at gcc dot gnu.org
  6 siblings, 0 replies; 7+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2014-12-09 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #6 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Fixed with r218520 and r218521.


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

end of thread, other threads:[~2014-12-09 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-64166-4@http.gcc.gnu.org/bugzilla/>
2014-12-03 14:56 ` [Bug jit/64166] JIT does not provide a way for verifying dumpfiles from testcases dmalcolm at gcc dot gnu.org
2014-12-03 15:12 ` rguenth at gcc dot gnu.org
2014-12-03 16:10 ` dmalcolm at gcc dot gnu.org
2014-12-04 21:58 ` dmalcolm at gcc dot gnu.org
2014-12-09 15:25 ` dmalcolm at gcc dot gnu.org
2014-12-09 15:36 ` dmalcolm at gcc dot gnu.org
2014-12-09 15:39 ` dmalcolm 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).