@@ -43,6 +43,16 @@ static TestResult run(const StreamMemoryArguments &arguments, Statistics &statis
43
43
if (levelzero.commandQueue == nullptr ) {
44
44
return TestResult::DeviceNotCapable;
45
45
}
46
+ if (isSharedSystemPointer (arguments.memoryPlacement )) {
47
+ ze_device_memory_access_properties_t memoryAccessCapabilities = {};
48
+ ASSERT_ZE_RESULT_SUCCESS (zeDeviceGetMemoryAccessProperties (levelzero.device , &memoryAccessCapabilities));
49
+ if (memoryAccessCapabilities.sharedSystemAllocCapabilities == 0 ) {
50
+ return TestResult::DeviceNotCapable;
51
+ }
52
+ if (arguments.contents != BufferContents::Zeros) {
53
+ return TestResult::NoImplementation;
54
+ }
55
+ }
46
56
Timer timer;
47
57
48
58
// Query double support
@@ -143,7 +153,11 @@ static TestResult run(const StreamMemoryArguments &arguments, Statistics &statis
143
153
144
154
// Enqueue filling of the buffers and set kernel arguments
145
155
for (auto i = 0u ; i < buffersCount; i++) {
146
- ASSERT_ZE_RESULT_SUCCESS (BufferContentsHelperL0::fillBuffer (levelzero, buffers[i], bufferSizes[i], arguments.contents , false ));
156
+ if (isSharedSystemPointer (arguments.memoryPlacement )) {
157
+ memset (buffers[i], 0u , bufferSizes[i]);
158
+ } else {
159
+ ASSERT_ZE_RESULT_SUCCESS (BufferContentsHelperL0::fillBuffer (levelzero, buffers[i], bufferSizes[i], arguments.contents , false ));
160
+ }
147
161
ASSERT_ZE_RESULT_SUCCESS (zeKernelSetArgumentValue (kernel, static_cast <int >(i), sizeof (buffers[i]), &buffers[i]));
148
162
}
149
163
if (setScalarArgument) {
@@ -165,6 +179,11 @@ static TestResult run(const StreamMemoryArguments &arguments, Statistics &statis
165
179
166
180
// Benchmark
167
181
for (auto i = 0u ; i < arguments.iterations ; i++) {
182
+ if (isSharedSystemPointer (arguments.memoryPlacement )) {
183
+ for (auto id = 0u ; id < buffersCount; id++) {
184
+ memset (buffers[id], 0u , bufferSizes[id]);
185
+ }
186
+ }
168
187
// Launch kernel
169
188
timer.measureStart ();
170
189
ASSERT_ZE_RESULT_SUCCESS (zeCommandQueueExecuteCommandLists (levelzero.commandQueue , 1 , &cmdList, 0 ));
@@ -199,7 +218,7 @@ static TestResult run(const StreamMemoryArguments &arguments, Statistics &statis
199
218
ASSERT_ZE_RESULT_SUCCESS (zeEventDestroy (event));
200
219
ASSERT_ZE_RESULT_SUCCESS (zeEventPoolDestroy (eventPool));
201
220
for (size_t i = 0 ; i < buffersCount; i++) {
202
- ASSERT_ZE_RESULT_SUCCESS (zeMemFree (levelzero. context , buffers[i]));
221
+ ASSERT_ZE_RESULT_SUCCESS (UsmHelper::deallocate (arguments. memoryPlacement , levelzero , buffers[i]));
203
222
}
204
223
ASSERT_ZE_RESULT_SUCCESS (zeCommandListDestroy (cmdList));
205
224
ASSERT_ZE_RESULT_SUCCESS (zeKernelDestroy (kernel));
0 commit comments