Temporaries inside analyze_lifetimes blocks can be used after the block creating unintuitive errors.
I propose that we replace all the variables names inside of the analyze_lifetimes that are marked as temporary. This will mean any uses after the block result in unnamed variable errors instead of silently calling legate.
The goal is to prevent
A = ...
B = ....
@analyze_lifetimes begin # prod is identified as temporary
prod = A .* B
C[:, :] .= prod.+ 2.0f0
end
product .+= # Use after free
Proposed emitted code
A = ...
B = ....
@analyze_lifetimes begin
new_var = gensym() #wouldnt actually be defined like this, can be generated inside macro.
$new_var= A .* B
C[:, :] .= $new_var.+ 2.0f0
end
product .+= # Name error
Temporaries inside analyze_lifetimes blocks can be used after the block creating unintuitive errors.
I propose that we replace all the variables names inside of the
analyze_lifetimesthat are marked as temporary. This will mean any uses after the block result in unnamed variable errors instead of silently calling legate.The goal is to prevent
Proposed emitted code