Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
141 changes: 141 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: HMLL Build Workflow

on:
workflow_call:
inputs:
os:
description: 'Operating system to run on'
required: true
type: string
compiler-cc:
description: 'C compiler'
required: true
type: string
compiler-cxx:
description: 'C++ compiler'
required: true
type: string
build-type:
description: 'CMake build type (Release, Debug, RelWithDebInfo)'
required: false
type: string
default: 'Debug'
static-build:
description: 'Build static library'
required: false
type: boolean
default: false
enable-cuda:
description: 'Enable CUDA support'
required: false
type: boolean
default: false
cuda-version:
description: 'CUDA version to use'
required: false
type: string
default: '12.2.0'
enable-python:
description: 'Enable Python bindings'
required: false
type: boolean
default: false
python-version:
description: 'Python version to use'
required: false
type: string
default: '3.11'
enable-rust:
description: 'Enable Rust bindings'
required: false
type: boolean
default: false
rust-toolchain:
description: 'Rust toolchain version'
required: false
type: string
default: 'stable'
enable-sanitizers:
description: 'Enable sanitizers'
required: false
type: boolean
default: true
enable-safetensors:
description: 'Enable safetensors support'
required: false
type: boolean
default: true
run-tests:
description: 'Run tests after build'
required: false
type: boolean
default: true

jobs:
build:
runs-on: ${{ inputs.os }}

steps:
- uses: actions/checkout@v6

- name: Setup CUDA
if: inputs.enable-cuda
uses: Jimver/[email protected]
with:
cuda: ${{ inputs.cuda-version }}
method: 'network'
sub-packages: '["nvcc"]'

- name: Setup Python
if: inputs.enable-python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Setup Rust
if: inputs.enable-rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ inputs.rust-toolchain }}

- name: Install Python dependencies
if: inputs.enable-python
run: |
python -m pip install --upgrade pip
pip install pytest numpy

- name: Configure CMake
env:
CC: ${{ inputs.compiler-cc }}
CXX: ${{ inputs.compiler-cxx }}
run: |
cmake -B ${{ github.workspace }}/build \
-DCMAKE_BUILD_TYPE=${{ inputs.build-type }} \
-DHMLL_BUILD_STATIC=${{ inputs.static-build && 'ON' || 'OFF' }} \
-DHMLL_BUILD_TESTS=${{ inputs.run-tests && 'ON' || 'OFF' }} \
-DHMLL_ENABLE_SANITIZERS=${{ inputs.enable-sanitizers && 'ON' || 'OFF' }} \
-DHMLL_ENABLE_SAFETENSORS=${{ inputs.enable-safetensors && 'ON' || 'OFF' }} \
${{ inputs.enable-cuda && '-DHMLL_ENABLE_CUDA=ON' || '' }}

- name: Build C++ Library
run: cmake --build ${{ github.workspace }}/build --config ${{ inputs.build-type }}

- name: Build Rust Bindings
if: inputs.enable-rust
working-directory: lib/rust/hmll
run: cargo build --release

- name: Test C++ Library
if: inputs.run-tests
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ inputs.build-type }} --output-on-failure

- name: Test Rust Bindings
if: inputs.enable-rust && inputs.run-tests
working-directory: lib/rust/hmll
run: cargo test

- name: Test Python Bindings
if: inputs.enable-python && inputs.run-tests
run: |
python examples/read_with_hmll.py || echo "Python example test - define proper test suite"
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
cpu-build-matrix:
name: CPU Build (${{ matrix.os }}, ${{ matrix.compiler.cc }}, static=${{ matrix.static }})
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
compiler: [
{ cc: gcc, cxx: g++ },
{ cc: clang, cxx: clang++ }
]
static: [ false, true ]
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
compiler-cc: ${{ matrix.compiler.cc }}
compiler-cxx: ${{ matrix.compiler.cxx }}
build-type: Debug
static-build: ${{ matrix.static }}
enable-sanitizers: true
enable-safetensors: true
run-tests: true

cuda-build:
name: CUDA Build (${{ matrix.os }}, ${{ matrix.cuda-version }})
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
cuda-version: [ '12.6.0', '12.8.0', '13.0.0']
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
compiler-cc: clang
compiler-cxx: clang++
build-type: Debug
enable-cuda: true
cuda-version: ${{ matrix.cuda-version }}
enable-safetensors: true
enable-sanitizers: true
run-tests: false

rust-bindings:
name: Rust Bindings (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
rust-toolchain: [ stable, nightly ]
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
compiler-cc: gcc
compiler-cxx: g++
build-type: Debug
enable-rust: true
rust-toolchain: ${{ matrix.rust-toolchain }}
enable-safetensors: true
run-tests: true

python-bindings:
name: Python Bindings (${{ matrix.os }}, Python ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
python-version: [ '3.11', '3.12', '3.13', '3.13t' ]
uses: ./.github/workflows/build.yml
with:
os: ${{ matrix.os }}
compiler-cc: gcc
compiler-cxx: g++
build-type: Debug
enable-python: true
python-version: ${{ matrix.python-version }}
enable-safetensors: true
run-tests: true
43 changes: 0 additions & 43 deletions .github/workflows/cmake.yaml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/python.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion lib/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct hmll_range hmll_fetch_tensor(struct hmll *ctx, const struct hmll_registry
return (struct hmll_range){0};

const struct hmll_lookup_result lookup = hmll_lookup_tensor(ctx, registry, name);
if (lookup.specs == HMLL_FALSE) {
if (lookup.specs == NULL) {
ctx->error = HMLL_ERR(HMLL_ERR_TENSOR_NOT_FOUND);
return (struct hmll_range){0};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/rust/hmll-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn main() {
.derive_default(true)
.derive_copy(true)
.derive_eq(true)
.derive_hash(true)
.no_partialeq("hmll_loader")
.impl_debug(true)
.prepend_enum_name(false)
.size_t_is_usize(true)
Expand Down
Loading