Skip to content

Commit 8c63509

Browse files
authored
[SYCL] Don't load all fallback spirv when launching from SPIRV file (#11734)
Currently, sycl-post-link tool scans user's device image to detect any undefined function call to items in fallback spirv devicelibs and create a property in final executable to tell which fallback devicelibs are really needed. SYCL runtime will load required fallback spirv libs according to this property. However, if "SYCL_USE_KERNEL_SPIRV" is used, the kernel is launched from spv file and sycl-post-link tool is not involved to scan and generate the property. Previously, we just load and link all fallback spv files and underlying runtime will remove them when they don't need those code. However, we received a lot of complains about seeing a lot of unnecessary code from underlying runtime. So, this PR is to avoid loading this unnecessary code. If anyone uses clang++ driver to generate spv file, this file won't depend on any functions from fallback spv since device code has to be linked with wrapper .obj to involve any functions from fallback spv.
1 parent 0d62e08 commit 8c63509

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

sycl/source/detail/program_manager/program_manager.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,16 +1522,13 @@ void ProgramManager::flushSpecConstants(const program_impl &Prg,
15221522
Prg.flush_spec_constants(*Img, NativePrg);
15231523
}
15241524

1525-
// If the kernel is loaded from spv file, it may not include DeviceLib require
1526-
// mask, sycl runtime won't know which fallback device libraries are needed. In
1527-
// such case, the safest way is to load all fallback device libraries.
15281525
uint32_t ProgramManager::getDeviceLibReqMask(const RTDeviceBinaryImage &Img) {
15291526
const RTDeviceBinaryImage::PropertyRange &DLMRange =
15301527
Img.getDeviceLibReqMask();
15311528
if (DLMRange.isAvailable())
15321529
return DeviceBinaryProperty(*(DLMRange.begin())).asUint32();
15331530
else
1534-
return 0xFFFFFFFF;
1531+
return 0x0;
15351532
}
15361533

15371534
const KernelArgMask *

0 commit comments

Comments
 (0)