Skip to content

Metal: split multiply-used aggregate loads#822

Merged
maleadt merged 1 commit into
mainfrom
tb/breeze
Jun 3, 2026
Merged

Metal: split multiply-used aggregate loads#822
maleadt merged 1 commit into
mainfrom
tb/breeze

Conversation

@maleadt
Copy link
Copy Markdown
Member

@maleadt maleadt commented Jun 2, 2026

Julia emits a single by-value load of a large nested aggregate (e.g. an Oceananigans RectilinearGrid passed by reference) feeding several extractvalues. InstCombine only folds extractvalue(load) -> load(gep) for single-use loads, so a multiply-used aggregate load survives to the AGX backend, which crashes lowering it. Apply the same fold without the single-use guard (a codegen heuristic, not a correctness condition).

Closes JuliaGPU/Metal.jl#792

Julia emits a single by-value load of a large nested aggregate (e.g. an
Oceananigans RectilinearGrid passed by reference) feeding several
extractvalues. InstCombine only folds extractvalue(load) -> load(gep) for
single-use loads, so a multiply-used aggregate load survives to the AGX
backend, which crashes lowering it. Apply the same fold without the
single-use guard (a codegen heuristic, not a correctness condition).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maleadt maleadt changed the title Metal: split multiply-used aggregate loads (JuliaGPU/Metal.jl#792) Metal: split multiply-used aggregate loads Jun 3, 2026
@maleadt maleadt merged commit 7b270bd into main Jun 3, 2026
34 of 37 checks passed
@maleadt maleadt deleted the tb/breeze branch June 3, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Back-end crash due to large aggregate loads

1 participant