Skip to content

Commit

Permalink
Refactor TorchToTosa with separate construction of legal/illegal ops …
Browse files Browse the repository at this point in the history
…and conversion patterns.
  • Loading branch information
sahas3 committed Nov 12, 2024
1 parent 30c5193 commit ffa472f
Show file tree
Hide file tree
Showing 2 changed files with 233 additions and 206 deletions.
15 changes: 14 additions & 1 deletion include/torch-mlir/Conversion/TorchToTosa/TorchToTosa.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@

#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h"

#include <memory>

namespace mlir {
namespace torch {

/// Collect a set of legal/illegal ops for converting Torch operations to Tosa
/// dialect.
void populateTorchToTosaConversionLegalOps(ConversionTarget &target);

/// Collect a set of patterns to convert Torch operations to Tosa dialect +
/// return the set of illegalOps
std::set<StringRef>
populateTorchToTosaConversionPatternsAndIllegalOps(TypeConverter &typeConverter,
RewritePatternSet &patterns);

std::unique_ptr<OperationPass<func::FuncOp>> createConvertTorchToTosaPass();
}
} // namespace torch
} // namespace mlir

#endif // TORCHMLIR_CONVERSION_TORCHTOTOSA_TORCHTOTOSA_H
Loading

0 comments on commit ffa472f

Please sign in to comment.