Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL][NFC] Remove dead arg and check #16534

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 7 additions & 34 deletions sycl/source/detail/program_manager/program_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -780,8 +780,7 @@ static inline void CheckAndDecompressImage([[maybe_unused]] RTDeviceBinaryImage
// its ref count incremented.
ur_program_handle_t ProgramManager::getBuiltURProgram(
const ContextImplPtr &ContextImpl, const DeviceImplPtr &DeviceImpl,
const std::string &KernelName, const NDRDescT &NDRDesc,
bool JITCompilationIsRequired) {
const std::string &KernelName, const NDRDescT &NDRDesc) {
// Check if we can optimize program builds for sub-devices by using a program
// built for the root device
DeviceImplPtr RootDevImpl = DeviceImpl;
Expand All @@ -802,8 +801,7 @@ ur_program_handle_t ProgramManager::getBuiltURProgram(
auto Context = createSyclObjFromImpl<context>(ContextImpl);
auto Device = createSyclObjFromImpl<device>(
MustBuildOnSubdevice == true ? DeviceImpl : RootDevImpl);
const RTDeviceBinaryImage &Img =
getDeviceImage(KernelName, Context, Device, JITCompilationIsRequired);
const RTDeviceBinaryImage &Img = getDeviceImage(KernelName, Context, Device);

// Check that device supports all aspects used by the kernel
if (auto exception = checkDevSupportDeviceRequirements(Device, Img, NDRDesc))
Expand Down Expand Up @@ -1397,23 +1395,6 @@ ProgramManager::ProgramManager()
}
}

void CheckJITCompilationForImage(const RTDeviceBinaryImage *const &Image,
bool JITCompilationIsRequired) {
if (!JITCompilationIsRequired)
return;
// If the image is already compiled with AOT, throw an exception.
const sycl_device_binary_struct &RawImg = Image->getRawData();
if ((strcmp(RawImg.DeviceTargetSpec,
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_X86_64) == 0) ||
(strcmp(RawImg.DeviceTargetSpec,
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_GEN) == 0) ||
(strcmp(RawImg.DeviceTargetSpec,
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_FPGA) == 0)) {
throw sycl::exception(sycl::errc::feature_not_supported,
"Recompiling AOT image is not supported");
}
}

const char *getArchName(const device &Device) {
namespace syclex = sycl::ext::oneapi::experimental;
auto Arch = getSyclObjImpl(Device)->getDeviceArch();
Expand Down Expand Up @@ -1475,13 +1456,11 @@ RTDeviceBinaryImage *getBinImageFromMultiMap(

RTDeviceBinaryImage &
ProgramManager::getDeviceImage(const std::string &KernelName,
const context &Context, const device &Device,
bool JITCompilationIsRequired) {
const context &Context, const device &Device) {
if constexpr (DbgProgMgr > 0) {
std::cerr << ">>> ProgramManager::getDeviceImage(\"" << KernelName << "\", "
<< getSyclObjImpl(Context).get() << ", "
<< getSyclObjImpl(Device).get() << ", "
<< JITCompilationIsRequired << ")\n";
<< getSyclObjImpl(Device).get() << ")\n";

std::cerr << "available device images:\n";
debugPrintBinaryImages();
Expand All @@ -1491,7 +1470,7 @@ ProgramManager::getDeviceImage(const std::string &KernelName,
assert(m_SpvFileImage);
return getDeviceImage(
std::unordered_set<RTDeviceBinaryImage *>({m_SpvFileImage.get()}),
Context, Device, JITCompilationIsRequired);
Context, Device);
}

RTDeviceBinaryImage *Img = nullptr;
Expand All @@ -1511,8 +1490,6 @@ ProgramManager::getDeviceImage(const std::string &KernelName,
CheckAndDecompressImage(Img);

if (Img) {
CheckJITCompilationForImage(Img, JITCompilationIsRequired);

if constexpr (DbgProgMgr > 0) {
std::cerr << "selected device image: " << &Img->getRawData() << "\n";
Img->print();
Expand All @@ -1526,15 +1503,13 @@ ProgramManager::getDeviceImage(const std::string &KernelName,

RTDeviceBinaryImage &ProgramManager::getDeviceImage(
const std::unordered_set<RTDeviceBinaryImage *> &ImageSet,
const context &Context, const device &Device,
bool JITCompilationIsRequired) {
const context &Context, const device &Device) {
assert(ImageSet.size() > 0);

if constexpr (DbgProgMgr > 0) {
std::cerr << ">>> ProgramManager::getDeviceImage(Custom SPV file "
<< getSyclObjImpl(Context).get() << ", "
<< getSyclObjImpl(Device).get() << ", "
<< JITCompilationIsRequired << ")\n";
<< getSyclObjImpl(Device).get() << ")\n";

std::cerr << "available device images:\n";
debugPrintBinaryImages();
Expand Down Expand Up @@ -1563,8 +1538,6 @@ RTDeviceBinaryImage &ProgramManager::getDeviceImage(
ImageIterator = ImageSet.begin();
std::advance(ImageIterator, ImgInd);

CheckJITCompilationForImage(*ImageIterator, JITCompilationIsRequired);

if constexpr (DbgProgMgr > 0) {
std::cerr << "selected device image: " << &(*ImageIterator)->getRawData()
<< "\n";
Expand Down
11 changes: 3 additions & 8 deletions sycl/source/detail/program_manager/program_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,11 @@ class ProgramManager {

RTDeviceBinaryImage &getDeviceImage(const std::string &KernelName,
const context &Context,
const device &Device,
bool JITCompilationIsRequired = false);
const device &Device);

RTDeviceBinaryImage &getDeviceImage(
const std::unordered_set<RTDeviceBinaryImage *> &ImagesToVerify,
const context &Context, const device &Device,
bool JITCompilationIsRequired = false);
const context &Context, const device &Device);

ur_program_handle_t createURProgram(const RTDeviceBinaryImage &Img,
const context &Context,
Expand Down Expand Up @@ -174,13 +172,10 @@ class ProgramManager {
/// \param Context the context to build the program with
/// \param Device the device for which the program is built
/// \param KernelName the kernel's name
/// \param JITCompilationIsRequired If JITCompilationIsRequired is true
/// add a check that kernel is compiled, otherwise don't add the check.
ur_program_handle_t getBuiltURProgram(const ContextImplPtr &ContextImpl,
const DeviceImplPtr &DeviceImpl,
const std::string &KernelName,
const NDRDescT &NDRDesc = {},
bool JITCompilationIsRequired = false);
const NDRDescT &NDRDesc = {});

/// Builds a program from a given set of images or retrieves that program from
/// cache.
Expand Down
Loading