Skip to content

Commit

Permalink
Use --sysroot for device libraries in sycl-device-lib-nvptx.cpp (#15282)
Browse files Browse the repository at this point in the history
Adds the `--sysroot` option to `clang` invocations in
`clang/test/Driver/sycl-device-lib-nvptx.cpp` , pointing the compiler to
`clang/test/Driver/Inputs/SYCL`, so that it uses the mock files for
libraries, making the test pass even when DPC++ is not configured with
`--cuda` (similarly to how it's done for other SYCL driver lit tests).
  • Loading branch information
PietroGhg authored Sep 5, 2024
1 parent c407665 commit 153fab3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Empty file.
8 changes: 4 additions & 4 deletions clang/test/Driver/sycl-device-lib-nvptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// Check if internal libraries are still linked against when linkage of all
// device libs is manually excluded.
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fno-sycl-device-lib=all \
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fno-sycl-device-lib=all --sysroot=%S/Inputs/SYCL \
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-NO-DEVLIB %s

Expand All @@ -20,20 +20,20 @@
// CHK-NO-DEVLIB: {{[0-9]+}}: linker, {{{.*}}[[LIB1]], [[LIB2]], [[LIB3]]{{.*}}}, ir, (device-sycl, sm_50)

// Check that the -fsycl-device-lib flag has no effect when "all" is specified.
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fsycl-device-lib=all \
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl -fsycl-device-lib=all --sysroot=%S/Inputs/SYCL \
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-ALL %s

// Check that the -fsycl-device-lib flag has no effect when subsets of libs
// are specified.
// RUN: %clangxx -ccc-print-phases -std=c++11 \
// RUN: %clangxx -ccc-print-phases -std=c++11 --sysroot=%S/Inputs/SYCL \
// RUN: -fsycl -fsycl-device-lib=libc,libm-fp32,libm-fp64,libimf-fp32,libimf-fp64,libimf-bf16,libm-bfloat16 \
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-ALL %s

// Check that -fno-sycl-device-lib is ignored when it does not contain "all".
// A warning should be printed that the flag got ignored.
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl \
// RUN: %clangxx -ccc-print-phases -std=c++11 -fsycl --sysroot=%S/Inputs/SYCL \
// RUN: -fno-sycl-device-lib=libc,libm-fp32,libm-fp64,libimf-fp32,libimf-fp64,libimf-bf16,libm-bfloat16 \
// RUN: -fsycl-targets=nvptx64-nvidia-cuda %s 2>&1 \
// RUN: | FileCheck -check-prefixes=CHK-UNUSED-WARN,CHK-ALL %s
Expand Down

0 comments on commit 153fab3

Please sign in to comment.