Skip to content

Commit 4c3ffd8

Browse files
committed
[SYCL] Fix member initialization bugs
Signed-off-by: Hu, Peisen <[email protected]>
1 parent 32c518b commit 4c3ffd8

File tree

6 files changed

+14
-35
lines changed

6 files changed

+14
-35
lines changed

sycl/test-e2e/GroupAlgorithm/root_group.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ void testRootGroup() {
7575
struct TestKernel1 {
7676
sycl::buffer<bool> m_dataBuf;
7777
sycl::handler m_h;
78-
TestKernel1(sycl::buffer<bool> dataBuf, sycl::handler h) {
79-
m_dataBuf = dataBuf;
80-
m_h = h;
81-
}
78+
TestKernel1(sycl::buffer<bool> dataBuf, sycl::handler h)
79+
: m_dataBuf(dataBuf), m_h(h) {}
8280
void operator()(sycl::nd_item<1> it) const {
8381
sycl::accessor data{m_dataBuf, m_h};
8482
volatile float X = 1.0f;
@@ -131,10 +129,8 @@ void testRootGroupFunctions() {
131129
struct TestKernel2 {
132130
sycl::buffer<bool> m_testResultsBuf;
133131
sycl::handler m_h;
134-
TestKernel2(sycl::buffer<bool> testResultsBuf, sycl::handler h) {
135-
m_testResultsBuf = testResultsBuf;
136-
m_h = h;
137-
}
132+
TestKernel2(sycl::buffer<bool> testResultsBuf, sycl::handler h)
133+
: m_testResultsBuf(testResultsBuf), m_h(h) {}
138134
void operator()(sycl::nd_item<1> it) const {
139135
sycl::accessor testResults{m_testResultsBuf, m_h};
140136
const auto root = it.ext_oneapi_get_root_group();

sycl/test-e2e/VirtualFunctions/2/1/1/missing-overrides.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,8 @@ int main() try {
8585
sycl::buffer<int> mDataStorage;
8686
sycl::handler mCGH;
8787
KernelFunctor(sycl::buffer<storage_t> DeviceStorage,
88-
sycl::buffer<int> DataStorage, sycl::handler CGH) {
89-
mDeviceStorage = DeviceStorage;
90-
mDataStorage = DataStorage;
91-
mCGH = CGH;
92-
}
88+
sycl::buffer<int> DataStorage, sycl::handler CGH)
89+
: mDeviceStorage(DeviceStorage), mDataStorage(DataStorage), mCGH(CGH) {}
9390

9491
void operator()() const {
9592
sycl::accessor StorageAcc(mDeviceStorage, mCGH, sycl::write_only);

sycl/test-e2e/VirtualFunctions/2/1/1/more-complex-hierarchy.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,8 @@ int main() try {
6464
sycl::buffer<int> mDataStorage;
6565
sycl::handler mCGH;
6666
KernelFunctor(sycl::buffer<storage_t> DeviceStorage,
67-
sycl::buffer<int> DataStorage, sycl::handler CGH) {
68-
mDeviceStorage = DeviceStorage;
69-
mDataStorage = DataStorage;
70-
mCGH = CGH;
71-
}
67+
sycl::buffer<int> DataStorage, sycl::handler CGH)
68+
: mDeviceStorage(DeviceStorage), mDataStorage(DataStorage), mCGH(CGH) {}
7269

7370
void operator()() const {
7471
sycl::accessor StorageAcc(mDeviceStorage, mCGH, sycl::write_only);

sycl/test-e2e/VirtualFunctions/2/1/1/simple-hierarchy.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ int main() try {
4949
sycl::buffer<int> mDataStorage;
5050
sycl::handler mCGH;
5151
KernelFunctor(sycl::buffer<storage_t> DeviceStorage,
52-
sycl::buffer<int> DataStorage, sycl::handler CGH) {
53-
mDeviceStorage = DeviceStorage;
54-
mDataStorage = DataStorage;
55-
mCGH = CGH;
56-
}
57-
52+
sycl::buffer<int> DataStorage, sycl::handler CGH)
53+
: mDeviceStorage(DeviceStorage), mDataStorage(DataStorage), mCGH(CGH) {}
5854
void operator()() const {
5955
sycl::accessor StorageAcc(mDeviceStorage, mCGH, sycl::write_only);
6056
sycl::accessor DataAcc(mDataStorage, mCGH, sycl::write_only);

sycl/test-e2e/VirtualFunctions/2/2/single-construct-single-use.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,8 @@ int main() try {
7777
sycl::buffer<int> mDataStorage;
7878
sycl::handler mCGH;
7979
KernelFunctor(sycl::buffer<storage_t> DeviceStorage,
80-
sycl::buffer<int> DataStorage, sycl::handler CGH) {
81-
mDeviceStorage = DeviceStorage;
82-
mDataStorage = DataStorage;
83-
mCGH = CGH;
84-
}
85-
80+
sycl::buffer<int> DataStorage, sycl::handler CGH)
81+
: mDeviceStorage(DeviceStorage), mDataStorage(DataStorage), mCGH(CGH) {}
8682
void operator()() const {
8783
sycl::accessor StorageAcc(mDeviceStorage, mCGH, sycl::read_write);
8884
sycl::accessor DataAcc(mDataStorage, mCGH, sycl::write_only);

sycl/test-e2e/VirtualFunctions/misc/math.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,8 @@ int main() try {
5454
sycl::buffer<int> mDataStorage;
5555
sycl::handler mCGH;
5656
KernelFunctor(T DeviceStorage, sycl::buffer<float> DataStorage,
57-
sycl::handler CGH) {
58-
mDeviceStorage = DeviceStorage;
59-
mDataStorage = DataStorage;
60-
mCGH = CGH;
61-
}
57+
sycl::handler CGH)
58+
: mDeviceStorage(DeviceStorage), mDataStorage(DataStorage), mCGH(CGH) {}
6259

6360
void operator()() const {
6461
sycl::accessor DataAcc(mDataStorage, mCGH, sycl::read_write);

0 commit comments

Comments
 (0)