Skip to content

Commit 584279c

Browse files
committed
formatting fixed
1 parent 73cb60b commit 584279c

File tree

1 file changed

+28
-18
lines changed

1 file changed

+28
-18
lines changed

sycl/test-e2e/VirtualMem/virtual_mem_usm_compatibility.cpp

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@
1212

1313
#include "helpers.hpp"
1414

15-
int performResultCheck(size_t NumberOfElements, const int* DataResultPtr, const int ExpectedResultValue, std::string_view ErrorMessage){
16-
int IsSuccessful{0};
17-
for (size_t i = 0; i < NumberOfElements; i++) {
15+
int performResultCheck(size_t NumberOfElements, const int *DataResultPtr,
16+
const int ExpectedResultValue,
17+
std::string_view ErrorMessage) {
18+
int IsSuccessful{0};
19+
for (size_t i = 0; i < NumberOfElements; i++) {
1820
if (DataResultPtr[i] != ExpectedResultValue) {
19-
std::cerr << ErrorMessage
20-
<< i << ": " << DataResultPtr
21+
std::cerr << ErrorMessage << i << ": " << DataResultPtr
2122
<< " != " << ExpectedResultValue << std::endl;
2223
++IsSuccessful;
2324
}
@@ -36,10 +37,10 @@ int main() {
3637
constexpr int ValueSetInMemSetOperationPerByte = 1;
3738
constexpr int ValueSetInFillOperation = 444;
3839
constexpr size_t NumberOfElements = 1000;
39-
40+
4041
int *CopyBack = sycl::malloc_shared<int>(NumberOfElements, Queue);
4142
int *CopyFrom = sycl::malloc_shared<int>(NumberOfElements, Queue);
42-
43+
4344
size_t BytesRequired = NumberOfElements * sizeof(int);
4445

4546
size_t UsedGranularity = GetLCMGranularity(Device, Context);
@@ -54,12 +55,11 @@ int main() {
5455

5556
int *DataPtr = reinterpret_cast<int *>(MappedPtr);
5657

57-
auto copyBackFunc = [&Queue, CopyBack, DataPtr](){
58+
auto copyBackFunc = [&Queue, CopyBack, DataPtr]() {
5859
Queue
59-
.parallel_for(NumberOfElements,
60-
[=](sycl::id<1> Idx) { CopyBack[Idx] = DataPtr[Idx]; })
61-
.wait_and_throw();
62-
60+
.parallel_for(NumberOfElements,
61+
[=](sycl::id<1> Idx) { CopyBack[Idx] = DataPtr[Idx]; })
62+
.wait_and_throw();
6363
};
6464

6565
Queue
@@ -71,10 +71,13 @@ int main() {
7171
// Check that one can copy from virtual memory to a USM allocation.
7272

7373
copyBackFunc();
74-
Failed+= performResultCheck(NumberOfElements,CopyBack,ValueSetInKernelForCopyToUSM, "Comparison failed after copy from virtual memory to a USM allocation at index ");
74+
Failed += performResultCheck(NumberOfElements, CopyBack,
75+
ValueSetInKernelForCopyToUSM,
76+
"Comparison failed after copy from virtual "
77+
"memory to a USM allocation at index ");
7578

7679
// Check that can copy from a USM allocation to virtual memory
77-
80+
7881
for (size_t Idx = 0; Idx < NumberOfElements; ++Idx) {
7982
CopyFrom[Idx] = ValueSetForCopyToVirtualMem;
8083
}
@@ -86,8 +89,11 @@ int main() {
8689

8790
copyBackFunc();
8891

89-
Failed+= performResultCheck(NumberOfElements, CopyBack, ValueSetForCopyToVirtualMem, "Comparison failed after copy from a USM allocation to virtual memory at index ");
90-
92+
Failed += performResultCheck(NumberOfElements, CopyBack,
93+
ValueSetForCopyToVirtualMem,
94+
"Comparison failed after copy from a USM "
95+
"allocation to virtual memory at index ");
96+
9197
// Check that can use memset on virtual memory
9298
int ExpectedResultAfterMemSetOperation{0};
9399
std::memset(&ExpectedResultAfterMemSetOperation,
@@ -97,15 +103,19 @@ int main() {
97103

98104
copyBackFunc();
99105

100-
Failed+= performResultCheck(NumberOfElements, CopyBack, ExpectedResultAfterMemSetOperation, "Comparison failed after memset operation on virtual memory at index ");
106+
Failed += performResultCheck(
107+
NumberOfElements, CopyBack, ExpectedResultAfterMemSetOperation,
108+
"Comparison failed after memset operation on virtual memory at index ");
101109

102110
// Check that can use fill on virtual memory
103111
Queue.fill(DataPtr, ValueSetInFillOperation, NumberOfElements)
104112
.wait_and_throw();
105113

106114
copyBackFunc();
107115

108-
Failed+= performResultCheck(NumberOfElements, CopyBack, ValueSetInFillOperation, "Comparison failed after fill operation on virtual memory at index ");
116+
Failed += performResultCheck(
117+
NumberOfElements, CopyBack, ValueSetInFillOperation,
118+
"Comparison failed after fill operation on virtual memory at index ");
109119

110120
sycl::free(CopyFrom, Queue);
111121
sycl::free(CopyBack, Queue);

0 commit comments

Comments
 (0)