Skip to content
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

libclc build in Debug mode is very slow #6925

Closed
pvchupin opened this issue Sep 30, 2022 · 2 comments · Fixed by #12034
Closed

libclc build in Debug mode is very slow #6925

pvchupin opened this issue Sep 30, 2022 · 2 comments · Fixed by #12034
Labels
cuda CUDA back-end enhancement New feature or request

Comments

@pvchupin
Copy link
Contributor

Is there a way to improve that?

To reproduce:

python buildbot/configure.py --ci-defaults -t Debug
python buildbot/compile.py

I've notice that hang is happening at these lines (take ~13 minutes each):

.../llvm/build/bin/opt -O3 --nvvm-reflect-enable=false -o .../llvm/./lib/clc/builtins.opt.libspirv-nvptx64--nvidiacl.bc .../llvm/./lib/clc/builtins.link.libspirv-nvptx64--nvidiacl.bc
@pvchupin pvchupin added enhancement New feature or request cuda CUDA back-end labels Sep 30, 2022
@pvchupin
Copy link
Contributor Author

Tagging @Naghasan , @AerialMantis

@Naghasan
Copy link
Contributor

Naghasan commented Oct 3, 2022

libclc uses the toolchain you build (there is actually a hack to trick cmake into thinking clang is available during configuration).

This is hard to actually solve for CI (as you want a one off self contained build). Tablegen improved build time by building an optimised tablegen even in debug mode, but here this would mean an entire llvm toolchain is release when you want a debug mode...

From a user perspective we could have a flag for the user to provide a pre-build libclc or an alternative clang / opt / llvm-link / llc. The first would skip the build of the lib and the second speed it up.

Providing a pre-build libclc is opening the door to sync issues though, alternative clang and llvm toolchain is less of a problem as required backend or clang builtins update are not happening that often.

againull pushed a commit that referenced this issue Dec 14, 2023
Use `LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR` to specify the location of
custom toolchain to be used for creation of libclc. This helps with
debug build times:
  
* debug build of sycl-toolchain with libclc built with debug tools:
```sh                                                                                    
$ for f in $(ls lib/clc/*.bc); touch $f; time ninja sycl-toolchain
[0/2] Re-checking globbed directories...                                              
[6/6] Generating ../../lib/clc/remangled-l64-signed_char.libspirv-amdgcn-amd-amdhsa.bc
ninja sycl-toolchain  682.55s user 1.33s system 112% cpu 10:07.81 total               
```

* debug build of sycl-toolchain with libclc built with release tools:
```sh
$ for f in $(ls lib/clc/*.bc); touch $f; time ninja sycl-toolchain 
[0/2] Re-checking globbed directories...                                              
[6/6] Generating ../../lib/clc/remangled-l64-signed_char.libspirv-amdgcn-amd-amdhsa.bc
ninja sycl-toolchain  158.51s user 1.15s system 189% cpu 1:24.31 total                
```

Fixes: #6925
jsji pushed a commit that referenced this issue Dec 21, 2023
Use `LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR` to specify the location of
custom toolchain to be used for creation of libclc. This helps with
debug build times:
  
* debug build of sycl-toolchain with libclc built with debug tools:
```sh                                                                                    
$ for f in $(ls lib/clc/*.bc); touch $f; time ninja sycl-toolchain
[0/2] Re-checking globbed directories...                                              
[6/6] Generating ../../lib/clc/remangled-l64-signed_char.libspirv-amdgcn-amd-amdhsa.bc
ninja sycl-toolchain  682.55s user 1.33s system 112% cpu 10:07.81 total               
```

* debug build of sycl-toolchain with libclc built with release tools:
```sh
$ for f in $(ls lib/clc/*.bc); touch $f; time ninja sycl-toolchain 
[0/2] Re-checking globbed directories...                                              
[6/6] Generating ../../lib/clc/remangled-l64-signed_char.libspirv-amdgcn-amd-amdhsa.bc
ninja sycl-toolchain  158.51s user 1.15s system 189% cpu 1:24.31 total                
```

Fixes: #6925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda CUDA back-end enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants