Skip to content

Commit

Permalink
[SYCL][AMD] Propagate metadata in createURProgram (#14831)
Browse files Browse the repository at this point in the history
SYCL properties weren't converted when calling creatreURProgram, leading
to issue in finalization during KernelFusion for AMD.

Fixes #14841
  • Loading branch information
Naghasan committed Aug 1, 2024
1 parent 132f763 commit 41d8977
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 20 deletions.
5 changes: 5 additions & 0 deletions sycl/source/detail/device_binary_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ void RTDeviceBinaryImage::init(sycl_device_binary Bin) {
KernelParamOptInfo.init(Bin, __SYCL_PROPERTY_SET_KERNEL_PARAM_OPT_INFO);
AssertUsed.init(Bin, __SYCL_PROPERTY_SET_SYCL_ASSERT_USED);
ProgramMetadata.init(Bin, __SYCL_PROPERTY_SET_PROGRAM_METADATA);
// Convert ProgramMetadata into the UR format
for (const auto &Prop : ProgramMetadata) {
ProgramMetadataUR.push_back(
ur::mapDeviceBinaryPropertyToProgramMetadata(Prop));
}
ExportedSymbols.init(Bin, __SYCL_PROPERTY_SET_SYCL_EXPORTED_SYMBOLS);
ImportedSymbols.init(Bin, __SYCL_PROPERTY_SET_SYCL_IMPORTED_SYMBOLS);
DeviceGlobals.init(Bin, __SYCL_PROPERTY_SET_SYCL_DEVICE_GLOBALS);
Expand Down
8 changes: 3 additions & 5 deletions sycl/source/detail/program_manager/program_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,11 +500,9 @@ std::pair<ur_program_handle_t, bool> ProgramManager::getOrCreateURProgram(
// Get program metadata from properties
std::vector<ur_program_metadata_t> ProgMetadataVector;
for (const RTDeviceBinaryImage *Img : AllImages) {
auto ProgMetadata = Img->getProgramMetadata();
for (const auto &Prop : ProgMetadata) {
ProgMetadataVector.push_back(
ur::mapDeviceBinaryPropertyToProgramMetadata(Prop));
}
auto &ImgProgMetadata = Img->getProgramMetadataUR();
ProgMetadataVector.insert(ProgMetadataVector.end(),
ImgProgMetadata.begin(), ImgProgMetadata.end());
}
// TODO: Build for multiple devices once supported by program manager
NativePrg = createBinaryProgram(getSyclObjImpl(Context), Device,
Expand Down
3 changes: 0 additions & 3 deletions sycl/test-e2e/Basic/reqd_work_group_size.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

// TODO: Reenable, see https://github.com/intel/llvm/issues/14598
// UNSUPPORTED: linux, windows

#include <sycl/detail/core.hpp>

#include <iostream>
Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/DeviceGlobal/device_global_arrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//
// The OpenCL GPU backends do not currently support device_global backend
// calls.
// TODO: Reenable linux/windows, see https://github.com/intel/llvm/issues/14598
// UNSUPPORTED: opencl && gpu, linux, windows
// UNSUPPORTED: opencl && gpu
//
// Tests operator-> on device_global.

Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/DeviceGlobal/device_global_device_only.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//
// The OpenCL GPU backends do not currently support device_global backend
// calls.
// TODO: Reenable linux/windows, see https://github.com/intel/llvm/issues/14598
// UNSUPPORTED: opencl && gpu, linux, windows
// UNSUPPORTED: opencl && gpu
//
// Tests basic device_global access through device kernels.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//
// The OpenCL GPU backends do not currently support device_global backend
// calls.
// TODO: Reenable linux/windows, see https://github.com/intel/llvm/issues/14598
// UNSUPPORTED: opencl && gpu, linux, windows
// UNSUPPORTED: opencl && gpu
//
// Tests the passthrough of operators on device_global.

Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/DeviceGlobal/device_global_subscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
//
// The OpenCL GPU backends do not currently support device_global backend
// calls.
// TODO: Reenable linux/windows, see https://github.com/intel/llvm/issues/14598
// UNSUPPORTED: opencl && gpu, linux, windows
// UNSUPPORTED: opencl && gpu
//
// Tests operator[] on device_global.

Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/KernelFusion/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import platform

config.required_features += ['fusion']
# TODO: Reenable hip, see https://github.com/intel/llvm/issues/14598
config.unsupported_features += ['accelerator', 'hip']
config.unsupported_features += ['accelerator']

# TODO: enable on Windows once kernel fusion is supported on Windows.
if platform.system() != "Linux":
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/NewOffloadDriver/diamond_shape.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// REQUIRES: fusion
// TODO: Reenable, see https://github.com/intel/llvm/issues/14598
// UNSUPPORTED: hip

// RUN: %{build} %{embed-ir} -O2 --offload-new-driver -o %t.out
// RUN: %{run} %t.out
Expand Down

0 comments on commit 41d8977

Please sign in to comment.