Skip to content

Conversation

@EmilySillars
Copy link
Collaborator

This PR adds the following changes
1. Automatic Tiling
Adds automatic tiling for all linalg.matmul_tranpose_b operations detected as root operations of IREE dispatches. Users pass as compiler command line options --iree-quidditch-myrtle --iree-quidditch-myrtle-mode --iree-quidditch-myrtle-out with resepctive values of the path to myrtle.y, the mode of tile selection desired, and desired output path. Alternatively, users can manually specify the tile sizes for each dispatch using the flag --iree-quidditch-import-tiles, passing it the path to a json file containing tiling schemes. If both --iree-quidditch-myrtle and --iree-quidditch-import-tiles are set, Quidditch first tiles all dispatches requested by iree-quidditch-import tiles, and then uses myrtle to tile any remaining dispatches.
Relevant Repo Changes:

  • Modifies .gitmodules and requirements.txt to include a new submodule, myrtle
  • Removes the ConfigureForSnitch pass and replaces it with a new MLIR function interface pass called ConfigureTiles.
  • Defines a hash map used by the ConfigureForSnitch pass, which gets populated with (dispatch name, tiling scheme) pairs, after reading json output from myrtle. See QuidditchTarget.cpp, TilingScheme.h and TilingScheme.cpp for more details on this hash map.

2. Automatic Dispatch Timing
Adds automatic insertion of timing operations at the beginning and end of select dispatches. This timing option is enabled with compiler command line argument --iree-quidditch-time-disp. Valid values passed to the flag are either "grapeFruit" (which refers to the new GrapeFruit test case) or "fakennMxNxK" where M, N, and K are the dimensions of the new fakeNN test case's matmul_transpose_b operation.
Relevant Repo Changes:

  • Adds a new MLIR operation to the QuidditchSnitch_Dialect called myrtle_record_cycles.
  • Modifies the SpecializeDMACode pass to take in an argument timeDisp, which enables or disables insertion of the myrtle_record_cycles operation at the beginning and end of select dispatches.

3. Sensitivity Analysis
Adds scripts to automate NsNet2 Sensitivity Analysis as well new test case GrapeFruit (a copy of NsNet2)
and for future automation, the test case FakeNN (a standalone matmul_transpose_b operation).

  • GrapeFruit is a copy of NsNet2, except that it gets modified by the scripts inside comparing-tile-sizes to build different tiled versions of NsNet2.
  • FakeNN is a single PyTorch Linear Layer (torch.nn.linear) wrapped in a Neural Network Pytorch Object (nn.Module). Its input and output sizes can be easily changed by modifying its CMakeLists.txt and FakeNN.h header file. In a later PR, I will add scripts to automate compilation, running, and exporting of cycles for the FakeNN test case.

Relevant Repo Changes:

  • adds directory comparing-tile-sizes which contains automation scripts to compile, run and export per-dispatch cycle count for runs of NsNet2 (really using GrapeFruit test case)
  • adds two new sample programs to runtime/samples, GrapeFruit and FakeNN.

@EmilySillars
Copy link
Collaborator Author

@compor and @superlopuh, for some reason I cannot add you as reviewers to this PR, so I am tagging you.
I wrote up a summary of my changes, but I can also go through the files and comment on relevant snippets if that would be helpful.

void ConvertToRISCV::runOnOperation() {
ModuleOp module = getOperation();
SymbolTable symbolTable(module);
// module.emitWarning() << "Trying to see if my snitch instruction survived! TURKEY\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦃

std::string myrtleOut = "";
quidditch::TileInfoTbl tileInfo =
quidditch::TileInfoTbl(); // added for Configure Tiles Pass
std::string tableInfoErrs = "FROG ";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐸


# debugging
function_name(){
echo "yohoho $1 $2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏴‍☠️

@EmilySillars
Copy link
Collaborator Author

This PR is too large, so I am splitting it into pieces. First piece is here: #153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants