- 
                Notifications
    You must be signed in to change notification settings 
- Fork 794
          [SYCL RTC] Use cmake --install for resource.cpp generation
          #20466
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
c7597b7
              73e9f6e
              2b47019
              ce42833
              648c87a
              7dc63ba
              7598d3e
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -9,25 +9,39 @@ else() | |
| set(SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT "/sycl-jit-toolchain/") | ||
| endif() | ||
|  | ||
| set(SYCL_JIT_RESOURCE_DEPS | ||
| sycl-headers # include/sycl | ||
| clang # lib/clang/N/include | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py) | ||
| set(SYCL_JIT_RESOURCE_DEPS sycl-headers clang) | ||
| set(SYCL_JIT_RESOURCE_INSTALL_COMPONENTS sycl-headers OpenCL-Headers clang-resource-headers) | ||
|  | ||
| if ("libclc" IN_LIST LLVM_ENABLE_PROJECTS) | ||
| # Somehow just "libclc" doesn't build "remangled-*" (and maybe whatever else). | ||
| list(APPEND SYCL_JIT_RESOURCE_DEPS libclc libspirv-builtins) # lib/clc/*.bc | ||
| list(APPEND SYCL_JIT_RESOURCE_INSTALL_COMPONENTS libspirv-builtins) | ||
| endif() | ||
|  | ||
| if ("libdevice" IN_LIST LLVM_ENABLE_PROJECTS) | ||
| list(APPEND SYCL_JIT_RESOURCE_DEPS libsycldevice) # lib/*.bc | ||
| list(APPEND SYCL_JIT_RESOURCE_INSTALL_COMPONENTS libsycldevice) | ||
| endif() | ||
|  | ||
| set(ALL_RTC_PREPARE_RESOURCES_COMMANDS) | ||
| foreach(component IN LISTS SYCL_JIT_RESOURCE_INSTALL_COMPONENTS) | ||
| list(APPEND ALL_RTC_PREPARE_RESOURCES_COMMANDS | ||
| COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --prefix ${CMAKE_CURRENT_BINARY_DIR}/rtc-resources-install --component "${component}" | ||
|          | ||
| ) | ||
| endforeach() | ||
|  | ||
| add_custom_target(rtc-prepare-resources | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Not sure 
 No (at least IMO), and the incremental builds will output this: instead of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm also thinking about  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, it will just call the target which itself will determine it is up to date, so basically nothing happens and it's better than before IMO There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 Wouldn't the version of the file in that folder be regenerated if anyone makes a change to the file? Like someone modifies  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updating  | ||
| DEPENDS ${SYCL_JIT_RESOURCE_DEPS} | ||
| ${ALL_RTC_PREPARE_RESOURCES_COMMANDS} | ||
| COMMAND_EXPAND_LISTS | ||
| ) | ||
|  | ||
| add_custom_command( | ||
| OUTPUT ${SYCL_JIT_RESOURCE_CPP} | ||
| COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py --toolchain-dir ${CMAKE_BINARY_DIR} --output ${SYCL_JIT_RESOURCE_CPP} --prefix ${SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT} | ||
| COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py --toolchain-dir ${CMAKE_CURRENT_BINARY_DIR}/rtc-resources-install --output ${SYCL_JIT_RESOURCE_CPP} --prefix ${SYCL_JIT_VIRTUAL_TOOLCHAIN_ROOT} | ||
|          | ||
| DEPENDS | ||
| ${SYCL_JIT_RESOURCE_DEPS} | ||
| rtc-prepare-resources | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/utils/generate.py | ||
| ) | ||
|  | ||
| # We use C23/C++26's `#embed` to implement this resource creation, and "current" | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we don't need to depends on
OpenCL-Headers?Also do we need to depends on
clangjust forclang-resource-headers?If we can depend on all the components to be installed, then we can just maintain one list instead two lists here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no such target, but I probably need to dig deeper still.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-resource-headersis enough. Not sure what's actual underlying build target forOpenCL-Headers, but I think it's very safe to assume it's built by one of other dependencies (i.e.,ninja sycl-jitpasses in a clean build). @jsji , would you take another look?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Yeah, looks like we did not create target for
OpenCL-HeadersSo we either need to create a target for it, or we can assume
OpenCL-Headersis always there, so no dependency is needed.