forked from M-Labs/artiq
parent
c28fe47164
commit
38dac16041
|
@ -1546,8 +1546,8 @@ class LLVMIRGenerator:
|
||||||
lleltsptr = llglobal.bitcast(lleltsary.type.element.as_pointer())
|
lleltsptr = llglobal.bitcast(lleltsary.type.element.as_pointer())
|
||||||
llconst = ll.Constant(llty, [lleltsptr, ll.Constant(lli32, len(llelts))])
|
llconst = ll.Constant(llty, [lleltsptr, ll.Constant(lli32, len(llelts))])
|
||||||
return llconst
|
return llconst
|
||||||
elif types.is_rpc(typ) or types.is_c_function(typ):
|
elif types.is_rpc(typ) or types.is_c_function(typ) or types.is_builtin_function(typ):
|
||||||
# RPC and C functions have no runtime representation.
|
# RPC, C and builtin functions have no runtime representation.
|
||||||
return ll.Constant(llty, ll.Undefined)
|
return ll.Constant(llty, ll.Undefined)
|
||||||
elif types.is_function(typ):
|
elif types.is_function(typ):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -605,6 +605,14 @@ def is_builtin(typ, name=None):
|
||||||
return isinstance(typ, TBuiltin) and \
|
return isinstance(typ, TBuiltin) and \
|
||||||
typ.name == name
|
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):
|
def is_constructor(typ, name=None):
|
||||||
typ = typ.find()
|
typ = typ.find()
|
||||||
if name is not None:
|
if name is not None:
|
||||||
|
|
|
@ -211,6 +211,10 @@ class _RPCCalls(EnvExperiment):
|
||||||
def numpy_full(self):
|
def numpy_full(self):
|
||||||
return numpy.full(10, 20)
|
return numpy.full(10, 20)
|
||||||
|
|
||||||
|
@kernel
|
||||||
|
def numpy_nan(self):
|
||||||
|
return numpy.full(10, numpy.nan)
|
||||||
|
|
||||||
@kernel
|
@kernel
|
||||||
def builtin(self):
|
def builtin(self):
|
||||||
sleep(1.0)
|
sleep(1.0)
|
||||||
|
@ -229,6 +233,7 @@ class RPCCallsTest(ExperimentCase):
|
||||||
self.assertEqual(exp.numpy_things(),
|
self.assertEqual(exp.numpy_things(),
|
||||||
(numpy.int32(10), numpy.int64(20), numpy.array([42,])))
|
(numpy.int32(10), numpy.int64(20), numpy.array([42,])))
|
||||||
self.assertTrue((exp.numpy_full() == numpy.full(10, 20)).all())
|
self.assertTrue((exp.numpy_full() == numpy.full(10, 20)).all())
|
||||||
|
self.assertTrue(numpy.isnan(exp.numpy_nan()).all())
|
||||||
exp.builtin()
|
exp.builtin()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue