diff --git a/artiq/compiler/transforms/llvm_ir_generator.py b/artiq/compiler/transforms/llvm_ir_generator.py index b2fea1852..25d7c6859 100644 --- a/artiq/compiler/transforms/llvm_ir_generator.py +++ b/artiq/compiler/transforms/llvm_ir_generator.py @@ -1546,8 +1546,8 @@ class LLVMIRGenerator: lleltsptr = llglobal.bitcast(lleltsary.type.element.as_pointer()) llconst = ll.Constant(llty, [lleltsptr, ll.Constant(lli32, len(llelts))]) return llconst - elif types.is_rpc(typ) or types.is_c_function(typ): - # RPC and C functions have no runtime representation. + elif types.is_rpc(typ) or types.is_c_function(typ) or types.is_builtin_function(typ): + # RPC, C and builtin functions have no runtime representation. return ll.Constant(llty, ll.Undefined) elif types.is_function(typ): try: diff --git a/artiq/compiler/types.py b/artiq/compiler/types.py index be76adf5a..6e5015f48 100644 --- a/artiq/compiler/types.py +++ b/artiq/compiler/types.py @@ -605,6 +605,14 @@ def is_builtin(typ, name=None): return isinstance(typ, TBuiltin) and \ typ.name == name +def is_builtin_function(typ, name=None): + typ = typ.find() + if name is None: + return isinstance(typ, TBuiltinFunction) + else: + return isinstance(typ, TBuiltinFunction) and \ + typ.name == name + def is_constructor(typ, name=None): typ = typ.find() if name is not None: diff --git a/artiq/test/coredevice/test_embedding.py b/artiq/test/coredevice/test_embedding.py index 26277a7c9..b0bcbbed3 100644 --- a/artiq/test/coredevice/test_embedding.py +++ b/artiq/test/coredevice/test_embedding.py @@ -211,6 +211,10 @@ class _RPCCalls(EnvExperiment): def numpy_full(self): return numpy.full(10, 20) + @kernel + def numpy_nan(self): + return numpy.full(10, numpy.nan) + @kernel def builtin(self): sleep(1.0) @@ -229,6 +233,7 @@ class RPCCallsTest(ExperimentCase): self.assertEqual(exp.numpy_things(), (numpy.int32(10), numpy.int64(20), numpy.array([42,]))) self.assertTrue((exp.numpy_full() == numpy.full(10, 20)).all()) + self.assertTrue(numpy.isnan(exp.numpy_nan()).all()) exp.builtin()