Skip to content

[libclc] Switch to LLVM_RUNTIME_TARGETS build#21843

Open
wenju-he wants to merge 4 commits intointel:sycl-webfrom
wenju-he:libclc-LLVM_RUNTIME_TARGETS-sycl-web
Open

[libclc] Switch to LLVM_RUNTIME_TARGETS build#21843
wenju-he wants to merge 4 commits intointel:sycl-webfrom
wenju-he:libclc-LLVM_RUNTIME_TARGETS-sycl-web

Conversation

@wenju-he
Copy link
Copy Markdown
Contributor

Following 121f5a9, this PR removes deprecated LLVM_ENABLE_RUNTIMES=libclc build approach from SYCL toolchain.

For nvptx64-nvidia-cuda build, pass following options to cmake configure:
-DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=libclc
-DLLVM_RUNTIME_TARGETS="nvptx64-nvidia-cuda"

Submit this PR to sycl-web to avoid a gap with a downstream branch
which has transitioned to LLVM_RUNTIME_TARGETS build.

Following 121f5a9, this PR removes deprecated
`LLVM_ENABLE_RUNTIMES=libclc` build approach from SYCL toolchain.

For nvptx64-nvidia-cuda build, pass following options to cmake configure:
    -DRUNTIMES_nvptx64-nvidia-cuda_LLVM_ENABLE_RUNTIMES=libclc
    -DLLVM_RUNTIME_TARGETS="nvptx64-nvidia-cuda"
@wenju-he wenju-he requested review from a team, Maetveis and cperkinsintel as code owners April 22, 2026 10:39
@wenju-he wenju-he requested review from kweronsx and removed request for a team April 22, 2026 10:39
Copy link
Copy Markdown
Contributor

@Maetveis Maetveis left a comment

Choose a reason for hiding this comment

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

Thanks! This is great because it simplifies a lot of things for libclc. I think those simplifications should be in scope for this PR, I've marked what I found:

Comment on lines 24 to +49
@@ -39,18 +35,18 @@ foreach( t ${LIBCLC_TARGETS_TO_BUILD} )
# The solution is to create a separate directory for each target,
# and copy the lit.site.cfg.py file there; the name of the
# directory will be used as the target name.
file(MAKE_DIRECTORY ${LIBCLC_PERTARGET_TEST_DIR}/${t})
file(MAKE_DIRECTORY ${LIBCLC_PERTARGET_TEST_DIR}/${LIBCLC_TARGET})
file(COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
${LIBCLC_PERTARGET_TEST_DIR}/${t}/lit.site.cfg.py)
${LIBCLC_PERTARGET_TEST_DIR}/${LIBCLC_TARGET}/lit.site.cfg.py)

add_lit_testsuite(check-libclc-spirv-${t}
"Running libclc spirv-${t} regression tests"
${LIBCLC_PERTARGET_TEST_DIR}/${t}
add_lit_testsuite(check-libclc-spirv-${LIBCLC_TARGET}
"Running libclc spirv-${LIBCLC_TARGET} regression tests"
${LIBCLC_PERTARGET_TEST_DIR}/${LIBCLC_TARGET}
DEPENDS
${LIBCLC_TEST_DEPS}
libspirv-builtins
)
endforeach( t )
endif()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we no longer support multiple targets in the same build then this whole block should go away completely:

if(ARCH MATCHES "amdgcn|nvptx64")
  add_lit_testsuite(check-libclc-spirv-${LIBCLC_TARGET}
      "Running libclc spirv-${LIBCLC_TARGET} regression tests"
      ${CMAKE_CURRENT_BINARY_DIR}
      DEPENDS
        ${LIBCLC_TEST_DEPS}
        libspirv-builtins
      )
endif()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we no longer support multiple targets in the same build

This is correct.

this block is testing libspirv for when ARCH is either amdgcn or nvptx64 target. why delete it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LIBCLC_TARGET in above block will be replaced with library target when testing remangled libspirv as well.

Comment thread libclc/test/CMakeLists.txt Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LIBCLC_PERTARGET_TEST_DIR should be removed.
We don't need per-target test dirs if we only have one target in each build of libclc now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LIBCLC_PERTARGET_TEST_DIR should be removed.

Removed.

We don't need per-target test dirs if we only have one target in each build of libclc now.

We probably still need different dirs when one target has multiple libraries.

Comment thread libclc/test/lit.cfg.py Outdated
Comment on lines +50 to +51
config.target_triple = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we setting this exactly? Where is it used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

config.target_triple is required for below use_clang call. I have changed config.target_triple = None to config.target_triple = config.libclc_target

Comment thread libclc/test/lit.cfg.py Outdated
Comment on lines 22 to 23
if config.libclc_target is None:
lit_config.fatal("libclc_target parameter must be set when running directly")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This can also be removed libclc_target should never be None anymore.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed, thanks

Comment thread libclc/test/lit.cfg.py
Comment on lines 43 to 48
# test_exec_root: The root path where tests should be run. We create a unique
# test directory per libclc target to test to avoid data races when multiple
# targets try and access the the same libclc test files.
config.test_exec_root = os.path.join(
config.libclc_pertarget_test_dir, config.libclc_target
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This also needs to be modified, we only have one target now in each build so we shouldn't need to do this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

will keep it. There could be multiple libraries per one targets. For instance, libclc_target can be different when we testing remangled libspirv as well in the future.

Comment thread libclc/test/lit.site.cfg.py.in Outdated
Comment on lines 24 to 29
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This block should be removed too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed, thanks

@wenju-he wenju-he requested a review from Maetveis April 25, 2026 08:18
Copy link
Copy Markdown
Contributor

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

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

sycl and sycl-jit LGTM

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