-
-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numba Scan
fails when multiple None
values are passed in outputs_info
#1176
Comments
Scan
fails when multiple None
values are passed in outputs_info
I could trace back the issue to the names automatically attributed to the print(outer_nit_sot_names)
# ['auto_12', 'auto_12'] A quick hack indeed solves this issue: input_names = [f"{n.auto_name}_{i}" for i,n in enumerate(node.inputs[1:])] Instead of pushing a hack, let's try to understand the root cause and the assumptions in Let's add a breakpoint in op
# forall_inplace,cpu,scan_fn}(k, IncSubtensor{InplaceSet;:int64:}.0, k, k, A)
op.inputs
# [k, IncSubtensor{InplaceSet;:int64:}.0, k, k, A]
op.inputs[2] == op.inputs[3]
# True
op.inputs[2].dtype
# int32 The node, after optimization, contains two identical Let's go back for a second to the original graph, pre-compilation: result[1].owner.inputs
# [k, IncSubtensor{Set;:int64:}.0, k, k, A]
result[1].owner.inputs[2] == result[1].owner.inputs[3]
# True
result[1].owner.inputs[1] == result[1].owner.inputs[3]
# True We can thus eliminate optimizations from the list of potential culprits. But now we need to understand why the variable that corresponds to the number of steps ( Let's look at _scan_inputs = (
scan_seqs
+ mit_mot_scan_inputs
+ mit_sot_scan_inputs
+ sit_sot_scan_inputs
+ shared_scan_inputs
+ [actual_n_steps for x in range(n_nit_sot)]
+ other_shared_scan_args
+ other_scan_args
) _scan_inputs
# [IncSubtensor{Set;:int64:}.0, k, k, A]
actual_n_step
# k Now if I try to provide cloned # using [actual_n_steps.clone() for x in range(n_nit_sot)] to define _scan_inputs
# aesara.graph.utils.MissingInputError: Input 2 (k) of the graph (indices start from 0), used to compute for{cpu,scan_fn}(k, IncSubtensor{Set;:int64:}.0, k, k, A), was not provided and not given a value. Use the Aesara flag exception_verbosity='high', for more information on this error. So this issue touches to something more fundamental about Aesara's IR and how loops are represented in this IR. The hackish solution doesn't look so bad now, as a temporary fix. I am now wondering how using To be continued |
It looks like the only problem is that we're generating invalid Numba code because there are name collisions, so making sure that the names are unique is the solution. |
The solution is to have different names for variables that are different in the first place. This is just a workaround imo. |
Referencing a error raised in #1174, when an aesara
Scan
outputs_info includes more than one None (more than one output that behaves as a map), the placeholder variable name for this output appears to be re-used, resulting in a syntax error in the generated numba code.MRP:
SyntaxError: duplicate argument 'auto_25426' in function definition
Versions and main components
Aesara config (`python -c "import aesara; print(aesara.config)"`)
The text was updated successfully, but these errors were encountered: