mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 04:13:46 +00:00
083d376e6598628362ee91c2da170febd83590f4
38 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d9e576a2b2 |
Specify the type for inst definitions.
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
library/*.m:
mdbcomp/*.m:
ssdb/*.m:
Specify the type constructor for every inst definition that lists
the functors that values of that type may be bound to.
In library/maybe.m, delete the inst maybe_errors/1, because
(a) its name is misleading, since it is for the maybe_error/1 type (no s),
and (b) there is already an inst with the non-misleading name maybe_error
which had an identical definition.
In compiler/dep_par_conj.m, delete two insts that were duplicates
of insts defined in hlds_goal.m, and replace references to them
accordingly.
|
||
|
|
9095985aa8 |
Fix more warnings from --warn-inconsistent-pred-order-clauses.
deep_profiler/*.m:
Fix inconsistencies between (a) the order in which functions and predicates
are declared, and (b) the order in which they are defined.
In most modules, either the order of the declarations or the order
of the definitions made sense, and I changed the other to match.
In some modules, neither made sense, so I changed *both* to an order
that *does* make sense (i.e. it has related predicates together).
In query.m, put the various commands in the same sensible order
as the code processing them.
In html_format.m, merge two exported functions together, since
they can't be used separately.
In some places, put dividers between groups of related
functions/predicates, to make the groups themselves more visible.
In some places, fix comments or programming style.
deep_profiler/DEEP_FLAGS.in:
Since all the modules in this directory are now free from any warnings
generated by --warn-inconsistent-pred-order-clauses, specify that option
by default in this directory to keep it that way.
|
||
|
|
340c5300e6 |
Fix spelling in the deep profiler.
Fix some other issues as well that I found while fixing the spelling.
mdbcomp/feedback.automatic_parallelism.m:
deep_profiler/autopar_find_best_par.m:
deep_profiler/mdprof_create_feedback.m:
Rename the best_par_algorithm type to alg_for_finding_best_par,
since the old name was misleading. Perform the same rename for
another type based on it, and the option specifying it.
Remove the functor estimate_speedup_by_num_vars, since it hasn't
been used by anything in a long time, and won't in the future.
deep_profiler/autopar_calc_overlap.m:
deep_profiler/autopar_costs.m:
deep_profiler/autopar_reports.m:
deep_profiler/autopar_search_callgraph.m:
deep_profiler/autopar_search_goals.m:
deep_profiler/coverage.m:
deep_profiler/create_report.m:
deep_profiler/dump.m:
deep_profiler/mdprof_report_feedback.m:
deep_profiler/measurement_units.m:
deep_profiler/measurements.m:
deep_profiler/message.m:
deep_profiler/query.m:
deep_profiler/recursion_patterns.m:
deep_profiler/report.m:
deep_profiler/startup.m:
deep_profiler/var_use_analysis.m:
mdbcomp/mdbcomp.goal_path.m:
mdbcomp/program_representation.m:
Conform to the above. Fix spelling errors. In some places, improve
comments and/or variable names.
|
||
|
|
48473e23b8 |
On the module summary page, display the link to the module representation page
Estimated hours taken: 0.3 Branches: main On the module summary page, display the link to the module representation page only if we actually have access to the module representation. deep_profiler/report.m: Add a field giving this information to the data structure representing the module summary page. deep_profiler/create_report.m: Fill in this field when generating module summary information. deep_profiler/display_report.m: Act on this field when displaying module summary pages. |
||
|
|
2d0bfc0674 |
The algorithm that decides whether the order independent state update
Estimated hours taken: 120 Branches: main The algorithm that decides whether the order independent state update transformation is applicable in a given module needs access to the list of oisu pragmas in that module, and to information about the types of variables in the procedures named in those pragmas. This diff puts this information in Deep.procrep files, to make them available to the autoparallelization feedback program, to which that algorithm will later be added. Compilers that have this diff will generate Deep.procrep files in a new, slightly different format, but the deep profiler will be able to read Deep.procrep files not just in the new format, but in the old format as well. runtime/mercury_stack_layout.h: Add to module layout structures the fields holding the new information we want to put into Deep.procrep files. This means three things: - a bytecode array in module layout structures encoding the list of oisu pragmas in the module; - additions to the bytecode arrays in procedure layout structures mapping the procedure's variables to their types; and - a bytecode array containing the encoded versions of those types themselves in the module layout structure. This allows us to represent each type used in the module just once. Since there is now information in module layout structures that is needed only for deep profiling, as well as information that is needed only for debugging, the old arrangement that split a module's information between two structures, MR_ModuleLayout (debug specific info) and MR_ModuleCommonLayout (info used by both debugging and profiling), is no longer approriate. We could add a third structure containing profiling-specific info, but it is simpler to move all the info into just one structure, some of whose fields may not be used. This wastes only a few words of memory per module, but allows the runtime system to avoid unnecessary indirections. runtime/mercury_types.h: Remove the type synonym for the deleted type. runtime/mercury_grade.h: The change in mercury_stack_layout.h destroys binary compatibility with previous versions of Mercury for debug and deep profiling grades, so bump their grade-component-specific version numbers. runtime/mercury_deep_profiling.c: Write out the information in the new fields in module layout structures, if they are filled in. Since this changes the format of the Deep.procrep file, bump its version number. runtime/mercury_deep_profiling.h: runtime/mercury_stack_layout.c: Conform to the change to mercury_stack_layout.h. mdbcomp/program_representation.m: Add to module representations information about the oisu pragmas defined in that module, and the type table of the module. Optionally add to procedure representations a map mapping the variables of the procedure to their types. Rename the old var_table type to be the var_name_table type, since it contains just names. Make the var to type map separate, since it will be there only for selected procedures. Modify the predicates reading in module and procedure representations to allow them to read in the new representation, while still accepting the old one. Use the version number in the Deep.procrep file to decide which format to expect. mdbcomp/rtti_access.m: Add functions to encode the data representations that this module also decodes. Conform to the changes above. mdbcomp/feedback.automatic_parallelism.m: Conform the changes above. mdbcomp/prim_data.m: Fix layout. compiler/layout.m: Update the compiler's representation of layout structures to conform to the change to runtime/mercury_stack_layout.h. compiler/layout_out.m: Output the new parts of module layout structures. compiler/opt_debug.m: Allow the debugging of code referring to the new parts of module layout structures. compiler/llds_out_file.m: Conform to the move to a single module layout structure. compiler/prog_rep_tables.m: This new module provided mechanisms for building the string table and the type table components of module layouts. The string table part is old (it is moved here from stack_layout.m); the type table part is new. Putting this code in a module of its own allows us to remove a circular dependency between prog_rep.m and stack_layout.m; instead, both now just depend on prog_rep_tables.m. compiler/ll_backend.m: Add the new module. compiler/notes/compiler_design.html: Describe the new module. compiler/prog_rep.m: When generating the representation of a module for deep profiling, include the information needed by the order independent state update analysis: the list of oisu pragmas in the module, if any, and information about the types of variables in selected procedures. To avoid having these additions increasing the size of the bytecode representation too much, convert some fixed 32 bit numbers in the bytecode to use variable sized numbers, which will usually be 8 or 16 bits. Do not use predicates from bytecode_gen.m to encode numbers, since there is nothing keeping these in sync with the code that reads them in mdbcomp/program_representation.m. Instead, use new predicates in program_representation.m itself. compiler/stack_layout.m: Generate the new parts of module layouts. Remove the code moved to prog_rep_tables.m. compiler/continuation_info.m: compiler/proc_gen.m: Make some more information available to stack_layout.m. compiler/prog_data.m: Fix some formatting. compiler/introduce_parallelism.m: Conform to the renaming of the var_table type. compiler/follow_code.m: Fix the bug that used to cause the failure of the hard_coded/mode_check_clauses test case in deep profiling grades. deep_profiler/program_representation_utils.m: Output the new parts of module and procedure representations, to allow the correctness of this change to be tested. deep_profiler/mdprof_create_feedback.m: If we cannot read the Deep.procrep file, print a single error message and exit, instead of continuing with an analysis that will generate a whole bunch of error messages, one for each attempt to access a procedure's representation. deep_profiler/mdprof_procrep.m: Give this program an option that specifies what file it is to look at; do not hardwire in "Deep.procrep" in the current directory. deep_profiler/report.m: Add a report type that just prints the representation of a module. It returns the same information as mdprof_procrep, but from within the deep profiler, which can be more convenient. deep_profiler/create_report.m: deep_profiler/display_report.m: Respectively create and display the new report type. deep_profiler/query.m: Recognize a query asking for the new report type. deep_profiler/autopar_calc_overlap.m: deep_profiler/autopar_find_best_par.m: deep_profiler/autopar_reports.m: deep_profiler/autopar_search_callgraph.m: deep_profiler/autopar_search_goals.m: deep_profiler/autopar_types.m: deep_profiler/branch_and_bound.m: deep_profiler/coverage.m: deep_profiler/display.m: deep_profiler/html_format.m: deep_profiler/mdprof_test.m: deep_profiler/measurements.m: deep_profiler/query.m: deep_profiler/read_profile.m: deep_profiler/recursion_patterns.m: deep_profiler/top_procs.m: deep_profiler/top_procs.m: Conform to the changes above. Fix layout. tests/debugger/declarative/dependency.exp2: Add this file as a possible expected output. It contains the new field added to module representations. |
||
|
|
4a8ff92940 |
Add extra data to the procedure report in the form of an extra row of data
in the table for the calls into the procedure from its parent call sites.
Note that since this report shows proc static data parent call sites are
defined as calls to the procedure from other procedures (they may include
mutual recursion). As this may be a point of confusion this information is
only shown in developer mode.
report.m:
As above.
We also count the number of calls into this procedure, including the
numbers of unique ProcStatic and ProcDynamic structures seen.
The later is trivially the number of calls into the procedure.
create_report.m:
Generate this data.
display_report.m:
Handle the new report data.
display.m:
So that we only show this table row in developer mode, add a new table
row type (table_developer_row) that contains the real table row.
html_format.m:
Handle the new table row type.
|
||
|
|
9f68c330f0 |
Change the argument order of many of the predicates in the map, bimap, and
Branches: main
Change the argument order of many of the predicates in the map, bimap, and
multi_map modules so they are more conducive to the use of state variable
notation, i.e. make the order the same as in the sv* modules.
Prepare for the deprecation of the sv{bimap,map,multi_map} modules by
removing their use throughout the system.
library/bimap.m:
library/map.m:
library/multi_map.m:
As above.
NEWS:
Announce the change.
Separate out the "highlights" from the "detailed listing" for
the post-11.01 NEWS.
Reorganise the announcement of the Unicode support.
benchmarks/*/*.m:
browser/*.m:
compiler/*.m:
deep_profiler/*.m:
extras/*/*.m:
mdbcomp/*.m:
profiler/*.m:
tests/*/*.m:
ssdb/*.m:
samples/*/*.m
slice/*.m:
Conform to the above change.
Remove any dependencies on the sv{bimap,map,multi_map} modules.
|
||
|
|
2070f42b24 |
Refactor goal annotations in the deep profiler.
Goal annotations have previously been attached to goals using type-polymorphism
and in some cases type classes. This has become clumsy as new annotations are
created. Using the goal_id code introduced recently, this change associates
annotations with goals by storing them in an array indexed by goal ids. Many
analyses have been updated to make use of this code. This code should also be
faster as less allocation is done when annotating a goal as the goal
representation does not have to be reconstructed.
mdbcomp/mdbcomp.goal_path.m:
Add predicates for working with goal attribute arrays. These are
polymorphic arrays that are indexed by goal id and can be used to associate
information with goals.
deep_profiler/report.m:
The procrep coverage info report now stores the coverage annotations in a
goal_attr_array.
deep_profiler/coverage.m:
The coverage analysis now returns its result in a goal_attr_array rather
than by annotation the goal directly.
The interface for the coverage module has changed, it now allows
programmers to pass a goal_rep to it directly. This makes it easier to
call from other analyses.
The coverage analysis no longer uses the calls_and_exits structure.
Instead it uses the cost_and_callees structure like many other analyses.
This also makes it easier to perform this annotation and others using only
a single call site map structure.
Moved add_coverage_point_to_map/5 from create_report.m to coverage.m.
deep_profiler/analysis_utils.m:
Made cost_and_callees structure polymorphic so that any type can be used to
represent the callees. (So that either static or dynamic callees can be
used).
Added the number of exit port counts to the cost_and_callees structure.
Added build_static_call_site_cost_and_callees_map/4.
Rename build_call_site_cost_and_callees_map/4 to
build_dynamic_call_site_cost_and_callees_map/4.
deep_profiler/var_use_analysis.m:
Update the var_use_analysis to use coverage information provided in a
goal_attr_array.
deep_profiler/recursion_patterns.m:
Update the recursion analysis to use coverage information provided in a
goal_attr_array.
deep_profiler/program_representation_utils.m:
Add label_goals/4 to label goals with goal ids and build a map of goal ids
to goal paths.
Update pretty printing fucntions to work with either annotation on the
goals themselves or provided by a higher order value. The higher order
argument maps nicly to the function goal_get_attribute/3 in goal_path.m
deep_profiler/mdprof_fb.automatic_parallelism.m:
Modify goal_annotate_with_instmap, it now returns the instmap annotations
in a goal_attr_array.
Conform to changes in:
program_representation_utils.m
coverage.m
var_use_analysis.m
deep_profiler/message.m:
Updated messagee to more correctly express the problems that
mdprof_fb.automatic_parallelism.m may encounter.
deep_profiler/create_report.m:
Conform to changes in coverage.m.
Make use of code in analysis_utils.m to prepare call site maps for coverage
analysis.
deep_profiler/recursion_patterns.m:
deep_profiler/var_use_analysis.m:
Conform to changes in analysis_utils.m.
deep_profiler/display_report.m:
Conform to changes in program_representation_utils.m.
|
||
|
|
d43239d6a7 |
Move some of the goal path code from compiler/goal_path.m to the mdbcomp
library where it can be used by the deep profiler.
Also move the goal path code from program_representation.m to the new module,
goal_path.m in mdbcomp/
mdbcomp/goal_path.m:
New module containing goal path code.
mdbcomp/program_representation.m:
Original location of goal path code.
compiler/goal_path.m:
Move some of this goal_path code into mdbcomp/goal_path.m
mdbcomp/feedback.automatic_parallelisation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
browser/debugger_interface.m:
browser/declarative_execution.m:
browser/declarative_tree.m:
compiler/build_mode_constraints.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/continuation_info.m:
compiler/coverage_profiling.m:
compiler/deep_profiling.m:
compiler/format_call.m:
compiler/goal_path.m:
compiler/goal_util.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out_goal.m:
compiler/hlds_out_pred.m:
compiler/hlds_pred.m:
compiler/interval.m:
compiler/introduce_parallelism.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/mode_constraint_robdd.m:
compiler/mode_constraints.m:
compiler/mode_ordering.m:
compiler/ordering_mode_constraints.m:
compiler/polymorphism.m:
compiler/post_typecheck.m:
compiler/prog_rep.m:
compiler/prop_mode_constraints.m:
compiler/push_goals_together.m:
compiler/rbmm.condition_renaming.m:
compiler/smm_common.m:
compiler/stack_layout.m:
compiler/stack_opt.m:
compiler/trace_gen.m:
compiler/tupling.m:
compiler/type_constraints.m:
compiler/typecheck.m:
compiler/unify_gen.m:
compiler/unneeded_code.m:
deep_profiler/Mmakefile:
deep_profiler/analysis_utils.m:
deep_profiler/coverage.m:
deep_profiler/create_report.m:
deep_profiler/display_report.m:
deep_profiler/dump.m:
deep_profiler/mdprof_fb.automatic_parallelism.m:
deep_profiler/message.m:
deep_profiler/old_query.m:
deep_profiler/profile.m:
deep_profiler/program_representation_utils.m:
deep_profiler/read_profile.m:
deep_profiler/recursion_patterns.m:
deep_profiler/report.m:
deep_profiler/var_use_analysis.m:
slice/Mmakefile:
slice/mcov.m:
Conform to the move of the goal path code.
|
||
|
|
436d37cc8d |
Fix a regression that affected coverage profiling and automatic parallelism
analysis.
When instrumenting a program for deep and coverage profiling the compiler adds
goal path information to the program. The compiler also writes out a bytecode
representation of the program. The step_switch goal path step includes a field
for the number of functors of the type of the variable that is being switched
upon. When this is included in the deep profiling data (as it is now) and
these goals paths are used as the indexes in tables the deep profiler cannot
reconstruct matching goal paths from the program representation bytecode,
causing many important map lookups to fail or throw an exception.
We fix this not by preventing the compiler from writing out this information,
but by stripping it out of goal paths before the analysis tool uses those goal
paths.
mdbcomp/program_representation.m:
Add a new predicate rev_goal_path_remove_type_info/2 that removes
type-dependant information from goals.
deep_profiler/profile.m:
Change the goal_path string in the call_site_static type to contain a
reverse_goal_path rather than a string. This hides the abstraction of the
stripping of type dependant information within read_profile.m
deep_profiler/read_profile.m:
Strip type dependant information from goal path strings as they are read in.
Conform to changes in profile.m
deep_profiler/report.m:
In the call site static dump information use a goal_path field rather than
a string.
deep_profiler/analysis_utils.m:
deep_profiler/create_report.m:
deep_profiler/dump.m:
deep_profiler/mdprof_fb.automatic_parallelism.m:
deep_profiler/old_query.m:
Conform to changes in profile.m.
deep_profiler/display_report.m:
Conform to changes in report.m.
|
||
|
|
a2cd0da5b3 |
The existing representation of goal_paths is suboptimal for several reasons.
Estimated hours taken: 80 Branches: main The existing representation of goal_paths is suboptimal for several reasons. - Sometimes we need forward goal paths (e.g. to look up goals), and sometimes we need reverse goal paths (e.g. when computing goal paths in the first place). We had two types for them, but - their names, goal_path and goal_path_consable, were not expressive, and - we could store only one of them in goal_infos. - Testing whether goal A is a subgoal of goal B is quite error-prone using either form of goal paths. - Using a goal path as a key in a map, which several compiler passes want to do, requires lots of expensive comparisons. This diff replaces most uses of goal paths with goal ids. A goal id is an integer, so it can be used as a key in faster maps, or even in arrays. Every goal in the body of a procedure gets its id allocated in a depth first search. Since we process each goal before we dive into is descendants, the goal representing the whole body of a procedure always gets goal id 0. The depth first traversal also builds up a map (the containing goal map) that tells us the parent goal of ever subgoal, with the obvious exception of the root goal itself. From the containing goal map, one can compute both reverse and forward goal paths. It can also serve as the basis of an efficient test of whether the goal identified by goal id A is an ancestor of another goal identified by goal id B. We don't yet use this test, but I expect we will in the future. mdbcomp/program_representation.m: Add the goal_id type. Replace the existing goal_path and goal_path_consable types with two new types, forward_goal_path and reverse_goal_path. Since these now have wrappers around the list of goal path steps that identify each kind of goal path, it is now ok to expose their representations. This makes several compiler passes easier to code. Update the set of operations on goal paths to work on the new data structures. Add a couple of step types to represent lambdas and try goals. Their omission prior to this would have been a bug for constraint-based mode analysis, or any other compiler pass prior to the expansion out of lambda and try goals that wanted to use goal paths to identify subgoals. browser/declarative_tree.m: mdbcomp/rtti_access.m: mdbcomp/slice_and_dice.m: mdbcomp/trace_counts.m: slice/mcov.m: deep_profiler/*.m: Conform to the changes in goal path representation. compiler/hlds_goal: Replace the goal_path field with a goal_id field in the goal_info, indicating that from now on, this should be used to identify goals. Keep a reverse_goal_path field in the goal_info for use by RBMM and CTGC. Those analyses were too hard to convert to using goal_ids, especially since RBMM uses goal_paths to identify goals in multi-pass algorithms that should be one-pass and should not NEED to identify any goals for later processing. compiler/goal_path: Add predicates to fill in goal_ids, and update the predicates filling in the now deprecated reverse goal path fields. Add the operations needed by the rest of the compiler on goal ids and containing goal maps. Remove the option to set goal paths using "mode equivalent steps". Constraint based mode analysis now uses goal ids, and can now do its own equivalent optimization quite simply. Move the goal_path module from the check_hlds package to the hlds package. compiler/*.m: Conform to the changes in goal path representation. Most modules now use goal_ids to identify goals, and use a containing goal map to convert the goal ids to goal paths when needed. However, the ctgc and rbmm modules still use (reverse) goal paths. library/digraph.m: library/group.m: library/injection.m: library/pprint.m: library/pretty_printer.m: library/term_to_xml.m: Minor style improvements. |
||
|
|
8a28e40c9b |
Add the predicates sorry, unexpected and expect to library/error.m.
Estimated hours taken: 2 Branches: main Add the predicates sorry, unexpected and expect to library/error.m. compiler/compiler_util.m: library/error.m: Move the predicates sorry, unexpected and expect from compiler_util to error. Put the predicates in error.m into the same order as their declarations. compiler/*.m: Change imports as needed. compiler/lp.m: compiler/lp_rational.m: Change imports as needed, and some minor cleanups. deep_profiler/*.m: Switch to using the new library predicates, instead of calling error directly. Some other minor cleanups. NEWS: Mention the new predicates in the standard library. |
||
|
|
881039cfed |
Correct problems in the automatic parallelism analysis.
This patch fixes various problems, the most significant is the calculation of
variable use information. The parallelisation analysis uses deep profiling
data. In other words, profiling data that is attached to context information
referring to not just the procedure but the chain of calls leading to that
invocation of that procedure (modulo recursion). The variable use analysis did
not use deep profiling data, therefore comparing the time that a variable is
produced with a call to the time in total of that call was not sound, and
sometimes resulted in information that is not possible, such as a variable
being produced or consumed after the call that produces or consumes it has
exited.
This change-set updates the variable use analysis to use deep profiling data to
avoid these problems. At the same time it provides more accurate information
to the automatic parallelisation pass. This is possible because of an earlier
change that allowed the coverage data to use deep profiling data.
In its current state, the parallelisation analysis now finishes without errors
and computes meaningful results when analysing a profile of the mercury
compiler's execution.
deep_profiler/report.m:
The proc var use report is now a call site dynamic var use report.
1) It now uses deep profiling data.
2) It makes more sense from the callers perspective so it's now based
around a call site rather than a proc.
Add inst subtypes to the recursion_type type.
deep_profiler/query.m:
The proc var use query is now a call site dynamic var use query, see
report.m.
deep_profiler/var_use_analysis.m:
Fix a bug here and in mdprof_fb.automatic_parallelism.m: If a
variable is consumed by a call and appears in it's argument list more than
once, take the earliest consumption time rather than the one for the
earliest argument.
Variable use analysis now uses recursion_patterns.m to correctly compute
the cost of recursive calls. It also uses 'deep' profiler data.
Only measure variable use relative to the entry into a procedure, rather
than either relative to the entry or exit. This allows us to simplify a
lot of code.
deep_profiler/create_report.m:
The proc var use info report is now a call site dynamic var use info
report.
Move some utility code from here to the new analysis_utils.m module.
deep_profiler/display_report.m:
Conform to changes in report.m.
Improve the information displayed for variable first-use time
reports.
deep_profiler/mdprof_fb.automatic_parallelism.m:
Conform to changes in report.m
Refactored the walk down the clique tree. This no-longer uses the
clique reports from the deep profiling tool.
We now explore the same static procedure more than once. It may be best to
parallelise it in some contexts rather than others but for now we assume
that the benefits in some context are worth the costs without benefit in
the other contexts. This is better than reaching a context where it is
undesirable first and never visiting a case where parallelisation is
desirable.
Fix a bug in the calculation of how much parallelisation is used by
parallelisations in a clique's parents. This used to trigger an
assertion.
Don't try to parallelize anything in the "exception" module.
There's probably other builtin code we should skip over here.
Removed an overzealous assertion that was too easily triggered by the
inaccuracies of IEEE-754 arithmetic.
Compute variable use information lazily for each variable in each call. I
believe that this has made our implementation much faster as it no-longer
computes information that is never used.
Refactor and move build_recursive_call_site_cost_map to the new
module analysis_utils.m where it can be used by other analyses.
Call site cost maps now use the cs_cost_csq type to store costs,
code in this module now conforms to this change.
Conform to changes in messages.m
deep_profiler/recursion_patterns.m:
Export a new predicate, recursion_type_get_maybe_avg_max_depth/2. This
retrieves the average maximum recursion depth from recursion types that know
this information.
Move code that builds a call site cost map for a procedure to
analysis_utils.m where it can be used by other analyses.
deep_profiler/analysis_utils.m:
Added a new module containing various utility predicates for profile
analysis.
deep_profiler/coverage.m:
Added an extra utility predicate get_coverage_after/2.
deep_profiler/message.m:
Each message has a location that it refers to, a new location type has
been added: call_site_dynamic.
Added a new warning that can be used to describe when a call site's
argument's use time cannot be computed.
Added new predicates for printing out messages whose level is below a
certain threshold. These predicates can be called from io trace goals.
Message levels start at 0 and currently go to 4, more critical messages
have lower levels. The desired verbosity level is stored in a module local
mutable.
deep_profiler/mdprof_feedback.m:
Move the message printing code from here to message.m.
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
Conform to changes in query.m.
mdbcomp/feedback.automatic_parallelism.m:
Added a new function for computing the 'cpu time' of a parallel
computation.
library/lazy.m:
Moved lazy.m from extras to the standard library.
library/list.m:
Add a new predicate member_index0/3. Like member/2 except it also gives
the zero-based index of the current element within the list.
library/maybe.m:
Add two new insts.
maybe_yes(I) for the maybe type's yes/1 constructor.
maybe_error_ok(I) for the maybe_error type's ok/1 constructor.
library/Mercury.options:
Add a work around for compiling lazy.m with intermodule optimisations.
NEWS:
Update news file for the addition of lazy.m and the member_index0 predicate
in list.m
deep_profiler/.cvsignore:
Ignore feedback.automatic_parallelism.m which is copied by Mmakefile from
the mdbcomp/ directory.
|
||
|
|
1793e3898b |
Updated the automatic parallelism analysis to use the new recursive call costs
analysis.
deep_profiler/mdprof_fb.automatic_parallelism.m:
Use new clique recursion costs report to give the costs of recursive calls.
This is more accurate than the current method which is only accurate in some
less-common situations.
Refactored the walk through the program's call graph so that it fits more
neatly with the calculation of recursive calls. For instance it is
no-longer necessary to know the cost of the call into the current clique.
Delete a number of predicates that are never called.
deep_profiler/message.m:
Added a new message type, warning_cannot_compute_cost_of_recursive_calls
since the new recursive call cost algorithm is incomplete.
deep_profiler/recursion_patterns.m:
Avoid a thrown exception when trying to retrieve the parent call site of the
initial clique.
Fix the calculation of recursion depth. Name some variables more clearly
to avoid similar issues.
deep_profiler/report.m:
Add a clarifying comment to the recursion_type data type to indicate that
costs are per-call.
mdbcomp/program_representation.m:
Added a new exported predicate goal_path_inside/3 like goal_path_inside/2
except that it also returns the goal path of the inner goal relative to the
outer goal.
Made goal_path_inside/2 more efficient by using list.remove_suffix rather
than list.append which creates a choice point whose second solution always
fails. (See the comment on list.append/3 in mode out, in, in.
|
||
|
|
ba1f56c6d5 |
Finish the cost of recursive calls analysis for linear recursions.
This code will be used by the automatic parallelisation analysis. It is
accessible as a developer report in the deep profiler.
Thanks to Thibaut Feydy who helped me with the formula for the average cost of
recursive calls, and some missing parts in my maths knowledge :-).
deep_profiler/report.m:
Add extra fields to the rt_single constructor for the recursion_type data
type:
The average total depth of recursion.
The cost of a recursive call at the average recursion level.
A higher-order value that gives the cost of recursive calls at a given
level.
deep_profiler/recursion_patterns.m:
Use a per-call cost for the recursive call site cost report.
Document and code formulas for calculating the cost of recursive calls at
any level and at the average level for linear recursion.
Conform to changes in report.m.
deep_profiler/display_report.m:
In the recursive call cost report:
Print the average cost of recursive calls as well as the costs of
levels 0, 1, 2, N/2, N-2, N-1 and N.
Update text in column headers to indicate that costs are 'per call'.
Conform to changes in report.m
Fix a bug whereby visiting the menu screen and following some links from
it reset the user's preferences.
|
||
|
|
7e7d77e23f |
Make coverage profiling data 'deep'.
The deep profiler associates measurements with their context in the call graph
modulo recursion. This has been true for all measurements except for coverage
profiling data. This patch allows coverage data to be associated with
ProcDynamic structures so that it is keyed by this context not just the static
procedure. This new behaviour is the default the old option of static coverage
profiling is still available for testing, as is no coverage profiling. Note
that, as before, coverage profiling is supported by default however coverage
points are not inserted by default.
This change will be used to measure the depth of recursion, and therefore the
average cost of recursion as well as the likely times when variables are
produced in calls for the automatic parallelisation analysis.
runtime/mercury_conf_param.h:
Create three new preprocessor macros:
MR_DEEP_PROFILING_COVERAGE - defined when coverage profiling is
enabled.
MR_DEEP_PROFILING_COVERAGE_STATIC - defined when static coverage
profiling is being used.
MR_DEEP_PROFILING_COVERAGE_DYNAMIC - defined when dynamic coverage
profiling is being used.
runtime/mercury_deep_profiling.h:
Update data structures to support dynamic coverage profiling.
Use conditional compilation to allow us to test the deep profiler in three
different modes, without coverage profiling, with static coverage profiling
and with dynamic coverage profiling.
Rename MR_PROFILING_MALLOC, since it takes a type rather than a size in
bytes it should be called MR_PROFILING_NEW to conform with existing malloc
and new functions.
runtime/mercury_deep_profiling.c:
Avoid a C compiler warning.
MR_write_out_coverage_point has been removed, it's replaced with:
MR_write_out_coverage_points_static and
MR_write_out_coverage_points_dynamic.
These write out more than one coverage point and write out either static or
dynamic coverage points.
Write a 64bit flags value (a bitfield) to the header of the Deep.data file.
This replaces the canonical byte (with a bit). and the byte that describes
the word size. This value also includes two bits describing the whether no
coverage data, static coverage data or dynamic coverage data is present in
the file. A bit is reserved ti indicate if the data is compressed (which
is not yet supported).
MR_write_fixed_size_int now writes out 8 byte integers, this is only used
for some counts present at the beginning of the data file along with the
new flags value. It now takes a MR_uint_least64_t integer as it's
parameter. The assertion to test for negative numbers has been removed
since this type is unsigned.
Increment the Deep.data file format version number.
compiler/layout_out.m:
Conditionally compile the NULL pointer that represents the coverage points
list in proc statics. This is conditional on the
MR_DEEP_PROFILING_COVERAGE_STATIC macro being defined.
compiler/coverage_profiling.m:
Add support for generating dynamic coverage points.
compiler/options.m:
compiler/handle_options.m:
Implement the new developer options for controlling coverage profiling.
library/profiling_builtin.m:
Specialize increment_coverage_point_count for both static and dynamic
coverage profiling. This creates
increment_{static,dynamic}_coverage_point_count.
deep_profiler/profile.m:
Add an extra field to profile_stats, this tracks whether the file reader
should try to read none, static or dynamic coverage data.
Add an extra field to proc_dynamic, An array of coverage counts wrapped by
a maybe type. It's indexed the same as the array of coverage infos in
proc_static. This array is present if dynamic coverage profiling is being
done (the default).
Modify the coverage_points field in proc static, now there are two fields,
an array of coverage_point_info values which store compile-time data. And
an optional array of coverage points (present if static coverage profiling
was performed).
Updated the formatting of the proc static structure.
Moved the coverage_point type to coverage.m.
Created a new type, coverage_data_type which enumerates the possibilities
for coverage profiling: none, static and dynamic.
deep_profiler/coverage.m:
Move the coverage point type here from profile.m, as the profile data
structure no longer refers to it directly.
Create a predicate coverage_point_arrays_to_list/3 which merges coverage
point information and the counts themselves into coverage points. This can
be used to construct a list of coverage points regardless of whether static
or dynamic coverage points are being used.
deep_profiler/read_profile.m:
Conform to changes in runtime/mercury_deep_profiling.c.
Refactored reading of the file header, a new named predicate is now used
rather than a lambda expression.
Incremented the Deep.data version number.
deep_profiler/report.m:
Updated the proc dynamic dump report structure to include a list of
coverage points.
deep_profiler/create_report.m:
deep_profiler/display_report.m:
Conform to changes in profile.m.
The proc dynamic dump now shows coverage information that was contained in
that proc dynamic.
deep_profiler/canonical.m:
deep_profiler/dump.m:
Conform to changes in profile.m.
deep_profiler/io_combinator.m:
Add a 13-arg version of maybe_error_sequence.
deep_profiler/Mercury.options:
Documented another trace flag.
|
||
|
|
699663e5e2 |
Deep profiler enhancements.
Create two new deep profiler reports: the first calculates the costs of
recursive calls at any depth of recursion for a clique. The second summarises
the types of recursion seen in a program.
deep_profiler/query.m:
Introduce new cmd types.
Conform to changes of the cmd type.
Add a new preference: the maximum number of proc statics to display for
each recursion type.
Memoize the creation of the recursion types histogram report as it can take
a while to generate, 39 minutes on a Core 4 when generating a report for
the compiler it's self.
deep_profiler/report.m:
Define the new report structures.
deep_profiler/create_report.m:
Handle creation of the new reports.
Export describe_proc and own_and_inherit_to_perf_row_data so that the
recursion_patterns module can use them.
Write a find_clique_first_and_other_procs predicate to find the first
procedure in a clique, it also returns a list of the remaining procedures.
This is exported so that recursion_patterns can use it but it belongs here
as it is generally used for creating reports.
Refactor the retrieval of the progrep data from the deep data structure.
Make a note about a change that could be made to speed up large analyses.
deep_profiler/profile.m:
Refactor the retrieval of the progrep data from the deep data structure.
deep_profiler/display_report.m:
Handle translation of the new reports to the display data type.
Link to this report from clique reports, and to clique reports from the new
clique recursion costs report.
Refactor the code that constructs the lists of related reports.
deep_profiler/recursion_patterns.m:
Create a new module to contain the recursion pattern analysis code.
deep_profiler/old_html_format.m:
deep_profiler/old_query.m:
Conform to changes in query.m
deep_profiler/mdprof_fb.automatic_parallelism.m:
Remove add_call_site_to_map it is a duplicate of add_call_site_report_to_map.
Move add_call_site_report_to_map and proc_label_from_proc_desc to report.m
deep_profiler/measurement_units.m:
Include functions to manipulate probabilities of conjoint and disjoint events.
Allow percentages to be greater than 100% and less than 0% this can occur
legitimately in some cases.
deep_profiler/measurements.m:
deep_profiler/var_use_analysis.m:
Move weighted_average/3 from var_use_analysis.m to measurements.m where it
can be used globally.
deep_profiler/mdprof_test.m:
Modify the mdprof_test program so that it can generate the recursion types
histogram report, this is useful for profiling and debugging.
|
||
|
|
190764a083 |
Fix some usability problems in the deep profiler.
Estimated hours taken: 8 Branches: main Fix some usability problems in the deep profiler. deep_profiler/exclude.m: Provide a better, more explicit representation of the contour exclusion file. This representation allows the application of contour exclusion even if the contour exclusion file contains some unrecognized module names. This is useful, because some modules of the Mercury standard library, such as profiling_builtin and mer_std, are unrecognized. They are unrecognized because either they export no predicates, or because deep profiling is turned off for them. deep_profiler/query.m: Make a provision for controlling the number of a procedure's callers displayed at a time. deep_profiler/create_report.m: Take advantage of the new capabilities listed above. deep_profiler/display_report.m: When listing a procedure's callers, print any warning messages generated at startup about recognized modules. When listing a procedure's callers, list the application of contour exclusion among the links only if contour exclusion is in fact applicable. When listing a procedure's callers, allow the user to control how many callers are shown at a time. Make the default bunch size 20, instead of previous hardwired (and too small) 5. Fix some counterintuitive behavior. When clicking on one of the fields in the header of a table, in all but one of the displayed reports, this sorts the data being displayed on the selected column. The exception was top_procs, in which it changed the criterion on which the top_procs were selected, and thus changed the procedures being displayed as well. This diff eliminates the exception. The links in the header cells now do the expected thing, obeying the law of least astonishment. The criterion for selected what procs are top can still be changed using the already existing (and previously mostly redundant) links below the table. deep_profiler/startup.m: Look for contour exclusion files not in Deep.data.contour, but in Deep.contour, since this is more consistent with what we do for other auxiliary files, like Data.procrep. Make the reading of the exclusion file and the program representation file part of the normal startup process, instead of setting their fields to dummies and filling them in with real values later. If there is a program representation file, make sure that the names of the modules in it are not unrecognized by contour exclusion. Fix a minor old bug: don't count the time spent reading Deep.contour as part of the propagation pass. Print meaningful messages (to the log file in /var/tmp) about any problems in reading Deep.contour files. deep_profiler/apply_exclusion.m: deep_profiler/old_html_format.m: deep_profiler/old_query.m: deep_profiler/profile.m: deep_profiler/report.m: Conform to the changes above. doc/user_guide.texi: Document contour exclusion, and to make this possible, expand considerably the documentation of the deep profiler as a whole. doc/Mmakefile: Ensure that invocations of latex cannot hang waiting for user input. |
||
|
|
a34eb73d2d |
Several improvements to make the deep profiler more convenient to use.
Estimated hours taken: 6 Branches: main Several improvements to make the deep profiler more convenient to use. deep_profiler/mdprof_cgi.m: If the data file does not end in .data, generate an explicit error message. Without this, the deep profiler just hangs forever on such filenames. deep_profiler/query.m: Add a couple more categories of user preferences. The first new category controls whether, in reports for procedures and cliques, the deep profiler will display call sites through which there were no calls. The second new category controls whether the deep profiler includes module qualifications in the names of procedures. Module qualifying everything, as we did before, can clutter up the output, so the new default is to module qualify only the names of procedures that are in different modules from the module that defines the current procedure. deep_profiler/profile.m: deep_profiler/report.m: Remember module names and unqualified as well as qualified names of procedures. deep_profiler/create_report.m: deep_profiler/read_profile.m: Remember the newly needed information. deep_profiler/display_report.m: Implement the two new categories of preferences. When generating the menu, make the "follow the action" links more useful by implicitly preferring to (a) hide inactive call sites, and (b) sort by overall time. When sorting by time, if two times (clock ticks) are equal, try to use call sequence numbers to resolve the order. When generating the menu, print the total quanta as well as the total runtime computed from it. deep_profiler/dump.m: deep_profiler/old_html_format.m: deep_profiler/old_query.m: Conform to the changes above. |
||
|
|
b1257cbf48 |
Search for parallelism opportunities in a clique-wise manner.
Estimated hours taken: 25
Branches: main
Search for parallelism opportunities in a clique-wise manner. Starting at the
root clique traverse expensive calls to find cliques with procedures that
should be parallelised. This has several advantages, namely it gives a simple
method for calculating an approximation of the cost of a recursive call site.
In the future it will make it easier to perform specialise parallel versions
of procedures.
deep_profiler/mdprof_feedback.m:
As above.
Create a logging facility that provides some information about the
analysis to the user, I'm using this to determine the order of features I
should implement based on the usefulness of such a feature in analysed
programs. This has necessitated changes to the command line interface.
deep_profiler/profile.m:
Introduce deep_get_progrep_det/2 to retrieve the program representation
structure from a deep structure or throw an exception.
deep_profiler/report.m:
Add more information to a comment.
mdbcomp/feedback.m:
Add more information about a structure field's semantics in the field name
and comment.
Incremented the feedback file version number.
deep_profiler/Mercury.options
Remove some old --no-warn-unused-imports flags.
|
||
|
|
9d7dea1498 |
Document when a clique may have more than one proc_dynamic for the same
Estimated hours taken: 0.2 Branches: main deep_profiler/report.m: Document when a clique may have more than one proc_dynamic for the same procedure. |
||
|
|
dd5de9e8e5 |
Add a query to the deep profiler for reporting on the getter and setter
Estimated hours taken: 12 Branches: main Add a query to the deep profiler for reporting on the getter and setter predicates in a module. This can be used to decide whether a data structure should be split in two, and if so, which fields should go into the substructure. At the same time, improve the displays we generate for some other queries by making more table column headers capable of sorting the table. deep_profiler/query.m: Add the new query type. deep_profiler/report.m: Add the definition of the new report. Include the identity of the callee, if known, in call site descriptions, to allow sorting on this. deep_profiler/create_report.m: Add code to execute the new kind of query. Include the new field in call site descriptions. Remove "dump" from the name of the predicate that builds procrep_coverage reports, since the result isn't a raw dump. deep_profiler/display_report.m: Add code to display the new kind of report. Add a link to the new report to display we generate for the module query. Allow the table in the procedure report to be sorted by context or by callee. deep_profiler/display.m: Add a new table column class for displaying field names. deep_profiler/html_format.m: Handle the new table column class. deep_profiler/old_html_format.m: deep_profiler/old_query.m: "Handle" the new query. |
||
|
|
3ad840ebb2 |
Increase the deep profiler's cohesion by dividing the
Estimated hours taken: 1 Branches: main Increase the deep profiler's cohesion by dividing the program_representation_utils.m module into three files: - coverage.m containing the coverage analysis algorithm, - var_use_analysis.m containing the variable use analysis algorithm, and - program_representation_utils.m itself containing generally useful predicates working on program representations. The last is actually the smallest file. There are no algorithm changes, only the movement of code and a few minor fixes of white space and typos in comments. deep_profiler/coverage.m: deep_profiler/var_use_analysis.m: New modules, as described above. deep_profiler/program_representation_utils.m: Delete the code moved to the new modules. mdbcomp/program_representation.m: Move some utility types and predicates here from deep_profiler/program_representation_utils.m, since they may be useful for other tasks. deep_profiler/report.m: Move the data types specific to coverage and var use analysis to the new modules, along with the utility predicates operating on them. Import the new modules as needed. deep_profiler/create_report.m: deep_profiler/displayreport.m: deep_profiler/mdprof_feedback.m: Import the new modules as needed. |
||
|
|
effa745ab5 |
Perform implicit parallelism analysis in mdprof_feedback.
Estimated hours taken: 27 Branches: main Perform implicit parallelism analysis in mdprof_feedback. This calculates the amount of parallelism available in dependant conjunctions and advises the compiler how to parallelise code via the feedback system. deep_profiler/mdprof_feedback.m: Implement implicit parallelisation analysis. deep_profiler/program_representation_utils.m: Add a simple implementation of inst maps which are used by the implicit parallelisation analysis. This implementation also tracks that variables that are required in order to instantiate a variable. Export some procedures used by the variable use analysis for use in the parallelisation analysis in mdprof_feedback.m Create an extra predicate to retrieve all the variables used by an atomic goal. Move utility code in this module to the end. deep_profiler/report.m: Add utility function to convert cost_until_var_use values to raw values either since the beginning of the procedure or before the end. mdbcomp/feedback.m: Modified the format of implicit parallelism feedback information. Incremented the feedback file format version. mdbcomp/program_representation.m: Added a procedure to search for a variable name in a variable table and fail if it cannot find it. |
||
|
|
f23dc12e7b |
Add an analysis report to the deep profiler that can determine when an
Estimated Hours Taken: 15 Branches: main Add an analysis report to the deep profiler that can determine when an argument to a procedure is likely to be consumed or produced. This is useful for determining the parallelism within dependant conjunctions. Due to limitations in the deep profiler recursive code cannot be handled well, the following two problems (and workarounds) exist. If the variable we're searching for uses of is consumed or produced within a recursive (or mutually recursive) call, we do not follow this recursion. Instead assume a pessimistic default, that if the call produces the variable assume it's produced at the end of the call, if the call consumes the variable assume it's consumed at the beginning of the call. When calculating the cost of a goal that occurs before a consumption or after a production we cannot relative an accurate cost of a recursive call from the deep profiler (A cost of 1.0 is returned). deep_profiler/report.m: Add the new report structure. deep_profiler/program_representation_utils.m: The code for the new analysis depends on the program representation bytecode, it has been added to this module. deep_profiler/create_report.m: Code to create the new report. deep_profiler/display_report.m: Basic code to display the report. deep_profiler/query.m: Include support for parsing and running the commands that refer to this new report. Conform to changes in report.m deep_profiler/old_html_format.m: deep_profiler/old_query.m: Conform to changes in report.m |
||
|
|
4338d32859 |
Remove the goal path field from from the call_site_perf structure since it's
Estimated hours taken: 0.5
Branches: main
Remove the goal path field from from the call_site_perf structure since it's
superfluous.
deep_profiler/report.m:
As above.
Make the goal_path field in the call_site_desc structure store a goal path
rather than a string representing one.
deep_profiler/create_report.m:
deep_profiler/display_report.m:
Conform to changes in report.m
|
||
|
|
38ea2ae9d3 |
Simplify the coverage propagation algorithm in several respects.
Estimated hours taken: 8 Branches: main Simplify the coverage propagation algorithm in several respects. First, pass around the coverage before and after each goal separately, since almost all decisions affect the two program points differently. This allows us to eliminate much code whose job it used to be to split up coverage_infos and merge them back together just so they could be split again the next time around. In this new arragement, we join them together only when they are final and about to be attached to the goal they annotate. Second, we now explicitly assume that updating either the before or after count of a goal cannot lose knowledge, i.e. that we cannot go from e.g. before_known(X) to before_unknown. This *should* have been true with the previous system as well, but it was hard to see, because the code used to deliberately reset one or other of the before and after counts to unknown when processing subgoals. This diff deletes the code that tried to reestablish this invariant. Third, we now separate out the data structures used to hold sums of execution counts, and give them their own type to avoid possible mixups. deep_profiler/program_representation_utils.m: Make the changes above. The improved conceptual clarity allows us to move much of the complexity of the main coverage propagation algorithm into utility predicates, thus raising the level of abstraction. In a few places, the updated algorithm can propagate more coverage information than the old version. deep_profiler/program_representation_utils.m: mdbcomp/program_representation.m: Change the names of some function symbols to add the _rep suffix, to fit in with the naming scheme we use for the other components of program representations. deep_profiler/report.m: Rename a function symbol to make help avoid misunderstanding of its meaning. deep_profiler/display_report.m: Conform to the change to report.m. |
||
|
|
53b5ab7bd0 |
Cleanups of code I read as part of reviewing Paul's last change.
Estimated hours taken: 1 Branches: main Cleanups of code I read as part of reviewing Paul's last change. This is not the post-commit review itself. deep_profiler/program_representation_utils.m: Convert a couple of semidet predicates into functions returning bool, so we could check that every case is covered. Fix departures from our style guide. Add XXXs for unclear documentation. deep_profiler/report.m: Add some documentation. mdbcomp/program_representation.m: Add a utility function. |
||
|
|
be95a5c643 |
Move the remaining deep profiler commands, dump_clique, clique and root,
Estimated hours taken: 20 Branches: main Move the remaining deep profiler commands, dump_clique, clique and root, to the report mechanism. deep_profiler/report.m: Define the representation of the new reports. Change some names to be more consistent. deep_profiler/create_report.m: Add code to create the new reports. deep_profiler/measurement units.m: Add a predicate to needed by the root command. deep_profiler/display_report.m: Add code for converting the new reports to displays. Factor out some previously duplicated code for describing procedures and call sites and for comparing them by name and by context. Conform to the changes in display.m. deep_profiler/display.m: Expand the display representation to allow the specification of attributed text, with the available attributes being bold, italic and underlined. We now use bold in clique reports. deep_profiler/html_format.m: Handle the changes in display.m. Generate HTML with more structured line breaks. deep_profiler/query.m: Switch the default handling of the three commands over to the new mechanism. Remove a long unused function. deep_profiler/profile.m: Parameterize the call_site_and_callee type, to allow report.m to associate a procedure description, not a proc_static_ptr, with a normal call site. |
||
|
|
8658fc1cc9 |
Introduce a new report type in the deep profiler tools.
Branches: main
Introduce a new report type in the deep profiler tools. The procedure
representation coverage report displays a representation of the procedure,
annotated with determinism and coverage information. This allows a programmer
to view the most frequently taken execution paths through a procedure,
This report is available when the program has been compiled for coverage
profiling, and when a Deep.procrep file is available.
deep_profiler/report.m:
The coverage profiling dump report is now a coverage_information annotated
procedure representation structure.
Add a goal_path field to the call_site_perf type.
deep_profiler/program_representation_utils.m:
Create procrep_annotate_with_coverage/5 predicate to annotate a procedure
representation structure with coverage information.
Use type classes to convert goal annotations to strings used with the
procedure representation structures.
deep_profiler/create_report.m:
Call procrep_annotate_with_coverage to build the coverage-annotated
procedure representation report.
deep_profiler/display_report.m:
Conform to changes in deep_profiler/report.m
Implement a goal_annotation typeclass for coverage_info for displaying the
coverage information.
Display a link to the procrep_coverage report from the Procedure report.
deep_profiler/mdprof_cgi.m:
Add the ability to generate a procrep_coverage report to the command line
interface for debugging.
deep_profiler/mdprof_test.m:
Add the ability to generate all the procrep coverage reports possible from
a Deep.data file.
Make compressing the result (using a separate gzip process) optional,
since it can slow down the test for a negligible gain.
|
||
|
|
cfe35c9cb7 |
Modify the deep profiling tools, in particular mdprof_cgi, to make use of
Estimated Hours Taken: 10 Branches: main Modify the deep profiling tools, in particular mdprof_cgi, to make use of program representation files, and begin implementing the procrep coverage report. The mdprof coverage report is incomplete, however it is convenient to post this for review now. Currently it can display a pretty-printed procrep structure without coverage annotations. mdbcomp/program_representation.m: Modified program representation data structures to allow goals to be annotated with another type. deep_profiler/query.m: Create new deep profiling command, to display a coverage-annotated procedure representation. Support use of program representation information by new-style report generating code. Centralised command parsing to code within this module. Created constants for strings shared between cmd_to_string and string_to_maybe_cmd. deep_profiler/report.m: Add new report, report_procrep_coverage_dump. Modified the proc_static dump report to include the number of coverage points in the proc_static. deep_profiler/create_report.m: create_report now accepts an optional program representation structure, making it possible for report generation code to use the program representation structure. Support the new procrep coverage report, which is incomplete. Modify the proc static dump report, to display the number of coverage points within a proc_static structure. deep_profiler/display.m: Introduce display_verbatim, a new display element that is able to display verbatim text, such as source code. deep_profiler/display_report.m: Add support for displaying the new mdbcomp_coverage report. Modify the proc static dump display to show the number of coverage points, conforming to a change in report.m deep_profiler/html_format.m: Support the display_verbatim element. Use query_to_string from query.m to create the query part of a URL. Conform to changes in deep_profiler/query.m deep_profiler/startup.m: Modify read_and_startup to also read the program representation data if available. deep_profiler/mdprof_cgi.m: Use string_to_maybe_query from query.m to parse a query string. Renamed some variables. Modified command-loop to pass program representation between commands. deep_profiler/program_representation_utils.m: A new module to hold utilities from working with program representation data. Pretty printing code from mdprof_procrep has been moved here and modified to output a cord of strings rather than write to standard output. deep_profiler/mdprof_feedback.m: deep_profiler/mdprof_test.m: Conform to changes in query.m deep_profiler/mdprof_procrep.m: Move proc_rep pretty-printing code to program_representation_utils.m browser/declarative_tree.m: Conform to changes in mdbcomp/program_representation.m |
||
|
|
f637aa2458 |
Move three deep profiler commands to the new framework: the one that reports
Estimated hours taken: 16 Branches: main Move three deep profiler commands to the new framework: the one that reports all of a procedure's callers, the one that lists all the modules, and the one that lists all the procedures in a module. deep_profiler/report.m: Add report structures for the three newly handled commands. Modify the perf_row_data type to allow the representation of rows in which the self measures are meaningful, but the self_and_desc measures aren't, since this is true for module summaries. Remove a redundant field from an existing report structure. deep_profiler/query.m: Change the cmd type slightly to (a) make command names more distinct, (b) make it less error prone by replacing ints with purpose-specific wrapper types, and (c) to specify whether contour exclusion should be applied in the proc_callers command. Change (c) is needed because we contour exclusion alters the report we want to generate for the proc_callers command, but we don't want to pass the preferences to the code that computes reports. deep_profiler/create_report.m: Add code for computing the new report structures. Conform to the change to perf_row_data. deep_profiler/display_report.m: Add code for displaying the new report structures. Conform to the change to perf_row_data. deep_profiler/display.m: Avoid the need for a number-of-columns field in most table cells by having separate function symbols for single- and multi-column cells. Add a mechanism that allows us to avoid artifically nested lists (horizontal list inside a vertical list). Add the column classes needed by the newly implemented commands. deep_profiler/html_format.m: Conform to the changes in display.m and query.m. deep_profiler/profile.m: We used to read in the contour exclusion file just before computing and displaying a HTML page whose contents required it. We cannot do this with the report framework (since the predicate that computes report structures does not take I/O states as arguments), and it is better to read the contour exclusion file just once anyway. This diff therefore adds a field to the deep structure for holding the result of reading in the contour exclusion file (if any). deep_profiler/startup.m: Add code to fill in this new field. Switch to using state variables. deep_profiler/apply_exclusion.m: New module. It contains some code that used to be in query.m, but is now also needed by create_report.m, slightly modified. The modifications are to add some code that used to be in the callers of the moved predicates. This code used to be needed only once, but is now needed twice (since each predicate now has two callers). The reason why I didn't put all this into the existing exclude.m is that that would have required profile.m and exclude.m to import each other. deep_profiler/exclude.m: Change the return value to separate the case of a non-existent contour exclusion file from a file that exists but whose reading yields an error. Give variables better names. deep_profiler/mdprof_cgi.m: deep_profiler/mdprof_test.m: Conform to the changes in query.m. deep_profiler/apply_exclusion.m: New module. It contains some code that used to be in query.m, but is now also needed by create_report.m, slightly modified. The modifications are to add some code that used to be in the callers of the moved predicates. This code used to be needed only once, but is now needed twice (since each predicate now has two callers). The reason why I didn't put all this into the existing exclude.m is that that would have required profile.m and exclude.m to import each other. deep_profiler/exclude.m: Give variables better names. deep_profiler/measurements.m: Turn a semidet predicate into a function. |
||
|
|
599e1c2fdb |
Implement the proc command of the deep profiler using the report mechanism.
Estimated hours taken: 16 Branches: main Implement the proc command of the deep profiler using the report mechanism. Some of the detailed changes also address Paul's post-commit review of my previous diff. deep_profiler/report.m: Define the representation of the proc report. Change some names to be more consistent. deep_profiler/profile.m: Add a type for use in report.m. Document the fields of an existing type. deep_profiler/create_report.m: Add code to create proc reports. Change some names to be more consistent. Fix a bug: avoid divide by zero exceptions in some rare cases. deep_profiler/measurement units.m: Fix a bug: avoid divide by zero exceptions in some rare cases. deep_profiler/display_report.m: Add the code for converting proc reports to displays. This required rewriting almost everthing in this module to remove the assumption, which was previously embedded in many places, that the code is part of the implementation of the top_procs command. The new code is separated into two parts; the command-specific parts, and the parts that should be usable for all commands. (The reusable part is much bigger.) deep_profiler/display.m: Expand the display representation to allow the specification of - plain text as distinguished from headings - paragraph breaks - pseudo-links, i.e. text fragments that are formatted like links - table separator rows - table cells that span more than one column which are used in the new version of display_report.m. Simplify the mechanism for setting up table header groups. deep_profiler/html_format.m: Handle the changes in display.m. Fix some anomalies in the formatting of lists and tables. Group related code together. deep_profiler/query.m: Provide a switch for selecting which of the two mechanisms, the old direct generation of HTML or the new indirect generation through the report and display structures, should generate the HTML page for a command that both mechanisms can implement. The default is the new mechanism, but it can be overridden by implementors by creating a file called "/tmp/old_deep_profiler". Switch the default handling of the proc command over to the new mechanism. Rename some types and function symbols to make them more consistent and expressive. Generate more informative error messages for domain error exceptions. deep_profiler/mdprof_cgi.m: Add a mechanism for decoding the links in the generated pages. The mechanism takes the form of three new options: --decode, --decode-cmd, and --decode-prefs. When one or more of these are given, mdprof_cgi will not do its usual stuff, instead of just loops waiting for lines whose contents it will then try to decode as queries, as commands and/or as preferences. deep_profiler/Mercury.options: Try to postpone thrashing in the deep compiler when compiled in debug grades, by compiling their contents with shallow tracing. deep_profiler/array_util.m: Make shallow tracing effective by moving the deep recursions into non-exported predicates. deep_profiler/callgraph.m: deep_profiler/canonical.m: deep_profiler/startup.m: Convert the debugging code to use trace goals. deep_profiler/cliques.m: deep_profiler/read_profile.m: Convert the debugging code to use trace goals. Use more expressive names for lots of variables. In read_profile.m, avoid an unnecessary repackaging of data. deep_profiler/util.m: Fix some grammar errors in a comment, and comment some code to use state variables. deep_profiler/interface.m: Fix some grammar errors in a comment. deep_profiler/mdprof_feedback.m: Change some variable names to be consistent with the other modules. library/float.m: library/int.m: Make the messages in the domain errors we throw more expressive. library/io.m: Minor style changes. |
||
|
|
1de09830dc |
Deep profiling and program representation file format changes.
Estimated hours taken: 7.5 Branches: main Deep profiling and program representation file format changes. Include a table of variable names in the program representation used by the deep profiler (Deep.procrep). The table shouldn't contain variables introduced by the compiler. Include the name of the program from which the deep profile was generated in the header of the deep profiling data file (Deep.data). compiler/prog_rep.m: Optionally create the variable table within the bytecode generated for each procedure, The actual variable names are stored in the string table for the module. compiler/stack_layout.m: Enable the variable table only for deep profiling builds. mdbcomp/program_representation.m: Include variable table in each program representation structure. Create predicates to read in the variable table if it is present. Create predicates to lookup a variable name from a table or generate a name automatically. Incremented version number for the program representation file format. runtime/mercury_deep_profiling.c: Write out program name in header of deep profiling data. Increment version numbers of deep profiling and program representation file formats. browser/declarative_tree.m: deep_profiler/canonical.m: tests/debugger/declarative/builtin_call_rep.exp: tests/debugger/declarative/dependency.exp: Conform to changes in mdbcomp/program_representation.m deep_profiler/mdprof_procrep.m: Lookup and display variable names when displaying program representation. deep_profiler/profile.m: Make program name part of the profile_stats structure. deep_profiler/read_profile.m: deep_profiler/io_combinator.m: Read in program name from deep profiling data. Incremented version number for the deep profiling file format. deep_profiler/report.m: deep_profiler/create_report.m: deep_profiler/display_report.m: Display program name with the statistics on the menu report. deep_profiler/dump.m Conform to changes in deep_profiler/profile.m. |
||
|
|
8f0ef48784 |
Use reports to handle the call_site_static and call_site_dynamic queries.
Estimated hours taken: 3 Branches: main Use reports to handle the call_site_static and call_site_dynamic queries. deep_profiler/report.m: Add the two new report types. Give a better name to a type. deep_profiler/create_report.m: Add the code for the two new report types. Make the predicate for creating a perf_row_data more general, and avoid defining the perf_row_data field-by-field. deep_profiler/display.m: Rename a table_class that is now used not just by the top_procs command. Represent columns as cords, to avoid the need for keeping track of whether the list of columns is reversed. deep_profiler/display_report.m: Add the code to handle the two new report types. Refactor some existing code to allow it to called by the new code. Conform to the other changes in report.m. deep_profiler/html_format.m: Add newlines to the output, in order to make it more readable and to make using diff between two versions of the output feasible. Print the HTML title as a heading. Add a XXX about a disrespected control. deep_profiler/query.m: Use the new method to handle the two query types. |
||
|
|
3fc2b3f6b6 |
Use reports to handle the proc_static and proc_dynamic queries.
Estimated hours taken: 4 Branches: main Use reports to handle the proc_static and proc_dynamic queries. deep_profiler/report.m: Add the two new report types. Change the report type to give each query its own answer, without needing to use the report_message for reporting errors. Also, group each kind of report into a single data structure that can be manipulated independently of the other kinds of answers (like I did some time ago for items in the compiler.) deep_profiler/create_report.m: Add the code for the two new report types. Conform to the other changes in report.m. Inline some unnecessary intermediate predicates. deep_profiler/display.m: deep_profiler/html_format.m: Rename one table_class that is now used not just by the menu command. deep_profiler/display_report.m: Add the code to handle the two new report types. Refactor some existing code to allow it to called by the new code. Conform to the other changes in report.m. Fix several predicate names that would have become misleading as soon as we added new kinds of reports. The fix is to give them the prefix "top_procs_", since they all generate parts of top_procs pages. deep_profiler/query.m: Use the new method to handle the two query types. |
||
|
|
03035ad2e6 |
Convert Paul's new code to use cords of strings to represent HTML.
Estimated hours taken: 6 Branches: main Convert Paul's new code to use cords of strings to represent HTML. deep_profiler/html_format.m: Convert to using cords. Restructure the code in a couple of places to always put start and end tags around HTML fragments together. Fix a missing "=" in a tag. deep_profiler/interface.m: deep_profiler/mdprof_cgi.m: deep_profiler/read_profile.m: Provide better diagnostics. deep_profiler/create_report.m: deep_profiler/display.m: deep_profiler/display_report.m: deep_profiler/mdprof_feedback.m: deep_profiler/measurement_units.m: deep_profiler/query.m: deep_profiler/report.m: mdbcomp/feedback.m: Misc cleanups. They can be considered my post-commit review of Paul's diff. In mdprof_feedback.m, delete a strange test that prevented the program from being used from the command line. deep_profiler/dump.m: deep_profiler/mdprof_dump.m: deep_profiler/timeout.m: deep_profiler/util.m: Misc cleanups of old code. |
||
|
|
4a03798e3c |
Introduced intermediate data structures to mdprof_cgi.
Estimated Hours Taken: 60 Branches: main Introduced intermediate data structures to mdprof_cgi. This will make it easier to extract deep profiling information for any new tools. It also enables other viewers for deep profiling data to more easily be developed. New code making use of these data structures follows a pipeline pattern as it is converted between the following data structures in this order: Deep -> Report -> Display -> HTML This work is in progress and only a handful of deep profiler commands have been converted to use the new data structures. The old code has been kept for reference and should be removed in the future. deep_profiler/report.m: Created new module that defines a data structure for a deep profiler report. The new report data structure can be used to describe the content of a particular report. deep_profiler/display.m: Created new module that defines a data structure for displaying deep profiler information. The new display data structure can be used to describe the structure and content shown when a user views a deep profiler report. deep_profiler/measurement_units.m: Created new module defining data types to represent percentages, amounts of computer memory and time. deep_profiler/query.m: Move memory_units type to data_types.m. Handling of the following deep profiler commands has been re-written to use the new data structures: deep_cmd_quit, deep_cmd_timeout, deep_cmd_restart, deep_cmd_menu, deep_cmd_top_procs deep_profiler/create_report.m: Created new module for creating reports from the deep data structure. deep_profiler/display_report.m: Created new module for converting a report structure to a display structure. deep_profiler/html_format.m: Introduce new code to convert a display data structure into a string of HTML formatted text. Moved number formatting code to measurement_units.m. |