Skip to content

Commit 7035ae9

Browse files
lamb-jsearlmc1
authored andcommitted
[Comgr][SPIRV] Write .spv and .bc to file-system with SAVE_TEMPS
If AMD_COMGR_SAVE_TEMPS=1 is set, write the input SPIRV and output bitocde files to the Comgr temporary directories when calling the AMD_COMGR_TRANSLATE_SPIRV_TO_BC action. Also write the paths to the temporary directories to the Comgr log. Change-Id: Ibe7d2406ea22ff42101f92e25cd63712794012dd
1 parent a964746 commit 7035ae9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

amd/comgr/src/comgr-compiler.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,12 @@ amd_comgr_status_t AMDGPUCompiler::translateSpirvToBitcode() {
18711871

18721872
for (auto *Input : InSet->DataObjects) {
18731873

1874+
if (env::shouldSaveTemps()) {
1875+
if (auto Status = outputToFile(Input, getFilePath(Input, InputDir))) {
1876+
return Status;
1877+
}
1878+
}
1879+
18741880
if (Input->DataKind != AMD_COMGR_DATA_KIND_SPIRV) {
18751881
return AMD_COMGR_STATUS_ERROR_INVALID_ARGUMENT;
18761882
}
@@ -1914,9 +1920,15 @@ amd_comgr_status_t AMDGPUCompiler::translateSpirvToBitcode() {
19141920
return Status;
19151921
}
19161922

1917-
LogS << " SPIR-V Translation: amd-llvm-spirv -r "
1918-
<< "--spirv-target-env=CL2.0 " << Input->Name << " -o " << Output->Name
1919-
<< " (command line equivalent)\n";
1923+
LogS << "SPIR-V Translation: amd-llvm-spirv -r --spirv-target-env=CL2.0 "
1924+
<< getFilePath(Input, InputDir) << " "
1925+
<< getFilePath(Output, OutputDir) << " (command line equivalent)\n";
1926+
1927+
if (env::shouldSaveTemps()) {
1928+
if (auto Status = outputToFile(Output, getFilePath(Output, OutputDir))) {
1929+
return Status;
1930+
}
1931+
}
19201932
}
19211933

19221934
return AMD_COMGR_STATUS_SUCCESS;

0 commit comments

Comments
 (0)