Skip to content

Commit c702126

Browse files
michel2323amontoison
authored andcommitted
ZE_MAKE_VERSION and init
1 parent fa9ea17 commit c702126

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

lib/level-zero/common.jl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1-
#define ZE_MAKE_VERSION( _major, _minor ) (( _major << 16 )|( _minor & 0x0000ffff))
1+
"""
2+
ze_make_version(major::Integer, minor::Integer) -> UInt32
3+
4+
32-bit unsigned integer version number from major and minor components.
5+
This should be the Julia equivalent of the C macro:
6+
`#define ZE_MAKE_VERSION( _major, _minor ) (( _major << 16 )|( _minor & 0x0000ffff))`
7+
"""
8+
function ZE_MAKE_VERSION(major::Integer, minor::Integer)
9+
# Shift the major version 16 bits to the left
10+
# and combine it with the minor version using a bitwise OR.
11+
# The `& 0xffff` is implicit for standard integer types when combining,
12+
# but we can be explicit if needed. The result is cast to UInt32.
13+
return (UInt32(major) << 16) | (UInt32(minor) & 0x0000ffff)
14+
end
215
unmake_version(ver) = VersionNumber(Int(ver) >> 16, Int(ver) & 0x0000ffff)

lib/level-zero/oneL0.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ else
1515
using oneAPI_Level_Zero_Loader_jll
1616
end
1717

18+
include("common.jl")
1819
include("utils.jl")
1920
include("pointer.jl")
2021

@@ -85,7 +86,6 @@ end
8586

8687
# core wrappers
8788
include("error.jl")
88-
include("common.jl")
8989
include("driver.jl")
9090
include("device.jl")
9191
include("context.jl")
@@ -131,7 +131,7 @@ function __init__()
131131
zeInit(0)
132132
functional[] = true
133133
catch err
134-
@error "Failed to initialize oneAPI" exception=(err,catch_backtrace())
134+
@warn "Failed to initialize oneAPI"
135135
functional[] = false
136136
return
137137
end

0 commit comments

Comments
 (0)