예제 #1
0
def run(fn, args):
  args = prepare_args(args, fn.input_types)
  fn = loopify.apply(fn)
  fn = flatten(fn)
  if stride_specialization:
    fn = specialize(fn, python_values = args)
  compiled_fn = compile_entry(fn)
  assert len(args) == len(fn.input_types)
  result = compiled_fn.c_fn(*args)
  return result
예제 #2
0
def run(fn, args):
  args = prepare_args(args, fn.input_types)
  fn = loopify.apply(fn)
  # TODO: finish debuggin flattening 
  # fn = flatten(fn)
  fn = final_loop_optimizations.apply(fn)

  if stride_specialization:
    fn = specialize(fn, python_values = args)
  compiled_fn = PyModuleCompiler().compile_entry(fn)
  assert len(args) == len(fn.input_types)
  result = compiled_fn.c_fn(*args)
  return result
예제 #3
0
def run(fn, args):
    args = prepare_args(args, fn.input_types)

    fn = lower_to_loops(fn)

    if value_specialization:
        fn = specialize(fn, args)

    key = fn.cache_key
    if key in _cache:
        return _cache[key](*args)
    compiled_fn = PyModuleCompiler().compile_entry(fn)
    c_fn = compiled_fn.c_fn
    _cache[key] = c_fn
    return c_fn(*args)
예제 #4
0
def run(fn, args):
  args = prepare_args(args, fn.input_types)

  fn = lower_to_loops(fn)
  
  if value_specialization: 
    fn = specialize(fn, args)

  key = fn.cache_key
  if key in _cache:
    return _cache[key](*args)
  compiled_fn = PyModuleCompiler().compile_entry(fn)
  c_fn = compiled_fn.c_fn 
  _cache[key] = c_fn 
  return c_fn(*args)
  
예제 #5
0
def run(fn, args):
  args = prepare_args(args, fn.input_types)
  
  transformed_fn = loopify.apply(fn)
  transformed_fn = final_loop_optimizations.apply(transformed_fn)
  if value_specialization: 
    transformed_fn = specialize(transformed_fn, args)

  key = transformed_fn.cache_key
  if key in _cache:
    return _cache[key](*args)
  compiled_fn = PyModuleCompiler().compile_entry(transformed_fn)
  c_fn = compiled_fn.c_fn 
  _cache[key] = c_fn 
  return c_fn(*args)