diff --git a/artiq/test/lit/embedding/annotation_py.py b/artiq/test/lit/embedding/annotation_py.py deleted file mode 100644 index c790b6914..000000000 --- a/artiq/test/lit/embedding/annotation_py.py +++ /dev/null @@ -1,34 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from typing import List, Tuple - -import numpy as np - -from artiq.language.core import * -from artiq.language.types import * - -# CHECK-L: i64 @_Z13testbench.foozz(i64 %ARG.x, { i1, i32 } %ARG.y) - -@kernel -def foo(x: np.int64, y: np.int32 = 1) -> np.int64: - print(x + y) - return x + y - -# CHECK-L: void @_Z13testbench.barzz() -@kernel -def bar(x: np.int32) -> None: - print(x) - -# CHECK-L: @_Z21testbench.unpack_listzz({ i1, i64 }* nocapture writeonly sret({ i1, i64 }) %.1, { i64*, i32 }* %ARG.xs) -@kernel -def unpack_list(xs: List[np.int64]) -> Tuple[bool, np.int64]: - print(xs) - return (len(xs) == 1, xs[0]) - -@kernel -def entrypoint(): - print(foo(0, 2)) - print(foo(1, 3)) - bar(3) - print(unpack_list([1, 2, 3])) diff --git a/artiq/test/lit/embedding/class_same_name.py b/artiq/test/lit/embedding/class_same_name.py deleted file mode 100644 index 46cf7c16d..000000000 --- a/artiq/test/lit/embedding/class_same_name.py +++ /dev/null @@ -1,51 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding %s - -from artiq.language.core import * - - -class InnerA: - def __init__(self, val): - self.val = val - - @kernel - def run_once(self): - return self.val - - -class InnerB: - def __init__(self, val): - self.val = val - - @kernel - def run_once(self): - return self.val - - -def make_runner(InnerCls, val): - class Runner: - def __init__(self): - self.inner = InnerCls(val) - - @kernel - def run_once(self): - return self.inner.run_once() - - return Runner() - - -class Parent: - def __init__(self): - self.a = make_runner(InnerA, 1) - self.b = make_runner(InnerB, 42.0) - - @kernel - def run_once(self): - return self.a.run_once() + self.b.run_once() - - -parent = Parent() - - -@kernel -def entrypoint(): - parent.run_once() diff --git a/artiq/test/lit/embedding/error_subkernel_annot.py b/artiq/test/lit/embedding/error_subkernel_annot.py deleted file mode 100644 index 3f4bc1c5c..000000000 --- a/artiq/test/lit/embedding/error_subkernel_annot.py +++ /dev/null @@ -1,15 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t -# RUN: OutputCheck %s --file-to-check=%t - -from artiq.language.core import * -from artiq.language.types import * - -# CHECK-L: ${LINE:+2}: error: type annotation for argument 'x', '1', is not an ARTIQ type -@subkernel(destination=1) -def foo(x: 1) -> TNone: - pass - -@kernel -def entrypoint(): - # CHECK-L: ${LINE:+1}: note: in subkernel call here - foo() diff --git a/artiq/test/lit/embedding/error_subkernel_annot_return.py b/artiq/test/lit/embedding/error_subkernel_annot_return.py deleted file mode 100644 index 51977ae00..000000000 --- a/artiq/test/lit/embedding/error_subkernel_annot_return.py +++ /dev/null @@ -1,15 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t -# RUN: OutputCheck %s --file-to-check=%t - -from artiq.language.core import * -from artiq.language.types import * - -# CHECK-L: ${LINE:+2}: error: type annotation for return type, '1', is not an ARTIQ type -@subkernel(destination=1) -def foo() -> 1: - pass - -@kernel -def entrypoint(): - # CHECK-L: ${LINE:+1}: note: in subkernel call here - foo() diff --git a/artiq/test/lit/embedding/error_tuple_index_assign.py b/artiq/test/lit/embedding/error_tuple_index_assign.py deleted file mode 100644 index ffa68a6b6..000000000 --- a/artiq/test/lit/embedding/error_tuple_index_assign.py +++ /dev/null @@ -1,15 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t -# RUN: OutputCheck %s --file-to-check=%t - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def modify(x): - # CHECK-L: ${LINE:+1}: error: cannot assign to a tuple element - x[0] = 2 - -@kernel -def entrypoint(): - modify((1, "foo", True)) - modify((2, "bar", False)) diff --git a/artiq/test/lit/embedding/index_tuple.py b/artiq/test/lit/embedding/index_tuple.py deleted file mode 100644 index fced90201..000000000 --- a/artiq/test/lit/embedding/index_tuple.py +++ /dev/null @@ -1,16 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -# CHECK-L: void @_Z16testbench.unpackzz({ i32, { i8*, i32 }, i1 } %ARG.x) - -@kernel -def unpack(x): - print(x[0]) - -@kernel -def entrypoint(): - unpack((1, "foo", True)) - unpack((2, "bar", False)) diff --git a/artiq/test/lit/embedding/mixed_tuple.py b/artiq/test/lit/embedding/mixed_tuple.py deleted file mode 100644 index aaf947149..000000000 --- a/artiq/test/lit/embedding/mixed_tuple.py +++ /dev/null @@ -1,16 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding %s - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def consume_tuple(x: TTuple([TInt32, TBool])): - print(x) - -@kernel -def return_tuple() -> TTuple([TInt32, TBool]): - return (123, False) - -@kernel -def entrypoint(): - consume_tuple(return_tuple()) diff --git a/artiq/test/lit/embedding/subkernel_message_recv.py b/artiq/test/lit/embedding/subkernel_message_recv.py deleted file mode 100644 index 35e094aa6..000000000 --- a/artiq/test/lit/embedding/subkernel_message_recv.py +++ /dev/null @@ -1,22 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - message_pass() - # CHECK-NOT: call void @subkernel_send_message\(i32 ., i1 false, i8 1, i8 1, .*\), !dbg !. - # CHECK: call i8 @subkernel_await_message\(i32 2, i64 -1, { i8\*, i32 }\* nonnull .*, i8 1, i8 1\), !dbg !. - subkernel_recv("message", TInt32) - - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-NOT-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr -# CHECK-L: declare i8 @subkernel_await_message(i32, i64, { i8*, i32 }*, i8, i8) local_unnamed_addr -# CHECK-NOT-L: declare void @subkernel_await_finish(i32, i64) local_unnamed_addr -@subkernel(destination=1) -def message_pass() -> TNone: - subkernel_send(0, "message", 15) diff --git a/artiq/test/lit/embedding/subkernel_message_send.py b/artiq/test/lit/embedding/subkernel_message_send.py deleted file mode 100644 index 3f0f77e35..000000000 --- a/artiq/test/lit/embedding/subkernel_message_send.py +++ /dev/null @@ -1,20 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - message_pass() - # CHECK: call void @subkernel_send_message\(i32 2, i1 false, i8 1, i8 1, .*\), !dbg !. - # CHECK-NOT: call i8 @subkernel_await_message\(i32 1, i64 10000, { i8\*, i32 }\* nonnull .*, i8 1, i8 1\), !dbg !. - subkernel_send(1, "message", 15) - - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr -@subkernel(destination=1) -def message_pass() -> TNone: - subkernel_recv("message", TInt32) diff --git a/artiq/test/lit/embedding/subkernel_no_arg.py b/artiq/test/lit/embedding/subkernel_no_arg.py deleted file mode 100644 index 605fbbfaa..000000000 --- a/artiq/test/lit/embedding/subkernel_no_arg.py +++ /dev/null @@ -1,18 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK-NOT: call void @subkernel_send_message\(.*\), !dbg !. - no_arg() - - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-NOT-L: declare void @subkernel_send_message(i32, i1, i8, { i8*, i32 }*, i8**) local_unnamed_addr -@subkernel(destination=1) -def no_arg() -> TStr: - pass diff --git a/artiq/test/lit/embedding/subkernel_return.py b/artiq/test/lit/embedding/subkernel_return.py deleted file mode 100644 index 3c9d1169a..000000000 --- a/artiq/test/lit/embedding/subkernel_return.py +++ /dev/null @@ -1,22 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK-NOT: call void @subkernel_send_message\(.*\), !dbg !. - returning() - # CHECK: call i8 @subkernel_await_message\(i32 1, i64 -1, { i8\*, i32 }\* nonnull .*, i8 1, i8 1\), !dbg !. - # CHECK: call void @subkernel_await_finish\(i32 1, i64 -1\), !dbg !. - subkernel_await(returning) - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-NOT-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr -# CHECK-L: declare i8 @subkernel_await_message(i32, i64, { i8*, i32 }*, i8, i8) local_unnamed_addr -# CHECK-L: declare void @subkernel_await_finish(i32, i64) local_unnamed_addr -@subkernel(destination=1) -def returning() -> TInt32: - return 1 diff --git a/artiq/test/lit/embedding/subkernel_return_none.py b/artiq/test/lit/embedding/subkernel_return_none.py deleted file mode 100644 index a7795f785..000000000 --- a/artiq/test/lit/embedding/subkernel_return_none.py +++ /dev/null @@ -1,22 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK-NOT: call void @subkernel_send_message\(.*\), !dbg !. - returning_none() - # CHECK: call void @subkernel_await_finish\(i32 1, i64 -1\), !dbg !. - # CHECK-NOT: call i8 @subkernel_await_message\(i32 1, i64 -1\, .*\), !dbg !. - subkernel_await(returning_none) - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-NOT-L: declare void @subkernel_send_message(i32, i1, i8, { i8*, i32 }*, i8**) local_unnamed_addr -# CHECK-L: declare void @subkernel_await_finish(i32, i64) local_unnamed_addr -# CHECK-NOT-L: declare i8 @subkernel_await_message(i32, i64, { i8*, i32 }*, i8, i8) local_unnamed_addr -@subkernel(destination=1) -def returning_none() -> TNone: - pass diff --git a/artiq/test/lit/embedding/subkernel_self.py b/artiq/test/lit/embedding/subkernel_self.py deleted file mode 100644 index 7bf9cbafd..000000000 --- a/artiq/test/lit/embedding/subkernel_self.py +++ /dev/null @@ -1,25 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -class A: - @subkernel(destination=1) - def sk(self): - pass - - @kernel - def kernel_entrypoint(self): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK-NOT: call void @subkernel_send_message\(.*\), !dbg !. - self.sk() - -a = A() - -@kernel -def entrypoint(): - a.kernel_entrypoint() - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-NOT-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr diff --git a/artiq/test/lit/embedding/subkernel_self_args.py b/artiq/test/lit/embedding/subkernel_self_args.py deleted file mode 100644 index 5aebed2e9..000000000 --- a/artiq/test/lit/embedding/subkernel_self_args.py +++ /dev/null @@ -1,25 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -class A: - @subkernel(destination=1) - def sk(self, a): - pass - - @kernel - def kernel_entrypoint(self): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK: call void @subkernel_send_message\(i32 1, i1 false, i8 1, i8 1, .*\), !dbg !. - self.sk(1) - -a = A() - -@kernel -def entrypoint(): - a.kernel_entrypoint() - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr diff --git a/artiq/test/lit/embedding/subkernel_with_arg.py b/artiq/test/lit/embedding/subkernel_with_arg.py deleted file mode 100644 index 114516586..000000000 --- a/artiq/test/lit/embedding/subkernel_with_arg.py +++ /dev/null @@ -1,18 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK: call void @subkernel_send_message\(i32 ., i1 false, i8 1, i8 1, .*\), !dbg !. - accept_arg(1) - - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr -@subkernel(destination=1) -def accept_arg(arg: TInt32) -> TNone: - pass diff --git a/artiq/test/lit/embedding/subkernel_with_opt_arg.py b/artiq/test/lit/embedding/subkernel_with_opt_arg.py deleted file mode 100644 index fb5cc3df1..000000000 --- a/artiq/test/lit/embedding/subkernel_with_opt_arg.py +++ /dev/null @@ -1,21 +0,0 @@ -# RUN: env ARTIQ_DUMP_LLVM=%t %python -m artiq.compiler.testbench.embedding +compile %s -# RUN: OutputCheck %s --file-to-check=%t.ll - -from artiq.language.core import * -from artiq.language.types import * - -@kernel -def entrypoint(): - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK: call void @subkernel_send_message\(i32 ., i1 false, i8 1, i8 1, .*\), !dbg !. - accept_arg(1) - # CHECK: call void @subkernel_load_run\(i32 1, i8 1, i1 true\), !dbg !. - # CHECK: call void @subkernel_send_message\(i32 ., i1 false, i8 1, i8 2, .*\), !dbg !. - accept_arg(1, 2) - - -# CHECK-L: declare void @subkernel_load_run(i32, i8, i1) local_unnamed_addr -# CHECK-L: declare void @subkernel_send_message(i32, i1, i8, i8, { i8*, i32 }*, i8**) local_unnamed_addr -@subkernel(destination=1) -def accept_arg(arg_a, arg_b=5) -> TNone: - pass diff --git a/artiq/test/lit/escape/error_numpy_array.py b/artiq/test/lit/escape/error_numpy_array.py deleted file mode 100644 index 1ebdeda81..000000000 --- a/artiq/test/lit/escape/error_numpy_array.py +++ /dev/null @@ -1,15 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t -# RUN: OutputCheck %s --file-to-check=%t - -from artiq.experiment import * -import numpy as np - -@kernel -def a(): - # CHECK-L: ${LINE:+2}: error: cannot return an allocated value that does not live forever - # CHECK-L: ${LINE:+1}: note: ... to this point - return np.array([0, 1]) - -@kernel -def entrypoint(): - a() diff --git a/artiq/test/lit/escape/error_numpy_full.py b/artiq/test/lit/escape/error_numpy_full.py deleted file mode 100644 index 66158d8ca..000000000 --- a/artiq/test/lit/escape/error_numpy_full.py +++ /dev/null @@ -1,16 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t -# RUN: OutputCheck %s --file-to-check=%t - -from artiq.experiment import * -import numpy as np - -@kernel -def a(): - # CHECK-L: ${LINE:+2}: error: cannot return an allocated value that does not live forever - # CHECK-L: ${LINE:+1}: note: ... to this point - return np.full(10, 42.0) - - -@kernel -def entrypoint(): - a() diff --git a/artiq/test/lit/escape/error_numpy_transpose.py b/artiq/test/lit/escape/error_numpy_transpose.py deleted file mode 100644 index e1dc32d51..000000000 --- a/artiq/test/lit/escape/error_numpy_transpose.py +++ /dev/null @@ -1,17 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.embedding +diag %s 2>%t -# RUN: OutputCheck %s --file-to-check=%t - -from artiq.experiment import * -import numpy as np - -data = np.array([[0, 1], [2, 3]]) - -@kernel -def a(): - # CHECK-L: ${LINE:+2}: error: cannot return an allocated value that does not live forever - # CHECK-L: ${LINE:+1}: note: ... to this point - return np.transpose(data) - -@kernel -def entrypoint(): - a() diff --git a/artiq/test/lit/inferencer/error_tuple_index.py b/artiq/test/lit/inferencer/error_tuple_index.py deleted file mode 100644 index dd6f2dca9..000000000 --- a/artiq/test/lit/inferencer/error_tuple_index.py +++ /dev/null @@ -1,14 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.inferencer +diag %s >%t -# RUN: OutputCheck %s --file-to-check=%t - -i = 0 -x = (1, "foo", True) - -# CHECK-L: ${LINE:+1}: error: tuples can only be indexed by a constant -x[i] - -# CHECK-L: ${LINE:+1}: error: tuples can only be indexed by a constant -x[0:2] - -# CHECK-L: ${LINE:+1}: error: index 3 is out of range for tuple of size 3 -x[3] diff --git a/artiq/test/lit/integration/tuple_index.py b/artiq/test/lit/integration/tuple_index.py deleted file mode 100644 index 46ebb1428..000000000 --- a/artiq/test/lit/integration/tuple_index.py +++ /dev/null @@ -1,22 +0,0 @@ -# RUN: %python -m artiq.compiler.testbench.jit %s -# RUN: %python %s - -# Basic indexing -a = (1, "xyz", True) - -assert a[0] == 1 -assert a[1] == "xyz" -assert a[2] == True - -# Nested indexing -b = (a, 2, (3, "abc", a)) - -assert b[0][0] == 1 -assert b[1] == 2 -assert b[2][2][0] == 1 - -# Usage on the LHS of an assignment -c = (1, 2, [1, 2, 3]) - -c[2][0] = 456 -assert c[2][0] == 456