Skip to content

Instantly share code, notes, and snippets.

@bjacob
Created September 22, 2021 15:20
Show Gist options
  • Save bjacob/22dacb2681010578a024aa67c7e48846 to your computer and use it in GitHub Desktop.
Save bjacob/22dacb2681010578a024aa67c7e48846 to your computer and use it in GitHub Desktop.
auto getProcAddress = [=](const char* sym_name) mutable {
for (auto funcOp : moduleOp.getOps<mlir::FuncOp>()) {
if (funcOp.sym_name() == sym_name) {
return funcOp;
}
}
llvm::errs() << "No function named `" << sym_name << "` in module.\n";
signalPassFailure();
return mlir::FuncOp();
};
FuncOps funcOps;
funcOps.actual = getProcAddress("actual_matmul");
funcOps.expected = getProcAddress("expected_matmul");
funcOps.zeroMatrix = getProcAddress("zero_matrix");
funcOps.pseudorandomMatrix = getProcAddress("pseudorandom_matrix");
funcOps.identityMatrix = getProcAddress("identity_matrix");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment