Skip to content

avoid overflow when inline_cost_threshold == typemax(Int)#60121

Open
simeonschaub wants to merge 2 commits intomasterfrom
sds/inline_cost_overflow
Open

avoid overflow when inline_cost_threshold == typemax(Int)#60121
simeonschaub wants to merge 2 commits intomasterfrom
sds/inline_cost_overflow

Conversation

@simeonschaub
Copy link
Copy Markdown
Member

GPUCompiler will set inline_cost_threshold to typemax(Int) as a way to force inlining, make sure this doesn't cause integer overflow.

should fix JuliaGPU/AMDGPU.jl#846

GPUCompiler will set `inline_cost_threshold` to `typemax(Int)` as a way to force inlining, make sure this doesn't cause integer overflow.

should fix JuliaGPU/AMDGPU.jl#846
@simeonschaub simeonschaub added compiler:inference Type inference backport 1.10 Change should be backported to the 1.10 release backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 labels Nov 13, 2025
@oscardssmith
Copy link
Copy Markdown
Member

I would probably argue that setting a threshold so high that math doesn't work on it probably isn't a great idea (e.g. maybe set it to a couple billion instead since no GPU can compile that much code into a kernel?)

simeonschaub added a commit to JuliaGPU/GPUCompiler.jl that referenced this pull request Nov 14, 2025
as cost threshold for `always_inline` to avoid integer overflow

fix JuliaGPU/AMDGPU.jl#846

alternative to JuliaLang/julia#60121
@KristofferC KristofferC mentioned this pull request Nov 24, 2025
22 tasks
@KristofferC KristofferC mentioned this pull request Dec 16, 2025
21 tasks
This was referenced Jan 9, 2026
@DilumAluthge DilumAluthge mentioned this pull request Jan 19, 2026
71 tasks
@KristofferC KristofferC mentioned this pull request Feb 4, 2026
56 tasks
@adienes
Copy link
Copy Markdown
Member

adienes commented Feb 17, 2026

seems like it would be more principled to used checked arithmetic (maybe saturating is better in this context actually?) in cost_threshold += 19*default and cost_threshold += 4*default etc. rather than hard-coding a fix specifically and only for typemax

This was referenced Feb 20, 2026
@KristofferC KristofferC mentioned this pull request Mar 13, 2026
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.10 Change should be backported to the 1.10 release backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 compiler:inference Type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

call to unknown function jl_f_issubtype but CUDA works

4 participants