crash with ternary if and option #249

Closed
opened 2022-03-28 21:17:59 +08:00 by sb10q · 1 comment
Owner
from numpy import int32
from artiq.experiment import *
from artiq.coredevice.core import Core

@nac3
class NAC3Devices(EnvExperiment):
    core: KernelInvariant[Core]

    def build(self):
        self.setattr_device("core")

    @kernel
    def foo(self, x: Option[list[int32]]):
        y = [i for i in range(40)] if x.is_none() else x.unwrap()
        print_rpc(y[0])

    @kernel
    def run(self):
        self.foo(none)
...
"PHI node entries do not match predecessors!\n  %ifexpr = phi { i32*, i32 }* [ %phi, %then ], [ %unwrap_some, %else ]\nlabel %then\nlabel %cont2\nInstruction does not dominate all uses!\n  %phi = phi { i32*, i32 }* [ %tmparrstr, %normal_list ], [ %tmparrstr9, %empty_list ]\n  %ifexpr = phi { i32*, i32 }* [ %phi, %then ], [ %unwrap_some, %else ]\nInstruction does not dominate all uses!\n  %unwrap_some = load { i32*, i32 }*, { i32*, i32 }** %1, align 8\n  %ifexpr = phi { i32*, i32 }* [ %phi, %then ], [ %unwrap_some, %else ]\n"
thread '<unnamed>' panicked at 'explicit panic', /build/source/nac3core/src/codegen/mod.rs:235:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Got an error: explicit panic
thread '<unnamed>' panicked at 'tasks panicked', nac3core/src/codegen/mod.rs:191:13
Traceback (most recent call last):
  File "/nix/store/wgsnhn8c6krrs85l21zaplf9l230v8n3-python3.9-artiq-8.8184.69cda51.beta/bin/.artiq_compile-wrapped", line 9, in <module>
    sys.exit(main())
  File "/home/sb/artiq/artiq/frontend/artiq_compile.py", line 66, in main
    exp_inst.core.compile(exp_inst.run, [], {}, embedding_map, file_output=output)
  File "/home/sb/artiq/artiq/coredevice/core.py", line 79, in compile
    self.compiler.compile_method_to_file(obj, name, args, file_output, embedding_map)
pyo3_runtime.PanicException: tasks panicked

```python from numpy import int32 from artiq.experiment import * from artiq.coredevice.core import Core @nac3 class NAC3Devices(EnvExperiment): core: KernelInvariant[Core] def build(self): self.setattr_device("core") @kernel def foo(self, x: Option[list[int32]]): y = [i for i in range(40)] if x.is_none() else x.unwrap() print_rpc(y[0]) @kernel def run(self): self.foo(none) ``` ``` ... "PHI node entries do not match predecessors!\n %ifexpr = phi { i32*, i32 }* [ %phi, %then ], [ %unwrap_some, %else ]\nlabel %then\nlabel %cont2\nInstruction does not dominate all uses!\n %phi = phi { i32*, i32 }* [ %tmparrstr, %normal_list ], [ %tmparrstr9, %empty_list ]\n %ifexpr = phi { i32*, i32 }* [ %phi, %then ], [ %unwrap_some, %else ]\nInstruction does not dominate all uses!\n %unwrap_some = load { i32*, i32 }*, { i32*, i32 }** %1, align 8\n %ifexpr = phi { i32*, i32 }* [ %phi, %then ], [ %unwrap_some, %else ]\n" thread '<unnamed>' panicked at 'explicit panic', /build/source/nac3core/src/codegen/mod.rs:235:13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Got an error: explicit panic thread '<unnamed>' panicked at 'tasks panicked', nac3core/src/codegen/mod.rs:191:13 Traceback (most recent call last): File "/nix/store/wgsnhn8c6krrs85l21zaplf9l230v8n3-python3.9-artiq-8.8184.69cda51.beta/bin/.artiq_compile-wrapped", line 9, in <module> sys.exit(main()) File "/home/sb/artiq/artiq/frontend/artiq_compile.py", line 66, in main exp_inst.core.compile(exp_inst.run, [], {}, embedding_map, file_output=output) File "/home/sb/artiq/artiq/coredevice/core.py", line 79, in compile self.compiler.compile_method_to_file(obj, name, args, file_output, embedding_map) pyo3_runtime.PanicException: tasks panicked ```
sb10q added the
high-priority
label 2022-03-28 21:18:28 +08:00
Author
Owner

Also happens with simply:

    @kernel
    def foo(self, x: Option[int32]):
        y = 0 if x.is_none() else x.unwrap()
        print_rpc(y)

no need for the list.

Also happens with simply: ```python @kernel def foo(self, x: Option[int32]): y = 0 if x.is_none() else x.unwrap() print_rpc(y) ``` no need for the list.
sb10q added this to the Alpha milestone 2022-03-28 22:12:49 +08:00
sb10q closed this issue 2022-03-29 06:55:04 +08:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#249
No description provided.