| 67 | } // namespace |
| 68 | |
| 69 | void SupportedOpsMain(int argc, char** argv, const char* regen_run) { |
| 70 | std::vector<string> device_names = XlaOpRegistry::BackendNames(); |
| 71 | std::sort(device_names.begin(), device_names.end()); |
| 72 | |
| 73 | // Set up and parse flags. |
| 74 | string device; |
| 75 | std::vector<Flag> flag_list = { |
| 76 | {"device", &device, |
| 77 | "Name of the compilation device for which to print supported ops, " |
| 78 | "one of: " + |
| 79 | absl::StrJoin(device_names, ",")}, |
| 80 | }; |
| 81 | string usage = Flags::Usage(argv[0], flag_list); |
| 82 | bool parsed_flags_ok = Flags::Parse(&argc, argv, flag_list); |
| 83 | QCHECK(parsed_flags_ok) << "\n" << usage; |
| 84 | QCHECK(XlaOpRegistry::IsBackendRegistered(device)) |
| 85 | << "\nUnknown device: " << device << "\n" |
| 86 | << usage; |
| 87 | |
| 88 | // Run the program. |
| 89 | port::InitMain(usage.c_str(), &argc, &argv); |
| 90 | QCHECK(argc == 1) << "\nERROR: This command does not take any arguments " |
| 91 | "other than flags\n\n" |
| 92 | << usage; |
| 93 | PrintSupportedOps(device, regen_run); |
| 94 | } |
| 95 | |
| 96 | } // namespace tf2xla |
| 97 | } // namespace tensorflow |