Skip to content

Commit b1f8912

Browse files
committed
SPIRV: Simplify process spawning.
1 parent d032ef0 commit b1f8912

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/spirv.jl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,32 +148,33 @@ end
148148
cmd = `$(cmd) --spirv-max-version=$(job.config.target.version.major).$(job.config.target.version.minor)`
149149
end
150150
end
151-
proc = run(ignorestatus(cmd))
152-
if !success(proc)
151+
try
152+
run(cmd)
153+
catch e
153154
error("""Failed to translate LLVM code to SPIR-V.
154155
If you think this is a bug, please file an issue and attach $(input).""")
155156
end
156157

157158
# validate
158159
if job.config.target.validate
159-
cmd = `$(SPIRV_Tools_jll.spirv_val()) $translated`
160-
proc = run(ignorestatus(cmd))
161-
if !success(proc)
162-
run(`$(SPIRV_Tools_jll.spirv_dis()) $translated -o -`)
160+
try
161+
run(`$(SPIRV_Tools_jll.spirv_val()) $translated`)
162+
catch e
163163
error("""Failed to validate generated SPIR-V.
164164
If you think this is a bug, please file an issue and attach $(input) and $(translated).""")
165-
end
165+
end
166166
end
167167

168168
# optimize
169169
optimized = tempname(cleanup=false) * ".spv"
170170
if job.config.target.optimize
171-
cmd = `$(SPIRV_Tools_jll.spirv_opt()) -O --skip-validation $translated -o $optimized`
172-
proc = run(ignorestatus(cmd))
173-
if !success(proc)
174-
error("""Failed to optimize generated SPIR-V.
175-
If you think this is a bug, please file an issue and attach $(input) and $(translated).""")
176-
end
171+
try
172+
run(```$(SPIRV_Tools_jll.spirv_opt()) -O --skip-validation
173+
$translated -o $optimized```)
174+
catch
175+
error("""Failed to optimize generated SPIR-V.
176+
If you think this is a bug, please file an issue and attach $(input) and $(translated).""")
177+
end
177178
else
178179
cp(translated, optimized)
179180
end

0 commit comments

Comments
 (0)