def gen_ir(self, func, args_tuple, fastmath=False): with override_env_config("NUMBA_CPU_NAME", "skylake-avx512"), override_env_config( "NUMBA_CPU_FEATURES", ""): _flags = Flags() _flags.fastmath = FastMathOptions(fastmath) _flags.nrt = True jitted = compile_isolated(func, args_tuple, flags=_flags) return jitted.library.get_llvm_str()
def test_mangled_flags_with_fastmath_parfors_inline(self): # at least for these control cases flags = Flags() flags.nrt = True flags.auto_parallel = True flags.fastmath = True flags.inline = "always" self.assertLess(len(flags.get_mangle_string()), len(flags.summary())) demangled = flags.demangle(flags.get_mangle_string()) # There should be no pointer value in the demangled string. self.assertNotIn("0x", demangled)
def test_demangle(self): def check(flags): mangled = flags.get_mangle_string() out = flags.demangle(mangled) # Demangle result MUST match summary() self.assertEqual(out, flags.summary()) # test empty flags flags = Flags() check(flags) # test default check(DEFAULT_FLAGS) # test other flags = Flags() flags.no_cpython_wrapper = True flags.nrt = True flags.fastmath = True check(flags)
def compile_parallel(self, func, arg_types): fast_pflags = Flags() fast_pflags.auto_parallel = cpu.ParallelOptions(True) fast_pflags.nrt = True fast_pflags.fastmath = cpu.FastMathOptions(True) return compile_isolated(func, arg_types, flags=fast_pflags).entry_point