-
Notifications
You must be signed in to change notification settings - Fork 34
Support for julia 1.12 #181
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
Conversation
|
Okay, never mind, turns out I needed to add using Bumper, StaticTools, StaticCompiler
function times_table(argc::Int, argv::Ptr{Ptr{UInt8}})
argc == 3 || return printf(c"Incorrect number of command-line arguments\n")
rows = argparse(Int64, argv, 2) # First command-line argument
cols = argparse(Int64, argv, 3) # Second command-line argument
buf = MallocSlabBuffer()
@no_escape buf begin
M = @alloc(Int, rows, cols)
@inbounds for i=1:rows
@inbounds for j=1:cols
M[i,j] = i*j
end
end
printf(M)
end
free(buf)
end
filepath = compile_executable(times_table, (Int64, Ptr{Ptr{UInt8}}), "./") |
|
This likely has similar issues to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for trying to revive this @VarLad. I mostly have the same comment as I did for the previous one, so I'll just copy-paste it:
I think it probably doesn't make sense to try and have so many
if version(...)checks in here, and we should just increase our version support bounds.If people aren't able to upgrade to newer versions of julia or GPUCompiler, they will get stuck with older versions of StaticCompiler which is fine.
Also, the
pkgversionfunction was added in v1.9, so using it will break the v1.8 tests.Since v1.10 is the current julia LTS, I say we drop support for v1.8 and 1.9, and drop support for GPUCompiler < 1.5
That should make this simpler and hopefully more robust too.
Except I'd recommend now that we also drop v1.10 support and move onto v1.11/v1.12 support since there's already a released version that works on v1.10 anyways, and this isn't adding new features that people on 1.10 would want (if anything, it seems that some features have regressed, since it seems you changed some of the tests to remove the possibility of them emitting boundserrors)
| @inline function mul!(C::MallocArray, A::MallocArray, B::MallocArray) | ||
| @turbo for n ∈ indices((C,B), 2), m ∈ indices((C,A), 1) | ||
| #@turbo for n ∈ indices((C,B), 2), m ∈ indices((C,A), 1) | ||
| @turbo for n ∈ indices(C, 2), m ∈ indices(C, 1) | ||
| Cmn = zero(eltype(C)) | ||
| for k ∈ indices((A,B), (2,1)) | ||
| # for k ∈ indices((A,B), (2,1)) | ||
| for k ∈ indices(A, 2) | ||
| Cmn += A[m,k] * B[k,n] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed? Was it to avoid boundserrors causing it to fail to compile? If so, we should see if there's a device_override we could do to help the compiler not get tripped up here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted this, but both now and on the previous PR, loop_vector related stuff fail to compile
| @inline function mul!(C::StackArray, A::StackArray, B::StackArray) | ||
| @turbo for n ∈ indices((C,B), 2), m ∈ indices((C,A), 1) | ||
| # error since Julia v1.11 | ||
| #@turbo for n ∈ indices((C,B), 2), m ∈ indices((C,A), 1) | ||
| @turbo for n ∈ indices(C, 2), m ∈ indices(C, 1) | ||
| Cmn = zero(eltype(C)) | ||
| for k ∈ indices((A,B), (2,1)) | ||
| # for k ∈ indices((A,B), (2,1)) | ||
| for k ∈ indices(A, 2) | ||
| Cmn += A[m,k] * B[k,n] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
| #Compile dylib | ||
| name = repr(fib) | ||
| name = string(nameof(fib)) # repr(fib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did repr stop working?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I see if I use repr:
Testing Running tests...
Standalone Dylibs: Error During Test at ~/.julia/dev/StaticCompiler/test/testcore.jl:5
Got exception outside of a @test
UndefVarError: `name` not defined in `Main`
Suggestion: check for spelling errors or missing imports.
Hint: a global variable of this name also exists in LLVM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange
|
In the future, if you're reviving old PRs, please make sure you address the review feedback that's already been given on the older version of the PR before re-requesting that someone review it. Because of the amount of time that had past, I didn't immediately recognize that I had already made the exact same review comments back in June, so I spent some time basically just rediscovering the same complaints I already had back then. |
|
@MasonProtter apologies for wasting time, I forgot about the reviews in last PR. I'll be careful about it in future PRs. 🥲 I've addressed most of the comments. I've removed explicit support for anything pre-1.11 from the codebase. printdlm function call fails test as well with: |
|
There are a lot of warnings about: throughout the codebase 🤔 |
|
Thanks for taking this on! |
Yeah, this is probably due to the switch to opaque pointers in LLVM, and will require a bunch of changes in StaticTools, but I think they should be relatively straightforward/repetitive |
No problem, and sorry if I came off as grumpy, I was just explaining some best practices for submitting PRs like this.
Looking into this a bit more, it seems that there's been a change to how the errors from julia> indices(([1, 2], [3, 4, 5]), (1, 1))
ERROR: 2 and 3 are not equal
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:44
[2] _static_promote
@ ~/.julia/packages/Static/d7YOk/src/Static.jl:332 [inlined]
[3] static_promote
@ ~/.julia/packages/Static/d7YOk/src/Static.jl:330 [inlined]
[4] static_promote
@ ~/.julia/packages/Static/d7YOk/src/Static.jl:363 [inlined]
[5] static_promote
@ ~/.julia/packages/Static/d7YOk/src/Static.jl:371 [inlined]
[6] macro expansion
@ ~/.julia/packages/Static/d7YOk/src/Static.jl:751 [inlined]
[7] reduce_tup
@ ~/.julia/packages/Static/d7YOk/src/Static.jl:751 [inlined]
[8] indices(x::Tuple{Vector{Int64}, Vector{Int64}}, dim::Tuple{Int64, Int64})
@ StaticArrayInterface ~/.julia/packages/StaticArrayInterface/lkDPR/src/ranges.jl:60
[9] top-level scope
@ REPL[3]:1and the relevant method of I would still like some boundschecking in the tests (just to make sure we still eliminate boundserrors) so could you maybe just put @boundscheck checkbounds(...)calls into one of the loop vectorization tests? e.g. something like Base.@propagate_inbounds function mul!(C::StackArray, A::StackArray, B::StackArray)
@boundscheck begin
checkbounds(axes(C, 2), axes(B, 2))
checkbounds(axes(B, 2), axes(C, 2))
checkbounds(axes(C, 1), axes(A, 1))
checkbounds(axes(A, 1), axes(C, 1))
checkbounds(axes(A, 2), axes(B, 1))
checkbounds(axes(B, 1), axes(A, 2))
end
@turbo for n ∈ axes(C, 2), m ∈ axes(C, 1)
Cmn = zero(eltype(C))
for k ∈ axes(A, 2)
Cmn += A[m,k] * B[k,n]
end
C[m,n] = Cmn
end
return C
end |
|
@MasonProtter I think even simple loopvec is broke now on StaticCompiler.jl. using StaticCompiler, StaticTools, LoopVectorization
Base.@propagate_inbounds function loopvec_product(argc::Int, argv::Ptr{Ptr{UInt8}})
argc == 3 || return printf(stderrp(), c"Incorrect number of command-line arguments\n")
rows = argparse(Int64, argv, 2) # First command-line argument
cols = argparse(Int64, argv, 3) # Second command-line argument
s = 0
@turbo for i=1:rows
for j=1:cols
s += i*j
end
end
printf(s)
end
# Attempt to compile
path = compile_executable(loopvec_product, (Int64, Ptr{Ptr{UInt8}}), "./")(this compiles fine if I remove |
|
Unfortunate. I guess lets just mark those all inside |
|
There's the issue of |
MasonProtter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there! Thanks for sticking with it, just a few nitpicks then we can merge it.
|
This is quite weird, StaticCompiler both builds and all tests (pass + broken) work for me locally 🤔 |
|
Are you running the integration tests locally? |
|
Yeah, I just ran it again, I got: I can try commenting out |
|
I have commented out |
|
Closes #166 |
|
I'd say some amount of breakage in integration tests is acceptable given those may need to be fixed on the StaticTools side |
|
Nice! |
Based on #174
Currently filing this as a draft because Bumper.jl integration seems to be broken.