Skip to content

Commit 625308d

Browse files
committed
Address minor comments
1 parent c2bda5a commit 625308d

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

mlir/include/mlir/Target/SPIRV/Serialization.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ struct SerializationOptions {
3838
std::string validationFilePrefix = "";
3939
};
4040

41-
/// Serializes the given SPIR-V `module` and writes to `binary`. On failure,
41+
/// Serializes the given SPIR-V `moduleOp` and writes to `binary`. On failure,
4242
/// reports errors to the error handler registered with the MLIR context for
43-
/// `module`.
44-
LogicalResult serialize(ModuleOp module, SmallVectorImpl<uint32_t> &binary,
43+
/// `moduleOp`.
44+
LogicalResult serialize(ModuleOp moduleOp, SmallVectorImpl<uint32_t> &binary,
4545
const SerializationOptions &options = {});
4646

4747
} // namespace spirv

mlir/lib/Target/SPIRV/TranslateRegistration.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,10 @@ void registerFromSPIRVTranslation() {
8484
static size_t validationFileCounter = 0;
8585

8686
static LogicalResult
87-
serializeModule(spirv::ModuleOp module, raw_ostream &output,
87+
serializeModule(spirv::ModuleOp moduleOp, raw_ostream &output,
8888
const spirv::SerializationOptions &options) {
89-
9089
SmallVector<uint32_t, 0> binary;
91-
if (failed(spirv::serialize(module, binary)))
90+
if (failed(spirv::serialize(moduleOp, binary)))
9291
return failure();
9392

9493
size_t sizeInBytes = binary.size() * sizeof(uint32_t);
@@ -110,7 +109,8 @@ serializeModule(spirv::ModuleOp module, raw_ostream &output,
110109
std::string errorMessage;
111110
std::string filename =
112111
options.validationFilePrefix + std::to_string(validationFileCounter++);
113-
auto validationOutput = openOutputFile(filename, &errorMessage);
112+
std::unique_ptr<llvm::ToolOutputFile> validationOutput =
113+
openOutputFile(filename, &errorMessage);
114114
if (!validationOutput) {
115115
llvm::errs() << errorMessage << "\n";
116116
return failure();
@@ -132,14 +132,16 @@ void registerToSPIRVTranslation() {
132132
"saved to an additional file that starts with the given prefix. This "
133133
"is used to generate separate binaries for validation, where "
134134
"`--split-input-file` normally combines all outputs into one. The "
135-
"one combined output (`-o`) is still written."),
135+
"one combined output (`-o`) is still written. Created files need to "
136+
"be "
137+
"removed manually once processed."),
136138
llvm::cl::init(""));
137139

138140
TranslateFromMLIRRegistration toBinary(
139141
"serialize-spirv", "serialize SPIR-V dialect",
140-
[](spirv::ModuleOp module, raw_ostream &output) {
141-
return serializeModule(module, output,
142-
{true, false, (validationFilesPrefix != ""),
142+
[](spirv::ModuleOp moduleOp, raw_ostream &output) {
143+
return serializeModule(moduleOp, output,
144+
{true, false, !validationFilesPrefix.empty(),
143145
validationFilesPrefix});
144146
},
145147
[](DialectRegistry &registry) {

0 commit comments

Comments
 (0)