1- //  REQUIRES: system-linux || system-windows
2- 
31//  End-to-end clang-offload-wrapper executable test: check that -batch options
42//  works, and that the tool generates data properly accessible at runtime.
53
6- //  --- Prepare test data
7- //  - create the first binary image
4+ //  Prepare test data. Create the first binary image.
85//  RUN: echo -e -n 'device binary image1\n' > %t.bin
96//  RUN: echo -e -n '[Category1]\nint_prop1=1|10\n[Category2]\nint_prop2=1|20\n' > %t.props
107//  RUN: echo -e -n 'kernel1\nkernel2\n' > %t.sym
118
12- //  - create  the second binary image with byte array property values
9+ //  Create  the second binary image with byte array property values. 
1310//  RUN: echo -e -n 'device binary image2\n' > %t_1.bin
1411//  RUN: echo -e -n '[Category3]\n' > %t_1.props
1512//  RUN: echo -e -n 'kernel1=2|IAAAAAAAAAQA\n' >> %t_1.props
1613//  RUN: echo -e -n 'kernel2=2|oAAAAAAAAAw///3/wB\n' >> %t_1.props
1714
18- //  - create  the batch file input for the wrapper
15+ //  Create  the batch file input for the wrapper. 
1916//  RUN: echo '[Code|Properties|Symbols]' > %t.batch
2017//  RUN: echo %t.bin"|"%t.props"|"%t.sym >> %t.batch
2118//  RUN: echo %t_1.bin"|"%t_1.props"|" >> %t.batch
22- //  --- Generate "gold" output
19+ 
20+ //  Generate "gold" output.
2321//  RUN: cat %t.bin %t.props %t.sym > %t.all
24- //  --- Create the wrapper object 
25- //  -host omitted - generate object for  the host triple: 
22+ 
23+ //  Create  the wrapper object. 
2624#ifdef  __INTEL_PREVIEW_BREAKING_CHANGES
27- // / TODO: Remove -fpreview-breaking-changes from the command line, when removing the macro
25+ // / TODO: Remove -fpreview-breaking-changes from the command line, when removing the macro. 
2826//  RUN: clang-offload-wrapper -kind=sycl -target=TARGET -format=native -batch %t.batch -o %t.wrapped.bc -fpreview-breaking-changes
2927#endif  //  __INTEL_PREVIEW_BREAKING_CHANGES
3028//  RUN: llc --filetype=obj %t.wrapped.bc -o %t.wrapped.o
31- //  --- Compile & link the test with the wrapper
29+ 
30+ //  Compile & link the test with the wrapper.
3231//  RUN: %clangxx %t.wrapped.o %s -o %t.batch.exe -v
33- //  --- Run and check ignoring white spaces
32+ 
33+ //  Run and check ignoring white spaces.
3434//  RUN: %t.batch.exe > %t.batch.exe.out
3535//  RUN: diff -b %t.batch.exe.out %t.all
3636
37- #include  < cassert> 
3837#include  < cstdint> 
3938#include  < cstring> 
4039#include  < iostream> 
@@ -53,26 +52,26 @@ struct _pi_offload_entry_struct {
5352typedef  _pi_offload_entry_struct *_pi_offload_entry;
5453
5554struct  _pi_device_binary_property_struct  {
56-   char  *Name;       //  null -terminated property name
57-   void  *ValAddr;    //  address  of property value
58-   uint32_t  Type;    //  pi_property_type
59-   uint64_t  ValSize; //  size  of property value in bytes
55+   char  *Name;       //  Null -terminated property name. 
56+   void  *ValAddr;    //  Address  of property value. 
57+   uint32_t  Type;    //  pi_property_type. 
58+   uint64_t  ValSize; //  Size  of property value in bytes. 
6059};
6160
6261typedef  _pi_device_binary_property_struct *pi_device_binary_property;
6362
6463struct  _pi_device_binary_property_set_struct  {
65-   char  *Name;                                //  the  name
66-   pi_device_binary_property PropertiesBegin; //  array  start
67-   pi_device_binary_property PropertiesEnd;   //  array  end
64+   char  *Name;                                //  The  name. 
65+   pi_device_binary_property PropertiesBegin; //  Array  start. 
66+   pi_device_binary_property PropertiesEnd;   //  Array  end. 
6867};
6968
7069typedef  _pi_device_binary_property_set_struct *pi_device_binary_property_set;
7170
7271struct  pi_device_binary_struct  {
7372  uint16_t  Version;
74-   uint8_t  Kind;   //  4 for SYCL
75-   uint8_t  Format; //  1 for native
73+   uint8_t  Kind;   //  4 for SYCL. 
74+   uint8_t  Format; //  1 for native. 
7675  const  char  *DeviceTargetSpec;
7776  const  char  *CompileOptions;
7877  const  char  *LinkOptions;
@@ -96,7 +95,7 @@ typedef pi_device_binaries_struct *pi_device_binaries;
9695
9796static  pi_device_binaries BinDesc = nullptr ;
9897
99- //  Wrapper object has code which calls these 2 functions below
98+ //  Wrapper object has code which calls these 2 functions below. 
10099extern  " C" void  __sycl_register_lib (pi_device_binaries desc) {
101100  BinDesc = desc;
102101}
@@ -149,9 +148,9 @@ static int dumpBinary0() {
149148  ASSERT (Bin->Kind  == 4 , " Bin->Kind" 
150149  ASSERT (Bin->Format  == 1 , " Bin->Format" 
151150
152-   //  dump  code
151+   //  Dump  code. 
153152  std::cout << getString (Bin->BinaryStart , Bin->BinaryEnd );
154-   //  dump  properties
153+   //  Dump  properties. 
155154  for  (pi_device_binary_property_set PropSet = Bin->PropertySetsBegin ; PropSet != Bin->PropertySetsEnd ; ++PropSet) {
156155    std::cout << " [" Name  << " ]" 
157156              << " \n " 
@@ -161,7 +160,7 @@ static int dumpBinary0() {
161160      std::cout << Prop->Name  << " =" Type  << " |" getInt (&Prop->ValSize ) << " \n " 
162161    }
163162  }
164-   //  dump  symbols
163+   //  Dump  symbols. 
165164  for  (_pi_offload_entry Entry = Bin->EntriesBegin ; Entry != Bin->EntriesEnd ; ++Entry)
166165    std::cout << Entry->name  << " \n " 
167166  return  0 ;
@@ -191,7 +190,7 @@ static int checkBinary1() {
191190    int  Cnt = 0 ;
192191
193192    for  (pi_device_binary_property Prop = PropSet->PropertiesBegin ; Prop != PropSet->PropertiesEnd ; ++Prop, ++Cnt) {
194-       ASSERT (Prop->Type  == 2 , " Prop->Type" //  must  be a byte array
193+       ASSERT (Prop->Type  == 2 , " Prop->Type" //  Must  be a byte array. 
195194      char  *Ptr = reinterpret_cast <char  *>(Prop->ValAddr );
196195      int  Cmp = std::memcmp (Prop->ValAddr , GoldArrays[Cnt].Ptr , GoldArrays[Cnt].Size );
197196      ASSERT (Cmp == 0 , " byte array property" 
0 commit comments