File tree Expand file tree Collapse file tree 3 files changed +3
-47
lines changed Expand file tree Collapse file tree 3 files changed +3
-47
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ CodecBzip2 = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd"
1010ExprTools  = " e2ba6199-217a-4e67-a87a-7c52f15ade04" 
1111GPUArrays  = " 0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" 
1212GPUCompiler  = " 61eb1bfa-7361-4325-ad38-22787b887f55" 
13+ GPUToolbox  = " 096a3bc2-3ced-46d0-87f4-dd12716f4bfc" 
1314KernelAbstractions  = " 63c18a36-062a-441e-b654-da1e3ab1ce7c" 
1415LLVM  = " 929cbde3-209d-540e-8aea-75f648917ca0" 
1516LLVMDowngrader_jll  = " f52de702-fb25-5922-94ba-81dd59b07444" 
@@ -37,6 +38,7 @@ CodecBzip2 = "0.8.5"
3738ExprTools  = " 0.1" 
3839GPUArrays  = " 11.2.1" 
3940GPUCompiler  = " 0.26, 0.27, 1" 
41+ GPUToolbox  = " 0.1" 
4042KernelAbstractions  = " 0.9.1" 
4143LLVM  = " 7.2, 8, 9" 
4244LLVMDowngrader_jll  = " 0.6" 
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Metal
33using  GPUArrays
44using  Adapt
55using  GPUCompiler
6+ using  GPUToolbox:  SimpleVersion, @sv_str 
67using  LLVM
78using  LLVM. Interop
89import  LLVMDowngrader_jll
Original file line number Diff line number Diff line change 1- #  device intrinsics for querying the compute SimpleVersion and PTX ISA version
2- 
3- 
4- # # a GPU-compatible version number
5- 
6- #  XXX : this is duplicated with CUDA.jl; move it to a common place
7- 
8- struct  SimpleVersion
9-     major:: UInt32 
10-     minor:: UInt32 
11- 
12-     SimpleVersion (major, minor= 0 ) =  new (major, minor)
13- end 
14- 
15- function  Base. tryparse (:: Type{SimpleVersion} , v:: AbstractString )
16-     parts =  split (v, " ." 
17-     1  <=  length (parts) <=  2  ||  return  nothing 
18- 
19-     int_parts =  map (parts) do  part
20-         tryparse (Int, part)
21-     end 
22-     any (isnothing, int_parts) &&  return  nothing 
23- 
24-     SimpleVersion (int_parts... )
25- end 
26- 
27- function  Base. parse (:: Type{SimpleVersion} , v:: AbstractString )
28-     ver =  tryparse (SimpleVersion, v)
29-     ver ===  nothing  &&  throw (ArgumentError (" invalid SimpleVersion string: '$v '" 
30-     return  ver
31- end 
32- 
33- SimpleVersion (v:: AbstractString ) =  parse (SimpleVersion, v)
34- 
35- @inline  function  Base. isless (a:: SimpleVersion , b:: SimpleVersion )
36-     (a. major <  b. major) &&  return  true 
37-     (a. major >  b. major) &&  return  false 
38-     (a. minor <  b. minor) &&  return  true 
39-     (a. minor >  b. minor) &&  return  false 
40-     return  false 
41- end 
42- 
43- macro  sv_str (str)
44-     SimpleVersion (str)
45- end 
46- 
47- 
481# # accessors for the Metal and AIR version
492
503export  metal_version, air_version
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments