Example #1
0
def build_gufunc_wrapper(py_func, cres, sin, sout, cache, is_parfors):
    """Build gufunc wrapper for the given arguments.
    The *is_parfors* is a boolean indicating whether the gufunc is being
    built for use as a ParFors kernel. This changes codegen and caching
    behavior.
    """
    library = cres.library
    ctx = cres.target_context
    signature = cres.signature
    innerinfo = ufuncbuilder.build_gufunc_wrapper(
        py_func,
        cres,
        sin,
        sout,
        cache=cache,
        is_parfors=is_parfors,
    )
    sym_in = set(sym for term in sin for sym in term)
    sym_out = set(sym for term in sout for sym in term)
    inner_ndim = len(sym_in | sym_out)

    info = build_gufunc_kernel(
        library,
        ctx,
        innerinfo,
        signature,
        inner_ndim,
    )
    return info
Example #2
0
def build_gufunc_wrapper(library, ctx, signature, sin, sout, fndesc, env):
    innerfunc, env = ufuncbuilder.build_gufunc_wrapper(library, ctx,
                                                       signature, sin, sout,
                                                       fndesc=fndesc, env=env)
    sym_in = set(sym for term in sin for sym in term)
    sym_out = set(sym for term in sout for sym in term)
    inner_ndim = len(sym_in | sym_out)

    ptr = build_gufunc_kernel(library, ctx, innerfunc, signature, inner_ndim)

    return ptr, env
Example #3
0
def build_gufunc_wrapper(library, ctx, llvm_func, signature, sin, sout, fndesc,
                         env):
    innerfunc, env = ufuncbuilder.build_gufunc_wrapper(library, ctx, llvm_func,
                                                       signature, sin, sout,
                                                       fndesc=fndesc, env=env)
    sym_in = set(sym for term in sin for sym in term)
    sym_out = set(sym for term in sout for sym in term)
    inner_ndim = len(sym_in | sym_out)

    lfunc = build_gufunc_kernel(library, ctx, innerfunc, signature, inner_ndim)
    library.add_ir_module(lfunc.module)
    return lfunc, env
Example #4
0
def build_gufunc_wrapper(py_func, cres, sin, sout, cache):
    library = cres.library
    ctx = cres.target_context
    signature = cres.signature
    innerfunc, env, wrapper_name = ufuncbuilder.build_gufunc_wrapper(py_func, cres, sin, sout,
                                                       cache=cache)
    sym_in = set(sym for term in sin for sym in term)
    sym_out = set(sym for term in sout for sym in term)
    inner_ndim = len(sym_in | sym_out)

    ptr, name = build_gufunc_kernel(library, ctx, innerfunc, signature, inner_ndim)

    return ptr, env, name
Example #5
0
def build_gufunc_wrapper(py_func, cres, sin, sout, cache):
    library = cres.library
    ctx = cres.target_context
    signature = cres.signature
    innerfunc, env, wrapper_name = ufuncbuilder.build_gufunc_wrapper(py_func, cres, sin, sout,
                                                       cache=cache)
    sym_in = set(sym for term in sin for sym in term)
    sym_out = set(sym for term in sout for sym in term)
    inner_ndim = len(sym_in | sym_out)

    ptr, name = build_gufunc_kernel(library, ctx, innerfunc, signature, inner_ndim)

    return ptr, env, name
Example #6
0
def build_gufunc_wrapper(library, ctx, signature, sin, sout, fndesc, env):
    innerfunc, env = ufuncbuilder.build_gufunc_wrapper(library,
                                                       ctx,
                                                       signature,
                                                       sin,
                                                       sout,
                                                       fndesc=fndesc,
                                                       env=env)
    sym_in = set(sym for term in sin for sym in term)
    sym_out = set(sym for term in sout for sym in term)
    inner_ndim = len(sym_in | sym_out)

    ptr = build_gufunc_kernel(library, ctx, innerfunc, signature, inner_ndim)

    return ptr, env