MCPcopy Create free account
hub / github.com/KhronosGroup/OpenCL-CTS / REGISTER_TEST

Function REGISTER_TEST

test_conformance/buffers/test_buffer_fill.cpp:712–905  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

710
711
712REGISTER_TEST(buffer_fill_struct)
713{
714 TestStruct pattern;
715 size_t ptrSize = sizeof( TestStruct );
716 size_t global_work_size[3];
717 int n, err;
718 size_t j, offset_elements, fill_elements;
719 int src_flag_id;
720 int total_errors = 0;
721 MTdata d = init_genrand( gRandomSeed );
722
723 size_t min_alignment = get_min_alignment(context);
724
725 global_work_size[0] = (size_t)num_elements;
726
727
728 for (src_flag_id = 0; src_flag_id < NUM_FLAGS; src_flag_id++)
729 {
730 // Skip immutable memory flags
731 if (flag_set[src_flag_id] & CL_MEM_IMMUTABLE_EXT)
732 {
733 continue;
734 }
735
736 clProgramWrapper program;
737 clKernelWrapper kernel;
738 log_info("Testing with cl_mem_flags: %s\n",
739 flag_set_names[src_flag_id]);
740
741 err = create_single_kernel_helper(context, &program, &kernel, 1,
742 &struct_kernel_code,
743 "read_fill_struct");
744 if (err)
745 {
746 log_error(" Error creating program for struct\n");
747 free_mtdata(d);
748 return -1;
749 }
750
751 // Test with random offsets and fill sizes
752 for (n = 0; n < 8; n++)
753 {
754 clEventWrapper event[2];
755 clMemWrapper buffers[2];
756 void *outptr;
757 TestStruct *inptr;
758 TestStruct *hostptr;
759
760 offset_elements =
761 (size_t)get_random_float(0.f, (float)(num_elements - 8), d);
762 fill_elements = (size_t)get_random_float(
763 8.f, (float)(num_elements - offset_elements), d);
764 log_info("Testing random fill from offset %d for %d elements: \n",
765 (int)offset_elements, (int)fill_elements);
766
767 pattern.a = (cl_int)genrand_int32(d);
768 pattern.b = (cl_float)get_random_float(-FLT_MAX, FLT_MAX, d);
769

Callers

nothing calls this directly

Calls 10

init_genrandFunction · 0.85
get_min_alignmentFunction · 0.85
free_mtdataFunction · 0.85
get_random_floatFunction · 0.85
genrand_int32Function · 0.85
align_mallocFunction · 0.85
align_freeFunction · 0.85
verify_fill_structFunction · 0.85
test_buffer_fillFunction · 0.85

Tested by

no test coverage detected