Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions sycl/test-e2e/SYCLBIN/simple_kernel_aot.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// RUN: %clangxx --offload-new-driver -fsyclbin=input -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device bmg-g21" -o %t.input_bmg_g21_gpu_device_arch.syclbin %s
// RUN: %clangxx --offload-new-driver -fsyclbin=input -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" -o %t.input_all_gpu_device_archs.syclbin %s
// RUN: %clangxx --offload-new-driver -fsyclbin=object -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device bmg-g21" -o %t.object_bmg_g21_gpu_device_arch.syclbin %s
// RUN: %clangxx --offload-new-driver -fsyclbin=executable -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device bmg-g21" -o %t.executable_bmg_g21_gpu_device_arch.syclbin %s
// RUN: %clangxx --offload-new-driver -fsyclbin -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device bmg-g21" -o %t.default_bmg_g21_gpu_device_arch.syclbin %s

// RUN: syclbin-dump %t.input_bmg_g21_gpu_device_arch.syclbin | FileCheck %s --check-prefix CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH
// RUN: syclbin-dump %t.input_all_gpu_device_archs.syclbin | FileCheck %s --check-prefix CHECK-INPUT-ALL-GPU-DEVICE-ARCHS
// RUN: syclbin-dump %t.object_bmg_g21_gpu_device_arch.syclbin | FileCheck %s --check-prefix CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH
// RUN: syclbin-dump %t.executable_bmg_g21_gpu_device_arch.syclbin | FileCheck %s --check-prefix CHECK-EXECUTABLE-BMG-G21-GPU-DEVICE-ARCH
// RUN: syclbin-dump %t.default_bmg_g21_gpu_device_arch.syclbin | FileCheck %s --check-prefix CHECK-EXECUTABLE-BMG-G21-GPU-DEVICE-ARCH

// Checks the generated SYCLBIN contents of a simple SYCL free function kernel.

#include <sycl/sycl.hpp>

extern "C" {
SYCL_EXT_ONEAPI_FUNCTION_PROPERTY(
(sycl::ext::oneapi::experimental::single_task_kernel))
void TestKernel(int *Ptr, int Size) {
for (size_t I = 0; I < Size; ++I)
Ptr[I] = I;
}
}

// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH: Version: {{[1-9]+}}
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Global metadata:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: SYCLBIN/global metadata:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: state: 0
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Number of Abstract Modules: 1
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Abstract Module 0:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Metadata:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH: Number of IR Modules: 0
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Number of Native Device Code Images: 1
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Native device code image 0:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Metadata:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: SYCLBIN/native device code image metadata:
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: arch: bmg_g21
// CHECK-INPUT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Raw native device code image bytes: <Binary blob of {{.*}} bytes>

// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS: Version: {{[1-9]+}}
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Global metadata:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: SYCLBIN/global metadata:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: state: 0
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Number of Abstract Modules: 1
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Abstract Module 0:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Metadata:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS: Number of IR Modules: 0
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Number of Native Device Code Images: 1
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Native device code image 0:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Metadata:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: SYCLBIN/native device code image metadata:
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: arch:{{.*}}
// CHECK-INPUT-ALL-GPU-DEVICE-ARCHS-NEXT: Raw native device code image bytes: <Binary blob of {{.*}} bytes>

// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH: Version: {{[1-9]+}}
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Global metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: SYCLBIN/global metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: state: 1
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Number of Abstract Modules: 1
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Abstract Module 0:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH: Number of IR Modules: 0
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Number of Native Device Code Images: 1
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Native device code image 0:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: SYCLBIN/native device code image metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: arch:{{.*}}
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Raw native device code image bytes: <Binary blob of {{.*}} bytes>

// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH: Version: {{[1-9]+}}
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Global metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: SYCLBIN/global metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: state: 2
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Number of Abstract Modules: 1
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Abstract Module 0:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH: Number of IR Modules: 0
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Number of Native Device Code Images: 1
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Native device code image 0:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: SYCLBIN/native device code image metadata:
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: arch:{{.*}}
// CHECK-OBJECT-BMG-G21-GPU-DEVICE-ARCH-NEXT: Raw native device code image bytes: <Binary blob of {{.*}} bytes>
5 changes: 5 additions & 0 deletions sycl/test/syclbin/input_files.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: syclbin-dump nonexistent.syclbin | FileCheck %s --check-prefix CHECK-NONEXISTENT-FILE
// RUN: syclbin-dump malformed.syclbin | FileCheck %s --check-prefix CHECK-MALFORMED-FILE

// CHECK-NONEXISTENT-FILE: Failed to open or read file nonexistent.syclbin
// CHECK-MALFORMED-FILE: Invalid data was encountered while parsing the file
Binary file added sycl/test/syclbin/malformed.syclbin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we move this to an Inputs subfolder?

Binary file not shown.
13 changes: 0 additions & 13 deletions sycl/tools/syclbin-dump/syclbin-dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ raw_ostream &operator<<(raw_ostream &OS, const ScopedIndent &) {
return OS.indent(CurrentIndentationLevel);
}

std::string_view StateToString(llvm::object::SYCLBIN::BundleState State) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as it was not used and it was affecting the code coverage

switch (State) {
case llvm::object::SYCLBIN::BundleState::Input:
return "input";
case llvm::object::SYCLBIN::BundleState::Object:
return "object";
case llvm::object::SYCLBIN::BundleState::Executable:
return "executable";
default:
return "UNKNOWN";
}
}

std::string PropertyValueToString(const llvm::util::PropertyValue &PropVal) {
switch (PropVal.getType()) {
case llvm::util::PropertyValue::UINT32:
Expand Down
Loading