Skip to content

Commit

Permalink
Merge pull request #2062 from JuliaGPU/tb/gpucompiler
Browse files Browse the repository at this point in the history
Adapt to GPUCompiler#master.
  • Loading branch information
maleadt authored Aug 28, 2023
2 parents ac1bc29 + 760c2bd commit a1992fb
Show file tree
Hide file tree
Showing 32 changed files with 111 additions and 497 deletions.
32 changes: 12 additions & 20 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,27 +107,25 @@ steps:
!build.pull_request.draft
timeout_in_minutes: 120
commands: |
julia -e '
julia --project -e '
using Pkg
Pkg.activate(joinpath(pwd(), "lib", lowercase("{{matrix.package}}")))
println("--- :julia: Instantiating project")
withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do
pkgs = [PackageSpec(path=pwd())]
Pkg.instantiate()
pkgs = [PackageSpec(path=joinpath(pwd(), "lib", lowercase("{{matrix.package}}")))]
if "{{matrix.package}}" == "cuTensorNet"
# cuTensorNet depends on a development version of cuTENSOR
push!(pkgs, PackageSpec(path=joinpath(pwd(), "lib", "cutensor")))
end
Pkg.develop(pkgs)
Pkg.instantiate()
Pkg.add("CUDA_Runtime_jll")
write(joinpath(pwd(), "lib", lowercase("{{matrix.package}}"), "LocalPreferences.toml"),
"[CUDA_Runtime_jll]\nversion = \"{{matrix.cuda}}\"")
write("LocalPreferences.toml", "[CUDA_Runtime_jll]\nversion = \"{{matrix.cuda}}\"")
end
println("+++ :julia: Running tests")
Pkg.test(coverage=true)'
Pkg.test("{{matrix.package}}"; coverage=true)'
- group: ":telescope: Downstream"
depends_on: "cuda"
Expand All @@ -142,25 +140,21 @@ steps:
- lib
- examples
command: |
julia -e '
julia --project -e '
using Pkg
println("--- :julia: Instantiating project")
withenv("JULIA_PKG_PRECOMPILE_AUTO" => 0) do
Pkg.develop("NNlibCUDA")
Pkg.activate("NNlibCUDA")
Pkg.develop([PackageSpec(path=pwd()),
PackageSpec(path=joinpath(pwd(), "lib", "cudnn"))])
Pkg.instantiate()
Pkg.add("CUDA_Runtime_jll")
write(joinpath(Pkg.devdir(), "NNlibCUDA", "LocalPreferences.toml"),
"[CUDA_Runtime_jll]\nversion = \"12.0\"")
Pkg.develop("NNlibCUDA")
Pkg.develop(path=joinpath(pwd(), "lib", "cudnn"))
write("LocalPreferences.toml", "[CUDA_Runtime_jll]\nversion = \"12.0\"")
end
println("+++ :julia: Running tests")
Pkg.test(coverage=true)'
Pkg.test("NNlibCUDA"; coverage=true)'
agents:
queue: "juliagpu"
cuda: "*"
Expand Down Expand Up @@ -292,10 +286,8 @@ steps:
ENV["CODESPEED_ENVIRONMENT"] = ENV["BUILDKITE_AGENT_NAME"]
println("--- :julia: Instantiating project")
Pkg.resolve()
Pkg.instantiate()
Pkg.activate("perf")
Pkg.resolve()
Pkg.instantiate()
push!(LOAD_PATH, @__DIR__)
Expand Down
8 changes: 5 additions & 3 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.8.5"
manifest_format = "2.0"
project_hash = "e8fd324aba09b72a771344d3910c4e1284ae62a0"
project_hash = "c38f3e404ea342fb740cb16012407cbac90360fd"

[[deps.AbstractFFTs]]
deps = ["ChainRulesCore", "LinearAlgebra", "Test"]
Expand Down Expand Up @@ -170,9 +170,11 @@ version = "0.1.5"

[[deps.GPUCompiler]]
deps = ["ExprTools", "InteractiveUtils", "LLVM", "Libdl", "Logging", "Scratch", "TimerOutputs", "UUIDs"]
git-tree-sha1 = "8de395b1243771bbb79ac832ec96c7def7a4586f"
git-tree-sha1 = "2bec2c336b65f1ca50c4fcb2933712503db8eb2d"
repo-rev = "master"
repo-url = "https://github.com/JuliaGPU/GPUCompiler.jl.git"
uuid = "61eb1bfa-7361-4325-ad38-22787b887f55"
version = "0.22.0"
version = "0.23.0"

[[deps.InlineStrings]]
deps = ["Parsers"]
Expand Down
12 changes: 10 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ RandomNumbers = "e6cf234a-135c-5ec9-84dd-332b85af5143"
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
UnsafeAtomicsLLVM = "d80eeb9a-aca5-4d75-85e5-170c8b632249"

[weakdeps]
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"

[extensions]
SpecialFunctionsExt = "SpecialFunctions"

[compat]
AbstractFFTs = "0.4, 0.5, 1.0"
Adapt = "3.3"
Expand All @@ -47,7 +52,7 @@ Crayons = "4"
DataFrames = "1"
ExprTools = "0.1"
GPUArrays = "8.6"
GPUCompiler = "0.22"
GPUCompiler = "0.23"
KernelAbstractions = "0.9.2"
LLVM = "6"
NVTX = "0.3.2"
Expand All @@ -60,3 +65,6 @@ Requires = "0.5, 1.0"
SpecialFunctions = "1.3, 2"
UnsafeAtomicsLLVM = "0.1"
julia = "1.8"

[extras]
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# math functionality corresponding to SpecialFunctions.jl

module SpecialFunctionsExt

using CUDA
using CUDA: @device_override

isdefined(Base, :get_extension) ? (using SpecialFunctions) : (using ..SpecialFunctions)


## error

Expand Down Expand Up @@ -46,3 +53,6 @@

@device_override SpecialFunctions.bessely(n::Int32, x::Float64) = ccall("extern __nv_yn", llvmcall, Cdouble, (Int32, Cdouble), n, x)
@device_override SpecialFunctions.bessely(n::Int32, x::Float32) = ccall("extern __nv_ynf", llvmcall, Cfloat, (Int32, Cfloat), n, x)


end
10 changes: 0 additions & 10 deletions lib/cudnn/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
using Test

# work around JuliaLang/Pkg.jl#2500
if VERSION < v"1.8"
test_project = first(Base.load_path())
preferences_file = joinpath(dirname(@__DIR__), "LocalPreferences.toml")
test_preferences_file = joinpath(dirname(test_project), "LocalPreferences.toml")
if isfile(preferences_file) && !isfile(test_preferences_file)
cp(preferences_file, test_preferences_file)
end
end

using CUDA
@info "CUDA information:\n" * sprint(io->CUDA.versioninfo(io))

Expand Down
20 changes: 10 additions & 10 deletions lib/cusolver/dense.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for (bname, fname,elty) in ((:cusolverDnSpotrf_bufferSize, :cusolverDnSpotrf, :F
@eval begin
function potrf!(uplo::Char,
A::StridedCuMatrix{$elty})
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A)
lda = max(1, stride(A, 2))

Expand Down Expand Up @@ -55,7 +55,7 @@ for (fname,elty) in ((:cusolverDnSpotrs, :Float32),
function potrs!(uplo::Char,
A::StridedCuMatrix{$elty},
B::StridedCuVecOrMat{$elty})
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A)
if size(B, 1) != n
throw(DimensionMismatch("first dimension of B, $(size(B,1)), must match second dimension of A, $n"))
Expand Down Expand Up @@ -83,7 +83,7 @@ for (bname, fname,elty) in ((:cusolverDnSpotri_bufferSize, :cusolverDnSpotri, :F
@eval begin
function potri!(uplo::Char,
A::StridedCuMatrix{$elty})
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A)
lda = max(1, stride(A, 2))

Expand Down Expand Up @@ -177,7 +177,7 @@ for (bname, fname,elty) in ((:cusolverDnSsytrf_bufferSize, :cusolverDnSsytrf, :F
@eval begin
function sytrf!(uplo::Char,
A::StridedCuMatrix{$elty})
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A)
lda = max(1, stride(A, 2))

Expand Down Expand Up @@ -502,7 +502,7 @@ for (jname, bname, fname, elty, relty) in ((:syevd!, :cusolverDnSsyevd_bufferSiz
function $jname(jobz::Char,
uplo::Char,
A::StridedCuMatrix{$elty})
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A)
lda = max(1, stride(A, 2))
W = CuArray{$relty}(undef, n)
Expand Down Expand Up @@ -542,7 +542,7 @@ for (jname, bname, fname, elty, relty) in ((:sygvd!, :cusolverDnSsygvd_bufferSiz
uplo::Char,
A::StridedCuMatrix{$elty},
B::StridedCuMatrix{$elty})
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
nA, nB = checksquare(A, B)
if nB != nA
throw(DimensionMismatch("Dimensions of A ($nA, $nA) and B ($nB, $nB) must match!"))
Expand Down Expand Up @@ -589,7 +589,7 @@ for (jname, bname, fname, elty, relty) in ((:sygvj!, :cusolverDnSsygvj_bufferSiz
B::StridedCuMatrix{$elty};
tol::$relty=eps($relty),
max_sweeps::Int=100)
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
nA, nB = checksquare(A, B)
if nB != nA
throw(DimensionMismatch("Dimensions of A ($nA, $nA) and B ($nB, $nB) must match!"))
Expand Down Expand Up @@ -643,7 +643,7 @@ for (jname, bname, fname, elty, relty) in ((:syevjBatched!, :cusolverDnSsyevjBat
max_sweeps::Int=100)

# Set up information for the solver arguments
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A)
lda = max(1, stride(A, 2))
batchSize = size(A,3)
Expand Down Expand Up @@ -702,7 +702,7 @@ for (fname, elty) in ((:cusolverDnSpotrsBatched, :Float32),
throw(DimensionMismatch(""))
end
# Set up information for the solver arguments
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A[1])
if size(B[1], 1) != n
throw(DimensionMismatch("first dimension of B[i], $(size(B[1],1)), must match second dimension of A, $n"))
Expand Down Expand Up @@ -741,7 +741,7 @@ for (fname, elty) in ((:cusolverDnSpotrfBatched, :Float32),
function potrfBatched!(uplo::Char, A::Vector{<:StridedCuMatrix{$elty}})

# Set up information for the solver arguments
VERSION >= v"1.8" && LinearAlgebra.BLAS.chkuplo(uplo)
LinearAlgebra.BLAS.chkuplo(uplo)
n = checksquare(A[1])
lda = max(1, stride(A[1], 2))
batchSize = length(A)
Expand Down
Loading

0 comments on commit a1992fb

Please sign in to comment.