[Bug] `cutlass_profiler` fails to build with `CUTLASS_BUILD_SHARED_LIBS=OFF`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.5k
- Forks
- 2.1k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 7
Description
Bug: cutlass_profiler fails to build with CUTLASS_BUILD_SHARED_LIBS=OFF
Description
When building CUTLASS v4.3.5 (and main) with static-only configuration (-DCUTLASS_BUILD_SHARED_LIBS=OFF -DCUTLASS_BUILD_STATIC_LIBS=ON), the cutlass_profiler target fails to compile with:
fatal error: cutlass/library/library.h: No such file or directory
The header file exists at tools/library/include/cutlass/library/library.h, but the include path is never propagated to the profiler target.
Root Cause
In tools/library/CMakeLists.txt (lines 283–290), the cutlass_lib alias is only created when shared libs are enabled:
# For backward compatibility with the old name
if(CUTLASS_BUILD_SHARED_LIBS)
add_library(cutlass_lib ALIAS cutlass_library) # ← only when shared ON
endif()
if(CUTLASS_BUILD_STATIC_LIBS)
add_library(cutlass_lib_static ALIAS cutlass_library_static)
endif()
However, tools/profiler/CMakeLists.txt (line 89) unconditionally links against cutlass_lib:
target_link_libraries(
cutlass_profiler
PRIVATE
cutlass_lib # ← always required, no fallback
cutlass_tools_util_includes
...
)
When CUTLASS_BUILD_SHARED_LIBS=OFF, the cutlass_lib target does not exist. CMake silently treats the name as a plain linker flag (-lcutlass_lib) rather than a CMake target, so:
- Transitive include directories from
cutlass_library_includes(which providestools/library/include/) are not propagated → compilation fails with missing headers. - Even if compilation somehow passed, linking would also fail because no
libcutlass_lib.soorlibcutlass_lib.afile exists.
Environment
- CUTLASS version: v4.3.5 (also verified on
main) - Platform: aarch64
- CMake: 3.31.6
- GCC: 13.3.0
- Base image:
nvcr.io/nvidia/pytorch:25.08-py3
Steps to Reproduce
git clone --branch v4.3.5 --depth 1 https://github.com/NVIDIA/cutlass.git
cmake \
-DCUTLASS_BUILD_SHARED_LIBS=OFF \
-DCUTLASS_BUILD_STATIC_LIBS=ON \
-DCUTLASS_NVCC_ARCHS="100a;103a" \
-DCUTLASS_ENABLE_EXAMPLES=OFF \
-DCUTLASS_ENABLE_TESTS=OFF \
-DCUTLASS_LIBRARY_KERNELS="cutlass3x_sm100_tensorop_gemm_f16_*" \
-S ./cutlass \
-B ./cutlass/build
cmake --build ./cutlass/build --target cutlass_profiler
Why static-only?
On aarch64, even per-family shared libraries can overflow R_AARCH64_PREL32 relocations (±2 GB limit) in .eh_frame when thousands of SM100 GEMM kernel objects are linked into a single .so. Building static-only avoids this linker limitation entirely, since .a archives defer relocation to the final executable link.
CUTLASS already has -mcmodel=medium handling for x86_64 large library relocation issues, but has no equivalent workaround for aarch64.
Suggested Fix
Add a static fallback alias in tools/library/CMakeLists.txt:
if(CUTLASS_BUILD_STATIC_LIBS)
add_library(cutlass_lib_static ALIAS cutlass_library_static)
if(NOT TARGET cutlass_lib)
add_library(cutlass_lib ALIAS cutlass_library_static)
endif()
endif()
This ensures cutlass_lib exists regardless of the shared/static configuration, preserving backward compatibility.
Current Workaround
We apply a sed patch post-clone before running cmake:
sed -i '/add_library(cutlass_lib_static ALIAS cutlass_library_static)/a\
if(NOT TARGET cutlass_lib)\n\
add_library(cutlass_lib ALIAS cutlass_library_static)\n\
endif()' cutlass/tools/library/CMakeLists.txt
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tools/library/CMakeLists.txt around the cutlass_lib and cutlass_lib_static aliases, then inspect the cutlass_profiler linkage in tools/profiler/CMakeLists.txt. Configure with shared libraries off and static libraries on, build the cutlass_profiler target, and confirm that compilation and linking succeed with the library include paths propagated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100