Improve help documentation for split flags.

Make it easier to locally find out how to pass flags to the different backends.

PiperOrigin-RevId: 357281536
Change-Id: I4fbdf200f8f65f5aec1588f5d7285dc8622549cd
This commit is contained in:
Jacques Pienaar 2021-02-12 15:38:46 -08:00 committed by TensorFlower Gardener
parent 156b5ce928
commit be0ec80ce4
2 changed files with 12 additions and 2 deletions

View File

@ -17,6 +17,17 @@ limitations under the License.
#include "tensorflow/core/platform/init_main.h"
static llvm::cl::extrahelp FlagSplittingHelp(R"(
The command line parsing is split between the two flag parsing libraries used by
TensorFlow and LLVM:
* Flags before the first '--' are parsed by tensorflow::InitMain while those
post are parsed by LLVM's command line parser.
* If there is no separator, then no flags are parsed by InitMain and only
LLVM command line parser used.
The above help options reported are for LLVM's parser, run with `--help --` for
TensorFlow's help.
)");
namespace tensorflow {
InitMlir::InitMlir(int *argc, char ***argv) : init_llvm_(*argc, *argv) {

View File

@ -21,12 +21,11 @@ limitations under the License.
namespace tensorflow {
// Initializer to perform both InitLLVM and TF"s InitMain initialization.
// Initializer to perform both InitLLVM and TF's InitMain initialization.
// InitMain also performs flag parsing and '--' is used to separate flags passed
// to it: Flags before the first '--' are parsed by InitMain and argc and argv
// progressed to the flags post. If there is no separator, then no flags are
// parsed by InitMain and argc/argv left unadjusted.
// TODO(jpienaar): The way help flag is handled could be improved.
class InitMlir {
public:
InitMlir(int *argc, char ***argv);