diff --git a/mlir/include/mlir/Target/SPIRV/Serialization.h b/mlir/include/mlir/Target/SPIRV/Serialization.h index bc58093ead864..e474101402e58 100644 --- a/mlir/include/mlir/Target/SPIRV/Serialization.h +++ b/mlir/include/mlir/Target/SPIRV/Serialization.h @@ -38,14 +38,14 @@ struct SerializationOptions { /// or an absolute path followed by the prefix. For example: /// /// * "foo" - Create files with a `foo` prefix in the current working - /// directory. For example: `fooXYZ123`, `fooABC456` ... `fooXXXXXX`. - /// The last 6 characters will be a unique combination as - /// generated by `llvm::sys::fs::createUniqueFile`. + /// directory. For example: `fooXYZ123.spv`, `fooABC456.spv` ... + /// `fooXXXXXX.spv`. The last 6 characters will be a unique combination + /// as generated by `llvm::sys::fs::createUniqueFile`. /// /// * "my/dir/foo" - Create files in `my/dir` with a `foo` prefix. The - /// `my/dir` need to exists. For example: `fooXYZ123`, `fooABC456` ... - /// `fooXXXXXX` will be created and stored in `/my/dir`. Filenames - /// follow the same pattern as above. + /// `my/dir` need to exists. For example: `fooXYZ123.spv`, + /// `fooABC456.spv` ... `fooXXXXXX.spv` will be created and stored in + /// `/my/dir`. Filenames follow the same pattern as above. /// /// * "/home/user/my/dir" - Same as above but using an absolute path. std::string validationFilePrefix = ""; diff --git a/mlir/lib/Target/SPIRV/TranslateRegistration.cpp b/mlir/lib/Target/SPIRV/TranslateRegistration.cpp index 4391ee714c519..796354e154c02 100644 --- a/mlir/lib/Target/SPIRV/TranslateRegistration.cpp +++ b/mlir/lib/Target/SPIRV/TranslateRegistration.cpp @@ -106,7 +106,7 @@ serializeModule(spirv::ModuleOp moduleOp, raw_ostream &output, int fd = 0; std::error_code errorCode = llvm::sys::fs::createUniqueFile( - options.validationFilePrefix + "%%%%%%", fd, filename); + options.validationFilePrefix + "%%%%%%.spv", fd, filename); if (errorCode) return moduleOp.emitError("error creating validation output file: ") << errorCode.message() << "\n"; diff --git a/mlir/test/Target/SPIRV/mlir-translate.mlir b/mlir/test/Target/SPIRV/mlir-translate.mlir index 9f91fc97dcaed..cbce351dd35b5 100644 --- a/mlir/test/Target/SPIRV/mlir-translate.mlir +++ b/mlir/test/Target/SPIRV/mlir-translate.mlir @@ -5,7 +5,7 @@ // RUN: rm -rf %t // RUN: mkdir %t && mlir-translate --serialize-spirv --no-implicit-module \ // RUN: --split-input-file --spirv-save-validation-files-with-prefix=%t/foo %s \ -// RUN: && ls %t | wc -l | FileCheck %s +// RUN: && ls %t/foo*.spv | wc -l | FileCheck %s // RUN: rm -rf %t // CHECK: 4