Skip to content

feat(libfreetpu): add lightweight freetpu_is_available() hardware probe - #59

Merged
saariuslystoned merged 1 commit into
mainfrom
feat/freetpu-is-available
Dec 5, 2026
Merged

saariuslystoned merged 1 commit into
mainfrom
feat/freetpu-is-available

Conversation

@saariuslystoned

Copy link
Copy Markdown
Collaborator

Adds int freetpu_is_available(void) to freetpu.h / freetpu_device.cpp so external backends like llama.cpp (ggml-freetpu) can query TPU hardware presence cleanly without hardcoding device paths or creating/destroying a full freetpu_context_t.

On Linux/Android, opens and immediately closes /dev/edgetpu-soc (O_RDWR | O_CLOEXEC) and /dev/dma_heap/system (O_RDONLY | O_CLOEXEC), returning 1 if both succeed and 0 otherwise. Returns 0 on non-Linux hosts.

Proof

  • ctest --output-on-failure: 5/5 passed on AppleClang 21.
  • Verified clean build of ggml-freetpu (test-backend-ops, llama-bench) against installed libfreetpu.

@saariuslystoned
saariuslystoned merged commit 96d3e0b into main Dec 5, 2026
3 checks passed
@saariuslystoned
saariuslystoned deleted the feat/freetpu-is-available branch December 5, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant