gnu: Add foxi.

* gnu/packages/machine-learning.scm (foxi): New variable.
* gnu/packages/patches/foxi-fix-build.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
This commit is contained in:
David Elsing 2024-03-23 22:05:00 +00:00 committed by Ludovic Courtès
parent 35f4f33138
commit 3ef0b4e402
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 85 additions and 0 deletions

View file

@ -1237,6 +1237,7 @@ dist_patch_DATA = \
%D%/packages/patches/foobillard++-pkg-config.patch \
%D%/packages/patches/foomatic-filters-CVE-2015-8327.patch \
%D%/packages/patches/foomatic-filters-CVE-2015-8560.patch \
%D%/packages/patches/foxi-fix-build.patch \
%D%/packages/patches/fp16-implicit-double.patch \
%D%/packages/patches/fp16-system-libraries.patch \
%D%/packages/patches/fpc-reproducibility.patch \

View file

@ -4235,6 +4235,35 @@ (define-public tensorpipe
the tensors contained therein.")
(license license:bsd-3))))
(define-public foxi
(let
((commit "c278588e34e535f0bb8f00df3880d26928038cad")
(revision "0"))
(package
(name "foxi")
(version (git-version "1.4.1" revision commit))
(source (origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/houseroad/foxi")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(base32
"0q3ssm5hmmvwfwx87mnnajbavzgpahybw6rpn8ysr9r095dwgq5a"))
(patches (search-patches "foxi-fix-build.patch"))))
(build-system cmake-build-system)
(arguments
(list
;; No tests
#:tests? #f))
(home-page "https://github.com/houseroad/foxi")
(synopsis "ONNXIFI with Facebook Extension")
(description "ONNX Interface for Framework Integration is a cross-platform
API for loading and executing ONNX graphs on optimized backends. This package
contains facebook extensions and is used by PyTorch.")
(license license:expat))))
;; Please also update python-torchvision when updating this package.
(define-public python-pytorch
(package

View file

@ -0,0 +1,55 @@
Taken from https://github.com/houseroad/foxi/pull/25.
diff --git a/foxi/onnxifi_dummy.c b/foxi/onnxifi_dummy.c
index 2115af9..73e25fc 100644
--- a/foxi/onnxifi_dummy.c
+++ b/foxi/onnxifi_dummy.c
@@ -103,7 +103,10 @@ ONNXIFI_PUBLIC ONNXIFI_CHECK_RESULT onnxStatus ONNXIFI_ABI onnxInitGraph(
const void* onnxModel,
uint32_t weightCount,
const onnxTensorDescriptorV1* weightDescriptors,
- onnxGraph* graph) {
+ onnxGraph* graph,
+ uint32_t maxSeqLength,
+ void* deferredWeightReader) {
+
if (graph == NULL) {
return ONNXIFI_STATUS_INVALID_POINTER;
}
@@ -215,6 +218,8 @@ ONNXIFI_PUBLIC ONNXIFI_CHECK_RESULT onnxStatus ONNXIFI_ABI
onnxWaitEventFor(onnxEvent event,
uint32_t timeoutMs,
onnxEventState* eventState,
- onnxStatus* eventStatus) {
+ onnxStatus* eventStatus,
+ char* message,
+ size_t* messageLength) {
return ONNXIFI_STATUS_SUCCESS;
}
\ No newline at end of file
diff --git a/foxi/onnxifi_wrapper.c b/foxi/onnxifi_wrapper.c
index 98a9325..abe1440 100644
--- a/foxi/onnxifi_wrapper.c
+++ b/foxi/onnxifi_wrapper.c
@@ -761,7 +761,9 @@ ONNXIFI_PUBLIC onnxStatus ONNXIFI_ABI onnxInitGraph(
const void* onnxModel,
uint32_t weightsCount,
const onnxTensorDescriptorV1* weightDescriptors,
- onnxGraph* graph)
+ onnxGraph* graph,
+ uint32_t maxSeqLength,
+ void* deferredWeightReader)
{
if (graph == NULL) {
return ONNXIFI_STATUS_INVALID_POINTER;
@@ -797,7 +799,9 @@ ONNXIFI_PUBLIC onnxStatus ONNXIFI_ABI onnxInitGraph(
onnxModel,
weightsCount,
weightDescriptors,
- &graph_wrapper->graph);
+ &graph_wrapper->graph,
+ maxSeqLength,
+ deferredWeightReader);
switch (status) {
case ONNXIFI_STATUS_SUCCESS:
case ONNXIFI_STATUS_FALLBACK: