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

Function REGISTER_TEST

test_conformance/SVM/test_enqueue_api.cpp:73–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73REGISTER_TEST(svm_enqueue_api)
74{
75 clContextWrapper contextWrapper = NULL;
76 clCommandQueueWrapper queues[MAXQ];
77 cl_uint num_devices = 0;
78 const size_t elementNum = 1024;
79 const size_t numSVMBuffers = 32;
80 cl_int error = CL_SUCCESS;
81 RandomSeed seed(0);
82
83 error = create_cl_objects(device, NULL, &contextWrapper, NULL, &queues[0],
84 &num_devices, CL_DEVICE_SVM_COARSE_GRAIN_BUFFER);
85 context = contextWrapper;
86 if (error) return TEST_FAIL;
87
88 queue = queues[0];
89
90 // all possible sizes of vectors and scalars
91 size_t typeSizes[] = {
92 sizeof(cl_uchar), sizeof(cl_uchar2), sizeof(cl_uchar3),
93 sizeof(cl_uchar4), sizeof(cl_uchar8), sizeof(cl_uchar16),
94 sizeof(cl_ushort), sizeof(cl_ushort2), sizeof(cl_ushort3),
95 sizeof(cl_ushort4), sizeof(cl_ushort8), sizeof(cl_ushort16),
96 sizeof(cl_uint), sizeof(cl_uint2), sizeof(cl_uint3),
97 sizeof(cl_uint4), sizeof(cl_uint8), sizeof(cl_uint16),
98 sizeof(cl_ulong), sizeof(cl_ulong2), sizeof(cl_ulong3),
99 sizeof(cl_ulong4), sizeof(cl_ulong8), sizeof(cl_ulong16),
100 };
101
102 enum allocationTypes
103 {
104 host,
105 svm
106 };
107
108 struct TestType
109 {
110 allocationTypes srcAlloc;
111 allocationTypes dstAlloc;
112 TestType(allocationTypes type1, allocationTypes type2)
113 : srcAlloc(type1), dstAlloc(type2)
114 {}
115 };
116
117 std::vector<TestType> testTypes;
118
119 testTypes.push_back(TestType(host, host));
120 testTypes.push_back(TestType(host, svm));
121 testTypes.push_back(TestType(svm, host));
122 testTypes.push_back(TestType(svm, svm));
123
124 for (const auto test_case : testTypes)
125 {
126 log_info("clEnqueueSVMMemcpy case: src_alloc = %s, dst_alloc = %s\n",
127 test_case.srcAlloc == svm ? "svm" : "host",
128 test_case.dstAlloc == svm ? "svm" : "host");
129 for (size_t i = 0; i < ARRAY_SIZE(typeSizes); ++i)
130 {

Callers

nothing calls this directly

Calls 5

create_cl_objectsFunction · 0.85
generate_dataFunction · 0.85
usleepFunction · 0.85
TestTypeClass · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected