Skip to content

Commit 01a59e4

Browse files
committed
cleaned up comments, removed logging code. sb gtg
Signed-off-by: Chris Perkins <[email protected]>
1 parent 3585fde commit 01a59e4

File tree

6 files changed

+30
-183
lines changed

6 files changed

+30
-183
lines changed

sycl/include/CL/sycl/detail/cl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
#define CL_TARGET_OPENCL_VERSION 220
1515
#endif
1616

17-
//#define CPOUT std::clog
18-
#define CPOUT \
19-
std::clog.rdbuf(NULL); \
20-
std::clog
21-
//#define CP_CHANGE_IMAGE 1
2217

2318
#include <CL/cl.h>
2419
#include <CL/cl_ext.h>

sycl/include/CL/sycl/detail/image_impl.hpp

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ class __SYCL_EXPORT image_impl final : public SYCLMemObjT {
7979
"Dimensions of cl::sycl::image can be 1, 2 or 3");
8080

8181
void setPitches() {
82-
CPOUT << "setPitches()!!" << std::endl;
8382
size_t WHD[3] = {1, 1, 1}; // Width, Height, Depth.
8483
#ifndef CP_CHANGE_IMAGE
8584
for (int I = 0; I < Dimensions; I++)
@@ -106,8 +105,6 @@ class __SYCL_EXPORT image_impl final : public SYCLMemObjT {
106105

107106
template <bool B = (Dimensions > 1)>
108107
void setPitches(const EnableIfPitchT<B> Pitch) {
109-
CPOUT << "setPitched() DIM BIG! " << Pitch[0] << " / "
110-
<< ((Dimensions == 3) ? Pitch[1] : 0) << std::endl;
111108
MRowPitch = Pitch[0];
112109
MSlicePitch =
113110
(Dimensions == 3) ? Pitch[1] : MRowPitch; // Dimensions will be 2/3.
@@ -268,45 +265,19 @@ class __SYCL_EXPORT image_impl final : public SYCLMemObjT {
268265
RT::PiMemImageDesc getImageDesc(bool InitFromHostPtr) {
269266
RT::PiMemImageDesc Desc;
270267
Desc.image_type = getImageType();
271-
// CP
272-
// MRange<> is [width], [height,width], or [depth,height,width]
273-
if (Dimensions == 3) {
274-
CPOUT << "getImageDesc: MRange: {" << MRange[0] << "," << MRange[1] << ","
275-
<< MRange[2] << "}" << std::endl;
276-
} else if (Dimensions == 2) {
277-
CPOUT << "getImageDesc: MRange: {" << MRange[0] << "," << MRange[1] << "}"
278-
<< std::endl;
279-
} else if (Dimensions == 1) {
280-
CPOUT << "getImageDesc: MRange: {" << MRange[0] << "}" << std::endl;
281-
}
282268

283-
#ifdef CP_CHANGE_IMAGE
284-
int x_term_pos = 2, y_term_pos = 1, z_term_pos = 0;
285-
if (Dimensions == 2) {
286-
y_term_pos = 0;
287-
x_term_pos = 1;
288-
}
289-
if (Dimensions == 1) {
290-
x_term_pos = 0;
291-
}
292-
#else
269+
// MRange<> is [width], [width,height,width], or [width,height,depth] (which
270+
// is different than MAccessRange, etc in bufffers)
293271
int x_term_pos = 0, y_term_pos = 1, z_term_pos = 2;
294-
#endif
295-
296272
Desc.image_width = MRange[x_term_pos];
297273
Desc.image_height = Dimensions > 1 ? MRange[y_term_pos] : 1;
298274
Desc.image_depth = Dimensions > 2 ? MRange[z_term_pos] : 1;
299-
CPOUT << " Desc.image_ w/h/d: " << Desc.image_width << " / "
300-
<< Desc.image_height << " / " << Desc.image_depth << std::endl;
301275

302276
// TODO handle cases with IMAGE1D_ARRAY and IMAGE2D_ARRAY
303277
Desc.image_array_size = 0;
304278
// Pitches must be 0 if host ptr is not provided.
305279
Desc.image_row_pitch = InitFromHostPtr ? MRowPitch : 0;
306280
Desc.image_slice_pitch = InitFromHostPtr ? MSlicePitch : 0;
307-
CPOUT << " Desc.image_ row_pitch/slice: " << Desc.image_row_pitch
308-
<< " / " << Desc.image_slice_pitch << std::endl;
309-
310281
Desc.num_mip_levels = 0;
311282
Desc.num_samples = 0;
312283
Desc.buffer = nullptr;

sycl/plugins/opencl/pi_opencl.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -529,20 +529,12 @@ pi_result piMemImageCreate(pi_context context, pi_mem_flags flags,
529529
const pi_image_format *image_format,
530530
const pi_image_desc *image_desc, void *host_ptr,
531531
pi_mem *ret_mem) {
532-
CPOUT << "image_desc w/h/d: " << image_desc->image_width << " / "
533-
<< image_desc->image_height << " / " << image_desc->image_depth
534-
<< std::endl;
535-
CPOUT << " arrSz/row/slice: " << image_desc->image_array_size
536-
<< " / " << image_desc->image_row_pitch << " / "
537-
<< image_desc->image_slice_pitch << std::endl;
538-
539532
pi_result ret_err = PI_INVALID_OPERATION;
540533
*ret_mem = cast<pi_mem>(
541534
clCreateImage(cast<cl_context>(context), cast<cl_mem_flags>(flags),
542535
cast<const cl_image_format *>(image_format),
543536
cast<const cl_image_desc *>(image_desc), host_ptr,
544537
cast<cl_int *>(&ret_err)));
545-
CPOUT << "ret_mem :: err: " << *ret_mem << " :: " << ret_err << std::endl;
546538
return ret_err;
547539
}
548540

sycl/source/detail/memory_manager.cpp

Lines changed: 11 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,7 @@ void prepTermPositions(term_positions &pos, int Dimensions,
256256
// 1 ==> {width, 1, 1}
257257
// 2 ==> {height, width, 1}
258258
// 3 ==> {depth, height, width}
259-
// If the Dimension is 1, and being called by ~SYCLMemObjT, then
260-
// DstAccessRange[0] and DstSize[0] will already sized to bytes with
261-
// DstElemSize of 1. Some callers enqueue 0 as DimDst/DimSrc.
259+
// Some callers enqueue 0 as DimDst/DimSrc.
262260
#ifdef CP_CHANGE_IMAGE
263261
if (true) {
264262
#else
@@ -296,38 +294,14 @@ void copyH2D(SYCLMemObjI *SYCLMemObj, char *SrcMem, QueueImplPtr,
296294
const RT::PiQueue Queue = TgtQueue->getHandleRef();
297295
const detail::plugin &Plugin = TgtQueue->getPlugin();
298296

299-
CPOUT << "copyH2D " << std::endl;
300-
CPOUT << "DimSrc: " << DimSrc << " SrcAccessRange: " << SrcAccessRange[0]
301-
<< " / " << SrcAccessRange[1] << " / " << SrcAccessRange[2]
302-
<< std::endl;
303-
// CPOUT << " " << DimSrc << " SrcOffset: " << SrcOffset[0] << " / "
304-
// << SrcOffset[1] << " / " << SrcOffset[2] << std::endl;
305-
CPOUT << "DimDst: " << DimDst << " DstAccessRange: " << DstAccessRange[0]
306-
<< " / " << DstAccessRange[1] << " / " << DstAccessRange[2]
307-
<< std::endl;
308-
// CPOUT << " " << DimSrc << " DstOffset: " << DstOffset[0] << " / "
309-
// << DstOffset[1] << " / " << DstOffset[2] << std::endl;
310-
CPOUT << "SrcElemSize / DstElemSize: " << SrcElemSize << " / " << DstElemSize
311-
<< std::endl;
312-
CPOUT << std::endl;
313-
314297
detail::SYCLMemObjI::MemObjType MemType = SYCLMemObj->getType();
315298
term_positions SrcPos, DstPos;
316299
prepTermPositions(SrcPos, DimSrc, MemType);
317300
prepTermPositions(DstPos, DimDst, MemType);
318301

319-
// int src_x_term_pos = 2, src_y_term_pos = 1, src_z_term_pos = 0;
320-
// if(DimSrc == 2){
321-
// src_x_term_pos = 1; src_y_term_pos = 0; src_z_term_pos = 2;
322-
// } else if (DimSrc == 1){
323-
// src_x_term_pos = 0; src_y_term_pos = 1; src_z_term_pos = 2;
324-
// }
325-
// int dst_x_term_pos = 2, dst_y_term_pos = 1, dst_z_term_pos = 0;
326-
// if(DimDst == 2){
327-
// dst_x_term_pos = 1; dst_y_term_pos = 0; dst_z_term_pos = 2;
328-
// } else if (DimDst == 1){
329-
// dst_x_term_pos = 0; dst_y_term_pos = 1; dst_z_term_pos = 2;
330-
// }
302+
// If the Dimension is 1, and being called by ~SYCLMemObjT,
303+
// thenDstAccessRange[0] and DstSize[0] will already sized to bytes with
304+
// DstElemSize of 1.
331305
size_t DstXOffBytes = DstOffset[DstPos.x_term] * DstElemSize;
332306
size_t SrcXOffBytes = SrcOffset[SrcPos.x_term] * SrcElemSize;
333307
size_t DstARWidthBytes = DstAccessRange[DstPos.x_term] * DstElemSize;
@@ -395,44 +369,14 @@ void copyD2H(SYCLMemObjI *SYCLMemObj, RT::PiMem SrcMem, QueueImplPtr SrcQueue,
395369
const RT::PiQueue Queue = SrcQueue->getHandleRef();
396370
const detail::plugin &Plugin = SrcQueue->getPlugin();
397371

398-
// the offsets/ranges coming from accessor are always id<3>/range<3>
399-
// But their organization varies by dimension:
400-
// 1 ==> {width, 1, 1}
401-
// 2 ==> {height, width, 1}
402-
// 3 ==> {depth, height, width}
403-
404-
CPOUT << "copyD2H " << std::endl;
405-
CPOUT << "DimSrc: " << DimSrc << " SrcAccessRange: " << SrcAccessRange[0]
406-
<< " / " << SrcAccessRange[1] << " / " << SrcAccessRange[2]
407-
<< std::endl;
408-
// CPOUT << " " << DimSrc << " SrcOffset: " << SrcOffset[0] << " / "
409-
// << SrcOffset[1] << " / " << SrcOffset[2] << std::endl;
410-
CPOUT << "DimDst: " << DimDst << " DstAccessRange: " << DstAccessRange[0]
411-
<< " / " << DstAccessRange[1] << " / " << DstAccessRange[2]
412-
<< std::endl;
413-
// CPOUT << " " << DimSrc << " DstOffset: " << DstOffset[0] << " / "
414-
// << DstOffset[1] << " / " << DstOffset[2] << std::endl;
415-
CPOUT << "SrcElemSize / DstElemSize: " << SrcElemSize << " / " << DstElemSize
416-
<< std::endl;
417-
CPOUT << std::endl;
418-
419372
detail::SYCLMemObjI::MemObjType MemType = SYCLMemObj->getType();
420373
term_positions SrcPos, DstPos;
421374
prepTermPositions(SrcPos, DimSrc, MemType);
422375
prepTermPositions(DstPos, DimDst, MemType);
423376

424-
// int src_x_term_pos = 2, src_y_term_pos = 1, src_z_term_pos = 0;
425-
// if(DimSrc == 2){
426-
// src_x_term_pos = 1; src_y_term_pos = 0; src_z_term_pos = 2;
427-
// } else if (DimSrc == 1){
428-
// src_x_term_pos = 0; src_y_term_pos = 1; src_z_term_pos = 2;
429-
// }
430-
// int dst_x_term_pos = 2, dst_y_term_pos = 1, dst_z_term_pos = 0;
431-
// if(DimDst == 2){
432-
// dst_x_term_pos = 1; dst_y_term_pos = 0; dst_z_term_pos = 2;
433-
// } else if (DimDst == 1){
434-
// dst_x_term_pos = 0; dst_y_term_pos = 1; dst_z_term_pos = 2;
435-
// }
377+
// If the Dimension is 1, and being called by ~SYCLMemObjT,
378+
// thenDstAccessRange[0] and DstSize[0] will already sized to bytes with
379+
// DstElemSize of 1.
436380
size_t DstXOffBytes = DstOffset[DstPos.x_term] * DstElemSize;
437381
size_t SrcXOffBytes = SrcOffset[SrcPos.x_term] * SrcElemSize;
438382
// size_t DstARWidthBytes = DstAccessRange[DstPos.x_term] * DstElemSize;
@@ -498,44 +442,14 @@ void copyD2D(SYCLMemObjI *SYCLMemObj, RT::PiMem SrcMem, QueueImplPtr SrcQueue,
498442
const RT::PiQueue Queue = SrcQueue->getHandleRef();
499443
const detail::plugin &Plugin = SrcQueue->getPlugin();
500444

501-
// the offsets/ranges coming from accessor are always id<3>/range<3>
502-
// But their organization varies by dimension:
503-
// 1 ==> {width, 1, 1}
504-
// 2 ==> {height, width, 1}
505-
// 3 ==> {depth, height, width}
506-
507-
CPOUT << "copyD2D " << std::endl;
508-
CPOUT << "DimSrc: " << DimSrc << " SrcAccessRange: " << SrcAccessRange[0]
509-
<< " / " << SrcAccessRange[1] << " / " << SrcAccessRange[2]
510-
<< std::endl;
511-
// CPOUT << " " << DimSrc << " SrcOffset: " << SrcOffset[0] << " / "
512-
// << SrcOffset[1] << " / " << SrcOffset[2] << std::endl;
513-
CPOUT << "DimDst: " /* << DimDst << " DstAccessRange: " << DstAccessRange[0]
514-
<< " / " << DstAccessRange[1] << " / " <<
515-
DstAccessRange[2] */
516-
<< std::endl;
517-
// CPOUT << " " << DimSrc << " DstOffset: " << DstOffset[0] << " / "
518-
// << DstOffset[1] << " / " << DstOffset[2] << std::endl;
519-
CPOUT << "SrcElemSize / DstElemSize: " << SrcElemSize << " / " << DstElemSize
520-
<< std::endl;
521-
CPOUT << std::endl;
522-
523445
detail::SYCLMemObjI::MemObjType MemType = SYCLMemObj->getType();
524446
term_positions SrcPos, DstPos;
525447
prepTermPositions(SrcPos, DimSrc, MemType);
526448
prepTermPositions(DstPos, DimDst, MemType);
527-
// int src_x_term_pos = 2, src_y_term_pos = 1, src_z_term_pos = 0;
528-
// if(DimSrc == 2){
529-
// src_x_term_pos = 1; src_y_term_pos = 0; src_z_term_pos = 2;
530-
// } else if (DimSrc == 1){
531-
// src_x_term_pos = 0; src_y_term_pos = 1; src_z_term_pos = 2;
532-
// }
533-
// int dst_x_term_pos = 2, dst_y_term_pos = 1, dst_z_term_pos = 0;
534-
// if(DimDst == 2){
535-
// dst_x_term_pos = 1; dst_y_term_pos = 0; dst_z_term_pos = 2;
536-
// } else if (DimDst == 1){
537-
// dst_x_term_pos = 0; dst_y_term_pos = 1; dst_z_term_pos = 2;
538-
// }
449+
450+
// If the Dimension is 1, and being called by ~SYCLMemObjT,
451+
// thenDstAccessRange[0] and DstSize[0] will already sized to bytes with
452+
// DstElemSize of 1.
539453
size_t DstXOffBytes = DstOffset[DstPos.x_term] * DstElemSize;
540454
size_t SrcXOffBytes = SrcOffset[SrcPos.x_term] * SrcElemSize;
541455
// size_t DstARWidthBytes = DstAccessRange[DstPos.x_term] * DstElemSize;

sycl/test/plugins/enqueue-arg-order-buffer.cpp

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,6 @@
22
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
33
// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
44

5-
// TFAIL: *
6-
7-
/*
8-
Manual
9-
clang++ -fsycl -o eaob.bin enqueue-arg-order-buffer.cpp
10-
clang++ -fsycl -g -o eaob.d enqueue-arg-order-buffer.cpp
11-
SYCL_PI_TRACE=2 ./eaob.bin
12-
13-
clang++ --driver-mode=g++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -o eaob.bin enqueue-arg-order-buffer.cpp
14-
SYCL_PI_TRACE=2 SYCL_BE=PI_CUDA ./eaob.bin
15-
16-
llvm-lit --param SYCL_BE=PI_CUDA -v enqueue-arg-order-buffer.cpp
17-
*/
18-
195
#include <CL/sycl.hpp>
206
#include <CL/sycl/accessor.hpp>
217
#include <iostream>
@@ -60,10 +46,6 @@ void remind() {
6046
std::cout << "SlicePitch SHOULD be 0 or : " << width * sizeof(float) * height
6147
<< std::endl
6248
<< std::endl; // 0 or 320
63-
64-
// NOTE: presently we see 20/16/1 for Region and 20 for row pitch. both
65-
// incorrect.
66-
6749
}
6850
// ----------- FUNCTIONAL
6951
template <template <int> class T>
@@ -72,31 +54,38 @@ static void printRangeId(T<3> arr) {
7254
}
7355

7456
void testDetailConvertToArrayOfN(){
75-
//ranges
57+
// ranges, as used with buffers (args reverse order for images)
7658
range<1> range_1D(width);
7759
range<2> range_2D(height, width);
7860
range<3> range_3D(depth, height, width);
7961

80-
range<3> arr1 = sycl::detail::convertToArrayOfN<3,1>(range_1D);
81-
//should be: {1,1,16}
62+
range<3> arr1 = sycl::detail::convertToArrayOfN<3,1>(range_1D);
63+
// {16,1,1}
8264
printRangeId(arr1);
83-
//assert(arr1[0] == 1 && arr1[1] == 1 && arr1[2] == width && "arr1 should be {1,1,16} ");
65+
assert(arr1[0] == width && arr1[1] == 1 && arr1[2] == 1 &&
66+
"arr1 expected as {16,1,1}");
8467

8568
range<3> arr2 = sycl::detail::convertToArrayOfN<3,1>(range_2D);
86-
//should be: {1, 5, 16}
69+
//{5, 16, 1}
8770
printRangeId(arr2);
88-
//assert(arr2[0] == 1 && arr2[1] == height && arr2[2] == width && "arr2 should be {1,5,16} ");
71+
assert(arr2[0] == height && arr2[1] == width && arr2[2] == 1 &&
72+
"arr2 expected as {5, 16, 1}");
8973

9074
range<3> arr3 = sycl::detail::convertToArrayOfN<3,1>(range_3D);
91-
//should be: {3, 5, 16}
75+
//{3, 5, 16}
9276
printRangeId(arr3);
93-
//assert(arr3[0] == depth && arr3[1] == height && arr3[2] == width && "arr3 should be {3,5,16} ");
77+
assert(arr3[0] == depth && arr3[1] == height && arr3[2] == width &&
78+
"arr3 expected as {3,5,16}");
9479

9580
range<2> smaller2 = sycl::detail::convertToArrayOfN<2,1>(range_3D);
96-
//assert(smaller2[0] == height && smaller2[1] == width && "smaller2 should be {5,16} ");
81+
//{3,5}
82+
std::cout << "{" << smaller2[0] << "," << smaller2[1] << "}" << std::endl;
83+
assert(smaller2[0] == depth && smaller2[1] == height &&
84+
"smaller2 expected {3,5} ");
9785

9886
range<1> smaller1 = sycl::detail::convertToArrayOfN<1,1>(range_3D);
99-
//assert(smaller1[0] == width && "smaller1 should be {16} ");
87+
//{3}
88+
assert(smaller1[0] == depth && "smaller1 expected {3} ");
10089
}
10190

10291
// class to give access to protected function getLinearIndex

sycl/test/plugins/enqueue-arg-order-image.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22
// RUN: env SYCL_PI_TRACE=2 %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
33
// RUN: env SYCL_PI_TRACE=2 %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
44

5-
/*
6-
Manual
7-
clang++ -fsycl -o eaoi.bin enqueue-arg-order-image.cpp
8-
clang++ -fsycl -g -o eaoi.d enqueue-arg-order-image.cpp
9-
SYCL_PI_TRACE=2 ./eaoi.bin
10-
11-
clang++ --driver-mode=g++ -fsycl -fsycl-targets=nvptx64-nvidia-cuda-sycldevice -o eaoi.bin enqueue-arg-order-image.cpp
12-
SYCL_PI_TRACE=2 SYCL_BE=PI_CUDA ./eaoi.bin
13-
14-
llvm-lit --param SYCL_BE=PI_CUDA -v enqueue-arg-order-image.cpp
15-
*/
16-
175
#include <CL/sycl.hpp>
186
#include <CL/sycl/accessor.hpp>
197
#include <iostream>
@@ -52,8 +40,6 @@ void remind() {
5240
<< width * sizeof(sycl::float4) * height << std::endl
5341
<< std::endl; // 0 or 1280
5442

55-
// NOTE: presently we see 5/16/1 for image Region and 80 for row pitch. both
56-
// incorrect
5743
}
5844

5945

0 commit comments

Comments
 (0)