diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 92d8139822489..2e857f13990be 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -10029,13 +10029,8 @@ void OffloadWrapper::ConstructJob(Compilation &C, const JobAction &JA, // clang-offload-wrapper // -o=.bc // -host=x86_64-pc-linux-gnu -kind=sycl -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - // -format=spirv .spv (optional) - // -format=spirv .spv (optional) -#else // -format=spirv .spv // -format=spirv .spv -#endif // ... ArgStringList WrapperArgs; diff --git a/clang/test/Driver/clang-offload-wrapper-exe-preview.cpp b/clang/test/Driver/clang-offload-wrapper-exe-preview.cpp deleted file mode 100644 index 5524e873f1c90..0000000000000 --- a/clang/test/Driver/clang-offload-wrapper-exe-preview.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// End-to-end test for clang-offload-wrapper executable: -// Verifies that the clang-offload-wrapper's -batch option correctly processes -// multiple device binaries: -// Test creates two device binary images with associated properties and symbols, -// and a batch input file describing them [1, 1a, 1b, 2]. -// It also creates the expected "gold" output for the first image, -// by concatenating the input data [3]. -// It then runs clang-offload-wrapper to generate the expected wrapper object, -// and batch file created on step [2] is passed as an input to -// clang-offload-wrapper to produce device binary descriptors for each of the -// wrapped images. Resulting .bc file is compiled with llc to produce an -// object file [4]. -// Then the test is compiled and linked with the generated wrapper object [5]. -// Finally, the test executable is run and its output is compared to the "gold" -// output created on step [3], ignoring white spaces [6]. -// Expected behavior is that the clang-offload-wrapper correctly encodes -// the input data for multiple device binaries described in input batch file -// and that the resulting runtime data -// (device code, properties, and symbols) is accessible and matches the input. -// The test checks both integer and byte array property values, ensuring proper -// decoding and runtime access. - -// [1] Prepare test data. -// [1a] Create the first binary image. -// RUN: echo -e -n 'device binary image1\n' > %t.bin -// RUN: echo -e -n '[Category1]\nint_prop1=1|10\n[Category2]\nint_prop2=1|20\n' > %t.props -// RUN: echo -e -n 'kernel1\nkernel2\n' > %t.sym - -// [1b] Create the second binary image with byte array property values. -// RUN: echo -e -n 'device binary image2\n' > %t_1.bin -// RUN: echo -e -n '[Category3]\n' > %t_1.props -// RUN: echo -e -n 'kernel1=2|IAAAAAAAAAQA\n' >> %t_1.props -// RUN: echo -e -n 'kernel2=2|oAAAAAAAAAw///3/wB\n' >> %t_1.props - -// [2] Create the batch file input for the wrapper. -// RUN: echo '[Code|Properties|Symbols]' > %t.batch -// RUN: echo %t.bin"|"%t.props"|"%t.sym >> %t.batch -// RUN: echo %t_1.bin"|"%t_1.props"|" >> %t.batch - -// [3] Generate "gold" output. "gold" output is the concatenation of all input -// data, in the order it is expected to be outputed by the test, -// see `dumpBinary0` below. -// After test is run on step [6], `dumpBinary0` outputs binary image data and -// this output is compared to the "gold" output. -// RUN: cat %t.bin %t.props %t.sym > %t.all - -// [4] Create the wrapper object. -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES -/// TODO: Remove -fpreview-breaking-changes from the command line, when removing the macro. -// RUN: clang-offload-wrapper -kind=sycl -target=TARGET -format=native -batch %t.batch -o %t.wrapped.bc -fpreview-breaking-changes -#endif // __INTEL_PREVIEW_BREAKING_CHANGES -// RUN: llc --filetype=obj %t.wrapped.bc -o %t.wrapped.o - -// [5] Compile & link the test with the wrapper. -// RUN: %clangxx %t.wrapped.o %s -o %t.batch.exe - -// [6] Run and check ignoring white spaces. -// RUN: %t.batch.exe > %t.batch.exe.out -// RUN: diff -b %t.batch.exe.out %t.all - -#include -#include -#include -#include - -// Data types created by the offload wrapper and inserted in the wrapper object. -// Matches those defined in SYCL Runtime. -struct _sycl_offload_entry_struct { - void *addr; - char *name; - size_t size; - int32_t flags; - int32_t reserved; -}; - -typedef _sycl_offload_entry_struct *_sycl_offload_entry; - -struct _sycl_device_binary_property_struct { - char *Name; // Null-terminated property name. - void *ValAddr; // Address of property value. - uint32_t Type; // pi_property_type. - uint64_t ValSize; // Size of property value in bytes. -}; - -typedef _sycl_device_binary_property_struct *sycl_device_binary_property; - -struct _sycl_device_binary_property_set_struct { - char *Name; // The name. - sycl_device_binary_property PropertiesBegin; // Array start. - sycl_device_binary_property PropertiesEnd; // Array end. -}; - -typedef _sycl_device_binary_property_set_struct *sycl_device_binary_property_set; - -struct sycl_device_binary_struct { - uint16_t Version; - uint8_t Kind; // Type of offload model the binary employs; must be 4 for SYCL. - uint8_t Format; // Format of the binary data: SPIR-V, LLVM IR bitcode, ... - const char *DeviceTargetSpec; - const char *CompileOptions; - const char *LinkOptions; - const unsigned char *BinaryStart; - const unsigned char *BinaryEnd; - _sycl_offload_entry EntriesBegin; - _sycl_offload_entry EntriesEnd; - sycl_device_binary_property_set PropertySetsBegin; - sycl_device_binary_property_set PropertySetsEnd; -}; -typedef sycl_device_binary_struct *sycl_device_binary; - -struct sycl_device_binaries_struct { - uint16_t Version; - uint16_t NumDeviceBinaries; - sycl_device_binary DeviceBinaries; - _sycl_offload_entry *HostEntriesBegin; - _sycl_offload_entry *HostEntriesEnd; -}; -typedef sycl_device_binaries_struct *sycl_device_binaries; - -static sycl_device_binaries BinDesc = nullptr; - -// Wrapper object has code which calls these 2 functions below. -extern "C" void __sycl_register_lib(sycl_device_binaries desc) { - BinDesc = desc; -} - -extern "C" void __sycl_unregister_lib() {} - -#define ASSERT(Cond, Msg) \ - if (!(Cond)) { \ - std::cerr << "*** ERROR: wrong " << Msg << "\n"; \ - return 1; \ - } - -static std::string getString(const unsigned char *B, const unsigned char *E) { - return std::string(reinterpret_cast(B), E - B); -} - -static int getInt(void *Addr) { - const char *Ptr = reinterpret_cast(Addr); - return Ptr[0] | (Ptr[1] << 8) | (Ptr[2] << 16) | (Ptr[3] << 24); -} - -using byte = unsigned char; - -static void printProp(const sycl_device_binary_property &Prop) { - std::cerr << "Property " << Prop->Name << " {\n"; - std::cerr << " Type: " << Prop->Type << "\n"; - if (Prop->Type != 1) - std::cerr << " Size = " << Prop->ValSize << "\n"; - - std::cerr << " Value = "; - if (Prop->Type == 1) - std::cerr << getInt(&Prop->ValSize); - else { - std::cerr << " {\n "; - - byte *Ptr = (byte *)Prop->ValAddr; - - for (auto I = 0; I < Prop->ValSize && I < 100; ++I) { - std::cerr << " 0x" << std::hex << (unsigned int)Ptr[I]; - std::cerr << std::dec; - } - std::cerr << "\n }"; - } - std::cerr << "\n"; - std::cerr << "}\n"; -} - -static int dumpBinary0() { - sycl_device_binary Bin = &BinDesc->DeviceBinaries[0]; - ASSERT(Bin->Kind == 4, "Bin->Kind"); - ASSERT(Bin->Format == 1, "Bin->Format"); - - // Dump code. - std::cout << getString(Bin->BinaryStart, Bin->BinaryEnd); - // Dump properties. - for (sycl_device_binary_property_set PropSet = Bin->PropertySetsBegin; PropSet != Bin->PropertySetsEnd; ++PropSet) { - std::cout << "[" << PropSet->Name << "]" - << "\n"; - - for (sycl_device_binary_property Prop = PropSet->PropertiesBegin; Prop != PropSet->PropertiesEnd; ++Prop) { - ASSERT(Prop->Type == 1, "Prop->Type"); - std::cout << Prop->Name << "=" << Prop->Type << "|" << getInt(&Prop->ValSize) << "\n"; - } - } - // Dump symbols. - for (_sycl_offload_entry Entry = Bin->EntriesBegin; Entry != Bin->EntriesEnd; ++Entry) - std::cout << Entry->name << "\n"; - return 0; -} - -// Clang offload wrapper does Base64 decoding on byte array property values, so -// they can't be dumped as is and compared to the original. Instead, this -// testcase checks that the byte array in the property value is equal to the -// pre-decoded byte array. -static int checkBinary1() { - // Decoded from "IAAAAAAAAAQA": - const byte Arr0[] = {8, 0, 0, 0, 0, 0, 0, 0, 0x1}; - // Decoded from "oAAAAAAAAAw///3/wB": - const byte Arr1[] = {40, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0x7F, 0xFF, 0x70}; - - struct { - const byte *Ptr; - const size_t Size; - } GoldArrays[] = { - {Arr0, sizeof(Arr0)}, - {Arr1, sizeof(Arr1)}}; - sycl_device_binary Bin = &BinDesc->DeviceBinaries[1]; - ASSERT(Bin->Kind == 4, "Bin->Kind"); - ASSERT(Bin->Format == 1, "Bin->Format"); - - for (sycl_device_binary_property_set PropSet = Bin->PropertySetsBegin; PropSet != Bin->PropertySetsEnd; ++PropSet) { - int Cnt = 0; - - for (sycl_device_binary_property Prop = PropSet->PropertiesBegin; Prop != PropSet->PropertiesEnd; ++Prop, ++Cnt) { - ASSERT(Prop->Type == 2, "Prop->Type"); // Must be a byte array. - char *Ptr = reinterpret_cast(Prop->ValAddr); - int Cmp = std::memcmp(Prop->ValAddr, GoldArrays[Cnt].Ptr, GoldArrays[Cnt].Size); - ASSERT(Cmp == 0, "byte array property"); - } - } - return 0; -} - -int main(int argc, char **argv) { - ASSERT(BinDesc->NumDeviceBinaries == 2, "BinDesc->NumDeviceBinaries"); - ASSERT(BinDesc->Version == 1, "BinDesc->Version"); - - if (dumpBinary0() != 0) - return 1; - if (checkBinary1() != 0) - return 1; - return 0; -} diff --git a/clang/test/Driver/clang-offload-wrapper-exe.cpp b/clang/test/Driver/clang-offload-wrapper-exe.cpp index 6af0a7d2c7250..06db45e55b8c3 100644 --- a/clang/test/Driver/clang-offload-wrapper-exe.cpp +++ b/clang/test/Driver/clang-offload-wrapper-exe.cpp @@ -1,51 +1,68 @@ -// REQUIRES: system-linux || system-windows - -// End-to-end clang-offload-wrapper executable test: check that -batch options -// works, and that the tool generates data properly accessible at runtime. - -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES -/// TODO: Delete this test when the preview changes are enabled by default. -/// Rename clang-offload-wrapper-exe-preview.cpp to clang-offload-wrapper-exe.cpp -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - -// --- Prepare test data -// - create the first binary image +// End-to-end test for clang-offload-wrapper executable: +// Verifies that the clang-offload-wrapper's -batch option correctly processes +// multiple device binaries: +// Test creates two device binary images with associated properties and symbols, +// and a batch input file describing them [1, 1a, 1b, 2]. +// It also creates the expected "gold" output for the first image, +// by concatenating the input data [3]. +// It then runs clang-offload-wrapper to generate the expected wrapper object, +// and batch file created on step [2] is passed as an input to +// clang-offload-wrapper to produce device binary descriptors for each of the +// wrapped images. Resulting .bc file is compiled with llc to produce an +// object file [4]. +// Then the test is compiled and linked with the generated wrapper object [5]. +// Finally, the test executable is run and its output is compared to the "gold" +// output created on step [3], ignoring white spaces [6]. +// Expected behavior is that the clang-offload-wrapper correctly encodes +// the input data for multiple device binaries described in input batch file +// and that the resulting runtime data +// (device code, properties, and symbols) is accessible and matches the input. +// The test checks both integer and byte array property values, ensuring proper +// decoding and runtime access. + +// [1] Prepare test data. +// [1a] Create the first binary image. // RUN: echo -e -n 'device binary image1\n' > %t.bin // RUN: echo -e -n '[Category1]\nint_prop1=1|10\n[Category2]\nint_prop2=1|20\n' > %t.props // RUN: echo -e -n 'kernel1\nkernel2\n' > %t.sym -// RUN: echo -e -n 'Manifest file - arbitrary data generated by the toolchain\n' > %t.mnf -// - create the second binary image with byte array property values +// [1b] Create the second binary image with byte array property values. // RUN: echo -e -n 'device binary image2\n' > %t_1.bin // RUN: echo -e -n '[Category3]\n' > %t_1.props // RUN: echo -e -n 'kernel1=2|IAAAAAAAAAQA\n' >> %t_1.props // RUN: echo -e -n 'kernel2=2|oAAAAAAAAAw///3/wB\n' >> %t_1.props -// - create the batch file input for the wrapper -// RUN: echo '[Code|Properties|Symbols|Manifest]' > %t.batch -// RUN: echo %t.bin"|"%t.props"|"%t.sym"|"%t.mnf >> %t.batch -// RUN: echo %t_1.bin"|"%t_1.props"|""|" >> %t.batch -// --- Generate "gold" output -// RUN: cat %t.bin %t.mnf %t.props %t.sym > %t.all -// --- Create the wrapper object -// -host omitted - generate object for the host triple: +// [2] Create the batch file input for the wrapper. +// RUN: echo '[Code|Properties|Symbols]' > %t.batch +// RUN: echo %t.bin"|"%t.props"|"%t.sym >> %t.batch +// RUN: echo %t_1.bin"|"%t_1.props"|" >> %t.batch + +// [3] Generate "gold" output. "gold" output is the concatenation of all input +// data, in the order it is expected to be outputed by the test, +// see `dumpBinary0` below. +// After test is run on step [6], `dumpBinary0` outputs binary image data and +// this output is compared to the "gold" output. +// RUN: cat %t.bin %t.props %t.sym > %t.all + +// [4] Create the wrapper object. // RUN: clang-offload-wrapper -kind=sycl -target=TARGET -format=native -batch %t.batch -o %t.wrapped.bc // RUN: llc --filetype=obj %t.wrapped.bc -o %t.wrapped.o -// --- Compile & link the test with the wrapper -// RUN: %clangxx %t.wrapped.o %s -o %t.batch.exe -v -// --- Run and check ignoring white spaces + +// [5] Compile & link the test with the wrapper. +// RUN: %clangxx %t.wrapped.o %s -o %t.batch.exe + +// [6] Run and check ignoring white spaces. // RUN: %t.batch.exe > %t.batch.exe.out // RUN: diff -b %t.batch.exe.out %t.all -#include #include #include #include #include // Data types created by the offload wrapper and inserted in the wrapper object. -// Match those defined in SYCL runtime Plugin Interface. -struct _pi_offload_entry_struct { +// Matches those defined in SYCL Runtime. +struct _sycl_offload_entry_struct { void *addr; char *name; size_t size; @@ -53,56 +70,54 @@ struct _pi_offload_entry_struct { int32_t reserved; }; -typedef _pi_offload_entry_struct *_pi_offload_entry; +typedef _sycl_offload_entry_struct *_sycl_offload_entry; -struct _pi_device_binary_property_struct { - char *Name; // null-terminated property name - void *ValAddr; // address of property value - uint32_t Type; // pi_property_type - uint64_t ValSize; // size of property value in bytes +struct _sycl_device_binary_property_struct { + char *Name; // Null-terminated property name. + void *ValAddr; // Address of property value. + uint32_t Type; // pi_property_type. + uint64_t ValSize; // Size of property value in bytes. }; -typedef _pi_device_binary_property_struct *pi_device_binary_property; +typedef _sycl_device_binary_property_struct *sycl_device_binary_property; -struct _pi_device_binary_property_set_struct { - char *Name; // the name - pi_device_binary_property PropertiesBegin; // array start - pi_device_binary_property PropertiesEnd; // array end +struct _sycl_device_binary_property_set_struct { + char *Name; // The name. + sycl_device_binary_property PropertiesBegin; // Array start. + sycl_device_binary_property PropertiesEnd; // Array end. }; -typedef _pi_device_binary_property_set_struct *pi_device_binary_property_set; +typedef _sycl_device_binary_property_set_struct *sycl_device_binary_property_set; -struct pi_device_binary_struct { +struct sycl_device_binary_struct { uint16_t Version; - uint8_t Kind; // 4 for SYCL - uint8_t Format; // 1 for native + uint8_t Kind; // Type of offload model the binary employs; must be 4 for SYCL. + uint8_t Format; // Format of the binary data: SPIR-V, LLVM IR bitcode, ... const char *DeviceTargetSpec; const char *CompileOptions; const char *LinkOptions; - const char *ManifestStart; - const char *ManifestEnd; const unsigned char *BinaryStart; const unsigned char *BinaryEnd; - _pi_offload_entry EntriesBegin; - _pi_offload_entry EntriesEnd; - pi_device_binary_property_set PropertySetsBegin; - pi_device_binary_property_set PropertySetsEnd; + _sycl_offload_entry EntriesBegin; + _sycl_offload_entry EntriesEnd; + sycl_device_binary_property_set PropertySetsBegin; + sycl_device_binary_property_set PropertySetsEnd; }; -typedef pi_device_binary_struct *pi_device_binary; +typedef sycl_device_binary_struct *sycl_device_binary; -struct pi_device_binaries_struct { +struct sycl_device_binaries_struct { uint16_t Version; uint16_t NumDeviceBinaries; - pi_device_binary DeviceBinaries; - _pi_offload_entry *HostEntriesBegin; - _pi_offload_entry *HostEntriesEnd; + sycl_device_binary DeviceBinaries; + _sycl_offload_entry *HostEntriesBegin; + _sycl_offload_entry *HostEntriesEnd; }; -typedef pi_device_binaries_struct *pi_device_binaries; +typedef sycl_device_binaries_struct *sycl_device_binaries; -static pi_device_binaries BinDesc = nullptr; +static sycl_device_binaries BinDesc = nullptr; -// Wrapper object has code which calls these 2 functions below -extern "C" void __sycl_register_lib(pi_device_binaries desc) { +// Wrapper object has code which calls these 2 functions below. +extern "C" void __sycl_register_lib(sycl_device_binaries desc) { BinDesc = desc; } @@ -125,7 +140,7 @@ static int getInt(void *Addr) { using byte = unsigned char; -static void printProp(const pi_device_binary_property &Prop) { +static void printProp(const sycl_device_binary_property &Prop) { std::cerr << "Property " << Prop->Name << " {\n"; std::cerr << " Type: " << Prop->Type << "\n"; if (Prop->Type != 1) @@ -150,26 +165,24 @@ static void printProp(const pi_device_binary_property &Prop) { } static int dumpBinary0() { - pi_device_binary Bin = &BinDesc->DeviceBinaries[0]; + sycl_device_binary Bin = &BinDesc->DeviceBinaries[0]; ASSERT(Bin->Kind == 4, "Bin->Kind"); ASSERT(Bin->Format == 1, "Bin->Format"); - // dump code + // Dump code. std::cout << getString(Bin->BinaryStart, Bin->BinaryEnd); - // dump manifest - std::cout << std::string(Bin->ManifestStart, Bin->ManifestEnd - Bin->ManifestStart); - // dump properties - for (pi_device_binary_property_set PropSet = Bin->PropertySetsBegin; PropSet != Bin->PropertySetsEnd; ++PropSet) { + // Dump properties. + for (sycl_device_binary_property_set PropSet = Bin->PropertySetsBegin; PropSet != Bin->PropertySetsEnd; ++PropSet) { std::cout << "[" << PropSet->Name << "]" << "\n"; - for (pi_device_binary_property Prop = PropSet->PropertiesBegin; Prop != PropSet->PropertiesEnd; ++Prop) { + for (sycl_device_binary_property Prop = PropSet->PropertiesBegin; Prop != PropSet->PropertiesEnd; ++Prop) { ASSERT(Prop->Type == 1, "Prop->Type"); std::cout << Prop->Name << "=" << Prop->Type << "|" << getInt(&Prop->ValSize) << "\n"; } } - // dump symbols - for (_pi_offload_entry Entry = Bin->EntriesBegin; Entry != Bin->EntriesEnd; ++Entry) + // Dump symbols. + for (_sycl_offload_entry Entry = Bin->EntriesBegin; Entry != Bin->EntriesEnd; ++Entry) std::cout << Entry->name << "\n"; return 0; } @@ -190,15 +203,15 @@ static int checkBinary1() { } GoldArrays[] = { {Arr0, sizeof(Arr0)}, {Arr1, sizeof(Arr1)}}; - pi_device_binary Bin = &BinDesc->DeviceBinaries[1]; + sycl_device_binary Bin = &BinDesc->DeviceBinaries[1]; ASSERT(Bin->Kind == 4, "Bin->Kind"); ASSERT(Bin->Format == 1, "Bin->Format"); - for (pi_device_binary_property_set PropSet = Bin->PropertySetsBegin; PropSet != Bin->PropertySetsEnd; ++PropSet) { + for (sycl_device_binary_property_set PropSet = Bin->PropertySetsBegin; PropSet != Bin->PropertySetsEnd; ++PropSet) { int Cnt = 0; - for (pi_device_binary_property Prop = PropSet->PropertiesBegin; Prop != PropSet->PropertiesEnd; ++Prop, ++Cnt) { - ASSERT(Prop->Type == 2, "Prop->Type"); // must be a byte array + for (sycl_device_binary_property Prop = PropSet->PropertiesBegin; Prop != PropSet->PropertiesEnd; ++Prop, ++Cnt) { + ASSERT(Prop->Type == 2, "Prop->Type"); // Must be a byte array. char *Ptr = reinterpret_cast(Prop->ValAddr); int Cmp = std::memcmp(Prop->ValAddr, GoldArrays[Cnt].Ptr, GoldArrays[Cnt].Size); ASSERT(Cmp == 0, "byte array property"); diff --git a/clang/test/Driver/clang-offload-wrapper.c b/clang/test/Driver/clang-offload-wrapper.c index 5efd52d025452..bdbd6e761b747 100644 --- a/clang/test/Driver/clang-offload-wrapper.c +++ b/clang/test/Driver/clang-offload-wrapper.c @@ -5,16 +5,12 @@ // // RUN: clang-offload-wrapper --help | FileCheck %s --check-prefix CHECK-HELP -// CHECK-HELP: OVERVIEW: A tool to create a wrapper bitcode for offload target binaries. -// CHECK-HELP: Takes offload target binaries and optional manifest files as input -// CHECK-HELP: and produces bitcode file containing target binaries packaged as data -// CHECK-HELP: and initialization code which registers target binaries in the offload -// CHECK-HELP: runtime. Manifest files format and contents are not restricted and are -// CHECK-HELP: a subject of agreement between the device compiler and the native -// CHECK-HELP: runtime for that device. When present, manifest file name should -// CHECK-HELP: immediately follow the corresponding device image filename on the -// CHECK-HELP: command line. Options annotating a device binary have effect on all -// CHECK-HELP: subsequent input, until redefined. +// CHECK-HELP: OVERVIEW: A tool to create a wrapper bitcode for offload target binaries +// CHECK-HELP: Takes offload target binaries as input and produces bitcode file +// CHECK-HELP: containing target binaries packaged as data and initialization code +// CHECK-HELP: which registers target binaries in the offload runtime. Options +// CHECK-HELP: annotating a device binary have effect on all subsequent input, +// CHECK-HELP: until redefined. // CHECK-HELP: For example: // CHECK-HELP: clang-offload-wrapper \ // CHECK-HELP: -host x86_64-pc-linux-gnu \ @@ -26,7 +22,6 @@ // CHECK-HELP: -entries=sym.txt \ // CHECK-HELP: -properties=props.txt \ // CHECK-HELP: a.spv \ -// CHECK-HELP: a_mf.txt \ // CHECK-HELP: -target=xxx \ // CHECK-HELP: -format=native \ // CHECK-HELP: -compile-opts="" \ @@ -34,17 +29,16 @@ // CHECK-HELP: -entries="" \ // CHECK-HELP: -properties="" \ // CHECK-HELP: b.bin \ -// CHECK-HELP: b_mf.txt \ // CHECK-HELP: -kind=openmp \ // CHECK-HELP: c.bin\n // CHECK-HELP: This command generates an x86 wrapper object (.bc) enclosing the // CHECK-HELP: following tuples describing a single device binary each: -// CHECK-HELP: |offload|target|data |data |manifest|compile|entries|properties|...| -// CHECK-HELP: | kind | |format| | |options| | |...| -// CHECK-HELP: |-------|------|------|-----|--------|-------|-------|----------|---| -// CHECK-HELP: |sycl |spir64|spirv |a.spv|a_mf.txt| -g |sym.txt|props.txt |...| -// CHECK-HELP: |sycl |xxx |native|b.bin|b_mf.txt| | | |...| -// CHECK-HELP: |openmp |xxx |native|c.bin| | | | |...| +// CHECK-HELP: |offload|target|data |data |compile|entries|properties|...| +// CHECK-HELP: | kind | |format| |options| | |...| +// CHECK-HELP: |-------|------|------|-----|-------|-------|----------|---| +// CHECK-HELP: |sycl |spir64|spirv |a.spv| -g |sym.txt|props.txt |...| +// CHECK-HELP: |sycl |xxx |native|b.bin| | | |...| +// CHECK-HELP: |openmp |xxx |native|c.bin| | | |...| // CHECK-HELP: |...| link | // CHECK-HELP: |...| options | // CHECK-HELP: |---|--------------------| @@ -62,8 +56,8 @@ // CHECK-HELP: Table files consist of a table of filenames that provide // CHECK-HELP: Code, Symbols, Properties, etc. // CHECK-HELP: Example input table file in batch mode: -// CHECK-HELP: [Code|Symbols|Properties|Manifest] -// CHECK-HELP: a_0.bc|a_0.sym|a_0.props|a_0.mnf +// CHECK-HELP: [Code|Symbols|Properties] +// CHECK-HELP: a_0.bc|a_0.sym|a_0.props // CHECK-HELP: a_1.bin||| // CHECK-HELP: Example usage: // CHECK-HELP: clang-offload-wrapper -batch -host=x86_64-unknown-linux-gnu @@ -99,14 +93,13 @@ // RUN: echo 'Content of device file1' > %t1.tgt // RUN: echo 'Content of device file2' > %t2.tgt // RUN: echo 'Content of device file3' > %t3.tgt -// RUN: echo 'Content of manifest file1' > %t1_mf.txt // // ------- // Check bitcode produced by the wrapper tool. // // RUN: clang-offload-wrapper -add-omp-offload-notes \ // RUN: -host=x86_64-pc-linux-gnu \ -// RUN: -kind=openmp -target=tg2 -format=native %t3.tgt %t1_mf.txt \ +// RUN: -kind=openmp -target=tg2 -format=native %t3.tgt \ // RUN: -kind=sycl -target=tg1 -compile-opts=-g -link-opts=-cl-denorms-are-zero \ // RUN: -format spirv %t1.tgt \ // RUN: -target=tg2 -compile-opts= -link-opts= \ @@ -123,7 +116,7 @@ // CHECK-IR-DAG: [[DESCTY:%.+]] = type { i32, ptr, ptr, ptr } // --- SYCL device binary image descriptor structure -// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } +// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } // CHECK-IR-DAG: [[SYCL_DESCTY:%.+]] = type { i16, i16, ptr, ptr, ptr } // CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]] @@ -150,7 +143,9 @@ // CHECK-IR: [[SYCL_BIN1:@.+]] = internal unnamed_addr constant [[SYCL_BIN1TY:\[[0-9]+ x i8\]]] c"Content of device file2{{.+}}" // CHECK-IR: [[SYCL_INFO1:@.+]] = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr [[SYCL_BIN1]] to i64), i64 24], section ".tgtimg", align 16 -// CHECK-IR: [[SYCL_IMAGES:@.+]] = internal unnamed_addr constant [2 x [[SYCL_IMAGETY]]] [{{.*}} { i16 2, i8 4, i8 2, ptr [[SYCL_TGT0]], ptr [[SYCL_COMPILE_OPTS0]], ptr [[SYCL_LINK_OPTS0]], ptr null, ptr null, ptr [[SYCL_BIN0]], ptr getelementptr ([[SYCL_BIN0TY]], ptr [[SYCL_BIN0]], i64 0, i64 24), ptr null, ptr null, ptr null, ptr null }, [[SYCL_IMAGETY]] { i16 2, i8 4, i8 1, ptr [[SYCL_TGT1]], ptr [[SYCL_COMPILE_OPTS1]], ptr [[SYCL_LINK_OPTS1]], ptr null, ptr null, ptr [[SYCL_BIN1]], ptr getelementptr ([[SYCL_BIN1TY]], ptr [[SYCL_BIN1]], i64 0, i64 24), ptr null, ptr null, ptr null, ptr null }] +// CHECK-IR: @llvm.used = appending global [3 x ptr] [ptr [[OMP_INFO]], ptr [[SYCL_INFO]], ptr [[SYCL_INFO1]]] + +// CHECK-IR: [[SYCL_IMAGES:@.+]] = internal unnamed_addr constant [2 x [[SYCL_IMAGETY]]] [{{.*}} { i16 3, i8 4, i8 2, ptr [[SYCL_TGT0]], ptr [[SYCL_COMPILE_OPTS0]], ptr [[SYCL_LINK_OPTS0]], ptr [[SYCL_BIN0]], ptr getelementptr ([24 x i8], ptr [[SYCL_BIN0]], i64 0, i64 24), ptr null, ptr null, ptr null, ptr null }, [[SYCL_IMAGETY]] { i16 3, i8 4, i8 1, ptr [[SYCL_TGT1]], ptr [[SYCL_COMPILE_OPTS1]], ptr [[SYCL_LINK_OPTS1]], ptr [[SYCL_BIN1]], ptr getelementptr ([24 x i8], ptr [[SYCL_BIN1]], i64 0, i64 24), ptr null, ptr null, ptr null, ptr null }] // CHECK-IR: [[SYCL_DESC:@.+]] = internal constant [[SYCL_DESCTY]] { i16 1, i16 2, ptr [[SYCL_IMAGES]], ptr null, ptr null } @@ -189,7 +184,7 @@ // // RUN: clang-offload-wrapper -kind sycl -host=x86_64-pc-linux-gnu -emit-reg-funcs=0 -desc-name=lalala -o - %t.tgt | llvm-dis | FileCheck %s --check-prefix CHECK-IR1 // CHECK-IR1: source_filename = "offload.wrapper.object" -// CHECK-IR1: [[IMAGETY:%.+]] = type { i16, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } +// CHECK-IR1: [[IMAGETY:%.+]] = type { i16, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } // CHECK-IR1: [[DESCTY:%.+]] = type { i16, i16, ptr, ptr, ptr } // CHECK-IR1-NOT: @llvm.global_ctors // CHECK-IR1-NOT: @llvm.global_dtors diff --git a/clang/test/Driver/sycl-linker-wrapper-image.cpp b/clang/test/Driver/sycl-linker-wrapper-image.cpp index a5afc31f16605..3af7a619724e6 100644 --- a/clang/test/Driver/sycl-linker-wrapper-image.cpp +++ b/clang/test/Driver/sycl-linker-wrapper-image.cpp @@ -38,7 +38,7 @@ int main() { // CHECK-DAG: %_pi_device_binary_property_struct = type { ptr, ptr, i32, i64 } // CHECK-DAG: %_pi_device_binary_property_set_struct = type { ptr, ptr, ptr } // CHECK-DAG: %struct.__tgt_offload_entry = type { i64, i16, i16, i32, ptr, ptr, i64, i64, ptr } -// CHECK-DAG: %__sycl.tgt_device_image = type { i16, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } +// CHECK-DAG: %__sycl.tgt_device_image = type { i16, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr } // CHECK-DAG: %__sycl.tgt_bin_desc = type { i16, i16, ptr, ptr, ptr } // CHECK-DAG: @.sycl_offloading.target.0 = internal unnamed_addr constant [7 x i8] c"spir64\00" @@ -58,7 +58,7 @@ int main() { // CHECK-DAG: @__sycl_offload_entries_arr = internal constant [1 x %struct.__tgt_offload_entry] [%struct.__tgt_offload_entry { i64 0, i16 1, i16 8, i32 0, ptr null, ptr @__sycl_offload_entry_name, i64 0, i64 0, ptr null }] // CHECK-DAG: @.sycl_offloading.0.info = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr @.sycl_offloading.0.data to i64), i64 912], section ".tgtimg", align 16 // CHECK-DAG: @llvm.used = appending global [1 x ptr] [ptr @.sycl_offloading.0.info], section "llvm.metadata" -// CHECK-DAG: @.sycl_offloading.device_images = internal unnamed_addr constant [1 x %__sycl.tgt_device_image] [%__sycl.tgt_device_image { i16 2, i8 4, i8 0, ptr @.sycl_offloading.target.0, ptr @.sycl_offloading.opts.compile.0, ptr @.sycl_offloading.opts.link.0, ptr null, ptr null, ptr @.sycl_offloading.0.data, ptr getelementptr ([912 x i8], ptr @.sycl_offloading.0.data, i64 0, i64 912), ptr @__sycl_offload_entries_arr, ptr getelementptr ([1 x %struct.__tgt_offload_entry], ptr @__sycl_offload_entries_arr, i64 0, i64 1), ptr @__sycl_offload_prop_sets_arr.5, ptr getelementptr ([3 x %_pi_device_binary_property_set_struct], ptr @__sycl_offload_prop_sets_arr.5, i64 0, i64 3) }] +// CHECK-DAG: @.sycl_offloading.device_images = internal unnamed_addr constant [1 x %__sycl.tgt_device_image] [%__sycl.tgt_device_image { i16 3, i8 4, i8 0, ptr @.sycl_offloading.target.0, ptr @.sycl_offloading.opts.compile.0, ptr @.sycl_offloading.opts.link.0, ptr @.sycl_offloading.0.data, ptr getelementptr ([912 x i8], ptr @.sycl_offloading.0.data, i64 0, i64 912), ptr @__sycl_offload_entries_arr, ptr getelementptr ([1 x %struct.__tgt_offload_entry], ptr @__sycl_offload_entries_arr, i64 0, i64 1), ptr @__sycl_offload_prop_sets_arr.5, ptr getelementptr ([3 x %_pi_device_binary_property_set_struct], ptr @__sycl_offload_prop_sets_arr.5, i64 0, i64 3) }] // CHECK-DAG: @.sycl_offloading.descriptor = internal constant %__sycl.tgt_bin_desc { i16 1, i16 1, ptr @.sycl_offloading.device_images, ptr null, ptr null } // CHECK-DAG: @llvm.global_ctors = {{.*}} { i32 1, ptr @sycl.descriptor_reg, ptr null }] // CHECK-DAG: @llvm.global_dtors = {{.*}} { i32 1, ptr @sycl.descriptor_unreg, ptr null }] diff --git a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp index 822b3e100c258..cf94eeb5e34dc 100644 --- a/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp +++ b/clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp @@ -81,9 +81,6 @@ using namespace llvm::object; static constexpr char COL_CODE[] = "Code"; static constexpr char COL_SYM[] = "Symbols"; static constexpr char COL_PROPS[] = "Properties"; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -static constexpr char COL_MANIFEST[] = "Manifest"; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // Offload models supported by this tool. The support basically means mapping // a string representation given at the command line to a value from this @@ -257,13 +254,8 @@ static cl::opt BatchMode( "Table files consist of a table of filenames that provide\n" "Code, Symbols, Properties, etc.\n" "Example input table file in batch mode:\n" -#ifdef __INTEL_PREVIEW_BREAKING_CHANGES " [Code|Symbols|Properties]\n" " a_0.bc|a_0.sym|a_0.props\n" -#else - " [Code|Symbols|Properties|Manifest]\n" - " a_0.bc|a_0.sym|a_0.props|a_0.mnf\n" -#endif // __INTEL_PREVIEW_BREAKING_CHANGES " a_1.bin|||\n" "Example usage:\n" " clang-offload-wrapper -batch -host=x86_64-unknown-linux-gnu\n" @@ -327,15 +319,6 @@ class BinaryWrapper { /// Represents a single image to wrap. class Image { public: -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - Image(const llvm::StringRef File_, const llvm::StringRef Manif_, - const llvm::StringRef Tgt_, BinaryImageFormat Fmt_, - const llvm::StringRef CompileOpts_, const llvm::StringRef LinkOpts_, - const llvm::StringRef EntriesFile_, const llvm::StringRef PropsFile_) - : File(File_.str()), Manif(Manif_.str()), Tgt(Tgt_.str()), Fmt(Fmt_), - CompileOpts(CompileOpts_.str()), LinkOpts(LinkOpts_.str()), - EntriesFile(EntriesFile_.str()), PropsFile(PropsFile_.str()) {} -#endif // __INTEL_PREVIEW_BREAKING_CHANGES Image(const llvm::StringRef File_, const llvm::StringRef Tgt_, BinaryImageFormat Fmt_, const llvm::StringRef CompileOpts_, const llvm::StringRef LinkOpts_, const llvm::StringRef EntriesFile_, @@ -346,10 +329,6 @@ class BinaryWrapper { /// Name of the file with actual contents const std::string File; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /// Name of the manifest file - const std::string Manif; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES /// Offload target architecture const std::string Tgt; /// Format @@ -391,19 +370,6 @@ class BinaryWrapper { llvm::SmallVector, 4> AutoGcBufs; public: -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - void addImage(const OffloadKind Kind, llvm::StringRef File, - llvm::StringRef Manif, llvm::StringRef Tgt, - const BinaryImageFormat Fmt, llvm::StringRef CompileOpts, - llvm::StringRef LinkOpts, llvm::StringRef EntriesFile, - llvm::StringRef PropsFile) { - std::unique_ptr &Pack = Packs[Kind]; - if (!Pack) - Pack.reset(new SameKindPack()); - Pack->emplace_back(std::make_unique( - File, Manif, Tgt, Fmt, CompileOpts, LinkOpts, EntriesFile, PropsFile)); - } -#endif // __INTEL_PREVIEW_BREAKING_CHANGES void addImage(const OffloadKind Kind, llvm::StringRef File, llvm::StringRef Tgt, const BinaryImageFormat Fmt, llvm::StringRef CompileOpts, llvm::StringRef LinkOpts, @@ -509,14 +475,10 @@ class BinaryWrapper { return DescTy; } -// DeviceImageStructVersion change log: -// -- version 2: updated to PI 1.2 binary image format -// -- version 3: removed ManifestStart, ManifestEnd pointers -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - const uint16_t DeviceImageStructVersion = 2; -#else + // DeviceImageStructVersion change log: + // -- version 2: updated to PI 1.2 binary image format + // -- version 3: removed ManifestStart, ManifestEnd pointers const uint16_t DeviceImageStructVersion = 3; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // typedef enum { // PI_PROPERTY_TYPE_INT32, @@ -582,12 +544,6 @@ class BinaryWrapper { // /// a null-terminated string; target- and compiler-specific options // /// which are suggested to use to "link" program at runtime // const char *LinkOptions; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -// /// Pointer to the manifest data start -// const unsigned char *ManifestStart; -// /// Pointer to the manifest data end -// const unsigned char *ManifestEnd; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // /// Pointer to the device binary image start // void *ImageStart; // /// Pointer to the device binary image end @@ -602,47 +558,22 @@ class BinaryWrapper { StructType *getSyclDeviceImageTy() { if (!SyclImageTy) { -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - if (!PreviewBreakingChanges) { - SyclImageTy = StructType::create( - { - Type::getInt16Ty(C), // Version - Type::getInt8Ty(C), // OffloadKind - Type::getInt8Ty(C), // Format - getPtrTy(), // DeviceTargetSpec - getPtrTy(), // CompileOptions - getPtrTy(), // LinkOptions - getPtrTy(), // ManifestStart - getPtrTy(), // ManifestEnd - getPtrTy(), // ImageStart - getPtrTy(), // ImageEnd - getPtrTy(), // EntriesBegin - getPtrTy(), // EntriesEnd - getPtrTy(), // PropertySetBegin - getPtrTy() // PropertySetEnd - }, - "__tgt_device_image"); - } else { -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - SyclImageTy = StructType::create( - { - Type::getInt16Ty(C), // Version - Type::getInt8Ty(C), // OffloadKind - Type::getInt8Ty(C), // Format - getPtrTy(), // DeviceTargetSpec - getPtrTy(), // CompileOptions - getPtrTy(), // LinkOptions - getPtrTy(), // ImageStart - getPtrTy(), // ImageEnd - getPtrTy(), // EntriesBegin - getPtrTy(), // EntriesEnd - getPtrTy(), // PropertySetBegin - getPtrTy() // PropertySetEnd - }, - "__tgt_device_image"); -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - } -#endif // __INTEL_PREVIEW_BREAKING_CHANGES + SyclImageTy = StructType::create( + { + Type::getInt16Ty(C), // Version + Type::getInt8Ty(C), // OffloadKind + Type::getInt8Ty(C), // Format + getPtrTy(), // DeviceTargetSpec + getPtrTy(), // CompileOptions + getPtrTy(), // LinkOptions + getPtrTy(), // ImageStart + getPtrTy(), // ImageEnd + getPtrTy(), // EntriesBegin + getPtrTy(), // EntriesEnd + getPtrTy(), // PropertySetBegin + getPtrTy() // PropertySetEnd + }, + "__tgt_device_image"); } return SyclImageTy; } @@ -1083,9 +1014,6 @@ class BinaryWrapper { } auto *Zero = ConstantInt::get(getSizeTTy(), 0u); -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - auto *NullPtr = Constant::getNullValue(getPtrTy()); -#endif // __INTEL_PREVIEW_BREAKING_CHANGES Constant *ZeroZero[] = {Zero, Zero}; // Create initializer for the images array. @@ -1098,13 +1026,8 @@ class BinaryWrapper { errs() << "adding image: offload kind=" << offloadKindToString(Kind) << Img << "\n"; - auto *Fver = ConstantInt::get( - Type::getInt16Ty(C), -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - PreviewBreakingChanges ? 3 : DeviceImageStructVersion); -#else - DeviceImageStructVersion); -#endif // __INTEL_PREVIEW_BREAKING_CHANGES + auto *Fver = + ConstantInt::get(Type::getInt16Ty(C), DeviceImageStructVersion); auto *Fknd = ConstantInt::get(Type::getInt8Ty(C), Kind); auto *Ffmt = ConstantInt::get(Type::getInt8Ty(C), Img.Fmt); auto *Ftgt = addStringToModule( @@ -1116,25 +1039,6 @@ class BinaryWrapper { Twine("opts.link.") + Twine(ImgId)); -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - std::pair FMnf; - - if (!PreviewBreakingChanges) { - if (Img.Manif.empty()) { - // No manifest - zero out the fields. - FMnf = std::make_pair(NullPtr, NullPtr); - } else { - Expected MnfOrErr = loadFile(Img.Manif); - if (!MnfOrErr) - return MnfOrErr.takeError(); - MemoryBuffer *Mnf = *MnfOrErr; - FMnf = addArrayToModule( - ArrayRef(Mnf->getBufferStart(), Mnf->getBufferSize()), - Twine(OffloadKindTag) + Twine(ImgId) + Twine(".manifest")); - } - } -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - if (MySymPropReader) MySymPropReader->getNextDeviceImageInitializer(); @@ -1237,24 +1141,10 @@ class BinaryWrapper { return EntriesOrErr.takeError(); std::pair ImageEntriesPtrs = *EntriesOrErr; ImagesInits.push_back( -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - PreviewBreakingChanges - ? -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - ConstantStruct::get(getSyclDeviceImageTy(), Fver, Fknd, Ffmt, - Ftgt, Foptcompile, Foptlink, Fbin.first, - Fbin.second, ImageEntriesPtrs.first, - ImageEntriesPtrs.second, - PropSets.get().first, PropSets.get().second) -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - : ConstantStruct::get( - getSyclDeviceImageTy(), Fver, Fknd, Ffmt, Ftgt, - Foptcompile, Foptlink, FMnf.first, FMnf.second, - Fbin.first, Fbin.second, ImageEntriesPtrs.first, - ImageEntriesPtrs.second, PropSets.get().first, - PropSets.get().second) -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - ); + ConstantStruct::get(getSyclDeviceImageTy(), Fver, Fknd, Ffmt, Ftgt, + Foptcompile, Foptlink, Fbin.first, Fbin.second, + ImageEntriesPtrs.first, ImageEntriesPtrs.second, + PropSets.get().first, PropSets.get().second)); } else ImagesInits.push_back(ConstantStruct::get( getDeviceImageTy(), Fbin.first, Fbin.second, EntriesB, EntriesE)); @@ -1725,9 +1615,6 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &Out, const BinaryWrapper::Image &Img) { Out << "\n{\n"; Out << " file = " << Img.File << "\n"; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - Out << " manifest = " << (Img.Manif.empty() ? "-" : Img.Manif) << "\n"; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES Out << " format = " << formatToString(Img.Fmt) << "\n"; Out << " target = " << (Img.Tgt.empty() ? "-" : Img.Tgt) << "\n"; Out << " compile options = " @@ -1883,23 +1770,11 @@ int main(int argc, const char **argv) { cl::ParseCommandLineOptions( argc, argv, "A tool to create a wrapper bitcode for offload target binaries.\n" -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - "Takes offload target binaries and optional manifest files as input\n" -#else - "Takes offload target binaries as input\n" -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - "and produces bitcode file containing target binaries packaged as data\n" - "and initialization code which registers target binaries in the offload\n" -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - "runtime. Manifest files format and contents are not restricted and are\n" - "a subject of agreement between the device compiler and the native\n" - "runtime for that device. When present, manifest file name should\n" - "immediately follow the corresponding device image filename on the\n" - "command line. Options annotating a device binary have effect on all\n" -#else - "runtime. Options annotating a device binary have effect on all\n" -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - "subsequent input, until redefined.\n" + "Takes offload target binaries as input and produces bitcode file\n" + "containing target binaries packaged as data and initialization code\n" + "which registers target binaries in the offload runtime. Options\n" + "annotating a device binary have effect on all subsequent input,\n" + "until redefined.\n" "\n" "For example:\n" " clang-offload-wrapper \\\n" @@ -1912,9 +1787,6 @@ int main(int argc, const char **argv) { " -entries=sym.txt \\\n" " -properties=props.txt \\\n" " a.spv \\\n" -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - " a_mf.txt \\\n" -#endif // __INTEL_PREVIEW_BREAKING_CHANGES " -target=xxx \\\n" " -format=native \\\n" " -compile-opts=\"\" \\\n" @@ -1922,30 +1794,18 @@ int main(int argc, const char **argv) { " -entries=\"\" \\\n" " -properties=\"\" \\\n" " b.bin \\\n" -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - " b_mf.txt \\\n" -#endif // __INTEL_PREVIEW_BREAKING_CHANGES " -kind=openmp \\\n" " c.bin\\n" "\n" "This command generates an x86 wrapper object (.bc) enclosing the\n" "following tuples describing a single device binary each:\n" "\n" -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - "|offload|target|data |data |manifest|compile|entries|properties|...|\n" - "| kind | |format| | |options| | |...|\n" - "|-------|------|------|-----|--------|-------|-------|----------|---|\n" - "|sycl |spir64|spirv |a.spv|a_mf.txt| -g |sym.txt|props.txt |...|\n" - "|sycl |xxx |native|b.bin|b_mf.txt| | | |...|\n" - "|openmp |xxx |native|c.bin| | | | |...|\n" -#else "|offload|target|data |data |compile|entries|properties|...|\n" "| kind | |format| |options| | |...|\n" "|-------|------|------|-----|-------|-------|----------|---|\n" "|sycl |spir64|spirv |a.spv| -g |sym.txt|props.txt |...|\n" "|sycl |xxx |native|b.bin| | | |...|\n" "|openmp |xxx |native|c.bin| | | |...|\n" -#endif // __INTEL_PREVIEW_BREAKING_CHANGES "\n" "|...| link |\n" "|...| options |\n" @@ -2012,20 +1872,7 @@ int main(int argc, const char **argv) { // ID != 0 signal that a new image(s) must be added if (ID != 0) { // create an image instance using current state -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - if (!PreviewBreakingChanges && CurInputGroup.size() > 2) { - reportError( - createStringError(errc::invalid_argument, - "too many inputs for a single binary image, " - " {opt}expected")); - return 1; - } -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - if ( -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - PreviewBreakingChanges && -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - CurInputGroup.size() > 1) { + if (CurInputGroup.size() > 1) { reportError(createStringError(errc::invalid_argument, "too many inputs for a single binary " "image, expected")); @@ -2047,17 +1894,9 @@ int main(int argc, const char **argv) { // iterate via records for (const auto &Row : T.rows()) { -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - if (!PreviewBreakingChanges) - Wr.addImage(Knd, Row.getCell(COL_CODE), - Row.getCell(COL_MANIFEST, ""), Tgt, Fmt, CompileOpts, - LinkOpts, Row.getCell(COL_SYM, ""), - Row.getCell(COL_PROPS, "")); - else -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - Wr.addImage(Knd, Row.getCell(COL_CODE), Tgt, Fmt, CompileOpts, - LinkOpts, Row.getCell(COL_SYM, ""), - Row.getCell(COL_PROPS, "")); + Wr.addImage(Knd, Row.getCell(COL_CODE), Tgt, Fmt, CompileOpts, + LinkOpts, Row.getCell(COL_SYM, ""), + Row.getCell(COL_PROPS, "")); } } else { if (Knd == OffloadKind::Unknown) { @@ -2066,15 +1905,8 @@ int main(int argc, const char **argv) { return 1; } StringRef File = CurInputGroup[0]; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - if (!PreviewBreakingChanges) { - StringRef Manif = CurInputGroup.size() > 1 ? CurInputGroup[1] : ""; - Wr.addImage(Knd, File, Manif, Tgt, Fmt, CompileOpts, LinkOpts, - EntriesFile, PropsFile); - } else -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - Wr.addImage(Knd, File, Tgt, Fmt, CompileOpts, LinkOpts, EntriesFile, - PropsFile); + Wr.addImage(Knd, File, Tgt, Fmt, CompileOpts, LinkOpts, EntriesFile, + PropsFile); } CurInputGroup.clear(); } diff --git a/clang/tools/clang-offload-wrapper/SymPropReader.cpp b/clang/tools/clang-offload-wrapper/SymPropReader.cpp index bdc3cf5557cc6..c84e23f2664e6 100644 --- a/clang/tools/clang-offload-wrapper/SymPropReader.cpp +++ b/clang/tools/clang-offload-wrapper/SymPropReader.cpp @@ -74,12 +74,6 @@ auto getInitializerNumElements(const Constant *Initializer) { // /// a null-terminated string; target- and compiler-specific options // /// which are suggested to use to "link" program at runtime // const char *LinkOptions; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -// /// Pointer to the manifest data start -// const unsigned char *ManifestStart; -// /// Pointer to the manifest data end -// const unsigned char *ManifestEnd; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // /// Pointer to the device binary image start // void *ImageStart; // /// Pointer to the device binary image end @@ -92,8 +86,8 @@ auto getInitializerNumElements(const Constant *Initializer) { // }; // -constexpr unsigned int EntriesBeginIndexInTDI{10}; -constexpr unsigned int PropertySetBeginIndexInTDI{12}; +constexpr unsigned int EntriesBeginIndexInTDI{8}; +constexpr unsigned int PropertySetBeginIndexInTDI{10}; // struct __tgt_offload_entry { // void *addr; diff --git a/llvm/lib/Frontend/Offloading/SYCLOffloadWrapper.cpp b/llvm/lib/Frontend/Offloading/SYCLOffloadWrapper.cpp index ed15bcd41d0c5..d5f2819621eb4 100644 --- a/llvm/lib/Frontend/Offloading/SYCLOffloadWrapper.cpp +++ b/llvm/lib/Frontend/Offloading/SYCLOffloadWrapper.cpp @@ -161,12 +161,6 @@ struct Wrapper { /// // a null-terminated string; target- and compiler-specific options /// // which are suggested to use to "link" program at runtime /// const char *LinkOptions; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /// // Pointer to the manifest data start - /// const unsigned char *ManifestStart; - /// // Pointer to the manifest data end - /// const unsigned char *ManifestEnd; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES /// // Pointer to the device binary image start /// void *ImageStart; /// // Pointer to the device binary image end @@ -179,47 +173,22 @@ struct Wrapper { /// }; /// \endcode StructType *getSyclDeviceImageTy() { -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - if (!PreviewBreakingChanges) { - return StructType::create( - { - Type::getInt16Ty(C), // Version - Type::getInt8Ty(C), // OffloadKind - Type::getInt8Ty(C), // Format - PointerType::getUnqual(C), // DeviceTargetSpec - PointerType::getUnqual(C), // CompileOptions - PointerType::getUnqual(C), // LinkOptions - PointerType::getUnqual(C), // ManifestStart - PointerType::getUnqual(C), // ManifestEnd - PointerType::getUnqual(C), // ImageStart - PointerType::getUnqual(C), // ImageEnd - PointerType::getUnqual(C), // EntriesBegin - PointerType::getUnqual(C), // EntriesEnd - PointerType::getUnqual(C), // PropertySetBegin - PointerType::getUnqual(C) // PropertySetEnd - }, - "__sycl.tgt_device_image"); - } else { -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - return StructType::create( - { - Type::getInt16Ty(C), // Version - Type::getInt8Ty(C), // OffloadKind - Type::getInt8Ty(C), // Format - PointerType::getUnqual(C), // DeviceTargetSpec - PointerType::getUnqual(C), // CompileOptions - PointerType::getUnqual(C), // LinkOptions - PointerType::getUnqual(C), // ImageStart - PointerType::getUnqual(C), // ImageEnd - PointerType::getUnqual(C), // EntriesBegin - PointerType::getUnqual(C), // EntriesEnd - PointerType::getUnqual(C), // PropertySetBegin - PointerType::getUnqual(C) // PropertySetEnd - }, - "__sycl.tgt_device_image"); -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - } -#endif // __INTEL_PREVIEW_BREAKING_CHANGES + return StructType::create( + { + Type::getInt16Ty(C), // Version + Type::getInt8Ty(C), // OffloadKind + Type::getInt8Ty(C), // Format + PointerType::getUnqual(C), // DeviceTargetSpec + PointerType::getUnqual(C), // CompileOptions + PointerType::getUnqual(C), // LinkOptions + PointerType::getUnqual(C), // ImageStart + PointerType::getUnqual(C), // ImageEnd + PointerType::getUnqual(C), // EntriesBegin + PointerType::getUnqual(C), // EntriesEnd + PointerType::getUnqual(C), // PropertySetBegin + PointerType::getUnqual(C) // PropertySetEnd + }, + "__sycl.tgt_device_image"); } /// Creates a structure for SYCL specific binary descriptor type. Corresponds @@ -573,11 +542,7 @@ struct Wrapper { // DeviceImageStructVersion change log: // -- version 2: updated to PI 1.2 binary image format // -- version 3: removed ManifestStart, ManifestEnd pointers -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - uint16_t DeviceImageStructVersion = PreviewBreakingChanges ? 3 : 2; -#else // __INTEL_PREVIEW_BREAKING_CHANGES constexpr uint16_t DeviceImageStructVersion = 3; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES constexpr uint8_t SYCLOffloadKind = 4; // Corresponds to SYCL auto *Version = ConstantInt::get(Type::getInt16Ty(C), DeviceImageStructVersion); @@ -605,33 +570,14 @@ struct Wrapper { Twine(OffloadKindTag) + ImageID + ".data", Image.Target); } -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - std::pair Manifests = {NullPtr, NullPtr}; -#endif - // For SYCL image offload entries are defined here, by wrapper, so // those are created per image std::pair ImageEntriesPtrs = addOffloadEntriesToModule(Image.Entries); - Constant *WrappedImage = -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - PreviewBreakingChanges - ? -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - ConstantStruct::get(SyclDeviceImageTy, Version, Kind, Format, - Target, CompileOptions, LinkOptions, - Binary.first, Binary.second, - ImageEntriesPtrs.first, ImageEntriesPtrs.second, - PropSets.first, PropSets.second) -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - : ConstantStruct::get( - SyclDeviceImageTy, Version, Kind, Format, Target, - CompileOptions, LinkOptions, Manifests.first, - Manifests.second, Binary.first, Binary.second, - ImageEntriesPtrs.first, ImageEntriesPtrs.second, - PropSets.first, PropSets.second) -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - ; + Constant *WrappedImage = ConstantStruct::get( + SyclDeviceImageTy, Version, Kind, Format, Target, CompileOptions, + LinkOptions, Binary.first, Binary.second, ImageEntriesPtrs.first, + ImageEntriesPtrs.second, PropSets.first, PropSets.second); if (Options.EmitRegistrationFunctions) emitRegistrationFunctions(Binary.first, Image.Image->getBufferSize(), @@ -693,26 +639,18 @@ struct Wrapper { /// ... /// static const char ImageN[] = { }; /// -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -/// static constexpr uint16_t Version = 2; -#else // __INTEL_PREVIEW_BREAKING_CHANGES -/// static constexpr uint16_t Version = 3; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES -/// static constexpr uint16_t OffloadKind = 4; // SYCL -/// -/// static const __sycl.tgt_device_image Images[] = { -/// { -/// Version, /*Version*/ -/// OffloadKind, // Kind of offload model. -/// Format, // format of the image - SPIRV, LLVMIR -/// // bc, etc -// NULL, /*DeviceTargetSpec*/ -/// CompileOptions0, /*CompileOptions0*/ -/// LinkOptions0, /*LinkOptions0*/ -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -/// NULL, /*ManifestStart*/ -/// NULL, /*ManifestEnd*/ -#endif // __INTEL_PREVIEW_BREAKING_CHANGES + /// static constexpr uint16_t Version = 3; + /// static constexpr uint16_t OffloadKind = 4; // SYCL + /// + /// static const __sycl.tgt_device_image Images[] = { + /// { + /// Version, /*Version*/ + /// OffloadKind, // Kind of offload model. + /// Format, // format of the image - SPIRV, LLVMIR + /// // bc, etc + // NULL, /*DeviceTargetSpec*/ + /// CompileOptions0, /*CompileOptions0*/ + /// LinkOptions0, /*LinkOptions0*/ /// Image0, /*ImageStart*/ /// Image0 + sizeof(Image0), /*ImageEnd*/ /// __start_offloading_entries0, /*EntriesBegin*/ diff --git a/sycl/source/detail/compiler.hpp b/sycl/source/detail/compiler.hpp index 670c8ce957ff4..dd510f70fa4c6 100644 --- a/sycl/source/detail/compiler.hpp +++ b/sycl/source/detail/compiler.hpp @@ -188,11 +188,7 @@ enum sycl_device_binary_type : uint8_t { }; // Device binary descriptor version supported by this library. -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES -static const uint16_t SYCL_DEVICE_BINARY_VERSION = 1; -#else // __INTEL_PREVIEW_BREAKING_CHANGES static const uint16_t SYCL_DEVICE_BINARY_VERSION = 3; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // The kind of offload model the binary employs; must be 4 for SYCL static const uint8_t SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL = 4; @@ -229,12 +225,6 @@ struct sycl_device_binary_struct { /// a null-terminated string; target- and compiler-specific options /// which are suggested to use to "link" program at runtime const char *LinkOptions; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /// Pointer to the manifest data start - const char *ManifestStart; - /// Pointer to the manifest data end - const char *ManifestEnd; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES /// Pointer to the target code start const unsigned char *BinaryStart; /// Pointer to the target code end diff --git a/sycl/source/detail/device_binary_image.cpp b/sycl/source/detail/device_binary_image.cpp index 87fcd69ec85a9..6e2f0baa4f369 100644 --- a/sycl/source/detail/device_binary_image.cpp +++ b/sycl/source/detail/device_binary_image.cpp @@ -218,10 +218,6 @@ DynRTDeviceBinaryImage::DynRTDeviceBinaryImage() Bin->Kind = SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL; Bin->CompileOptions = ""; Bin->LinkOptions = ""; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - Bin->ManifestStart = nullptr; - Bin->ManifestEnd = nullptr; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES Bin->BinaryStart = nullptr; Bin->BinaryEnd = nullptr; Bin->EntriesBegin = nullptr; diff --git a/sycl/source/detail/jit_device_binaries.cpp b/sycl/source/detail/jit_device_binaries.cpp index 1be235044dd5d..ec11fda8d7c8c 100644 --- a/sycl/source/detail/jit_device_binaries.cpp +++ b/sycl/source/detail/jit_device_binaries.cpp @@ -110,10 +110,6 @@ sycl_device_binary_struct DeviceBinaryContainer::getPIDeviceBinary( DeviceBinary.Format = Format; DeviceBinary.CompileOptions = CompileOptions ? CompileOptions.get() : ""; DeviceBinary.LinkOptions = ""; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - DeviceBinary.ManifestStart = nullptr; - DeviceBinary.ManifestEnd = nullptr; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES // It is safe to use these pointers here, as their lifetime is managed by // the JITContext. DeviceBinary.BinaryStart = BinaryStart; diff --git a/sycl/source/detail/syclbin.cpp b/sycl/source/detail/syclbin.cpp index 55b9d150f92f7..9f101e6eff80d 100644 --- a/sycl/source/detail/syclbin.cpp +++ b/sycl/source/detail/syclbin.cpp @@ -310,10 +310,6 @@ SYCLBINBinaries::SYCLBINBinaries(const char *SYCLBINContent, size_t SYCLBINSize) __SYCL_DEVICE_BINARY_TARGET_SPIRV64; // TODO: Determine. DeviceBinary.CompileOptions = nullptr; DeviceBinary.LinkOptions = nullptr; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - DeviceBinary.ManifestStart = nullptr; - DeviceBinary.ManifestEnd = nullptr; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES DeviceBinary.BinaryStart = reinterpret_cast(IRM.RawIRBytes.data()); DeviceBinary.BinaryEnd = reinterpret_cast( @@ -347,10 +343,6 @@ SYCLBINBinaries::SYCLBINBinaries(const char *SYCLBINContent, size_t SYCLBINSize) getDeviceTargetSpecFromTriple(TargetTriple); DeviceBinary.CompileOptions = nullptr; DeviceBinary.LinkOptions = nullptr; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - DeviceBinary.ManifestStart = nullptr; - DeviceBinary.ManifestEnd = nullptr; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES DeviceBinary.BinaryStart = reinterpret_cast( NDCI.RawDeviceCodeImageBytes.data()); DeviceBinary.BinaryEnd = reinterpret_cast( diff --git a/sycl/test-e2e/Compression/compression_separate_compile.cpp b/sycl/test-e2e/Compression/compression_separate_compile.cpp index 210d0372b41e0..28a1543a963db 100644 --- a/sycl/test-e2e/Compression/compression_separate_compile.cpp +++ b/sycl/test-e2e/Compression/compression_separate_compile.cpp @@ -3,9 +3,6 @@ // REQUIRES: zstd, opencl-aot, cpu, linux -// XFAIL: run-mode && preview-mode -// XFAIL-TRACKER: https://github.com/intel/llvm/issues/20397 - // XFAIL: target-native_cpu // XFAIL-TRACKER: https://github.com/intel/llvm/issues/20397 diff --git a/sycl/unittests/compression/CompressionTests.cpp b/sycl/unittests/compression/CompressionTests.cpp index d085d8caf8a18..c2a684a46c1ad 100644 --- a/sycl/unittests/compression/CompressionTests.cpp +++ b/sycl/unittests/compression/CompressionTests.cpp @@ -135,28 +135,19 @@ TEST(CompressionTest, ConcurrentDecompressionOfDeviceImage) { _sycl_offload_entry_struct EntryStruct = { /*addr*/ nullptr, const_cast(EntryName), strlen(EntryName), /*flags*/ 0, /*reserved*/ 0}; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - sycl_device_binary_struct BinStruct { /*Version*/ - 1, -#else sycl_device_binary_struct BinStruct{/*Version*/ 3, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - /*Kind*/ 4, - /*Format*/ SYCL_DEVICE_BINARY_TYPE_SPIRV, - /*DeviceTargetSpec*/ nullptr, - /*CompileOptions*/ nullptr, - /*LinkOptions*/ nullptr, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /*ManifestStart*/ nullptr, - /*ManifestEnd*/ nullptr, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - /*BinaryStart*/ compressedDataPtr, - /*BinaryEnd*/ compressedDataPtr + compressedSize, - /*EntriesBegin*/ &EntryStruct, - /*EntriesEnd*/ &EntryStruct + 1, - /*PropertySetsBegin*/ nullptr, - /*PropertySetsEnd*/ nullptr - }; + /*Kind*/ 4, + /*Format*/ SYCL_DEVICE_BINARY_TYPE_SPIRV, + /*DeviceTargetSpec*/ nullptr, + /*CompileOptions*/ nullptr, + /*LinkOptions*/ nullptr, + /*BinaryStart*/ compressedDataPtr, + /*BinaryEnd*/ compressedDataPtr + + compressedSize, + /*EntriesBegin*/ &EntryStruct, + /*EntriesEnd*/ &EntryStruct + 1, + /*PropertySetsBegin*/ nullptr, + /*PropertySetsEnd*/ nullptr}; sycl_device_binary Bin = &BinStruct; CompressedRTDeviceBinaryImage Img{Bin}; diff --git a/sycl/unittests/helpers/MockDeviceImage.hpp b/sycl/unittests/helpers/MockDeviceImage.hpp index 1811509ae4eb0..cd85140076c27 100644 --- a/sycl/unittests/helpers/MockDeviceImage.hpp +++ b/sycl/unittests/helpers/MockDeviceImage.hpp @@ -252,19 +252,13 @@ class MockDeviceImage { const std::string &DeviceTargetSpec, const std::string &CompileOptions, const std::string &LinkOptions, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - std::vector &&Manifest, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES std::vector &&Binary, internal::LifetimeExtender OffloadEntries, MockPropertySet PropertySet) : MVersion(Version), MKind(Kind), MFormat(Format), MDeviceTargetSpec(DeviceTargetSpec), MCompileOptions(CompileOptions), - MLinkOptions(LinkOptions), -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - MManifest(std::move(Manifest)), -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - MBinary(std::move(Binary)), MOffloadEntries(std::move(OffloadEntries)), + MLinkOptions(LinkOptions), MBinary(std::move(Binary)), + MOffloadEntries(std::move(OffloadEntries)), MPropertySet(std::move(PropertySet)) { MNativeHandle = { MVersion, @@ -273,10 +267,6 @@ class MockDeviceImage { MDeviceTargetSpec.c_str(), MCompileOptions.c_str(), MLinkOptions.c_str(), -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - MManifest.empty() ? nullptr : &*MManifest.cbegin(), - MManifest.empty() ? nullptr : &*MManifest.crbegin() + 1, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES &*MBinary.begin(), (&*MBinary.begin()) + MBinary.size(), MOffloadEntries.begin(), @@ -292,21 +282,13 @@ class MockDeviceImage { const std::string &DeviceTargetSpec, const std::string &CompileOptions, const std::string &LinkOptions, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - std::vector &&Manifest, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES std::vector &&Binary, std::vector &&OffloadEntries, MockPropertySet PropertySet) : MockDeviceImage(Version, Kind, Format, DeviceTargetSpec, CompileOptions, - LinkOptions, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - std::move(Manifest), -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - std::move(Binary), + LinkOptions, std::move(Binary), internal::LifetimeExtender(std::move(OffloadEntries)), - std::move(PropertySet)) { - } + std::move(PropertySet)) {} MockDeviceImage(uint8_t Format, const std::string &DeviceTargetSpec, const std::string &CompileOptions, @@ -317,13 +299,9 @@ class MockDeviceImage { : MockDeviceImage(SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, Format, DeviceTargetSpec, CompileOptions, LinkOptions, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - {}, // Manifest. -#endif // __INTEL_PREVIEW_BREAKING_CHANGES std::move(Binary), internal::LifetimeExtender(std::move(OffloadEntries)), - std::move(PropertySet)) { - } + std::move(PropertySet)) {} /// Constructs a mock SYCL device image with: /// - the latest version @@ -332,17 +310,12 @@ class MockDeviceImage { /// - placeholder binary data MockDeviceImage(std::vector &&OffloadEntries, MockPropertySet PropertySet) - : MockDeviceImage(SYCL_DEVICE_BINARY_VERSION, - SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, - SYCL_DEVICE_BINARY_TYPE_SPIRV, - __SYCL_DEVICE_BINARY_TARGET_SPIRV64, "", "", -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - {}, // Manifest. -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - std::vector{1, 2, 3, 4, 5}, - internal::LifetimeExtender(std::move(OffloadEntries)), - std::move(PropertySet)) { - } + : MockDeviceImage( + SYCL_DEVICE_BINARY_VERSION, SYCL_DEVICE_BINARY_OFFLOAD_KIND_SYCL, + SYCL_DEVICE_BINARY_TYPE_SPIRV, __SYCL_DEVICE_BINARY_TARGET_SPIRV64, + "", "", std::vector{1, 2, 3, 4, 5}, + internal::LifetimeExtender(std::move(OffloadEntries)), + std::move(PropertySet)) {} /// Constructs a mock SYCL device image with: /// - the latest version @@ -363,9 +336,6 @@ class MockDeviceImage { std::string MDeviceTargetSpec; std::string MCompileOptions; std::string MLinkOptions; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - std::vector MManifest; -#endif // __INTEL_PREVIEW_BREAKING_CHANGES std::vector MBinary; internal::LifetimeExtender MOffloadEntries; MockPropertySet MPropertySet; diff --git a/sycl/unittests/kernel-and-program/PersistentDeviceCodeCache.cpp b/sycl/unittests/kernel-and-program/PersistentDeviceCodeCache.cpp index 32e914086472a..d760b3a748c16 100644 --- a/sycl/unittests/kernel-and-program/PersistentDeviceCodeCache.cpp +++ b/sycl/unittests/kernel-and-program/PersistentDeviceCodeCache.cpp @@ -263,28 +263,18 @@ class PersistentDeviceCodeCache _sycl_offload_entry_struct EntryStruct = { /*addr*/ nullptr, const_cast(EntryName), strlen(EntryName), /*flags*/ 0, /*reserved*/ 0}; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - sycl_device_binary_struct BinStruct { /*Version*/ - 1, -#else sycl_device_binary_struct BinStruct{/*Version*/ 3, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - /*Kind*/ 4, - /*Format*/ GetParam(), - /*DeviceTargetSpec*/ nullptr, - /*CompileOptions*/ nullptr, - /*LinkOptions*/ nullptr, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /*ManifestStart*/ nullptr, - /*ManifestEnd*/ nullptr, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - /*BinaryStart*/ nullptr, - /*BinaryEnd*/ nullptr, - /*EntriesBegin*/ &EntryStruct, - /*EntriesEnd*/ &EntryStruct + 1, - /*PropertySetsBegin*/ nullptr, - /*PropertySetsEnd*/ nullptr - }; + /*Kind*/ 4, + /*Format*/ GetParam(), + /*DeviceTargetSpec*/ nullptr, + /*CompileOptions*/ nullptr, + /*LinkOptions*/ nullptr, + /*BinaryStart*/ nullptr, + /*BinaryEnd*/ nullptr, + /*EntriesBegin*/ &EntryStruct, + /*EntriesEnd*/ &EntryStruct + 1, + /*PropertySetsBegin*/ nullptr, + /*PropertySetsEnd*/ nullptr}; sycl_device_binary Bin = &BinStruct; detail::RTDeviceBinaryImage Img{Bin}; ur_program_handle_t NativeProg; @@ -321,28 +311,18 @@ TEST_P(PersistentDeviceCodeCache, MultipleImages) { _sycl_offload_entry_struct ExtraEntryStruct = { /*addr*/ nullptr, const_cast(ExtraEntryName), strlen(ExtraEntryName), /*flags*/ 0, /*reserved*/ 0}; -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - sycl_device_binary_struct ExtraBinStruct { /*Version*/ - 1, -#else sycl_device_binary_struct ExtraBinStruct{/*Version*/ 3, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - /*Kind*/ 4, - /*Format*/ GetParam(), - /*DeviceTargetSpec*/ nullptr, - /*CompileOptions*/ nullptr, - /*LinkOptions*/ nullptr, -#ifndef __INTEL_PREVIEW_BREAKING_CHANGES - /*ManifestStart*/ nullptr, - /*ManifestEnd*/ nullptr, -#endif // __INTEL_PREVIEW_BREAKING_CHANGES - /*BinaryStart*/ nullptr, - /*BinaryEnd*/ nullptr, - /*EntriesBegin*/ &ExtraEntryStruct, - /*EntriesEnd*/ &ExtraEntryStruct + 1, - /*PropertySetsBegin*/ nullptr, - /*PropertySetsEnd*/ nullptr - }; + /*Kind*/ 4, + /*Format*/ GetParam(), + /*DeviceTargetSpec*/ nullptr, + /*CompileOptions*/ nullptr, + /*LinkOptions*/ nullptr, + /*BinaryStart*/ nullptr, + /*BinaryEnd*/ nullptr, + /*EntriesBegin*/ &ExtraEntryStruct, + /*EntriesEnd*/ &ExtraEntryStruct + 1, + /*PropertySetsBegin*/ nullptr, + /*PropertySetsEnd*/ nullptr}; sycl_device_binary ExtraBin = &ExtraBinStruct; detail::RTDeviceBinaryImage ExtraImg{ExtraBin}; std::string BuildOptions{"--multiple-images"};