-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathoneAPI.jl
More file actions
104 lines (82 loc) · 2.37 KB
/
oneAPI.jl
File metadata and controls
104 lines (82 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
module oneAPI
using GPUArrays
using Adapt
using GPUCompiler
import ExprTools
using SpecialFunctions
import Preferences
using LLVM
using LLVM.Interop
using Core: LLVMPtr
using SPIRV_LLVM_Translator_jll, SPIRV_Tools_jll
using oneAPI_Support_jll
export oneL0
# core library
include("../lib/utils/APIUtils.jl")
include("../lib/level-zero/oneL0.jl")
using .oneL0
functional() = oneL0.functional[]
# device functionality
import SPIRVIntrinsics
SPIRVIntrinsics.@import_all
SPIRVIntrinsics.@reexport_public
Base.Experimental.@MethodTable(method_table)
include("device/runtime.jl")
include("device/array.jl")
include("device/quirks.jl")
# essential stuff
include("context.jl")
# array abstraction
include("memory.jl")
include("pool.jl")
include("array.jl")
# compiler implementation
include("compiler/compilation.jl")
include("compiler/execution.jl")
include("compiler/reflection.jl")
if Sys.islinux()
# library interop
include("../lib/support/Support.jl")
include("../lib/sycl/SYCL.jl")
using .SYCL
export SYCL
# array libraries
include("../lib/mkl/oneMKL.jl")
export oneMKL
end
# integrations and specialized functionality
include("broadcast.jl")
include("mapreduce.jl")
include("gpuarrays.jl")
include("random.jl")
include("utils.jl")
include("oneAPIKernels.jl")
import .oneAPIKernels: oneAPIBackend
include("accumulate.jl")
include("sorting.jl")
include("indexing.jl")
export oneAPIBackend
function __init__()
precompiling = ccall(:jl_generating_output, Cint, ()) != 0
precompiling && return
if oneL0.NEO_jll.is_available() && oneL0.functional[]
if Sys.iswindows()
@warn """oneAPI.jl support for native Windows is experimental and incomplete.
For the time being, it is recommended to use WSL or Linux instead."""
else
# ensure that the OpenCL loader finds the ICD files from our artifacts
ENV["OCL_ICD_FILENAMES"] = oneL0.NEO_jll.libigdrcl
end
# XXX: work around an issue with SYCL/Level Zero interoperability
# (see JuliaGPU/oneAPI.jl#417)
ENV["SYCL_PI_LEVEL_ZERO_BATCH_SIZE"] = "1"
end
return nothing
end
function set_debug!(debug::Bool)
for jll in [oneL0.NEO_jll, oneL0.NEO_jll.libigc_jll]
Preferences.set_preferences!(jll, "debug" => string(debug); force=true)
end
@info "oneAPI debug mode $(debug ? "enabled" : "disabled"); please re-start Julia."
end
end