[m-rev.] the grade library is ready for review

Julien Fischer jfischer at opturion.com
Tue Apr 5 13:15:31 AEST 2016


Hi Zoltan,

On Fri, 1 Apr 2016, Zoltan Somogyi wrote:

> The changes I have made over the last few days have made
> the grade library ready for review. I would appreciate your feedback
> on it before I start integrating it into the compiler. (I won't
> commit any changes that do that without a separate review.)
>
> You will probably want to start with compiler/notes/grade_library.html,
> which gives an overview of the library. The grade_lib directory
> contains the library itself (the grade_lib.m package and its submodules,
> all of which have names starting with "grade_"), and three standalone
> programs.
>
> The test_grades program poses 160 problems to the solver and prints
> the results (some fail, some succeed); you should check whether the
> successes AND failures seem reasonable to you.
>
> The try_all_grade_structs program is a sanity check; it tests whether
> the grade library can properly process all valid grades (of which there
> are more than one million!). This takes a bit less than a minute on
> my laptop, which shows that the grade library can handle the kinds
> of problems that this test poses in about 50 microseconds each.
> (I expect that solving partial, not full, grade specifications takes longer.)

That tool generates approx. 370,000 grades with the pregen component.
While it's true that the code generator(s) can generate code for those,
Mercury's build system only supports five of them (i.e. if you're using
the pregen grade component for its intended purpose there are only five
pregen grades -- the others won't work).  Those grades are:

     none.gc.pregen
     reg.gc.pregen
     asm_fast.gc.pregen
     hlc.gc.pregen

and (currently) asm_jump.gc.pregen.

Given that the configure script only selects asm_jump as the best LLDS
base grade when something is amiss, I think it would probably be safer
to fall back to reg or none in that case as well.  I'll make that change
shortly.  I think the grade library should reject any grade with a
pregen component that is not one of the four in the list above.

Julien.


More information about the reviews mailing list