Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2c5946b
fix: add .claude and .specify to .gitignore
Oct 22, 2025
38f565b
feat: add SGLang inference server and OpenAI proxy integration
Oct 22, 2025
12a3625
fix: increase SGLang server readiness timeout and enhance OpenAI prox…
Oct 23, 2025
1458b95
feat: replace SGLang inference with deterministic-inference setup and…
Oct 24, 2025
8b27a9f
feat: add launch script for deterministic-inference server with paren…
Oct 24, 2025
e98404c
fix: add CLAUDE.md to .gitignore and ensure .specify is ignored
Oct 27, 2025
9585a84
feat: enhance completions and chat functions to support chat-mode and…
Oct 27, 2025
47ebdc9
feat: update inference request handling and add local inference serve…
Oct 27, 2025
9838e1b
fix: improve health check URL construction in inference server
Oct 27, 2025
70ea091
feat: enhance health check mechanism and improve inference request ha…
Oct 27, 2025
e86df25
feat: add support for Bearer token handling in generate function
Oct 28, 2025
fd5e148
fix: correct variable assignment in extract_inference_params function
Oct 28, 2025
0556c44
fix: update health check response to use 'status' key for server health
Oct 28, 2025
ffcd12e
Squashed commit of the following:
Oct 28, 2025
5cb20d0
feat: enhance inference response handling with attestation support
Oct 28, 2025
8a7accd
refactor: remove unused HTTP info response function and improve shell…
Oct 28, 2025
8473d51
refactor: streamline code structure and improve readability in dev_se…
Oct 28, 2025
439c3e8
feat: enhance inference request handling with improved attestation logic
Oct 28, 2025
a76e115
refactor: simplify CORS header handling in add_cors_headers function
Oct 30, 2025
742424a
feat: enhance inference handling with improved health check and reque…
Oct 30, 2025
61b7d17
refactor: update launch-monitored script to improve process monitorin…
Oct 30, 2025
883a89a
refactor: remove launch-monitored script and related server lifecycle…
Oct 31, 2025
25da79e
fix: adjust read_body function to set maximum length and timeout for …
Nov 3, 2025
1167cf0
feat: add configurable maximum readers for LMDB environment
Nov 5, 2025
11ed83b
feat: add default configuration for sev_gpu module in default_message
Nov 7, 2025
81cb161
feat: add streaming support to inference and HTTP reply handling
Nov 21, 2025
406845d
feat: implement stream commitment handling in maybe_sign function
Nov 25, 2025
23222e7
feat: add stop function and enhance inference request handling
Nov 25, 2025
201fd65
feat: enhance documentation and improve stop function in inference se…
Nov 25, 2025
59fe7dc
Merge branch 'edge' into PR/dcv_inference
Dec 8, 2025
686749f
feat: add NVIDIA GPU TEE Attestation NIF for evidence collection and …
Dec 10, 2025
f1c9688
fix: use raw status in stream replies and add unistd.h include
Dec 10, 2025
3999951
refactor: rename NIF module initialization from `dev_sev_gpu_nif` to …
Dec 10, 2025
7a83d65
feat: Add configurable debug logging for nvat SDK in GPU NIF, default…
Dec 10, 2025
23ffc10
refactor: Reimplement GPU evidence verification using `nvat_attestati…
Dec 10, 2025
b2b63fb
refactor: Add logger name to `nvat_logger_spdlog_create` calls.
Dec 10, 2025
4f15237
refactor: migrate GPU attestation logic to C NIF, adding nonce extrac…
Dec 10, 2025
1b02b51
refactor: c to c++
Dec 10, 2025
47e3147
refactor: Remove `nonce` from generated evidence JSON, rename attesta…
Dec 10, 2025
a333612
feat: Include full decoded attestation result, raw data, and nonce in…
Dec 10, 2025
348187f
feat: Update default inference model name to google/gemma-3-27b-it
Dec 10, 2025
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
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rebar3.crashdump

native/hb_beamr/*.o
native/hb_beamr/*.d

!native/dev_sev_gpu/NVGPULocalv4Policy.json
priv/*
.DS_STORE
cache-*
Expand All @@ -45,4 +45,11 @@ mkdocs-site-manifest.csv

!test/admissible-report-wallet.json
!test/admissible-report.json
!test/config.json
!test/config.json

__pycache__
native/dev_sev_gpu/*.log

.claude
.specify
CLAUDE.md
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 4,
"editor.rulers": [80]
"editor.rulers": [80],
"cmake.sourceDirectory": "/home/jax/apuslabs/HyperBEAM/native/dev_sev_gpu_nif"
}
95 changes: 95 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,98 @@ setup-genesis-wasm: $(GENESIS_WASM_SERVER_DIR)
fi
@cd $(GENESIS_WASM_SERVER_DIR) && npm install > /dev/null 2>&1 && \
echo "Installed genesis-wasm@1.0 server."

DETERMINISTIC_INFERENCE_BRANCH = main
DETERMINISTIC_INFERENCE_DIR = _build/deterministic-inference
DETERMINISTIC_INFERENCE_REPO = https://github.com/apuslabs/deterministic-inference.git

setup-python:
@if ! command -v python3 > /dev/null; then \
echo "Error: Python3 is not installed. Please install Python3 before continuing."; \
echo "For Ubuntu/Debian, you can install it with:"; \
echo " sudo apt-get update && sudo apt-get install -y python3 python3-pip python3-venv"; \
exit 1; \
fi
@if ! command -v uv > /dev/null; then \
echo "Installing uv package manager..."; \
curl -LsSf https://astral.sh/uv/install.sh | sh; \
fi

# Set up deterministic-inference environment
setup-inference: setup-python $(DETERMINISTIC_INFERENCE_DIR)
@echo "Setting up deterministic-inference..."
@cd $(DETERMINISTIC_INFERENCE_DIR) && \
uv sync && \
echo "Installed deterministic-inference package with uv."

$(DETERMINISTIC_INFERENCE_DIR):
@echo "Cloning deterministic-inference repository..." && \
git clone -b $(DETERMINISTIC_INFERENCE_BRANCH) $(DETERMINISTIC_INFERENCE_REPO) $(DETERMINISTIC_INFERENCE_DIR) --single-branch && \
echo "Extracted deterministic-inference to $(DETERMINISTIC_INFERENCE_DIR)"

CC_DIR = native/dev_sev_gpu
# NVAT SDK Configuration
NVAT_SDK_BRANCH = main
NVAT_SDK_REPO = https://github.com/NVIDIA/attestation-sdk.git
NVAT_SDK_DIR = _build/attestation-sdk
NVAT_BUILD_DIR = $(NVAT_SDK_DIR)/nv-attestation-sdk-cpp/build
DEV_SEV_GPU_NIF_DIR = _build/dev_sev_gpu_nif

# Check NVAT dependencies
check-nvat-deps:
@missing=""; \
if ! command -v cmake > /dev/null; then missing="$$missing cmake"; fi; \
if ! command -v clang > /dev/null; then missing="$$missing clang"; fi; \
if ! command -v cargo > /dev/null; then missing="$$missing cargo(rust)"; fi; \
if ! pkg-config --exists libcurl 2>/dev/null; then missing="$$missing libcurl4-openssl-dev"; fi; \
if ! pkg-config --exists openssl 2>/dev/null; then missing="$$missing libssl-dev"; fi; \
if ! pkg-config --exists libxml-2.0 2>/dev/null; then missing="$$missing libxml2-dev"; fi; \
if ! pkg-config --exists xmlsec1 2>/dev/null; then missing="$$missing libxmlsec1-dev"; fi; \
if ! pkg-config --exists spdlog 2>/dev/null; then missing="$$missing libspdlog-dev"; fi; \
if [ -n "$$missing" ]; then \
echo "Error: Missing dependencies for nvat SDK:$$missing"; \
echo ""; \
echo "For Ubuntu/Debian, you can install them with:"; \
echo " sudo apt-get update && sudo apt-get install -y cmake clang pkg-config \\"; \
echo " libcurl4-openssl-dev libssl-dev libxml2-dev \\"; \
echo " libxmlsec1-dev libxmlsec1-openssl libspdlog-dev"; \
echo ""; \
echo "For Rust, install with:"; \
echo " curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"; \
exit 1; \
fi
@echo "All nvat dependencies are installed."

# Clone attestation-sdk repository
$(NVAT_SDK_DIR):
@echo "Cloning NVIDIA attestation-sdk repository..." && \
git clone -b $(NVAT_SDK_BRANCH) $(NVAT_SDK_REPO) $(NVAT_SDK_DIR) --single-branch && \
echo "Cloned attestation-sdk to $(NVAT_SDK_DIR)"

# Build nvat library
$(NVAT_BUILD_DIR)/libnvat.so: check-nvat-deps $(NVAT_SDK_DIR)
@echo "Building nvat SDK..." && \
cmake -S $(NVAT_SDK_DIR)/nv-attestation-sdk-cpp \
-B $(NVAT_BUILD_DIR) \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON && \
cmake --build $(NVAT_BUILD_DIR) -j$$(nproc) && \
echo "Built nvat SDK successfully"

# Build dev_sev_gpu NIF
$(DEV_SEV_GPU_NIF_DIR)/dev_sev_gpu_nif.so: $(NVAT_BUILD_DIR)/libnvat.so
@echo "Building dev_sev_gpu NIF..." && \
cmake -S native/dev_sev_gpu_nif \
-B $(DEV_SEV_GPU_NIF_DIR) \
-DCMAKE_BUILD_TYPE=Release \
-DNVAT_SDK_DIR=$(CURDIR)/$(NVAT_SDK_DIR)/nv-attestation-sdk-cpp \
-DNVAT_BUILD_DIR=$(CURDIR)/$(NVAT_BUILD_DIR) \
-DNVAT_DEBUG_LOG=OFF && \
cmake --build $(DEV_SEV_GPU_NIF_DIR) && \
mkdir -p priv && \
cp $(DEV_SEV_GPU_NIF_DIR)/dev_sev_gpu_nif.so priv/ && \
echo "Built dev_sev_gpu NIF successfully"

# Set up dev_sev_gpu environment (now uses nvat C++ SDK)
setup-cc: $(DEV_SEV_GPU_NIF_DIR)/dev_sev_gpu_nif.so
@echo "Installed dev_sev_gpu NIF successfully."
69 changes: 69 additions & 0 deletions native/dev_sev_gpu_nif/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 3.11)
project(dev_sev_gpu_nif VERSION 0.1.0 LANGUAGES CXX)

# Debug logging option (default: OFF for quiet operation)
option(NVAT_DEBUG_LOG "Enable verbose debug logging from nvat SDK" OFF)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Find Erlang NIF headers
find_path(ERL_NIF_INCLUDE_DIR erl_nif.h
HINTS /usr/local/lib/erlang/usr/include
/usr/lib/erlang/usr/include
$ENV{ERL_TOP}/erts-*/include
)

if(NOT ERL_NIF_INCLUDE_DIR)
message(FATAL_ERROR "Could not find erl_nif.h. Make sure Erlang development headers are installed.")
endif()

# NVAT SDK paths (passed from Makefile)
set(NVAT_SDK_DIR "" CACHE PATH "Path to nvat SDK source")
set(NVAT_BUILD_DIR "" CACHE PATH "Path to nvat SDK build")

if(NOT NVAT_SDK_DIR OR NOT NVAT_BUILD_DIR)
message(FATAL_ERROR "NVAT_SDK_DIR and NVAT_BUILD_DIR must be specified")
endif()

# Find nlohmann/json from nvat build (it's fetched by nvat's CMake)
find_path(NLOHMANN_JSON_INCLUDE_DIR nlohmann/json.hpp
HINTS ${NVAT_BUILD_DIR}/_deps/json-src/include
${NVAT_BUILD_DIR}/_deps/json-src/single_include
)

if(NOT NLOHMANN_JSON_INCLUDE_DIR)
message(FATAL_ERROR "Could not find nlohmann/json.hpp. Make sure nvat SDK was built first.")
endif()

add_library(dev_sev_gpu_nif SHARED
dev_sev_gpu_nif.cpp
)

target_include_directories(dev_sev_gpu_nif PRIVATE
${ERL_NIF_INCLUDE_DIR}
${NVAT_BUILD_DIR}/include
${NLOHMANN_JSON_INCLUDE_DIR}
)

target_link_directories(dev_sev_gpu_nif PRIVATE
${NVAT_BUILD_DIR}
)

target_link_libraries(dev_sev_gpu_nif PRIVATE
nvat
)

# Add debug log definition if enabled
if(NVAT_DEBUG_LOG)
target_compile_definitions(dev_sev_gpu_nif PRIVATE NVAT_DEBUG_LOG)
endif()

# Set output properties to match Erlang NIF expectations
set_target_properties(dev_sev_gpu_nif PROPERTIES
PREFIX ""
SUFFIX ".so"
# Set RPATH to find libnvat.so at runtime
INSTALL_RPATH "$ORIGIN/../lib"
BUILD_WITH_INSTALL_RPATH TRUE
)
Loading