Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Julia 1.12 #656

Merged
merged 6 commits into from
Jan 10, 2025
Merged

Updates for Julia 1.12 #656

merged 6 commits into from
Jan 10, 2025

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Jan 7, 2025

The compiler has changed a lot:

AFAIU, as explained by @vtjnash, this now means GPUCompiler.jl has to collect all code instances involved in a compilation job, and make sure type inference has run on them so that the cache is primed (as codegen no longer can recurse back into inference). The implementation for that is based on https://github.com/JuliaLang/julia/blob/0d6bd8cbe4673e7c7eb6237cc18de968b9bbdf63/Compiler/src/typeinfer.jl#L1296-L1325.

@vtjnash Added some questions for you inline.

src/jlgen.jl Show resolved Hide resolved
@@ -518,7 +542,7 @@ end
function ci_cache_lookup(cache, mi, min_world, max_world)
wvc = WorldView(cache, min_world, max_world)
ci = CC.get(wvc, mi, nothing)
if ci !== nothing && ci.inferred === nothing
if VERSION < v"1.12.0-DEV.1434" && ci !== nothing && ci.inferred === nothing
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this; we encounter CIs with inferred set to nothing, and those seem safe to pass to codegen now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally most CI should have their value set to nothing. Anything else you might have observed (whether on this version or in the past) is a transient state and can change concurrently, so is unsafe to rely upon

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you're saying that check is not necessary? If I don't forcibly populate our CI cache for CIs with ci.inferred == nothing, codegen calls into inference which is disallowed (Refusing to automatically run type inference with custom cache lookup.). On 1.11, at least.

src/jlgen.jl Outdated Show resolved Hide resolved
@maleadt maleadt marked this pull request as draft January 7, 2025 11:16
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 72.72727% with 12 lines in your changes missing coverage. Please review.

Project coverage is 74.18%. Comparing base (a94e6e2) to head (74f7602).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/validation.jl 28.57% 10 Missing ⚠️
src/jlgen.jl 93.33% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #656   +/-   ##
=======================================
  Coverage   74.18%   74.18%           
=======================================
  Files          24       24           
  Lines        3300     3312   +12     
=======================================
+ Hits         2448     2457    +9     
- Misses        852      855    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/jlgen.jl Outdated Show resolved Hide resolved
@maleadt maleadt force-pushed the tb/1.12 branch 2 times, most recently from c125f6c to 74f7602 Compare January 8, 2025 19:14
@maleadt maleadt marked this pull request as ready for review January 10, 2025 11:38
src/jlgen.jl Outdated Show resolved Hide resolved
src/validation.jl Outdated Show resolved Hide resolved
test/gcn_tests.jl Show resolved Hide resolved
test/gcn_tests.jl Show resolved Hide resolved
test/gcn_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/spirv_tests.jl Show resolved Hide resolved
src/jlgen.jl Outdated Show resolved Hide resolved
src/validation.jl Outdated Show resolved Hide resolved
test/gcn_tests.jl Show resolved Hide resolved
test/gcn_tests.jl Show resolved Hide resolved
Comment on lines +118 to 121
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)

asm = sprint(io->GCN.code_native(io, mod.parent2, Tuple{Int}; dump_module=true))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)
asm = sprint(io->GCN.code_native(io, mod.parent2, Tuple{Int}; dump_module=true))
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)

test/ptx_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/ptx_tests.jl Show resolved Hide resolved
test/spirv_tests.jl Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment on lines +56 to +57
@test occursin(r"s_add_u32.*(julia|j)_child_.*@rel32@", asm)
@test occursin(r"s_addc_u32.*(julia|j)_child_.*@rel32@", asm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"s_add_u32.*(julia|j)_child_.*@rel32@", asm)
@test occursin(r"s_addc_u32.*(julia|j)_child_.*@rel32@", asm)
@test occursin(r"s_add_u32.*(julia|j)_child_.*@rel32@", asm)
@test occursin(r"s_addc_u32.*(julia|j)_child_.*@rel32@", asm)

Comment on lines +92 to 93
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child_\d*,@function", asm)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child_\d*,@function", asm)

Comment on lines +118 to 121
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)

asm = sprint(io->GCN.code_native(io, mod.parent2, Tuple{Int}; dump_module=true))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)
asm = sprint(io->GCN.code_native(io, mod.parent2, Tuple{Int}; dump_module=true))
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child1_\d*,@function", asm)
@test occursin(r"\.type.*(julia|j)_[[:alnum:]_.]*child2_\d*,@function", asm)

Comment on lines +19 to 20
@test contains(ir, r"(julia|j)_identity")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test contains(ir, r"(julia|j)_identity")
@test contains(ir, r"(julia|j)_identity")
@test contains(asm, r"(julia|j)_identity")

@@ -187,7 +187,7 @@ end
ir = sprint(io->Native.code_llvm(io, valid_kernel, Tuple{}; optimize=false, dump_module=true))

# module should contain our function + a generic call wrapper
@test occursin(r"define\ .* void\ @.*julia_valid_kernel.*\(\)"x, ir)
@test occursin(r"define\ .* void\ @.*(julia|j)_valid_kernel.*\(\)"x, ir)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"define\ .* void\ @.*(julia|j)_valid_kernel.*\(\)"x, ir)
@test occursin(r"define\ .* void\ @.*(julia|j)_valid_kernel.*\(\)"x, ir)

@@ -149,7 +149,7 @@ end
end

asm = sprint(io->PTX.code_native(io, mod.parent, Tuple{Int64}))
@test occursin(r"call.uni\s+julia_child_"m, asm)
@test occursin(r"call.uni\s+(julia|j)_child_"m, asm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"call.uni\s+(julia|j)_child_"m, asm)
@test occursin(r"call.uni\s+(julia|j)_child_"m, asm)

Comment on lines +170 to +171
@test !occursin(r"\.visible \.func (julia|j)_nonentry", asm)
@test occursin(r"\.func (julia|j)_nonentry", asm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test !occursin(r"\.visible \.func (julia|j)_nonentry", asm)
@test occursin(r"\.func (julia|j)_nonentry", asm)
@test !occursin(r"\.visible \.func (julia|j)_nonentry", asm)
@test occursin(r"\.func (julia|j)_nonentry", asm)

Comment on lines +217 to 218
@test occursin(r"\.func (julia|j)_child_", asm)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"\.func (julia|j)_child_", asm)
@test occursin(r"\.func (julia|j)_child_", asm)
@test occursin(r"\.func (julia|j)_child_", asm)

Comment on lines +244 to 247
@test occursin(r"\.func (julia|j)_child1_", asm)
@test occursin(r"\.func (julia|j)_child2_", asm)

asm = sprint(io->PTX.code_native(io, mod.parent2, Tuple{Int}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"\.func (julia|j)_child1_", asm)
@test occursin(r"\.func (julia|j)_child2_", asm)
asm = sprint(io->PTX.code_native(io, mod.parent2, Tuple{Int}))
@test occursin(r"\.func (julia|j)_child1_", asm)
@test occursin(r"\.func (julia|j)_child2_", asm)
@test occursin(r"\.func (julia|j)_child1_", asm)
@test occursin(r"\.func (julia|j)_child2_", asm)

@@ -89,7 +89,7 @@ end
end

asm = sprint(io->SPIRV.code_native(io, kernel, Tuple{Bool}; kernel=true))
@test occursin(r"OpFunctionCall %void %julia_error", asm)
@test occursin(r"OpFunctionCall %void %(julia|j)_error", asm)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@test occursin(r"OpFunctionCall %void %(julia|j)_error", asm)
@test occursin(r"OpFunctionCall %void %(julia|j)_error", asm)

@maleadt maleadt merged commit ae520af into master Jan 10, 2025
18 of 19 checks passed
@maleadt maleadt deleted the tb/1.12 branch January 10, 2025 12:11
maleadt referenced this pull request Jan 10, 2025
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.

3 participants