[llvm] [mlir] [mlir][ods] Allow sharding of op definitions (PR #89423)

Jeff Niu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 13:13:47 PDT 2024


================

----------------
Mogball wrote:

`mlir-tblgen` calls into the TableGen parser and then calls into a function based on the command line with the parsed records. In order to make it ingest a C++ file (or another kind of file), I have to intercept it in the main function:

Turn this

```c++
// Generator that prints records.
GenRegistration printRecords("print-records", "Print all records to stdout",
                             [](const RecordKeeper &records, raw_ostream &os) {
                               os << records;
                               return false;
                             });

int main(int argc, char **argv) { return MlirTblgenMain(argc, argv); }
```

Into this:

```c++
int main(int argc, char **argv) { 
  if (argv[1] == "shard-src-files") return shardSourceFiles(argc, argv)
  return MlirTblgenMain(argc, argv); 
}

```

https://github.com/llvm/llvm-project/pull/89423


More information about the llvm-commits mailing list