Skip to content

Conversation

@jinge90
Copy link
Contributor

@jinge90 jinge90 commented Jul 25, 2025

We have marked "f[no-]sycl-device-lib=" option as deprecated and will remove in future major release and we also decide to reuse community "no-offloadlib" option to disable all sycl device libraries for debug purpose. This PR updates getDeviceLibraries to get rid of deprecated options and honor "no-offloadlib" while keeping previous legacy logic to handle deprecated options since they haven't been removed.
Once users touch the deprecated option, will delegate the handling to legacy "getDeviceLibraries" function. We will remove the legacy function in next major release.

@jinge90 jinge90 requested a review from a team as a code owner July 25, 2025 06:38
@jinge90 jinge90 marked this pull request as draft July 25, 2025 06:38
@jinge90 jinge90 marked this pull request as ready for review August 21, 2025 07:16
@jinge90 jinge90 requested a review from mdtoguchi August 21, 2025 07:16
@jinge90
Copy link
Contributor Author

jinge90 commented Aug 21, 2025

Hi, @mdtoguchi
Could you help review this PR?
Thanks very much.

@jinge90
Copy link
Contributor Author

jinge90 commented Aug 25, 2025

Hi, @mdtoguchi
Kind ping~~~
Thanks very much.

return LibraryList;
}

using SYCLDeviceLibsList = SmallVector<StringRef, 8>;
Copy link
Contributor

Choose a reason for hiding this comment

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

The number of elements defined exceeds its declared inline capacity for SYCLDeviceLibs (more than 8 elements)
We could omit the number of inlined elements N, and just have SmallVector<StringRef>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
Thanks very much.

LibSuffix = IsWindowsMSVCEnv ? ".new.obj" : ".new.o";
auto addLibraries = [&](const SYCLDeviceLibsList &LibsList) {
for (const StringRef &Lib : LibsList) {
SmallString<128> LibName(Lib);
Copy link
Contributor

Choose a reason for hiding this comment

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

Creating a new String and copying data can have performance implications, especially in loops.
Any reason to have SmallVector<StringRef> instead of SmallVector<String> ?

// RUN: %clangxx -### -nogpulib -fno-sycl-libspirv --sysroot=%S/Inputs/SYCL \
// RUN: -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx906 %s 2>&1 \
// RUN: %clangxx -### -fsycl -fsycl-targets=amdgcn-amd-amdhsa -fno-sycl-libspirv --sysroot=%S/Inputs/SYCL \
// RUN: -Xsycl-target-backend --offload-arch=gfx908 --rocm-path=%S/Inputs/rocm %s 2>&1 \
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is --offload-arch value changed from gfx906 to gfx908 and -nogpulib removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, @srividya-sundaram
Previously, the test didn't add --rocm-path, so the test would run fail on machines without AMD toolchain and reported some amd device rtl files were missing. To workaround this, "nogpulib" was added and this option wouldn't impact sycl device libraries link at that time.
Now, we reuse community "--no-offloadlib" option to disable all sycl device libraries and "nogpulib" is an alias for "--no-offloadlib", so we must remove this option otherwise all sycl device libraries will be disabled and the test will fail.
After removing "nogpulib", we need to specify --rocm-path to indicate where to find the required amd device rtl files and current syclos only have dummy amd device rtl files for gfx908, so we have to change offload-arch to gfx908 otherwise the test still reported error that amd device rtl files are missing.
Thanks very much.

}

SmallVector<std::string, 8>
SYCL::getDeviceLibraries(const Compilation &C, const llvm::Triple &TargetTriple,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a quick note/comment about what this function does and a description of the edge cases if applicable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
Thanks very much.

// TODO: remove getDeviceLibrariesLegacy when we remove deprecated options
// related to sycl device library link.
static SmallVector<std::string, 8>
getDeviceLibrariesLegacy(const Compilation &C, const llvm::Triple &TargetTriple,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment describing what this functions does and why it is needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.
Thanks very much.

@jinge90 jinge90 requested a review from a team August 27, 2025 03:16
@jinge90
Copy link
Contributor Author

jinge90 commented Aug 27, 2025

Hi, @intel/llvm-gatekeepers
The pre-ci failure should be a flaky issue:
Unexpectedly Passed Tests (1):
SYCL :: Matrix/SG32/joint_matrix_bfloat16.cpp
Could you help take a look?
Thanks very much.

@steffenlarsen
Copy link
Contributor

Looks like you were just unlucky and hit the driver uplift from #19880 but the test changes didn't get through. Should be good to go.

@steffenlarsen steffenlarsen merged commit 403ee01 into intel:sycl Aug 27, 2025
40 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants