Skip to content

Commit cd30a59

Browse files
[SYCL][NFC] Remove dead arg and check (#16534)
The JITCompilationIsRequired in a selection of build functions default to false and are never set by any callers. Given this, the argument can be removed. As a side-effect of this, the CheckJITCompilationForImage function will return immediately if the JITCompilationIsRequired was false, and since it always was the function is obsolete and can be removed. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
1 parent 4d3ffae commit cd30a59

File tree

2 files changed

+10
-42
lines changed

2 files changed

+10
-42
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ CheckAndDecompressImage([[maybe_unused]] RTDeviceBinaryImage *Img) {
781781
// its ref count incremented.
782782
ur_program_handle_t ProgramManager::getBuiltURProgram(
783783
const ContextImplPtr &ContextImpl, const DeviceImplPtr &DeviceImpl,
784-
const std::string &KernelName, const NDRDescT &NDRDesc,
785-
bool JITCompilationIsRequired) {
784+
const std::string &KernelName, const NDRDescT &NDRDesc) {
786785
// Check if we can optimize program builds for sub-devices by using a program
787786
// built for the root device
788787
DeviceImplPtr RootDevImpl = DeviceImpl;
@@ -803,8 +802,7 @@ ur_program_handle_t ProgramManager::getBuiltURProgram(
803802
auto Context = createSyclObjFromImpl<context>(ContextImpl);
804803
auto Device = createSyclObjFromImpl<device>(
805804
MustBuildOnSubdevice == true ? DeviceImpl : RootDevImpl);
806-
const RTDeviceBinaryImage &Img =
807-
getDeviceImage(KernelName, Context, Device, JITCompilationIsRequired);
805+
const RTDeviceBinaryImage &Img = getDeviceImage(KernelName, Context, Device);
808806

809807
// Check that device supports all aspects used by the kernel
810808
if (auto exception = checkDevSupportDeviceRequirements(Device, Img, NDRDesc))
@@ -1403,23 +1401,6 @@ ProgramManager::ProgramManager()
14031401
}
14041402
}
14051403

1406-
void CheckJITCompilationForImage(const RTDeviceBinaryImage *const &Image,
1407-
bool JITCompilationIsRequired) {
1408-
if (!JITCompilationIsRequired)
1409-
return;
1410-
// If the image is already compiled with AOT, throw an exception.
1411-
const sycl_device_binary_struct &RawImg = Image->getRawData();
1412-
if ((strcmp(RawImg.DeviceTargetSpec,
1413-
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_X86_64) == 0) ||
1414-
(strcmp(RawImg.DeviceTargetSpec,
1415-
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_GEN) == 0) ||
1416-
(strcmp(RawImg.DeviceTargetSpec,
1417-
__SYCL_DEVICE_BINARY_TARGET_SPIRV64_FPGA) == 0)) {
1418-
throw sycl::exception(sycl::errc::feature_not_supported,
1419-
"Recompiling AOT image is not supported");
1420-
}
1421-
}
1422-
14231404
const char *getArchName(const device &Device) {
14241405
namespace syclex = sycl::ext::oneapi::experimental;
14251406
auto Arch = getSyclObjImpl(Device)->getDeviceArch();
@@ -1481,13 +1462,11 @@ RTDeviceBinaryImage *getBinImageFromMultiMap(
14811462

14821463
RTDeviceBinaryImage &
14831464
ProgramManager::getDeviceImage(const std::string &KernelName,
1484-
const context &Context, const device &Device,
1485-
bool JITCompilationIsRequired) {
1465+
const context &Context, const device &Device) {
14861466
if constexpr (DbgProgMgr > 0) {
14871467
std::cerr << ">>> ProgramManager::getDeviceImage(\"" << KernelName << "\", "
14881468
<< getSyclObjImpl(Context).get() << ", "
1489-
<< getSyclObjImpl(Device).get() << ", "
1490-
<< JITCompilationIsRequired << ")\n";
1469+
<< getSyclObjImpl(Device).get() << ")\n";
14911470

14921471
std::cerr << "available device images:\n";
14931472
debugPrintBinaryImages();
@@ -1497,7 +1476,7 @@ ProgramManager::getDeviceImage(const std::string &KernelName,
14971476
assert(m_SpvFileImage);
14981477
return getDeviceImage(
14991478
std::unordered_set<RTDeviceBinaryImage *>({m_SpvFileImage.get()}),
1500-
Context, Device, JITCompilationIsRequired);
1479+
Context, Device);
15011480
}
15021481

15031482
RTDeviceBinaryImage *Img = nullptr;
@@ -1517,8 +1496,6 @@ ProgramManager::getDeviceImage(const std::string &KernelName,
15171496
CheckAndDecompressImage(Img);
15181497

15191498
if (Img) {
1520-
CheckJITCompilationForImage(Img, JITCompilationIsRequired);
1521-
15221499
if constexpr (DbgProgMgr > 0) {
15231500
std::cerr << "selected device image: " << &Img->getRawData() << "\n";
15241501
Img->print();
@@ -1532,15 +1509,13 @@ ProgramManager::getDeviceImage(const std::string &KernelName,
15321509

15331510
RTDeviceBinaryImage &ProgramManager::getDeviceImage(
15341511
const std::unordered_set<RTDeviceBinaryImage *> &ImageSet,
1535-
const context &Context, const device &Device,
1536-
bool JITCompilationIsRequired) {
1512+
const context &Context, const device &Device) {
15371513
assert(ImageSet.size() > 0);
15381514

15391515
if constexpr (DbgProgMgr > 0) {
15401516
std::cerr << ">>> ProgramManager::getDeviceImage(Custom SPV file "
15411517
<< getSyclObjImpl(Context).get() << ", "
1542-
<< getSyclObjImpl(Device).get() << ", "
1543-
<< JITCompilationIsRequired << ")\n";
1518+
<< getSyclObjImpl(Device).get() << ")\n";
15441519

15451520
std::cerr << "available device images:\n";
15461521
debugPrintBinaryImages();
@@ -1569,8 +1544,6 @@ RTDeviceBinaryImage &ProgramManager::getDeviceImage(
15691544
ImageIterator = ImageSet.begin();
15701545
std::advance(ImageIterator, ImgInd);
15711546

1572-
CheckJITCompilationForImage(*ImageIterator, JITCompilationIsRequired);
1573-
15741547
if constexpr (DbgProgMgr > 0) {
15751548
std::cerr << "selected device image: " << &(*ImageIterator)->getRawData()
15761549
<< "\n";

sycl/source/detail/program_manager/program_manager.hpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ class ProgramManager {
135135

136136
RTDeviceBinaryImage &getDeviceImage(const std::string &KernelName,
137137
const context &Context,
138-
const device &Device,
139-
bool JITCompilationIsRequired = false);
138+
const device &Device);
140139

141140
RTDeviceBinaryImage &getDeviceImage(
142141
const std::unordered_set<RTDeviceBinaryImage *> &ImagesToVerify,
143-
const context &Context, const device &Device,
144-
bool JITCompilationIsRequired = false);
142+
const context &Context, const device &Device);
145143

146144
ur_program_handle_t createURProgram(const RTDeviceBinaryImage &Img,
147145
const context &Context,
@@ -177,13 +175,10 @@ class ProgramManager {
177175
/// \param Context the context to build the program with
178176
/// \param Device the device for which the program is built
179177
/// \param KernelName the kernel's name
180-
/// \param JITCompilationIsRequired If JITCompilationIsRequired is true
181-
/// add a check that kernel is compiled, otherwise don't add the check.
182178
ur_program_handle_t getBuiltURProgram(const ContextImplPtr &ContextImpl,
183179
const DeviceImplPtr &DeviceImpl,
184180
const std::string &KernelName,
185-
const NDRDescT &NDRDesc = {},
186-
bool JITCompilationIsRequired = false);
181+
const NDRDescT &NDRDesc = {});
187182

188183
/// Builds a program from a given set of images or retrieves that program from
189184
/// cache.

0 commit comments

Comments
 (0)