Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -65 +64,0 @@
- add_msvc_runtime_flag(foxi_loader)
@@ -104 +102,0 @@
- add_msvc_runtime_flag(foxi_dummy)
@@ -118 +116 @@
- EXPORT ONNXTargets DESTINATION lib)
+ EXPORT ONNXTargets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
@@ -122 +120 @@
- EXPORT ONNXTargets DESTINATION lib)
+ EXPORT ONNXTargets RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
14 changes: 14 additions & 0 deletions houseroad/foxi/bd6feb6d0d3fc903df42b4feb82a602a5fcb1fd5/consumer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <foxi/onnxifi_loader.h>

#include <stdio.h>

int main(void) {
struct onnxifi_library onnx;
int ret = onnxifi_load(ONNXIFI_LOADER_FLAG_VERSION_1_0, NULL, &onnx);
if (!ret) {
printf("Cannot load onnxifi lib\n");
return 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure branch prints an error but returns 0 (success), so onTest (which checks the binary's exit code via lastErr!) can never fail even when onnxifi_load fails — the test becomes a no-op. onnxifi_load returns non-zero on success per upstream onnxifi_loader.h, so !ret is correctly the failure path; only the return code is wrong.

Suggested change
return 0;
if (!ret) {
fprintf(stderr, "Cannot load onnxifi lib\n");
return 1;
}

}
onnxifi_unload(&onnx);
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--- a/foxi/onnxifi_dummy.c
+++ b/foxi/onnxifi_dummy.c
@@ -103,7 +103,9 @@ 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 +217,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;
}
--- 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:
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import (
"os"
"path/filepath"
"strings"
)

// Conan Center cci.20210217 pins houseroad/foxi to this commit. The upstream
// repository has no release tags, so this commit is the only fetchable source
// ref for the selected recipe snapshot.
id "houseroad/foxi"

fromVer "bd6feb6d0d3fc903df42b4feb82a602a5fcb1fd5"

onBuild ctx => {
installDir := ctx.outputDir

patch := ctx.Proj.readFile("bd6feb6d0d3fc903df42b4feb82a602a5fcb1fd5/fix-conflicting-types.patch")!
patchPath := filepath.join(ctx.SourceDir, "_llar_fix-conflicting-types.patch")
os.writeFile(patchPath, patch, 0o644)!
patch "-p1", "--batch", "--forward", "-i", patchPath
lastErr!

cmakePatch := ctx.Proj.readFile("bd6feb6d0d3fc903df42b4feb82a602a5fcb1fd5/cmake.patch")!
cmakePatchPath := filepath.join(ctx.SourceDir, "_llar_cmake.patch")
os.writeFile(cmakePatchPath, cmakePatch, 0o644)!
patch "-p1", "--batch", "--forward", "-i", cmakePatchPath
lastErr!

c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir)
c.define "CMAKE_POLICY_VERSION_MINIMUM", "3.5"
c.configure
c.build
c.install

licenseDir := filepath.join(installDir, "licenses")
os.mkdirAll(licenseDir, 0o755)!
license := os.readFile(filepath.join(ctx.SourceDir, "LICENSE"))!
os.writeFile(filepath.join(licenseDir, "LICENSE"), license, 0o644)!

flags := []string{
"-I" + filepath.join(installDir, "include"),
"-L" + filepath.join(installDir, "lib"),
"-lfoxi_dummy",
"-lfoxi_loader",
"-ldl",
}
ctx.setMetadata strings.join(flags, " ")
}

onTest ctx => {
installDir := ctx.outputDir
testDir := filepath.join(ctx.SourceDir, "_llar_consumer")
os.mkdirAll(testDir, 0o755)!

source := ctx.Proj.readFile("bd6feb6d0d3fc903df42b4feb82a602a5fcb1fd5/consumer.c")!
sourcePath := filepath.join(testDir, "consumer.c")
os.writeFile(sourcePath, source, 0o644)!

flags := []string{
"-I" + filepath.join(installDir, "include"),
"-L" + filepath.join(installDir, "lib"),
"-lfoxi_dummy",
"-lfoxi_loader",
"-ldl",
}
binary := filepath.join(testDir, "consumer")
args := []string{sourcePath, "-o", binary}
args = append(args, flags...)
exec "cc", args...
lastErr!

os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
os.setenv("DYLD_LIBRARY_PATH", filepath.join(installDir, "lib"))!
exec binary
lastErr!
}
4 changes: 4 additions & 0 deletions houseroad/foxi/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"path": "houseroad/foxi",
"deps": {}
}
Loading