Skip to content

Commit dd8566d

Browse files
committed
datadeps: Validate further that RemainderAliasing is not empty
1 parent aa31d67 commit dd8566d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/datadeps/remainders.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,14 @@ function compute_remainder_for_arg!(state::DataDepsState,
220220
(Vector{Tuple{LocalMemorySpan,LocalMemorySpan}}(), Set{ThunkSyncdep}())
221221
end
222222
@opcounter :compute_remainder_for_arg_schedule
223-
schedule_remainder!(tracker_other_space[1], other_space_idx, target_space_idx, remainder, other_many_spans)
224-
if compute_syncdeps
223+
has_overlap = schedule_remainder!(tracker_other_space[1], other_space_idx, target_space_idx, remainder, other_many_spans)
224+
if compute_syncdeps && has_overlap
225225
@assert haskey(state.ainfos_owner, other_ainfo) "[idx $idx] ainfo $(typeof(other_ainfo)) has no owner"
226226
get_read_deps!(state, other_space, other_ainfo, write_num, tracker_other_space[2])
227227
end
228228
end
229229

230-
if isempty(tracker)
230+
if isempty(tracker) || all(tracked->isempty(tracked[1]), values(tracker))
231231
return NoAliasing(), 0
232232
end
233233

@@ -241,6 +241,7 @@ function compute_remainder_for_arg!(state::DataDepsState,
241241
end
242242
end
243243
end
244+
@assert !isempty(mra.remainders) "Expected at least one remainder (spaces: $spaces, tracker spaces: $(collect(keys(tracker))))"
244245
return mra, last_idx
245246
end
246247

@@ -262,6 +263,7 @@ function schedule_remainder!(tracker::Vector, source_space_idx::Int, dest_space_
262263
@assert span_len(source_span) == span_len(dest_span) "Source and dest spans are not the same size: $(span_len(source_span)) != $(span_len(dest_span))"
263264
push!(tracker, (source_span, dest_span))
264265
end
266+
return !isempty(diff)
265267
end
266268

267269
### Remainder copy functions

0 commit comments

Comments
 (0)