Skip to content

Commit ad14c6b

Browse files
committed
formatting fixed
1 parent ab20212 commit ad14c6b

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

sycl/test-e2e/VirtualMem/helpers.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ size_t GetLCMGranularity(
2424
return (DevGranularity / GCD) * CtxGranularity;
2525
}
2626

27-
size_t GetAlignedByteSize(const size_t UnalignedBytes, const size_t AligmentGranularity){
28-
return ((UnalignedBytes + AligmentGranularity - 1) / AligmentGranularity) * AligmentGranularity;
27+
size_t GetAlignedByteSize(const size_t UnalignedBytes,
28+
const size_t AligmentGranularity) {
29+
return ((UnalignedBytes + AligmentGranularity - 1) / AligmentGranularity) *
30+
AligmentGranularity;
2931
}

sycl/test-e2e/VirtualMem/remapping_virtual_memory_range.cpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// This test checks whether virtual memory range can correctly be accessed
2-
// even if it was re-mapped to a different physical range.
1+
// This test checks whether virtual memory range can correctly be accessed
2+
// even if it was re-mapped to a different physical range.
33

44
// RUN: %{build} -o %t.out
55
// RUN: %{run} %t.out
@@ -12,20 +12,20 @@
1212

1313
namespace syclext = sycl::ext::oneapi::experimental;
1414

15-
int main(){
15+
int main() {
1616

1717
sycl::queue Q;
1818
sycl::context Context = Q.get_context();
1919
sycl::device Device = Q.get_device();
20-
20+
2121
int Failed = 0;
22-
22+
2323
constexpr size_t NumberOfElements = 1000;
2424
constexpr int ValueSetInFirstKernel = 555;
2525
constexpr int ValueSetInSecondKernel = 999;
26-
26+
2727
size_t BytesRequired = NumberOfElements * sizeof(int);
28-
28+
2929
size_t UsedGranularity = GetLCMGranularity(Device, Context);
3030
size_t AlignedByteSize = GetAlignedByteSize(BytesRequired, UsedGranularity);
3131

@@ -35,7 +35,7 @@ int main(){
3535

3636
void *MappedPtr =
3737
FirstPhysicalMemory.map(VirtualMemoryPtr, AlignedByteSize,
38-
syclext::address_access_mode::read_write);
38+
syclext::address_access_mode::read_write);
3939

4040
int *DataPtr = reinterpret_cast<int *>(MappedPtr);
4141

@@ -46,14 +46,15 @@ int main(){
4646
}).wait_and_throw();
4747

4848
syclext::unmap(MappedPtr, AlignedByteSize, Context);
49-
49+
5050
syclext::physical_mem SecondPhysicalMemory{Device, Context, AlignedByteSize};
51-
MappedPtr = SecondPhysicalMemory.map(VirtualMemoryPtr, AlignedByteSize, syclext::address_access_mode::read_write);
51+
MappedPtr =
52+
SecondPhysicalMemory.map(VirtualMemoryPtr, AlignedByteSize,
53+
syclext::address_access_mode::read_write);
5254

5355
Q.parallel_for(NumberOfElements, [=](sycl::id<1> Idx) {
5456
DataPtr[Idx] = ValueSetInSecondKernel;
55-
}).wait_and_throw();
56-
57+
}).wait_and_throw();
5758

5859
{
5960
sycl::buffer<int> ResultBuffer(ResultHostData);
@@ -68,13 +69,14 @@ int main(){
6869
for (size_t i = 0; i < NumberOfElements; i++) {
6970
if (ResultHostData[i] != ValueSetInSecondKernel) {
7071
std::cout << "Comparison failed at index " << i << ": "
71-
<< ResultHostData[i] << " != " << ValueSetInSecondKernel<< std::endl;
72+
<< ResultHostData[i] << " != " << ValueSetInSecondKernel
73+
<< std::endl;
7274
++Failed;
7375
}
7476
}
7577

7678
syclext::unmap(MappedPtr, AlignedByteSize, Context);
7779
syclext::free_virtual_mem(VirtualMemoryPtr, AlignedByteSize, Context);
78-
79-
return 0;
80+
81+
return Failed;
8082
}

0 commit comments

Comments
 (0)