forked from M-Labs/artiq
remove lit tests for legacy compiler
This commit is contained in:
parent
567cd45eee
commit
f38a3ab795
@ -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]))
|
@ -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()
|
@ -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()
|
@ -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()
|
@ -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))
|
@ -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))
|
@ -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())
|
@ -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)
|
@ -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)
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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
|
@ -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()
|
@ -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()
|
@ -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()
|
@ -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]
|
@ -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
|
Loading…
Reference in New Issue
Block a user