Esempio n. 1
0
def make_tests(type_str, input_file, output_file):
    alias_test = ''
    func_calls = ''
    for size in [2, 3, 4, 8, 16]:
        alias_test += gen_alias_test(type_str, size)
        func_calls += make_func_call(TEST_NAME, type_str, str(size))
    write_source_file(alias_test, func_calls, TEST_NAME, input_file,
                      output_file, type_str)
def make_tests(type_str, input_file, output_file):
    test_string = ''
    func_calls = ''
    for size in Data.standard_sizes:
        test_string += gen_load_store_test(type_str, size)
        func_calls += make_func_call(TEST_NAME, type_str, str(size))
    write_source_file(test_string, func_calls, TEST_NAME, input_file,
                      output_file, type_str)
Esempio n. 3
0
def generate_operator_tests(type_str, input_file, output_file):
    """"""
    test_func_str = ''
    func_calls = ''
    is_opencl_type = type_str in ReverseData.rev_opencl_type_dict
    for size in Data.standard_sizes:
        test_str = generate_all_type_test(type_str, size)
        test_func_str += wrap_with_test_func(TEST_NAME + '_ALL_TYPES',
                                             type_str, test_str, str(size))
        func_calls += make_func_call(TEST_NAME + '_ALL_TYPES', type_str,
                                     str(size))
        if is_opencl_type:
            test_str = generate_all_types_specific_return_type_test(
                type_str, size)
            test_func_str += wrap_with_test_func(
                TEST_NAME + '_SPECIFIC_RETURN_TYPES', type_str, test_str,
                str(size))
            func_calls += make_func_call(TEST_NAME + '_SPECIFIC_RETURN_TYPES',
                                         type_str, str(size))
        if not type_str in [
                'float', 'double', 'cl::sycl::half', 'cl::sycl::cl_float',
                'cl::sycl::cl_double', 'cl::sycl::cl_half'
        ]:
            test_str = generate_non_fp_assignment_test(type_str, size)
            test_func_str += wrap_with_test_func(
                TEST_NAME + '_NON_FP_ASSIGNMENT', type_str, test_str,
                str(size))
            func_calls += make_func_call(TEST_NAME + '_NON_FP_ASSIGNMENT',
                                         type_str, str(size))
            test_str = generate_non_fp_bitwise_test(type_str, size)
            test_func_str += wrap_with_test_func(TEST_NAME + '_NON_FP_BITWISE',
                                                 type_str, test_str, str(size))
            func_calls += make_func_call(TEST_NAME + '_NON_FP_BITWISE',
                                         type_str, str(size))
            test_str = generate_non_fp_arithmetic_test(type_str, size)
            test_func_str += wrap_with_test_func(
                TEST_NAME + '_NON_FP_ARITHMETIC', type_str, test_str,
                str(size))
            func_calls += make_func_call(TEST_NAME + '_NON_FP_ARITHMETIC',
                                         type_str, str(size))
    write_source_file(test_func_str, func_calls, TEST_NAME, input_file,
                      output_file, type_str)
Esempio n. 4
0
def make_optional_tests(type_str, input_file, output_file, dest, dest_type):
    api_checks = ''
    func_calls = ''
    TEST_NAME_OP = TEST_NAME + '_as_convert_to_' + dest
    for size in Data.standard_sizes:
        api_checks += gen_optional_checks(type_str, size, dest, dest_type,
                                          TEST_NAME_OP)
        func_calls += make_func_call(TEST_NAME_OP, type_str, str(size))
    write_source_file(
        api_checks, func_calls, TEST_NAME_OP, input_file,
        output_file.replace('.cpp', '_as_convert_to_' + dest + '.cpp'),
        type_str)
Esempio n. 5
0
def make_tests(type_str, input_file, output_file):
    reverse_type_str = get_reverse_type(type_str)
    is_opencl_type = type_str in ReverseData.rev_opencl_type_dict
    api_checks = ''
    func_calls = ''
    for size in Data.standard_sizes:
        if is_opencl_type:
            api_checks += gen_interop_checks(type_str, reverse_type_str, size)
        else:
            api_checks += gen_host_checks(type_str, reverse_type_str, size)
        func_calls += make_func_call(TEST_NAME, type_str, str(size))
    write_source_file(api_checks, func_calls, TEST_NAME, input_file,
                      output_file, type_str)
Esempio n. 6
0
def make_tests(type_str, input_file, output_file, target_enable):
    api_checks = ''
    func_calls = ''
    for size in Data.standard_sizes:
        api_checks += gen_checks(type_str, size)
        func_calls += make_func_call(TEST_NAME, type_str, str(size))
    write_source_file(api_checks, func_calls, TEST_NAME, input_file,
                      output_file, type_str)

    if '64' in target_enable and not ('double' in type_str):
        make_optional_tests(type_str, input_file, output_file, 'fp64',
                            'double')

    if '16' in target_enable and not ('half' in type_str):
        make_optional_tests(type_str, input_file, output_file, 'fp16',
                            'sycl::half')
def generate_constructor_tests(type_str, input_file, output_file):
    """Generates a string for each constructor type containing each combination of test
    Constructor types: default, explicit, vec, opencl
    A cross section of variadic constructors are provided by the template"""
    test_str = ''
    test_func_str = ''
    func_calls = ''
    vector_sizes = Data.standard_sizes
    for size in vector_sizes:
        test_str += generate_default(type_str, size)
        test_str += generate_explicit(type_str, size)
        test_str += generate_vec(type_str, size)
        test_func_str += wrap_with_test_func(TEST_NAME, type_str, test_str,
                                             str(size))
        test_str = ''
        func_calls += make_func_call(TEST_NAME, type_str, str(size))

        write_source_file(test_func_str, func_calls, TEST_NAME, input_file,
                          output_file, type_str)