Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
Initialize the next array correlation value to be equal to the number…
Browse files Browse the repository at this point in the history
… of input arrays plus one.

This fixes a bug where it was initialized to zero and incremented and so you got accidental (and
incorrect) correlations between arrays created in the function with the input arrays.
  • Loading branch information
DrTodd13 committed Dec 18, 2015
1 parent 6a0ac7f commit c02ade8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/parallel-ir.jl
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ type expr_state
for i = 1:length(input_arrays)
init_corr[input_arrays[i]] = i
end
new(bl, 0, 0, init_corr, Dict{Array{SymGen,1},Int}(), Dict{Array{Any,1},Int}(), CompilerTools.LambdaHandling.LambdaInfo(), max_label)
new(bl, 0, length(input_arrays)+1, init_corr, Dict{Array{SymGen,1},Int}(), Dict{Array{Any,1},Int}(), CompilerTools.LambdaHandling.LambdaInfo(), max_label)
end
end

Expand Down Expand Up @@ -752,6 +752,7 @@ end
Given an array whose name is in "x", allocate a new equivalence class for this array.
"""
function addUnknownArray(x :: SymGen, state :: expr_state)
dprintln(3, "addUnknownArray x = ", x, " next = ", state.next_eq_class)
m = state.next_eq_class
state.next_eq_class += 1
state.array_length_correlation[x] = m + 1
Expand Down Expand Up @@ -3286,6 +3287,7 @@ Extract just the dimension variables names into dim_names and then register the
"""
function checkAndAddSymbolCorrelation(lhs :: SymGen, state, dim_array)
dim_names = SymGen[]

for i = 1:length(dim_array)
if typeof(dim_array[i]) != SymbolNode
return false
Expand Down Expand Up @@ -3418,6 +3420,9 @@ function create_equivalence_classes(node :: Expr, state :: expr_state, top_level
dprintln(3,"create_equivalence_classes starting top_level_number = ", top_level_number, " is_top = ", is_top_level)
dprintln(3,"create_equivalence_classes node = ", node, " type = ", typeof(node))
dprintln(3,"node.head = ", node.head)
dprintln(4,"array_length_correlations = ", state.array_length_correlation)
dprintln(4,"symbol_array_correlations = ", state.symbol_array_correlation)
dprintln(4,"range_correlations = ", state.range_correlation)

if node.head == :lambda
save_lambdaInfo = state.lambdaInfo
Expand Down

0 comments on commit c02ade8

Please sign in to comment.