Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6366150
Initial commit of new API
stijnh Aug 10, 2026
083f534
`hello_world` example is now working with new API
stijnh Aug 14, 2026
6c4acec
Change how `Scope` is implemented
stijnh Aug 24, 2026
2c0fb9b
Add support for HIP
stijnh Aug 24, 2026
71e5166
Some more work on the new API
stijnh Aug 31, 2026
d739afe
Add backends implemention from `dev` (`bf7aede`)
stijnh Aug 31, 2026
374e13e
Add support for `Runtime::adopt_buffer`
stijnh Aug 31, 2026
1fa802a
Make methods in `DataInterface` noexcept where possible
stijnh Aug 31, 2026
8bf3ec9
Add `PenaltyBreakBeforeMemberAccess` to .clang-format
stijnh Aug 31, 2026
9e404bd
Add initial support for reductions on GPU
stijnh Aug 31, 2026
44f45f8
Implement intial version of `fill_gpu`
stijnh Aug 31, 2026
422cef9
Further implementation of `fill_gpu`, `reduce_gpu`, and `copy_gpu`
stijnh Sep 1, 2026
f541203
Rename `README` to `README.md`
stijnh Sep 2, 2026
2fa9ad1
Fix formatting of license reference in README
isazi Sep 2, 2026
37bb977
Run the CI for pull-requests on the dev branch.
isazi Sep 2, 2026
898b2db
Rewrite of `copy_gpu`, `fill_gpu`, and `reduce_gpu`
stijnh Sep 3, 2026
d32a3d8
Merge remote-tracking branch 'origin/dev' into new-api
stijnh Sep 3, 2026
d55fbe3
Fix import in backends
stijnh Sep 3, 2026
aed9c80
Add examples directory
stijnh Sep 3, 2026
e5fde19
Various changes to make the code compile, the merge introduced some b…
isazi Sep 3, 2026
9ebaefe
The merge reintroduced an old bug, fixed it again.
isazi Sep 3, 2026
829a0e1
Fixed the use of ulong that does not work on MacOS
isazi Sep 3, 2026
664a438
Build the examples only if CUDA or HIP are used.
isazi Sep 3, 2026
d3ce617
Trying to fix a HIP build bug.
isazi Sep 3, 2026
6a3b36d
It is not needed to have cuda.cpp and hip.cpp
isazi Sep 3, 2026
f86570b
Missing argument names.
isazi Sep 3, 2026
e3c67d5
Fix few build bugs for both CUDA and HIP.
isazi Sep 3, 2026
8f678ec
Fixed a couple more bugs.
isazi Sep 3, 2026
3c53648
More HIP build errors.
isazi Sep 3, 2026
bcadde2
Claude fixed a Cmake HIP bug.
isazi Sep 4, 2026
0ffb2a1
Reintroduced the kmm.hpp file for easier user experience."
isazi Sep 4, 2026
9b7b21d
Claude fixed an inclusion problem.
isazi Sep 4, 2026
571b0bf
Typo.
isazi Sep 4, 2026
dfb66c3
Claude fixed a bug that Claude introduced.
isazi Sep 4, 2026
ff41929
Name change.
isazi Sep 4, 2026
56aebc3
Update ROCM version in CI to match LUMI.
isazi Sep 4, 2026
1d84ca9
Workaround for older HIP versions.
isazi Sep 4, 2026
349b96a
Another fix for HIP building.
isazi Sep 4, 2026
8d22b7e
Class to struct.
isazi Sep 4, 2026
686add7
Interrface change.
isazi Sep 4, 2026
9cd7844
Bug in casting.
isazi Sep 4, 2026
4852585
CUDA and HIP can be managed together.
isazi Sep 4, 2026
f7d0a4e
Workaround for older HIP.
isazi Sep 4, 2026
78ac7f6
Workaround for HIP context management.
isazi Sep 4, 2026
7939d25
Disable warnings in the CI.
isazi Sep 4, 2026
d882c96
Include the correct runtime.
isazi Sep 4, 2026
7b26087
Simplify the includes.
isazi Sep 4, 2026
6e6642d
Remove old include.
isazi Sep 4, 2026
6a49b82
Fix bug in `round_up_to_multiple` leading to overflow
stijnh Sep 4, 2026
8b48e15
Difference between CUDA and HIP.
isazi Sep 4, 2026
9a3a489
Claude generated port of the old benchmark to the new API. Needs test…
isazi Sep 4, 2026
251aed1
Fixed a bug in the benchmark.
isazi Sep 4, 2026
18aa860
Further implementation of memops GPU kernels
stijnh Sep 7, 2026
27987ea
Make `MemorySystem` a parameter of the `DataInterface` methods
stijnh Sep 7, 2026
309d93e
Add support for `Runtime::trim(...)`
stijnh Sep 7, 2026
8c67d17
Small fix for the reduce that uses CUB, neede HIP support.
isazi Sep 10, 2026
b560a91
Install hipcub in the CI.
isazi Sep 10, 2026
d6c4525
Claude fixed an error where HIP does not have one of the used intrins…
isazi Sep 10, 2026
5fbc903
Another workaround for HIP not being able to use memcpy.
isazi Sep 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeMemberAccess: 1000
PenaltyReturnTypeOnItsOwnLine: 400
PointerAlignment: Left
ReflowComments: false
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/cmake-cuda-multi-compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
fail-fast: false

matrix:
os: [ubuntu-latest]
build_type: [Debug]
build_type: [Release]
cpp_compiler: [g++, clang++]

steps:
Expand Down Expand Up @@ -50,8 +50,9 @@ jobs:
-DKMM_BUILD_TESTS:BOOL=ON
-DKMM_BUILD_EXAMPLES:BOOL=ON
-DKMM_BUILD_BENCHMARKS:BOOL=ON
-DKMM_ENABLE_WARNINGS:BOOL=OFF
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
24 changes: 16 additions & 8 deletions .github/workflows/cmake-hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,27 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
fail-fast: false

matrix:
os: [ubuntu-latest]
build_type: [Debug]
build_type: [Release]

steps:
- uses: loostrum/rocm-installer@main
with:
version: 6.2.2
packages: hip-dev hipcc rocm-device-libs rocblas rocm-hip-runtime-dev rocrand

- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install dependencies
run: |
sudo apt update
sudo apt install python3-setuptools python3-wheel
wget https://repo.radeon.com/amdgpu-install/6.3.4/ubuntu/noble/amdgpu-install_6.3.60304-1_all.deb
sudo apt install ./amdgpu-install_6.3.60304-1_all.deb
rm ./amdgpu-install_6.3.60304-1_all.deb
sudo apt update
sudo apt install hip-dev hipcc rocm-device-libs rocblas rocm-hip-runtime-dev rocrand hipcub-dev

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
Expand All @@ -42,18 +47,21 @@ jobs:
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_PREFIX_PATH=/opt/rocm
-DCMAKE_CXX_COMPILER:PATH=/opt/rocm/bin/amdclang++
-DCMAKE_HIP_COMPILER_ROCM_ROOT:PATH=/opt/rocm
-DCMAKE_HIP_ARCHITECTURES=gfx90a
-DAMDGPU_TARGETS=gfx90a
-DCMAKE_HIP_COMPILER:PATH=/opt/rocm/bin/amdclang++
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
-DSPDLOG_FMT_EXTERNAL:BOOL=ON
-DKMM_USE_HIP:BOOL=ON
-DKMM_BUILD_TESTS:BOOL=ON
-DKMM_BUILD_EXAMPLES:BOOL=ON
-DKMM_BUILD_BENCHMARKS:BOOL=ON
-DKMM_ENABLE_WARNINGS:BOOL=OFF
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
7 changes: 4 additions & 3 deletions .github/workflows/cmake-multi-compiler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: true
fail-fast: false

matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Debug]
build_type: [Release]
cpp_compiler: [g++, clang++]

steps:
Expand All @@ -42,11 +42,12 @@ jobs:
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
-DSPDLOG_FMT_EXTERNAL:BOOL=ON
-DKMM_BUILD_TESTS:BOOL=ON
-DKMM_ENABLE_WARNINGS:BOOL=OFF
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ cmake-build*
# Editors
.idea/
.vscode/

# Generated docs
docs/html/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "external/Catch2"]
path = external/Catch2
url = https://github.com/catchorg/Catch2.git
[submodule "external/unordered_dense"]
path = external/unordered_dense
url = https://github.com/martinus/unordered_dense
43 changes: 35 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)

# Project setup
set(PROJECT_NAME "kmm")
project(${PROJECT_NAME} LANGUAGES CXX VERSION 0.3)
project(${PROJECT_NAME} LANGUAGES CXX VERSION 0.4.0)

# User options (features)
option(KMM_STATIC "Build a static library" OFF)
Expand All @@ -14,6 +14,7 @@ option(KMM_ENABLE_LINTER "Enable clang-tidy linter" OFF)
option(KMM_BUILD_TESTS "Build tests" OFF)
option(KMM_BUILD_EXAMPLES "Build examples" OFF)
option(KMM_BUILD_BENCHMARKS "Build benchmarks" OFF)
option(KMM_ENABLE_WARNINGS "Enable -Wall -Wextra -Wconversion" ON)

# Check options
if(KMM_USE_CUDA AND KMM_USE_HIP)
Expand All @@ -29,8 +30,11 @@ file(GLOB_RECURSE sources
"${PROJECT_SOURCE_DIR}/src/*.cu"
)

# Exclude backend implementation files from compilation, as they are included in `src/core/backends.cpp`
list(FILTER sources EXCLUDE REGEX "src/backends/(cuda|hip|cpu)\\.cpp$")
list(FILTER sources EXCLUDE REGEX "src/utils/backends/cpu.cpp")

if(NOT KMM_USE_CUDA AND NOT KMM_USE_HIP)
list(APPEND sources "${PROJECT_SOURCE_DIR}/src/utils/backends/cpu.cpp")
endif()

# Create library
if(KMM_STATIC)
Expand All @@ -53,7 +57,8 @@ endif()
target_compile_options(${PROJECT_NAME}
PUBLIC
$<$<COMPILE_LANGUAGE:CUDA>:-forward-unknown-to-host-compiler>
-Wall -Wextra -Wconversion -Wno-unused-parameter
"$<$<BOOL:${KMM_ENABLE_WARNINGS}>:-Wall;-Wextra;-Wconversion;-Wno-unused-parameter>"
$<$<NOT:$<BOOL:${KMM_ENABLE_WARNINGS}>>:-w>
#$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-Werror>
)
target_compile_options(${PROJECT_NAME} PUBLIC ${CXXFLAGS})
Expand All @@ -73,6 +78,10 @@ set(SPDLOG_BUILD_PIC ON)
add_subdirectory(external/spdlog)
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)

# Dependencies: unordered_dense
add_subdirectory(external/unordered_dense)
target_link_libraries(${PROJECT_NAME} PUBLIC unordered_dense::unordered_dense)

# Install
include(GNUInstallDirs)
set_target_properties(
Expand Down Expand Up @@ -143,13 +152,31 @@ elseif(KMM_USE_HIP)
set(CMAKE_MODULE_PATH "${HIP_PATH}/cmake" ${CMAKE_MODULE_PATH})
find_package(HIP REQUIRED)
find_package(ROCBLAS REQUIRED)
set_source_files_properties(${sources} PROPERTIES LANGUAGE HIP)
find_package(hipcub REQUIRED)
# CMake only recognizes .cu as CUDA by default, so the actual GPU kernel files (which need to be
# compiled by amdclang++'s HIP frontend) must be reassigned explicitly. Plain .cpp files must
# stay as CXX -- forcing them to HIP too makes amdclang++ run a device-code compilation pass on
# files with no device code, which fails since they never include <hip/hip_runtime.h>.
set(hip_kernel_sources ${sources})
list(FILTER hip_kernel_sources INCLUDE REGEX "\\.cu$")
set_source_files_properties(${hip_kernel_sources} PROPERTIES LANGUAGE HIP)

# `enable_language(HIP)` above means CMake's native HIP-language support already knows how to
# compile the HIP-language kernel sources (invoking amdclang++ with the right -x hip flag and
# architecture), the same way CUDA_ARCHITECTURES drives .cu compilation in the CUDA branch. We
# deliberately do NOT link hip::device here: it exists for the legacy pattern of writing device
# code directly in .cpp files, and does so by force-injecting -x hip onto every CXX-language
# source in the target -- which breaks plain host .cpp files that never include hip headers.
set_target_properties(
${PROJECT_NAME}
PROPERTIES
HIP_ARCHITECTURES "gfx90a"
)
target_link_libraries(${PROJECT_NAME}
PUBLIC
hip::host
roc::rocblas
PRIVATE
hip::device
hip::hipcub
)

# Define `KMM_USE_HIP` macro so that headers can detect HIP usage
Expand All @@ -171,4 +198,4 @@ endif()
# Compile benchmarks
if(KMM_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
endif()
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,4 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
CLANG_FORMAT=clang-format --verbose

pretty:
${CLANG_FORMAT} -i include/kmm/*.hpp include/kmm/*/*.hpp
$(CLANG_FORMAT) -i src/*/*.cpp src/*/*.cu src/*/*.cuh
${CLANG_FORMAT} -i test/*/*.cpp
${CLANG_FORMAT} -i examples/*.cu
${CLANG_FORMAT} -i benchmarks/*.cu
find include src test examples \
\( -name '*.hpp' -o -name '*.cpp' -o -name '*.cu' -o -name '*.cuh' \) -type f -print0 \
| xargs -0 -r ${CLANG_FORMAT} -i

docs:
cd docs && doxygen Doxyfile

all: pretty

.PHONY : pretty
.PHONY : pretty docs
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,5 @@ int main() {

## License

KMM is made available under the terms of the Apache License version 2.0, see the file LICENSE for details.
KMM is made available under the terms of the Apache License version 2.0, see the LICENSE file for details.

Loading
Loading