|
11 | 11 | //
|
12 | 12 | //===----------------------------------------------------------------------===//
|
13 | 13 |
|
| 14 | +#include "mlir/Dialect/SPIRV/SPIRVDialect.h" |
14 | 15 | #include "mlir/Dialect/SPIRV/SPIRVModule.h"
|
15 | 16 | #include "mlir/Dialect/SPIRV/SPIRVOps.h"
|
16 | 17 | #include "mlir/Dialect/SPIRV/Serialization.h"
|
17 | 18 | #include "mlir/IR/Builders.h"
|
| 19 | +#include "mlir/IR/Dialect.h" |
18 | 20 | #include "mlir/IR/Function.h"
|
19 | 21 | #include "mlir/IR/Module.h"
|
20 | 22 | #include "mlir/Parser.h"
|
@@ -105,8 +107,12 @@ static LogicalResult serializeModule(ModuleOp module, raw_ostream &output) {
|
105 | 107 | namespace mlir {
|
106 | 108 | void registerToSPIRVTranslation() {
|
107 | 109 | TranslateFromMLIRRegistration toBinary(
|
108 |
| - "serialize-spirv", [](ModuleOp module, raw_ostream &output) { |
| 110 | + "serialize-spirv", |
| 111 | + [](ModuleOp module, raw_ostream &output) { |
109 | 112 | return serializeModule(module, output);
|
| 113 | + }, |
| 114 | + [](DialectRegistry ®istry) { |
| 115 | + registry.insert<spirv::SPIRVDialect>(); |
110 | 116 | });
|
111 | 117 | }
|
112 | 118 | } // namespace mlir
|
@@ -147,15 +153,23 @@ static LogicalResult roundTripModule(ModuleOp srcModule, bool emitDebugInfo,
|
147 | 153 | namespace mlir {
|
148 | 154 | void registerTestRoundtripSPIRV() {
|
149 | 155 | TranslateFromMLIRRegistration roundtrip(
|
150 |
| - "test-spirv-roundtrip", [](ModuleOp module, raw_ostream &output) { |
| 156 | + "test-spirv-roundtrip", |
| 157 | + [](ModuleOp module, raw_ostream &output) { |
151 | 158 | return roundTripModule(module, /*emitDebugInfo=*/false, output);
|
| 159 | + }, |
| 160 | + [](DialectRegistry ®istry) { |
| 161 | + registry.insert<spirv::SPIRVDialect>(); |
152 | 162 | });
|
153 | 163 | }
|
154 | 164 |
|
155 | 165 | void registerTestRoundtripDebugSPIRV() {
|
156 | 166 | TranslateFromMLIRRegistration roundtrip(
|
157 |
| - "test-spirv-roundtrip-debug", [](ModuleOp module, raw_ostream &output) { |
| 167 | + "test-spirv-roundtrip-debug", |
| 168 | + [](ModuleOp module, raw_ostream &output) { |
158 | 169 | return roundTripModule(module, /*emitDebugInfo=*/true, output);
|
| 170 | + }, |
| 171 | + [](DialectRegistry ®istry) { |
| 172 | + registry.insert<spirv::SPIRVDialect>(); |
159 | 173 | });
|
160 | 174 | }
|
161 | 175 | } // namespace mlir
|
0 commit comments