@@ -425,48 +425,48 @@ def compile_and_benchmark(self, kernel_source, gpu_args, params, kernel_options,
425425
426426 instance = self .create_kernel_instance (kernel_source , kernel_options , params , verbose )
427427 if isinstance (instance , util .ErrorConfig ):
428- return instance
429-
430- try :
431- # compile the kernel
432- start_compilation = time .perf_counter ()
433- func = self .compile_kernel (instance , verbose )
434- if not func :
435- result [to .objective ] = util .CompilationFailedConfig ()
436- else :
437- # add shared memory arguments to compiled module
438- if kernel_options .smem_args is not None :
439- self .dev .copy_shared_memory_args (util .get_smem_args (kernel_options .smem_args , params ))
440- # add constant memory arguments to compiled module
441- if kernel_options .cmem_args is not None :
442- self .dev .copy_constant_memory_args (kernel_options .cmem_args )
443- # add texture memory arguments to compiled module
444- if kernel_options .texmem_args is not None :
445- self .dev .copy_texture_memory_args (kernel_options .texmem_args )
446-
447- # stop compilation stopwatch and convert to miliseconds
448- last_compilation_time = 1000 * (time .perf_counter () - start_compilation )
449-
450- # test kernel for correctness
451- if func and (to .answer or to .verify ):
452- start_verification = time .perf_counter ()
453- self .check_kernel_output (func , gpu_args , instance , to .answer , to .atol , to .verify , verbose )
454- last_verification_time = 1000 * (time .perf_counter () - start_verification )
455-
456- # benchmark
457- if func :
458- start_benchmark = time .perf_counter ()
459- result .update (self .benchmark (func , gpu_args , instance , verbose , to .objective ))
460- last_benchmark_time = 1000 * (time .perf_counter () - start_benchmark )
461-
462- except Exception as e :
463- # dump kernel sources to temp file
464- temp_filenames = instance .prepare_temp_files_for_error_msg ()
465- print ("Error while compiling or benchmarking, see source files: " + " " .join (temp_filenames ))
466- raise e
428+ result [ to . objective ] = util . InvalidConfig ()
429+ else :
430+ try :
431+ # compile the kernel
432+ start_compilation = time .perf_counter ()
433+ func = self .compile_kernel (instance , verbose )
434+ if not func :
435+ result [to .objective ] = util .CompilationFailedConfig ()
436+ else :
437+ # add shared memory arguments to compiled module
438+ if kernel_options .smem_args is not None :
439+ self .dev .copy_shared_memory_args (util .get_smem_args (kernel_options .smem_args , params ))
440+ # add constant memory arguments to compiled module
441+ if kernel_options .cmem_args is not None :
442+ self .dev .copy_constant_memory_args (kernel_options .cmem_args )
443+ # add texture memory arguments to compiled module
444+ if kernel_options .texmem_args is not None :
445+ self .dev .copy_texture_memory_args (kernel_options .texmem_args )
446+
447+ # stop compilation stopwatch and convert to miliseconds
448+ last_compilation_time = 1000 * (time .perf_counter () - start_compilation )
449+
450+ # test kernel for correctness
451+ if func and (to .answer or to .verify ):
452+ start_verification = time .perf_counter ()
453+ self .check_kernel_output (func , gpu_args , instance , to .answer , to .atol , to .verify , verbose )
454+ last_verification_time = 1000 * (time .perf_counter () - start_verification )
455+
456+ # benchmark
457+ if func :
458+ start_benchmark = time .perf_counter ()
459+ result .update (self .benchmark (func , gpu_args , instance , verbose , to .objective ))
460+ last_benchmark_time = 1000 * (time .perf_counter () - start_benchmark )
461+
462+ except Exception as e :
463+ # dump kernel sources to temp file
464+ temp_filenames = instance .prepare_temp_files_for_error_msg ()
465+ print ("Error while compiling or benchmarking, see source files: " + " " .join (temp_filenames ))
466+ raise e
467467
468- #clean up any temporary files, if no error occured
469- instance .delete_temp_files ()
468+ #clean up any temporary files, if no error occured
469+ instance .delete_temp_files ()
470470
471471 result ['compile_time' ] = last_compilation_time or 0
472472 result ['verification_time' ] = last_verification_time or 0
0 commit comments