diff --git a/src/KernelAbstractions.jl b/src/KernelAbstractions.jl index 3881da55c..50469bfad 100644 --- a/src/KernelAbstractions.jl +++ b/src/KernelAbstractions.jl @@ -662,6 +662,19 @@ function priority!(::Backend, prio::Symbol) return nothing end +""" + versioninfo(io::IO=stdout, backend::Backend)::Nothing + +Print information about `backend` to `io`. It is up to the backends to +determine what is relevant. + +!!! note + Backend implementations **may** implement this function. If they do + so, they should implement `versioninfo(io::IO, ::Backend)::Nothing` +""" +versioninfo(io::IO, b::Backend) = println(io, "`versioninfo` is not implemented for $b") +versioninfo(b::Backend) = versioninfo(stdout, b) + """ device(::Backend)::Int diff --git a/src/pocl/backend.jl b/src/pocl/backend.jl index f23e20b0f..0e62fc0be 100644 --- a/src/pocl/backend.jl +++ b/src/pocl/backend.jl @@ -4,6 +4,8 @@ using ..POCL using ..POCL: @device_override, cl, method_table using ..POCL: device, clconvert, clfunction +using SPIRV_LLVM_Backend_jll, SPIRV_Tools_jll + import KernelAbstractions as KA import KernelAbstractions.KernelIntrinsics as KI @@ -19,6 +21,57 @@ export POCLBackend struct POCLBackend <: KA.GPU end +function KA.versioninfo(io::IO, ::POCLBackend) + println(io, "KernelAbstractions.jl version $(pkgversion(@__MODULE__))") + println(io) + + println(io, "Toolchain:") + println(io, " - Julia v$(VERSION)") + for jll in [SPIRV_LLVM_Backend_jll, SPIRV_Tools_jll, cl.pocl_standalone_jll] + name = string(jll) + println(io, " - $(name[1:(end - 4)]): $(pkgversion(jll))") + end + println(io) + + println(io, "Julia packages:") + for name in [:GPUCompiler, :LLVM, :SPIRVIntrinsics] + mod = getfield(POCL, name) + println(io, "- $(name): $(Base.pkgversion(mod))") + end + println(io) + + println(io, "POCL Version: ") + for platform in cl.platforms() + print(io, " OpenCL $(platform.opencl_version.major).$(platform.opencl_version.minor)") + if !isempty(platform.version) + print(io, ", $(platform.version)") + end + println(io) + + for device in cl.devices(platform) + print(io, " ยท $(device.name)") + + # show a list of tags + tags = [] + ## relevant extensions + if in("cl_khr_fp16", device.extensions) + push!(tags, "fp16") + end + if in("cl_khr_fp64", device.extensions) + push!(tags, "fp64") + end + if in("cl_khr_il_program", device.extensions) + push!(tags, "il") + end + ## render + if !isempty(tags) + print(io, " (", join(tags, ", "), ")") + end + println(io) + end + end + return +end ## Memory Operations diff --git a/test/runtests.jl b/test/runtests.jl index c1ab3a845..872b4e3d8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,6 +3,7 @@ using Test include("testsuite.jl") +KernelAbstractions.versioninfo(POCLBackend()) @info "Configuration" pocl = KernelAbstractions.POCL.nanoOpenCL.pocl_standalone_jll.libpocl @testset "CPU back-end" begin