Skip to content

Commit

Permalink
Add compiler param doc
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed May 2, 2023
1 parent 09e82fe commit 7ff249c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 13 deletions.
11 changes: 11 additions & 0 deletions docs/compiler_param.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Compiler Parameters
===================

Compiler parameters influence the way the C prediction function is generated
from a tree ensemble model.

-----------------------------

.. doxygengroup:: compiler_param
:project: tl2cgen
:content-only:
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Contents
:titlesonly:

api
compiler_param
tl2cgen-doxygen

Indices
Expand Down
24 changes: 14 additions & 10 deletions include/tl2cgen/compiler_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,32 @@ struct CompilerParam {
* \defgroup compiler_param Parameters for tree compiler
* \{
*/
/*! \brief name of model annotation file. Use the class ``treelite.Annotator``
to generate this file. */
/*!
* \brief Name of model annotation file.
* \verbatim embed:rst:leading-asterisk
* Use :py:meth:`~tl2cgen.annotate_branch` to generate this file.
* \endverbatim
*/
std::string annotate_in;
/*! \brief whether to quantize threshold points (0: no, >0: yes) */
/*! \brief Whether to quantize threshold points (0: no, >0: yes) */
int quantize;
/*! \brief option to enable parallel compilation;
/*! \brief Option to enable parallel compilation;
if set to nonzero, the trees will be evely distributed
into ``[parallel_comp]`` files. Set this option to improve
compilation time and reduce memory consumption during
compilation. */
int parallel_comp;
/*! \brief if >0, produce extra messages */
/*! \brief If >0, produce extra messages */
int verbose;
/*! \brief native lib name (without extension) */
/*! \brief Native lib name (without extension) */
std::string native_lib_name;
/*! \brief parameter for folding rarely visited subtrees (no if/else blocks);
/*! \brief Parameter for folding rarely visited subtrees (no if/else blocks);
all nodes whose data counts are lower than that of the root node
of the decision tree by [code_folding_req] will be
folded. To diable folding, set to +inf. If hessian sums are
of the decision tree by ``[code_folding_req]`` will be
folded. To diable folding, set to ``+inf``. If hessian sums are
available, they will be used as proxies of data counts. */
double code_folding_req;
/*! \brief Only applicable when compiler is set to ``failsafe``. If set to a positive value,
/*! \brief Only applicable when ``compiler`` is set to ``failsafe``. If set to a positive value,
the fail-safe compiler will not emit large constant arrays to the C code. Instead,
the arrays will be emitted as an ELF binary (Linux only). For large arrays, it is
much faster to directly dump ELF binaries than to pass them to a C compiler. */
Expand Down
2 changes: 1 addition & 1 deletion python/tl2cgen/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def generate_c_code(
dirpath :
Directory to store header and source files
params :
Parameters for compiler. See :py:doc:`this page <knobs/compiler_param>`
Parameters for compiler. See :py:doc:`this page </compiler_param>`
for the list of compiler parameters.
compiler :
Kind of C code generator to use. Currently, there are two possible values:
Expand Down
4 changes: 2 additions & 2 deletions python/tl2cgen/shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def export_lib(
Location to save the generated dynamic shared library
params :
Parameters to be passed to the compiler. See
:py:doc:`this page <knobs/compiler_param>` for the list of compiler
:py:doc:`this page </compiler_param>` for the list of compiler
parameters.
compiler :
Kind of C code generator to use. Currently, there are two possible values:
Expand Down Expand Up @@ -121,7 +121,7 @@ def export_srcpkg(
Name of model shared library to be built
params :
Parameters to be passed to the compiler. See
:py:doc:`this page <knobs/compiler_param>` for the list of compiler
:py:doc:`this page </compiler_param>` for the list of compiler
parameters.
compiler :
Name of compiler to use in C code generation
Expand Down

0 comments on commit 7ff249c

Please sign in to comment.