[Mlir-commits] [mlir] [mlir][spirv] Make ConvertToSPIRVPass into a test pass (non-public) (PR #124301)
Andrea Faulds
llvmlistbot at llvm.org
Fri Jan 24 08:56:09 PST 2025
================
@@ -71,9 +66,44 @@ void populateConvertToSPIRVPatterns(const SPIRVTypeConverter &typeConverter,
}
/// A pass to perform the SPIR-V conversion.
-struct ConvertToSPIRVPass final
- : impl::ConvertToSPIRVPassBase<ConvertToSPIRVPass> {
- using ConvertToSPIRVPassBase::ConvertToSPIRVPassBase;
+struct TestConvertToSPIRVPass final
+ : PassWrapper<TestConvertToSPIRVPass, OperationPass<>> {
+ Option<bool> runSignatureConversion{
+ *this, "run-signature-conversion",
+ llvm::cl::desc(
+ "Run function signature conversion to convert vector types"),
+ llvm::cl::init(true)};
+ Option<bool> runVectorUnrolling{
+ *this, "run-vector-unrolling",
+ llvm::cl::desc(
+ "Run vector unrolling to convert vector types in function bodies"),
+ llvm::cl::init(true)};
+ Option<bool> convertGPUModules{
+ *this, "convert-gpu-modules",
+ llvm::cl::desc("Clone and convert GPU modules"), llvm::cl::init(false)};
+ Option<bool> nestInGPUModule{
+ *this, "nest-in-gpu-module",
+ llvm::cl::desc("Put converted SPIR-V module inside the gpu.module "
+ "instead of alongside it."),
+ llvm::cl::init(false)};
+
+ MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TestConvertToSPIRVPass)
+
+ StringRef getArgument() const final { return "test-convert-to-spirv"; }
+ StringRef getDescription() const final {
+ return "Conversion to SPIR-V pass only used for internal tests.";
+ }
+ void getDependentDialects(DialectRegistry ®istry) const override {
+ registry.insert<spirv::SPIRVDialect>();
+ registry.insert<vector::VectorDialect>();
+ }
+
+ TestConvertToSPIRVPass() = default;
+ TestConvertToSPIRVPass(bool convertGPUModules, bool nestInGPUModule) {
+ this->convertGPUModules = std::move(convertGPUModules);
+ this->nestInGPUModule = std::move(nestInGPUModule);
----------------
andfau-amd wrote:
These can't be set with the initialization list, you have to use the assign operator as far as I can tell.
https://github.com/llvm/llvm-project/pull/124301
More information about the Mlir-commits
mailing list