File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -81,21 +81,26 @@ optimization_params(@nospecialize(job::CompilerJob{SPIRVCompilerTarget})) =
81
81
flush (input_io)
82
82
83
83
# compile to SPIR-V
84
- mktemp () do output, output_io
84
+ mktemp () do translated, translated_io
85
85
SPIRV_LLVM_Translator_jll. llvm_spirv () do translator
86
- cmd = ` $translator `
87
- if format == LLVM. API. LLVMAssemblyFile
88
- cmd = ` $cmd -spirv-text`
89
- end
90
- cmd = ` $cmd --spirv-debug-info-version=ocl-100 -o $output $input `
91
- run (cmd)
86
+ run (` $translator --spirv-debug-info-version=ocl-100 -o $translated $input ` )
92
87
end
93
88
94
- # read back the file
95
- if format == LLVM. API. LLVMAssemblyFile
96
- read (output_io, String)
97
- else
98
- read (output_io)
89
+ # optimize
90
+ # XXX : make this parameterizable?
91
+ mktemp () do optimized, optimized_io
92
+ SPIRV_Tools_jll. spirv_opt () do optimizer
93
+ run (` $optimizer -O $translated -o $optimized ` )
94
+ end
95
+
96
+ if format == LLVM. API. LLVMObjectFile
97
+ read (optimized)
98
+ else
99
+ # disassemble
100
+ SPIRV_Tools_jll. spirv_dis () do disassembler
101
+ read (` $disassembler $optimized ` , String)
102
+ end
103
+ end
99
104
end
100
105
end
101
106
end
You can’t perform that action at this time.
0 commit comments