Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 149529a

Browse files
committed
Apply suggestions from code review
1 parent 5550daf commit 149529a

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

SYCL/ESIMD/Prefix_Local_sum1.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ int main(int argc, char *argv[]) {
131131

132132
auto dev = q.get_device();
133133
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
134-
auto ctxt = q.get_context();
135134

136135
// allocate and initialized input
137136
unsigned int *pInputs = static_cast<unsigned int *>(
@@ -141,8 +140,8 @@ int main(int argc, char *argv[]) {
141140
}
142141

143142
// allocate device buffer
144-
unsigned int *pDeviceOutputs = static_cast<unsigned int *>(
145-
malloc_shared(size * TUPLE_SZ * sizeof(unsigned int), dev, ctxt));
143+
unsigned int *pDeviceOutputs =
144+
malloc_shared<unsigned int>(size * TUPLE_SZ, q);
146145

147146
// allocate & compute expected result
148147
unsigned int *pExpectOutputs = static_cast<unsigned int *>(
@@ -177,7 +176,7 @@ int main(int argc, char *argv[]) {
177176
}
178177
} catch (cl::sycl::exception const &e) {
179178
std::cout << "SYCL exception caught: " << e.what() << '\n';
180-
free(pInputs, ctxt);
179+
free(pInputs, q);
181180
free(pExpectOutputs);
182181
return 1;
183182
}
@@ -193,7 +192,7 @@ int main(int argc, char *argv[]) {
193192
std::cout << "Prefix " << (pass ? "=> PASSED" : "=> FAILED") << std::endl
194193
<< std::endl;
195194

196-
free(pDeviceOutputs, ctxt);
195+
free(pDeviceOutputs, q);
197196
free(pExpectOutputs);
198197
free(pInputs);
199198
return 0;

SYCL/ESIMD/Prefix_Local_sum2.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ int main(int argc, char *argv[]) {
126126

127127
auto dev = q.get_device();
128128
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
129-
auto ctxt = q.get_context();
130129

131130
// allocate and initialized input
132131
unsigned int *pInputs = static_cast<unsigned int *>(
@@ -136,8 +135,8 @@ int main(int argc, char *argv[]) {
136135
}
137136

138137
// allocate device buffer
139-
unsigned int *pDeviceOutputs = static_cast<unsigned int *>(
140-
malloc_shared(size * TUPLE_SZ * sizeof(unsigned int), dev, ctxt));
138+
unsigned int *pDeviceOutputs =
139+
malloc_shared<unsigned int>(size * TUPLE_SZ, q);
141140

142141
// allocate & compute expected result
143142
unsigned int *pExpectOutputs = static_cast<unsigned int *>(
@@ -171,7 +170,7 @@ int main(int argc, char *argv[]) {
171170
}
172171
} catch (cl::sycl::exception const &e) {
173172
std::cout << "SYCL exception caught: " << e.what() << '\n';
174-
free(pInputs, ctxt);
173+
free(pInputs, q);
175174
free(pExpectOutputs);
176175
return 1;
177176
}
@@ -187,7 +186,7 @@ int main(int argc, char *argv[]) {
187186
std::cout << "Prefix " << (pass ? "=> PASSED" : "=> FAILED") << std::endl
188187
<< std::endl;
189188

190-
free(pDeviceOutputs, ctxt);
189+
free(pDeviceOutputs, q);
191190
free(pExpectOutputs);
192191
free(pInputs);
193192
return 0;

SYCL/ESIMD/Prefix_Local_sum3.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ int main(int argc, char *argv[]) {
332332

333333
auto dev = q.get_device();
334334
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
335-
auto ctxt = q.get_context();
336335

337336
// allocate and initialized input data
338337
unsigned int *pInputs = static_cast<unsigned int *>(
@@ -342,8 +341,8 @@ int main(int argc, char *argv[]) {
342341
}
343342

344343
// allocate kernel buffer
345-
unsigned int *pDeviceOutputs = static_cast<unsigned int *>(
346-
malloc_shared(size * TUPLE_SZ * sizeof(unsigned int), dev, ctxt));
344+
unsigned int *pDeviceOutputs =
345+
malloc_shared<unsigned int>(size * TUPLE_SZ, q);
347346

348347
// allocate & intialize expected result
349348
unsigned int *pExpectOutputs = static_cast<unsigned int *>(
@@ -389,7 +388,7 @@ int main(int argc, char *argv[]) {
389388
std::cout << "Prefix " << (pass ? "=> PASSED" : "=> FAILED") << std::endl
390389
<< std::endl;
391390

392-
free(pDeviceOutputs, ctxt);
391+
free(pDeviceOutputs, q);
393392
free(pExpectOutputs);
394393
free(pInputs);
395394
return 0;

0 commit comments

Comments
 (0)