@@ -67,24 +67,38 @@ is_task_or_chunk(c::Chunk) = true
67
67
Base.:(== )(c1:: Chunk , c2:: Chunk ) = c1. handle == c2. handle
68
68
Base. hash (c:: Chunk , x:: UInt64 ) = hash (c. handle, hash (Chunk, x))
69
69
70
- collect_remote (chunk:: Chunk ) =
71
- move (chunk. processor, OSProc (), poolget (chunk. handle))
70
+ macro remotecall_fetch_fast (id, ex)
71
+ @assert Meta. isexpr (ex, :call )
72
+ f = ex. args[1 ]
73
+ args = ex. args[2 : end ]
74
+ quote
75
+ if $ myid () == id
76
+ $ (ex)
77
+ else
78
+ $ remotecall_fetch ($ f, id, $ (args... ))
79
+ end
80
+ end
81
+ end
72
82
73
- function collect (ctx :: Context , chunk:: Chunk ; options = nothing )
83
+ @inline function collect (chunk:: Chunk )
74
84
# delegate fetching to handle by default.
75
- if chunk. handle isa DRef && ! (chunk. processor isa OSProc)
85
+ #= if chunk.handle isa DRef && !(chunk.processor isa OSProc)
76
86
return remotecall_fetch(collect_remote, chunk.handle.owner, chunk)
87
+ #return @remotecall_fetch_fast chunk.handle.owner collect_remote(chunk)
77
88
elseif chunk.handle isa FileRef
78
89
return poolget(chunk.handle)
79
- else
80
- return move (chunk. processor, OSProc (), chunk. handle )
81
- end
90
+ else=#
91
+ return move (chunk. processor, OSProc (), chunk)
92
+ # end
82
93
end
94
+ collect_remote (chunk:: Chunk ) =
95
+ move (chunk. processor, OSProc (), poolget (chunk. handle))
96
+ collect (ctx:: Context , chunk:: Chunk ; options= nothing ) = collect (chunk)
83
97
collect (ctx:: Context , ref:: DRef ; options= nothing ) =
84
98
move (OSProc (ref. owner), OSProc (), ref)
85
99
collect (ctx:: Context , ref:: FileRef ; options= nothing ) =
86
100
poolget (ref) # FIXME : Do move call
87
- function Base. fetch (chunk:: Chunk ; raw= false )
101
+ @inline function Base. fetch (chunk:: Chunk ; raw= false )
88
102
if raw
89
103
poolget (chunk. handle)
90
104
else
@@ -93,9 +107,9 @@ function Base.fetch(chunk::Chunk; raw=false)
93
107
end
94
108
95
109
# Unwrap Chunk, DRef, and FileRef by default
96
- move (from_proc:: Processor , to_proc:: Processor , x:: Chunk ) =
110
+ @inline move (from_proc:: Processor , to_proc:: Processor , x:: Chunk ) =
97
111
move (from_proc, to_proc, x. handle)
98
- move (from_proc:: Processor , to_proc:: Processor , x:: Union{DRef,FileRef} ) =
112
+ @inline move (from_proc:: Processor , to_proc:: Processor , x:: Union{DRef,FileRef} ) =
99
113
move (from_proc, to_proc, poolget (x))
100
114
101
115
# Determine from_proc when unspecified
0 commit comments