forked from M-Labs/artiq
parent
c28fe47164
commit
38dac16041
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user