diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 00b49989..dc5a50ac 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -2,7 +2,7 @@ steps: - label: "CUDA.jl" plugins: - JuliaCI/julia#v1: - version: 1.6 + version: 1.8 - JuliaCI/julia-coverage#v1: codecov: true command: | @@ -25,7 +25,7 @@ steps: - label: "oneAPI.jl" plugins: - JuliaCI/julia#v1: - version: 1.6 + version: 1.8 - JuliaCI/julia-coverage#v1: codecov: true command: | @@ -76,7 +76,7 @@ steps: # - label: "AMDGPU.jl" # plugins: # - JuliaCI/julia#v1: -# version: 1.6 +# version: 1.8 # - JuliaCI/julia-coverage#v1: # codecov: true # command: | @@ -99,7 +99,7 @@ steps: - label: "Enzyme.jl" plugins: - JuliaCI/julia#v1: - version: 1.6 + version: 1.8 - JuliaCI/julia-coverage#v1: codecov: true command: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d5509c5..ea2caf66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - version: ['1.6', '1.7', '1.8', '1.9.0-beta4'] + version: ['1.8', '1.9', '1.10.0-beta2'] os: [ubuntu-latest, macOS-latest, windows-latest] arch: [x64] steps: diff --git a/Manifest.toml b/Manifest.toml index ce84e49c..706c9586 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,160 +1,180 @@ # This file is machine-generated - editing it directly is not advised -[[ArgTools]] +manifest_format = "2.0" + +[[deps.ArgTools]] uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f" +version = "1.1.1" -[[Artifacts]] +[[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" -[[Base64]] +[[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" -[[CEnum]] +[[deps.CEnum]] git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90" uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" version = "0.4.2" -[[Dates]] +[[deps.Dates]] deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" -[[Downloads]] -deps = ["ArgTools", "LibCURL", "NetworkOptions"] +[[deps.Downloads]] +deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"] uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6" +version = "1.6.0" -[[ExprTools]] +[[deps.ExprTools]] git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec" uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04" version = "0.1.10" -[[InteractiveUtils]] +[[deps.FileWatching]] +uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" + +[[deps.InteractiveUtils]] deps = ["Markdown"] uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" -[[JLLWrappers]] -deps = ["Artifacts", "Preferences"] -git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" +[[deps.JLLWrappers]] +deps = ["Preferences"] +git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.5.0" +version = "1.4.1" -[[LLVM]] +[[deps.LLVM]] deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Printf", "Unicode"] git-tree-sha1 = "8695a49bfe05a2dc0feeefd06b4ca6361a018729" uuid = "929cbde3-209d-540e-8aea-75f648917ca0" version = "6.1.0" -[[LLVMExtra_jll]] +[[deps.LLVMExtra_jll]] deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] git-tree-sha1 = "c35203c1e1002747da220ffc3c0762ce7754b08c" uuid = "dad2f222-ce93-54a1-a47d-0025e8a3acab" version = "0.0.23+0" -[[LazyArtifacts]] +[[deps.LazyArtifacts]] deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" -[[LibCURL]] +[[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" +version = "0.6.3" -[[LibCURL_jll]] +[[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" +version = "7.84.0+0" -[[LibGit2]] +[[deps.LibGit2]] deps = ["Base64", "NetworkOptions", "Printf", "SHA"] uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" -[[LibSSH2_jll]] +[[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" +version = "1.10.2+0" -[[Libdl]] +[[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" -[[Logging]] +[[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" -[[Markdown]] +[[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" -[[MbedTLS_jll]] +[[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" +version = "2.28.0+0" -[[MozillaCACerts_jll]] +[[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" +version = "2022.2.1" -[[NetworkOptions]] +[[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" +version = "1.2.0" -[[Pkg]] +[[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +version = "1.8.0" -[[Preferences]] +[[deps.Preferences]] deps = ["TOML"] git-tree-sha1 = "7eb1686b4f04b82f96ed7a4ea5890a4f0c7a09f1" uuid = "21216c6a-2e73-6563-6e65-726566657250" version = "1.4.0" -[[Printf]] +[[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" -[[REPL]] +[[deps.REPL]] deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"] uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" -[[Random]] -deps = ["Serialization"] +[[deps.Random]] +deps = ["SHA", "Serialization"] uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -[[SHA]] +[[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" +version = "0.7.0" -[[Scratch]] +[[deps.Scratch]] deps = ["Dates"] git-tree-sha1 = "30449ee12237627992a99d5e30ae63e4d78cd24a" uuid = "6c6a2e73-6563-6170-7368-637461726353" version = "1.2.0" -[[Serialization]] +[[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" -[[Sockets]] +[[deps.Sockets]] uuid = "6462fe0b-24de-5631-8697-dd941f90decc" -[[TOML]] +[[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" +version = "1.0.0" -[[Tar]] +[[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" +version = "1.10.1" -[[TimerOutputs]] +[[deps.TimerOutputs]] deps = ["ExprTools", "Printf"] git-tree-sha1 = "f548a9e9c490030e545f72074a41edfd0e5bcdd7" uuid = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f" version = "0.5.23" -[[UUIDs]] +[[deps.UUIDs]] deps = ["Random", "SHA"] uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" -[[Unicode]] +[[deps.Unicode]] uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" -[[Zlib_jll]] +[[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" +version = "1.2.12+3" -[[nghttp2_jll]] +[[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" +version = "1.48.0+0" -[[p7zip_jll]] +[[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0" +version = "17.4.0+0" diff --git a/Project.toml b/Project.toml index c4bfaa29..e389ac11 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GPUCompiler" uuid = "61eb1bfa-7361-4325-ad38-22787b887f55" authors = ["Tim Besard "] -version = "0.22.0" +version = "0.23.0" [deps] ExprTools = "e2ba6199-217a-4e67-a87a-7c52f15ade04" @@ -18,4 +18,4 @@ ExprTools = "0.1" LLVM = "6" Scratch = "1" TimerOutputs = "0.5" -julia = "1.6" +julia = "1.8" diff --git a/src/interface.jl b/src/interface.jl index f59c3326..866d18f5 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -229,10 +229,6 @@ end function optimization_params(@nospecialize(job::CompilerJob)) kwargs = NamedTuple() - if VERSION < v"1.8.0-DEV.486" - kwargs = (kwargs..., unoptimize_throw_blocks=false) - end - if job.config.always_inline kwargs = (kwargs..., inline_cost_threshold=typemax(Int)) end diff --git a/src/irgen.jl b/src/irgen.jl index 199dbfd5..558ea151 100644 --- a/src/irgen.jl +++ b/src/irgen.jl @@ -398,35 +398,23 @@ function classify_arguments(@nospecialize(job::CompilerJob), codegen_ft::LLVM.Fu return args end -if VERSION >= v"1.7.0-DEV.204" - function is_immutable_datatype(T::Type) - isa(T,DataType) && !Base.ismutabletype(T) - end -else - function is_immutable_datatype(T::Type) - isa(T,DataType) && !T.mutable - end +function is_immutable_datatype(T::Type) + isa(T,DataType) && !Base.ismutabletype(T) end -if VERSION >= v"1.7.0-DEV.204" - function is_inlinealloc(T::Type) - mayinlinealloc = (T.name.flags >> 2) & 1 == true - # FIXME: To simple - if mayinlinealloc - if !Base.datatype_pointerfree(T) - t_name(dt::DataType)=dt.name - if t_name(T).n_uninitialized != 0 - return false - end +function is_inlinealloc(T::Type) + mayinlinealloc = (T.name.flags >> 2) & 1 == true + # FIXME: To simple + if mayinlinealloc + if !Base.datatype_pointerfree(T) + t_name(dt::DataType)=dt.name + if t_name(T).n_uninitialized != 0 + return false end - return true end - return false - end -else - function is_inlinealloc(T::Type) - return T.isinlinealloc + return true end + return false end function is_concrete_immutable(T::Type) diff --git a/src/jlgen.jl b/src/jlgen.jl index 70ee3ae5..2a54c038 100644 --- a/src/jlgen.jl +++ b/src/jlgen.jl @@ -57,23 +57,10 @@ If the method is not found, a `MethodError` is thrown. function methodinstance(ft::Type, tt::Type, world::Integer) sig = typed_signature(ft, tt) - @static if VERSION >= v"1.8" - match, _ = CC._findsup(sig, nothing, world) - match === nothing && throw(MethodError(ft, tt, world)) + match, _ = CC._findsup(sig, nothing, world) + match === nothing && throw(MethodError(ft, tt, world)) - mi = CC.specialize_method(match) - else - meth = ccall(:jl_gf_invoke_lookup, Any, (Any, UInt), sig, world) - meth === nothing && throw(MethodError(ft, tt, world)) - - (ti, env) = ccall(:jl_type_intersection_with_env, Any, - (Any, Any), sig, meth.sig)::Core.SimpleVector - - meth = Base.func_for_method_checked(meth, ti, env) - - mi = ccall(:jl_specializations_get_linfo, Ref{MethodInstance}, - (Any, Any, Any, UInt), meth, ti, env, world) - end + mi = CC.specialize_method(match) return mi::MethodInstance end @@ -246,107 +233,21 @@ end ## method overrides -@static if isdefined(Base.Experimental, Symbol("@overlay")) - -# use an overlay method table - Base.Experimental.@MethodTable(GLOBAL_METHOD_TABLE) -else - -# use an overlay world -- a special world that contains all method overrides - -const GLOBAL_METHOD_TABLE = nothing - -const override_world = typemax(Csize_t) - 1 - -struct WorldOverlayMethodTable <: CC.MethodTableView - world::UInt -end - -function CC.findall(@nospecialize(sig::Type{<:Tuple}), table::WorldOverlayMethodTable; limit::Int=typemax(Int)) - _min_val = Ref{UInt}(typemin(UInt)) - _max_val = Ref{UInt}(typemax(UInt)) - _ambig = Ref{Int32}(0) - ms = Base._methods_by_ftype(sig, limit, override_world, false, _min_val, _max_val, _ambig) - if ms === false - return CC.missing - elseif isempty(ms) - # no override, so look in the regular world - _min_val[] = typemin(UInt) - _max_val[] = typemax(UInt) - ms = Base._methods_by_ftype(sig, limit, table.world, false, _min_val, _max_val, _ambig) - else - # HACK: inference doesn't like our override world - _min_val[] = table.world - end - if ms === false - return CC.missing - end - return CC.MethodLookupResult(ms::Vector{Any}, CC.WorldRange(_min_val[], _max_val[]), _ambig[] != 0) -end - -end - -""" - @override mt def - -!!! warning - - On Julia 1.6, evaluation of the expression returned by this macro should be postponed - until run time (i.e. don't just call this macro or return its returned value, but - save it in a global expression and `eval` it during `__init__`, additionally guarded - by a check to `ccall(:jl_generating_output, Cint, ()) != 0`). -""" -macro override(mt, ex) - if isdefined(Base.Experimental, Symbol("@overlay")) - esc(quote - Base.Experimental.@overlay $mt $ex - end) - else - quote - world_counter = cglobal(:jl_world_counter, Csize_t) - regular_world = unsafe_load(world_counter) - - $(Expr(:tryfinally, # don't introduce scope - quote - unsafe_store!(world_counter, $(override_world-1)) - $(esc(ex)) - end, - quote - unsafe_store!(world_counter, regular_world) - end - )) - end - end -end - ## interpreter -if isdefined(Base.Experimental, Symbol("@overlay")) - using Core.Compiler: OverlayMethodTable - const MTType = Core.MethodTable - if isdefined(Core.Compiler, :CachedMethodTable) - using Core.Compiler: CachedMethodTable - const GPUMethodTableView = CachedMethodTable{OverlayMethodTable} - get_method_table_view(world::UInt, mt::MTType) = - CachedMethodTable(OverlayMethodTable(world, mt)) - else - const GPUMethodTableView = OverlayMethodTable - get_method_table_view(world::UInt, mt::MTType) = OverlayMethodTable(world, mt) - end +using Core.Compiler: OverlayMethodTable +const MTType = Core.MethodTable +if isdefined(Core.Compiler, :CachedMethodTable) + using Core.Compiler: CachedMethodTable + const GPUMethodTableView = CachedMethodTable{OverlayMethodTable} + get_method_table_view(world::UInt, mt::MTType) = + CachedMethodTable(OverlayMethodTable(world, mt)) else - const MTType = Nothing - if isdefined(Core.Compiler, :CachedMethodTable) - using Core.Compiler: CachedMethodTable - const GPUMethodTableView = CachedMethodTable{WorldOverlayMethodTable} - get_method_table_view(world::UInt, mt::MTType) = - CachedMethodTable(WorldOverlayMethodTable(world)) - else - const GPUMethodTableView = WorldOverlayMethodTable - get_method_table_view(world::UInt, mt::MTType) = WorldOverlayMethodTable(world) - end + const GPUMethodTableView = OverlayMethodTable + get_method_table_view(world::UInt, mt::MTType) = OverlayMethodTable(world, mt) end struct GPUInterpreter <: CC.AbstractInterpreter @@ -404,9 +305,7 @@ end CC.may_optimize(interp::GPUInterpreter) = true CC.may_compress(interp::GPUInterpreter) = true CC.may_discard_trees(interp::GPUInterpreter) = true -if VERSION >= v"1.7.0-DEV.577" CC.verbose_stmt_info(interp::GPUInterpreter) = false -end if v"1.8-beta2" <= VERSION < v"1.9-" || VERSION >= v"1.9.0-DEV.120" CC.method_table(interp::GPUInterpreter) = interp.method_table @@ -634,16 +533,11 @@ function compile_method_instance(@nospecialize(job::CompilerJob)) @in_world job.world ccall(:jl_create_native, Ptr{Cvoid}, (Vector{MethodInstance}, LLVM.API.LLVMContextRef, Ptr{Base.CodegenParams}, Cint), [job.source], context(), Ref(params), CompilationPolicyExtern) - elseif VERSION >= v"1.8.0-DEV.661" + else @assert context() == JuliaContext() @in_world job.world ccall(:jl_create_native, Ptr{Cvoid}, (Vector{MethodInstance}, Ptr{Base.CodegenParams}, Cint), [job.source], Ref(params), CompilationPolicyExtern) - else - @assert context() == JuliaContext() - @in_world job.world ccall(:jl_create_native, Ptr{Cvoid}, - (Vector{MethodInstance}, Base.CodegenParams, Cint), - [job.source], params, CompilationPolicyExtern) end @assert native_code != C_NULL llvm_mod_ref = if VERSION >= v"1.9.0-DEV.516" diff --git a/src/optim.jl b/src/optim.jl index 17947ef2..4e36dad4 100644 --- a/src/optim.jl +++ b/src/optim.jl @@ -424,7 +424,7 @@ function lower_ptls!(mod::LLVM.Module) job = current_job::CompilerJob changed = false - intrinsic = VERSION >= v"1.7.0-DEV.1205" ? "julia.get_pgcstack" : "julia.ptls_states" + intrinsic = "julia.get_pgcstack" if haskey(functions(mod), intrinsic) ptls_getter = functions(mod)[intrinsic] diff --git a/src/reflection.jl b/src/reflection.jl index be910571..b8f09c00 100644 --- a/src/reflection.jl +++ b/src/reflection.jl @@ -63,11 +63,9 @@ function code_typed(@nospecialize(job::CompilerJob); interactive::Bool=false, kw interp = get_interpreter(job) descend_code_typed = getfield(mod, :descend_code_typed) descend_code_typed(sig; interp, kwargs...) - elseif VERSION >= v"1.7-" + else interp = get_interpreter(job) Base.code_typed_by_type(sig; interp, kwargs...) - else - Base.code_typed_by_type(sig; kwargs...) end end @@ -78,19 +76,13 @@ function code_warntype(io::IO, @nospecialize(job::CompilerJob); interactive::Boo # call Cthulhu without introducing a dependency on Cthulhu mod = get(Base.loaded_modules, Cthulhu, nothing) mod===nothing && error("Interactive code reflection requires Cthulhu; please install and load this package first.") - if VERSION < v"1.7-" - descend_code_typed = getfield(mod, :descend_code_typed) - descend_code_typed(job.source; kwargs...) - else - interp = get_interpreter(job) - descend_code_warntype = getfield(mod, :descend_code_warntype) - descend_code_warntype(sig; interp, kwargs...) - end - elseif VERSION >= v"1.7-" + interp = get_interpreter(job) - code_warntype_by_type(io, sig; interp, kwargs...) + descend_code_warntype = getfield(mod, :descend_code_warntype) + descend_code_warntype(sig; interp, kwargs...) else - code_warntype_by_type(io, sig; kwargs...) + interp = get_interpreter(job) + code_warntype_by_type(io, sig; interp, kwargs...) end end code_warntype(@nospecialize(job::CompilerJob); kwargs...) = code_warntype(stdout, job; kwargs...) @@ -103,10 +95,11 @@ InteractiveUtils.code_lowered(err::KernelError; kwargs...) = code_lowered(err.jo InteractiveUtils.code_typed(err::KernelError; kwargs...) = code_typed(err.job; kwargs...) InteractiveUtils.code_warntype(err::KernelError; kwargs...) = code_warntype(err.job; kwargs...) -# For VERSION >= v"1.9.0-DEV.516" -struct jl_llvmf_dump - TSM::LLVM.API.LLVMOrcThreadSafeModuleRef - F::LLVM.API.LLVMValueRef +@static if VERSION >= v"1.9.0-DEV.516" + struct jl_llvmf_dump + TSM::LLVM.API.LLVMOrcThreadSafeModuleRef + F::LLVM.API.LLVMValueRef + end end """ diff --git a/src/reflection_compat.jl b/src/reflection_compat.jl index 70ce3aca..dc578ee1 100644 --- a/src/reflection_compat.jl +++ b/src/reflection_compat.jl @@ -1,17 +1,12 @@ # The content of this file should be upstreamed to Julia proper using InteractiveUtils: highlighting +using Base: hasgenerator function method_instances(@nospecialize(tt::Type), world::UInt=Base.get_world_counter()) return map(Core.Compiler.specialize_method, method_matches(tt; world)) end -if VERSION >= v"1.7-" - const hasgenerator = Base.hasgenerator -else - const hasgenerator = Base.isgenerated -end - function code_lowered_by_type(@nospecialize(tt); generated::Bool=true, debuginfo::Symbol=:default) debuginfo = Base.IRShow.debuginfo(debuginfo) @@ -120,12 +115,9 @@ function code_warntype_by_type(io::IO, @nospecialize(tt); InteractiveUtils.warntype_type_printer(io, rettype, true) end println(io) -@static if VERSION < v"1.7.0" - Base.IRShow.show_ir(lambda_io, src, lineprinter(src), InteractiveUtils.warntype_type_printer) -else + irshow_config = Base.IRShow.IRShowConfig(lineprinter(src), InteractiveUtils.warntype_type_printer) Base.IRShow.show_ir(lambda_io, src, irshow_config) -end println(io) end nothing diff --git a/src/runtime.jl b/src/runtime.jl index 297c9682..24df4db7 100644 --- a/src/runtime.jl +++ b/src/runtime.jl @@ -212,13 +212,8 @@ for (T, t) in [Int8 => :int8, Int16 => :int16, Int32 => :int32, Int64 => $box_fn(val) = box($T(val), Val($(QuoteNode(t)))) $unbox_fn(obj) = unbox(obj, $T) - if VERSION >= v"1.8.0-DEV.600" - compile($box_fn, Any, ($T,), T_prjlvalue; llvm_name=$"ijl_$box_fn") - compile($unbox_fn, $T, (Any,); llvm_name=$"ijl_$unbox_fn") - else - compile($box_fn, Any, ($T,), T_prjlvalue; llvm_name=$"jl_$box_fn") - compile($unbox_fn, $T, (Any,); llvm_name=$"jl_$unbox_fn") - end + compile($box_fn, Any, ($T,), T_prjlvalue; llvm_name=$"ijl_$box_fn") + compile($unbox_fn, $T, (Any,); llvm_name=$"ijl_$unbox_fn") end end diff --git a/src/validation.jl b/src/validation.jl index 95e6ecf7..e35894e5 100644 --- a/src/validation.jl +++ b/src/validation.jl @@ -83,13 +83,11 @@ function check_invocation(@nospecialize(job::CompilerJob)) Core.Compiler.isconstType(dt) && continue real_arg_i += 1 - @static if VERSION >= v"1.7" - # XXX: can we support these for CPU targets? - if dt <: Core.OpaqueClosure - throw(KernelError(job, "passing an opaque closure", - """Argument $arg_i to your kernel function is an opaque closure. - This is a CPU-only object not supported by GPUCompiler.""")) - end + # XXX: can we support these for CPU targets? + if dt <: Core.OpaqueClosure + throw(KernelError(job, "passing an opaque closure", + """Argument $arg_i to your kernel function is an opaque closure. + This is a CPU-only object not supported by GPUCompiler.""")) end if !isbitstype(dt) diff --git a/test/native.jl b/test/native.jl index fe30ec3f..c3197c66 100644 --- a/test/native.jl +++ b/test/native.jl @@ -4,15 +4,9 @@ include("definitions/native.jl") ############################################################################################ -if VERSION >= v"1.8-" - using Cthulhu - include(joinpath(dirname(pathof(Cthulhu)), "..", "test", "FakeTerminals.jl")) - using .FakeTerminals - - test_interactive = true -else - test_interactive = false -end +using Cthulhu +include(joinpath(dirname(pathof(Cthulhu)), "..", "test", "FakeTerminals.jl")) +using .FakeTerminals cread1(io) = readuntil(io, '↩'; keep=true) cread(io) = cread1(io) * cread1(io) @@ -34,16 +28,14 @@ cread(io) = cread1(io) * cread1(io) asm = sprint(io->GPUCompiler.code_native(io, job)) @test contains(asm, "julia_identity") - if test_interactive - fake_terminal() do term, in, out, err - t = @async begin - GPUCompiler.code_typed(job, interactive=true, interruptexc=false, terminal=term, annotate_source=false) - end - lines = replace(cread(out), r"\e\[[0-9;]*[a-zA-Z]"=>"") # without ANSI escape codes - @test contains(lines, "identity(x)") - write(in, 'q') - wait(t) + fake_terminal() do term, in, out, err + t = @async begin + GPUCompiler.code_typed(job, interactive=true, interruptexc=false, terminal=term, annotate_source=false) end + lines = replace(cread(out), r"\e\[[0-9;]*[a-zA-Z]"=>"") # without ANSI escape codes + @test contains(lines, "identity(x)") + write(in, 'q') + wait(t) end end @@ -564,14 +556,13 @@ end kernel() = child() child() = 0 - GPUCompiler.@override method_table child() = 1 + Base.Experimental.@overlay method_table child() = 1 end ir = sprint(io->native_code_llvm(io, mod.kernel, Tuple{}; mod.method_table)) @test occursin("ret i64 1", ir) end -if VERSION >= v"1.7" @testset "#366: semi-concrete interpretation + overlay methods = dynamic dispatch" begin mod = @eval module $(gensym()) using ..GPUCompiler @@ -585,7 +576,7 @@ if VERSION >= v"1.7" end Base.Experimental.@MethodTable method_table - GPUCompiler.@override method_table Base.isnan(x::Float32) = + Base.Experimental.@overlay method_table Base.isnan(x::Float32) = (ccall("extern __nv_isnanf", llvmcall, Int32, (Cfloat,), x)) != 0 end @@ -616,7 +607,6 @@ end @test !occursin("inttoptr", ir) @test occursin("ret void", ir) end -end ############################################################################################ diff --git a/test/runtests.jl b/test/runtests.jl index bb8aec55..a50c794d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -21,10 +21,8 @@ include("native.jl") include("ptx.jl") include("spirv.jl") include("bpf.jl") -if VERSION >= v"1.8-" - include("gcn.jl") - include("metal.jl") -end +include("gcn.jl") +include("metal.jl") include("examples.jl") haskey(ENV, "CI") && GPUCompiler.timings()