taichi-dev / taichi

Productive, portable, and performant GPU programming in Python.
https://taichi-lang.org
Apache License 2.0
25.5k stars 2.28k forks source link

Not all `CompileConfig` options are available in `ti.init` #4544

Open RuRo opened 2 years ago

RuRo commented 2 years ago

This is either a documentation problem or bug.

The current init docs state that

Taichi provides highly customizable compilation through
``kwargs``, which allows for fine grained control of Taichi compiler
behavior. Below we list some of the most frequently used ones. For a
complete list, please check out
https://github.com/taichi-dev/taichi/blob/master/taichi/program/compile_config.h.

However not all options listed in compile_config.h are accepted in init. That is because the actual list of options is determined by this expression.

Notably, the following options are missing:

As a side note, sending the user to a header file for the list of config options is kind of suboptimal, imho. Not all default values are listed in the header file (why not btw?) and the config options on master might disagree with the user version. Both the default values and the actual list of configuration options can be obtained like this:

defaults = ti.lang.util.impl.default_cfg()
defaults = {name: getattr(defaults, name) for name in dir(defaults) if not name.startswith("_")}

You can then dynamically append information about the extra kwargs to ti.init.__doc__.

strongoier commented 2 years ago

Thanks for catching this! Typically, a config in compile_config.h but not in ti.init is simply legacy for various reasons. I think we need to get the documentation correct first. Would you mind sending a PR for your suggestion?

RuRo commented 2 years ago

Hi, sorry for the delayed reply. Unfortunately, I am kind of busy lately, so I won't be able to contribute anything in the forceable future. I'll keep submitting issues as I run into them while using taichi and I might revisit them once I get some free time. No promises tho, so if anyone wants to contribute it, that would be great.