peachsim 0.1.1684 → 0.1.1700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage-swift.ts +72 -5
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/inspect/actions.ts +1 -0
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/commands/screenshot.ts +12 -0
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +6729 -3591
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +3475 -2137
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +8970 -3652
- package/dist-lib/host/fetch-proxy-handler.cjs +332 -40
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +469 -143
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +465 -139
- package/dist-lib/native-app-identity-project.cjs +209 -86
- package/dist-lib/native-app-identity-project.mjs +251 -116
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +27 -23
- package/dist-lib/public-origins-lib.json +221 -88
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +3 -3
- package/dist-lib/sdk.mjs +2 -2
- package/dist-lib/skills.cjs +20997 -16596
- package/dist-lib/swift-compile.cjs +3075 -459
- package/dist-lib/swift-compile.mjs +3028 -415
- package/dist-lib/swift-package.cjs +131 -69
- package/dist-lib/swift-package.mjs +126 -68
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +5049 -1704
- package/dist-lib/vite.cjs +261 -58
- package/dist-lib/worklet-executable.cjs +8 -5
- package/dist-lib/worklet-executable.mjs +7 -4
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +15 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +6 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +3 -2
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -220
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLAvailability.h +22 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBackgroundActivitySession.h +145 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityCondition.h +113 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconIdentityConstraint.h +34 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBeaconRegion.h +225 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLBody.h +26 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularGeographicCondition.h +59 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCircularRegion.h +64 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLCondition.h +48 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLError.h +52 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLErrorDomain.h +24 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLGeocoder.h +55 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLHeading.h +117 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocation.h +9 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager+CLVisitExtensions.h +45 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManager.h +877 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationManagerDelegate.h +225 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceError.h +33 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationPushServiceExtension.h +28 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLLocationUpdater.h +250 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitor.h +140 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitorConfiguration.h +77 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringEvent.h +184 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLMonitoringRecord.h +57 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLPlacemark.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLRegion.h +123 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLServiceSession.h +211 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CLVisit.h +66 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Headers/CoreLocation.h +46 -0
- package/sdk/ios/System/Library/Frameworks/CoreLocation.framework/Modules/module.modulemap +7 -0
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +98 -3
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h +52 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceObjC.h +240 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceRef.h +474 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceTypes.h +66 -0
- package/sdk/ios/System/Library/Frameworks/IOSurface.framework/Modules/module.modulemap +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4AccelerationStructure.h +9 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Archive.h +16 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ArgumentTable.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunction.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BinaryFunctionDescriptor.h +14 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4BufferRange.h +79 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandAllocator.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandBuffer.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandEncoder.h +16 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommandQueue.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CommitFeedback.h +15 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Compiler.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4CompilerTask.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputeCommandEncoder.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4ComputePipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4Counters.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4FunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LibraryFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4LinkingDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningCommandEncoder.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MachineLearningPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4MeshRenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineDataSetSerializer.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4PipelineState.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderCommandEncoder.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPass.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4RenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4SpecializedFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4StitchedFunctionDescriptor.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTL4TileRenderPipeline.h +13 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructure.h +1212 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureCommandEncoder.h +322 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAccelerationStructureTypes.h +224 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLAllocation.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgument.h +279 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLArgumentEncoder.h +199 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBinaryArchive.h +142 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitCommandEncoder.h +266 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBlitPass.h +82 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLBuffer.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureManager.h +113 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCaptureScope.h +43 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandBuffer.h +449 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandEncoder.h +148 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCommandQueue.h +102 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputeCommandEncoder.h +350 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePass.h +90 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLComputePipeline.h +274 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLCounters.h +225 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDataType.h +232 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDefines.h +39 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDepthStencil.h +93 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDevice.h +1122 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDeviceCertification.h +29 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDrawable.h +36 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLDynamicLibrary.h +81 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLEvent.h +79 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFence.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionConstantValues.h +30 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionDescriptor.h +95 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionHandle.h +29 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionLog.h +37 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLFunctionStitching.h +131 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLGPUAddress.h +19 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLHeap.h +284 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandBuffer.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCommandQueue.h +11 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIOCompressor.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandBuffer.h +157 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIndirectCommandEncoder.h +110 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLIntersectionFunctionTable.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLibrary.h +549 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLinkedFunctions.h +57 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLLogState.h +65 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLParallelRenderCommandEncoder.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPipeline.h +57 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLPixelFormat.h +342 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRasterizationRate.h +323 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderCommandEncoder.h +1068 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPass.h +411 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLRenderPipeline.h +788 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResidencySet.h +141 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResource.h +307 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStateCommandEncoder.h +125 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceStatePass.h +85 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLResourceViewPool.h +22 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLSampler.h +252 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLStageInputOutputDescriptor.h +158 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTensor.h +17 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h +460 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTextureViewPool.h +18 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h +125 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVertexDescriptor.h +153 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/MTLVisibleFunctionTable.h +45 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Headers/Metal.h +94 -0
- package/sdk/ios/System/Library/Frameworks/Metal.framework/Modules/module.modulemap +6 -0
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTDefines.h +35 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTTagClass.h +33 -0
- package/sdk/ios/System/Library/Frameworks/UniformTypeIdentifiers.framework/Headers/UTType.h +504 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLEssentialsAvailability.h +14 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/CLLocationEssentials.h +444 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Headers/LocationEssentials.h +14 -0
- package/sdk/ios/System/Library/Frameworks/_LocationEssentials.framework/Modules/module.modulemap +14 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/complex.h +167 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/dispatch/dispatch.h +5 -0
- package/sdk/ios/usr/include/mach/mach_types.h +1 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/math.h +835 -2
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -1
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +2044 -0
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -21
- package/src/nitro-compile.ts +36 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/nitroContract.ts +18 -2
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +598 -81
- package/src/swift-coverage/package.ts +3 -1
- package/src/swift-coverage/xcode-assets.ts +66 -5
- package/src/swift-coverage/xcode-packages.ts +11 -6
- package/src/swift-host.ts +347 -60
- package/src/swift-objc-compile.ts +52 -10
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +53 -13
- package/src/swift-package-manifest.ts +151 -28
- package/src/swift-package.ts +158 -75
- package/src/swift-packages.ts +141 -44
- package/src/swift-source-file.ts +10 -15
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +154 -31
- package/src/swift-submit.ts +5 -0
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +168 -75
- package/src/target-matcher.ts +15 -2
- package/src/vite-plugin.ts +0 -10
- package/src/worklet-executable.ts +7 -3
- package/src/xcode-json-project.ts +14 -2
- package/src/xcode-project.ts +215 -100
- package/src/settings-flags.ts +0 -107
|
@@ -0,0 +1,913 @@
|
|
|
1
|
+
//
|
|
2
|
+
// bnns_graph.h
|
|
3
|
+
// BasicNeuralNetworkSubroutines
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2023 Apple Inc. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef __BNNS_GRAPH_HEADER__
|
|
9
|
+
#define __BNNS_GRAPH_HEADER__
|
|
10
|
+
|
|
11
|
+
#include "bnns_structures.h"
|
|
12
|
+
|
|
13
|
+
#include <stddef.h>
|
|
14
|
+
#include <stdint.h>
|
|
15
|
+
|
|
16
|
+
#if __has_include(<TargetConditionals.h>)
|
|
17
|
+
# include <TargetConditionals.h>
|
|
18
|
+
#endif // __has_include(<TargetConditionals.h>)
|
|
19
|
+
|
|
20
|
+
#if __has_include( <Availability.h> )
|
|
21
|
+
#include <Availability.h>
|
|
22
|
+
#else
|
|
23
|
+
#define __API_AVAILABLE(...)
|
|
24
|
+
#define __API_DEPRECATED_WITH_REPLACEMENT(...)
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
|
|
28
|
+
# define BNNS_ENUM(_name, _type, ...) \
|
|
29
|
+
typedef enum : _type { __VA_ARGS__ } _name
|
|
30
|
+
#else // __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
|
|
31
|
+
# define BNNS_ENUM(_name, _type, ...) \
|
|
32
|
+
enum { __VA_ARGS__ }; typedef _type _name
|
|
33
|
+
#endif// __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
|
|
34
|
+
|
|
35
|
+
#if __has_feature(assume_nonnull)
|
|
36
|
+
_Pragma("clang assume_nonnull begin")
|
|
37
|
+
#else
|
|
38
|
+
#define _Null_unspecified
|
|
39
|
+
#define _Nullable
|
|
40
|
+
#define _Nonnull
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
#ifdef __cplusplus
|
|
44
|
+
extern "C" {
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
#pragma mark - Data types
|
|
48
|
+
|
|
49
|
+
/// The compiled version of a graph that can be executed by BNNS.
|
|
50
|
+
/// This object may be written to a file and mmap'd into read-only memory at a future time for execution through a call to
|
|
51
|
+
/// `BNNSGraphExecute()` or `BNNSGraphContextExecute()`.
|
|
52
|
+
/// @seealso `BNNSGraphCompileFromFile`
|
|
53
|
+
typedef struct {
|
|
54
|
+
void *_Nullable data; ///< Pointer to opaque object
|
|
55
|
+
size_t size; ///< size in bytes of object pointed to by data
|
|
56
|
+
} bnns_graph_t
|
|
57
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
58
|
+
|
|
59
|
+
/// Wrapper around a `bnns_graph_t` object that adds mutable data storage.
|
|
60
|
+
/// Mutable data is required to support dynamic shapes and certain other execution options.
|
|
61
|
+
/// The underlying `graph_t` object must remain valid throughout the lifetime of this object.
|
|
62
|
+
/// @seealso `BNNSGraphContextMake`, `BNNSGraphContextDestroy`
|
|
63
|
+
typedef struct {
|
|
64
|
+
void *_Nullable data; ///< Pointer to opaque object
|
|
65
|
+
size_t size; ///< size in bytes of object pointed to by data
|
|
66
|
+
} bnns_graph_context_t
|
|
67
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
68
|
+
|
|
69
|
+
/// Compilation options used to compile source model to a `bnns_graph_t` object.
|
|
70
|
+
/// Create an initial object by calling `BNNSGraphCompileOptionsMakeDefault()` and
|
|
71
|
+
/// set or query individual options by calling the `BNNSGraphCompileOptions*` family of functions.
|
|
72
|
+
/// @seealso `BNNSGraphCompileOptionsMakeDefault`, `BNNSGraphCompileOptionsDestroy`
|
|
73
|
+
typedef struct {
|
|
74
|
+
void *_Nullable data; ///< Pointer to opaque object
|
|
75
|
+
size_t size; ///< size in bytes of object pointed to by data
|
|
76
|
+
} bnns_graph_compile_options_t
|
|
77
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
78
|
+
|
|
79
|
+
/// Specifies the shape of an argument
|
|
80
|
+
///
|
|
81
|
+
/// Members:
|
|
82
|
+
/// - `rank`: Rank of the tensor and number of elements in array shape. A rank of 0 may be used to indicate to
|
|
83
|
+
/// `BNNSGraphContextSetDynamicShapes()` that the constant or default shape from the
|
|
84
|
+
/// source should be used.
|
|
85
|
+
/// - `shape`: Array of length `rank` containing sizes of each dimension
|
|
86
|
+
/// May only be NULL if `rank==0`.
|
|
87
|
+
/// For inputs, `shape[d] = 0` is used to indicate that the constant or default shape from the source
|
|
88
|
+
/// should be used for dimension `d`.
|
|
89
|
+
/// For outputs, `shape[d] = 0` is set by `BNNSGraphContextSetDynamicShapes()` to indicate that
|
|
90
|
+
/// the size in that dimension could not be deduced from the input shape alone, but will depend on the values
|
|
91
|
+
/// of the input data. Note that in some cases the returned shape will only be an upper bound on the size in that
|
|
92
|
+
/// dimension.
|
|
93
|
+
typedef struct {
|
|
94
|
+
size_t rank;
|
|
95
|
+
uint64_t *_Nullable shape;
|
|
96
|
+
} bnns_graph_shape_t
|
|
97
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
98
|
+
|
|
99
|
+
/// Type for user-provided memory allocation function
|
|
100
|
+
///
|
|
101
|
+
/// The function may be called for either an initial allocation, or to resize an existing allocation.
|
|
102
|
+
/// Typically on the first execution of a graph all calls will be for allocation, and on subsequent executions with the same context it will
|
|
103
|
+
/// be for reallocation. An optimized implementation will normally track sizes and avoid reallocating if size is the same or smaller.
|
|
104
|
+
///
|
|
105
|
+
/// Arguments:
|
|
106
|
+
/// `user_memory_context`: pointer that stores allocator mechanism state, passed unaltered from the function that specifies an argument of this type
|
|
107
|
+
/// `user_memory_context_size`: size in bytes of `user_memory_context`.
|
|
108
|
+
/// `memptr`: pointer to be allocated or reallocated. If `*memptr` is NULL, data item is being allocated for the first time, if it is not NULL, the item is being reallocated
|
|
109
|
+
/// `alignment`: Minimum required alignment for the object, in bytes.
|
|
110
|
+
/// `size`: Minimum size of object to be returned in `memptr`, in bytes.
|
|
111
|
+
///
|
|
112
|
+
/// Returns:
|
|
113
|
+
/// 0 on success, non-zero on failure
|
|
114
|
+
///
|
|
115
|
+
/// @seealso `BNNSGraphContextSetWorkspaceAllocationCallback`, `BNNSGraphContextSetOutputAllocationCallback`
|
|
116
|
+
typedef int (*bnns_graph_realloc_fn_t)(void *_Nullable user_memory_context,
|
|
117
|
+
size_t user_memory_context_size,
|
|
118
|
+
void *_Nullable *_Nonnull memptr,
|
|
119
|
+
size_t alignment,
|
|
120
|
+
size_t size)
|
|
121
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
122
|
+
|
|
123
|
+
/// Type for user-provided memory free function
|
|
124
|
+
///
|
|
125
|
+
/// This is called upon destruction of a context to free *all* memory associated to the `user_memory_context`.
|
|
126
|
+
/// If user has supplied both workspace and output memory management functions and the `user_memory_context` pointers are equal,
|
|
127
|
+
/// BNNS will only call this function once during `BNNSGraphContextDestroy`.
|
|
128
|
+
///
|
|
129
|
+
/// @seealso `BNNSGraphContextSetWorkspaceAllocationCallback`, `BNNSGraphContextSetOutputAllocationCallback`
|
|
130
|
+
typedef void (*bnns_graph_free_all_fn_t)(void *_Nullable user_memory_context, size_t user_memory_context_size)
|
|
131
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
132
|
+
|
|
133
|
+
/// Message Level Enum
|
|
134
|
+
///
|
|
135
|
+
/// Indicates the logging type for a specified message for message-logging callbacks to
|
|
136
|
+
/// surface messages taking into account the message type
|
|
137
|
+
BNNS_ENUM(BNNSGraphMessageLevel, uint32_t,
|
|
138
|
+
BNNSGraphMessageLevelInfo
|
|
139
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 1,
|
|
140
|
+
BNNSGraphMessageLevelUnsupported
|
|
141
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 2,
|
|
142
|
+
BNNSGraphMessageLevelWarning
|
|
143
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 4,
|
|
144
|
+
BNNSGraphMessageLevelError
|
|
145
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 8,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
/// Additional user-defined logging argument for user to pass into the message logging callbacks
|
|
149
|
+
typedef struct {
|
|
150
|
+
|
|
151
|
+
/// size of the additional logging data
|
|
152
|
+
size_t size;
|
|
153
|
+
|
|
154
|
+
/// pointer to the additional logging data
|
|
155
|
+
void *_Nullable data;
|
|
156
|
+
|
|
157
|
+
} bnns_user_message_data_t
|
|
158
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
159
|
+
|
|
160
|
+
/// Graph execute message callback function
|
|
161
|
+
///
|
|
162
|
+
/// Surfaces messages (i.e. warnings, errors, logs) according to the `BNNSGraphMessageLevel` message level specifier
|
|
163
|
+
/// User may specify customized actionables and logging styles. Default definition of this callback reports messages onto `os_log`
|
|
164
|
+
typedef void (*bnns_graph_execute_message_fn_t)(BNNSGraphMessageLevel msg_level,
|
|
165
|
+
char const *_Nonnull error_msg,
|
|
166
|
+
char const *_Nullable op_info,
|
|
167
|
+
bnns_user_message_data_t * _Nullable additional_logging_arguments)
|
|
168
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
169
|
+
|
|
170
|
+
/// Graph compile message callback function
|
|
171
|
+
///
|
|
172
|
+
/// Surfaces messages (i.e. warnings, errors, logs) according to the `BNNSGraphMessageLevel` message level specifier
|
|
173
|
+
/// User may specify customized actionables and logging styles. Default definition of this callback reports messages onto `os_log`
|
|
174
|
+
typedef void (*bnns_graph_compile_message_fn_t)(BNNSGraphMessageLevel msg_level,
|
|
175
|
+
char const *_Nonnull error_msg,
|
|
176
|
+
char const *_Nullable source_location,
|
|
177
|
+
bnns_user_message_data_t * _Nullable additional_logging_arguments)
|
|
178
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
#pragma mark - Compile options
|
|
182
|
+
|
|
183
|
+
/// Allocates and returns a new `bnns_graph_compile_options_t` object initialized to default values.
|
|
184
|
+
/// The user is responsible for calling `BNNSGraphCompileOptionsDestroy` on this object once it is no longer required.
|
|
185
|
+
bnns_graph_compile_options_t BNNSGraphCompileOptionsMakeDefault(void)
|
|
186
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
187
|
+
|
|
188
|
+
/// Destroys the given options object
|
|
189
|
+
void BNNSGraphCompileOptionsDestroy(bnns_graph_compile_options_t options)
|
|
190
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
191
|
+
|
|
192
|
+
/// Sets option for compiled graph to execute on only one thread.
|
|
193
|
+
/// Default behavior is to execute on multiple threads.
|
|
194
|
+
void BNNSGraphCompileOptionsSetTargetSingleThread(bnns_graph_compile_options_t options,
|
|
195
|
+
bool value)
|
|
196
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
197
|
+
|
|
198
|
+
/// Returns true if execution is set to use a single thread, false otherwise.
|
|
199
|
+
bool BNNSGraphCompileOptionsGetTargetSingleThread(const bnns_graph_compile_options_t options)
|
|
200
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
201
|
+
|
|
202
|
+
/// Sets whether the generated `bnns_graph_t` object includes debug info.
|
|
203
|
+
/// Default behavior is *not* to include debug info.
|
|
204
|
+
void BNNSGraphCompileOptionsSetGenerateDebugInfo(bnns_graph_compile_options_t options,
|
|
205
|
+
bool value)
|
|
206
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
207
|
+
|
|
208
|
+
/// Returns true if the generated `bnns_graph_t` will contain the debug info, false otherwise.
|
|
209
|
+
bool BNNSGraphCompileOptionsGetGenerateDebugInfo(const bnns_graph_compile_options_t options)
|
|
210
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
211
|
+
|
|
212
|
+
/// BNNS Graph Compilation Optimization Preferences
|
|
213
|
+
/// - `BNNSGraphOptimizationPreferencePerformance`: Optimize for best execute performance
|
|
214
|
+
/// In this mode additional work may be moved to the compile phase, even if it increases the footprint of the IR.
|
|
215
|
+
/// - `BNNSGraphOptimizationPreferenceIRSize`: Optimize for smallest size of IR on disk
|
|
216
|
+
/// In this mode, data will be left in smallest possible form, but may decrease execute performance due
|
|
217
|
+
/// to cost of performing transformations
|
|
218
|
+
BNNS_ENUM(BNNSGraphOptimizationPreference, uint32_t,
|
|
219
|
+
BNNSGraphOptimizationPreferencePerformance __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 0,
|
|
220
|
+
BNNSGraphOptimizationPreferenceIRSize __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 1,
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
/// Specifies the optimization preference to compile with
|
|
224
|
+
/// Default is `BNNSGraphOptimizationPreferencePerformance`.
|
|
225
|
+
void BNNSGraphCompileOptionsSetOptimizationPreference(bnns_graph_compile_options_t options,
|
|
226
|
+
BNNSGraphOptimizationPreference preference)
|
|
227
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
228
|
+
|
|
229
|
+
/// Returns the current optimization preference.
|
|
230
|
+
BNNSGraphOptimizationPreference BNNSGraphCompileOptionsGetOptimizationPreference(bnns_graph_compile_options_t options)
|
|
231
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
232
|
+
|
|
233
|
+
/// Graph Compile-time Message Callback Setter
|
|
234
|
+
///
|
|
235
|
+
/// Specifies customized callback function for compile time message reporting.
|
|
236
|
+
/// When unspecified, default callback functions log messages onto `os_log`.
|
|
237
|
+
///
|
|
238
|
+
/// - `options`: graph compile options
|
|
239
|
+
/// - `log_callback`: routine that customizes the graph compile time message logging callback of type
|
|
240
|
+
/// `bnns_graph_compile_message_fn_t`
|
|
241
|
+
/// - `additional_logging_arguments`: additional user-set data for the message logging functions to pass onto the callback functions unaltered
|
|
242
|
+
void BNNSGraphCompileOptionsSetMessageLogCallback(bnns_graph_compile_options_t options,
|
|
243
|
+
bnns_graph_compile_message_fn_t log_callback,
|
|
244
|
+
bnns_user_message_data_t * _Nullable additional_logging_arguments)
|
|
245
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
246
|
+
|
|
247
|
+
/// Sets mask for log messages that are logged (either via `os_log` or the user specified callback)
|
|
248
|
+
///
|
|
249
|
+
/// - `options`: graph compile options
|
|
250
|
+
/// - `log_level_mask`: bitmask of levels to log for
|
|
251
|
+
/// (Default is BNNSGraphMessageLevelUnsupported | BNNSGraphMessageLevelWarning | BNNSGraphMessageLevelError)
|
|
252
|
+
void BNNSGraphCompileOptionsSetMessageLogMask(bnns_graph_compile_options_t options,
|
|
253
|
+
uint32_t log_level_mask)
|
|
254
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
255
|
+
|
|
256
|
+
#if !0
|
|
257
|
+
/// Specifies that the `bnns_graph_t` object should be generated directly to the given file
|
|
258
|
+
/// This is intended to reduce memory required for compilation, as the full set of graph weights need not be memory resident all at once
|
|
259
|
+
/// This option will be ignored if a file descriptor is supplied by calling `BNNSGraphCompileOptionsSetOutputFD`.
|
|
260
|
+
/// If this option is used, the `bnns_graph_t` returned BNNSCompileFromFile() will be a read-only mmap'd version of the result.
|
|
261
|
+
/// Passing NULL will reset to the default behavior of generating strictly in memory.
|
|
262
|
+
/// The file will be created with 0600 permissions (read/write by user only).
|
|
263
|
+
/// @seealso BNNSGraphCompileOptionsSetOutputFD
|
|
264
|
+
void BNNSGraphCompileOptionsSetOutputPath(bnns_graph_compile_options_t options, char const *_Nullable path)
|
|
265
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
266
|
+
|
|
267
|
+
/// Returns the path used if the `bnns_graph_t` object is generated directly to a file, or NULL if this option is not enabled
|
|
268
|
+
char const* _Nullable BNNSGraphCompileOptionsGetOutputPath(bnns_graph_compile_options_t options)
|
|
269
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
270
|
+
|
|
271
|
+
/// Specifies that the `bnns_graph_t` object should be generated directly to the given file descriptor
|
|
272
|
+
/// This is intended to reduce memory required for compilation, as the full set of graph weights need not be memory resident all at once
|
|
273
|
+
/// This option will override any previously set output path option.
|
|
274
|
+
/// The file indicated by the desriptor must be open for writing, and will be truncated and completely overwritten.
|
|
275
|
+
/// If this option is used, the `bnns_graph_t` returned BNNSCompileFromFile() will be a read-only mmap'd version of the result.
|
|
276
|
+
/// Passing -1 will reset to the default behavior of generating strictly in memory (or the file specified via
|
|
277
|
+
/// `BNNSGraphCompileOptionsSetOutputPath`).
|
|
278
|
+
void BNNSGraphCompileOptionsSetOutputFD(bnns_graph_compile_options_t options, int fd)
|
|
279
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
280
|
+
|
|
281
|
+
// Return the file descriptor to be used for output, or -1 it none has been set.
|
|
282
|
+
int BNNSGraphCompileOptionsGetOutputFD(bnns_graph_compile_options_t options)
|
|
283
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
284
|
+
#endif
|
|
285
|
+
|
|
286
|
+
#pragma mark - Compilation
|
|
287
|
+
|
|
288
|
+
#if !0
|
|
289
|
+
|
|
290
|
+
/// Compiles the given mlmodelc to a `bnns_graph_t` object.
|
|
291
|
+
/// The resulting object may be written to disk and then mmap'd in and executed in a new process at a later time or consumed
|
|
292
|
+
/// immediately.
|
|
293
|
+
///
|
|
294
|
+
/// The user is responsible for calling `free` (by default) or `munmap` (if a file was specified via one of the
|
|
295
|
+
/// `BNNSGraphCompileOptionsSetOutputPath*` calls) once they are ready to release the object.
|
|
296
|
+
///
|
|
297
|
+
/// Arguments:
|
|
298
|
+
/// - `filename`: specifies the path to the mlmodelc.
|
|
299
|
+
/// - `function`: specifies the name of a specific function to be compiled. If all functions in the source file are to be compiled,
|
|
300
|
+
/// `NULL` or the empty string may be passed.
|
|
301
|
+
/// - `options`: specifies compilation options. If the user passes `NULL`, options are the default set of options.
|
|
302
|
+
///
|
|
303
|
+
/// Returns:
|
|
304
|
+
/// - Compiled graph on success, or `(bnns_graph_t) { .data = NULL, .size = 0 }` on failure.
|
|
305
|
+
bnns_graph_t BNNSGraphCompileFromFile(const char *_Nonnull filename,
|
|
306
|
+
const char *_Nullable function,
|
|
307
|
+
bnns_graph_compile_options_t options)
|
|
308
|
+
__asm__("_BNNSGraphCompileFromFile_v2")
|
|
309
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
310
|
+
|
|
311
|
+
#endif
|
|
312
|
+
|
|
313
|
+
#pragma mark - Graph query
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
/// Returns number of input arguments from a graph function.
|
|
317
|
+
///
|
|
318
|
+
/// Arguments:
|
|
319
|
+
/// - `graph`: object to query.
|
|
320
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
321
|
+
///
|
|
322
|
+
/// Returns:
|
|
323
|
+
/// The number of input arguments on success, or `SIZE_T_MAX` on failure.
|
|
324
|
+
size_t BNNSGraphGetInputCount(bnns_graph_t graph,
|
|
325
|
+
const char *_Nullable function)
|
|
326
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
327
|
+
|
|
328
|
+
/// Returns number of output arguments from a graph function.
|
|
329
|
+
///
|
|
330
|
+
/// Arguments:
|
|
331
|
+
/// - `graph`: object to query.
|
|
332
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
333
|
+
///
|
|
334
|
+
/// Returns:
|
|
335
|
+
/// The number of output arguments on success, or `SIZE_T_MAX` on failure.
|
|
336
|
+
size_t BNNSGraphGetOutputCount(bnns_graph_t graph,
|
|
337
|
+
const char *_Nullable function)
|
|
338
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
339
|
+
|
|
340
|
+
/// Returns total number of arguments for a graph function.
|
|
341
|
+
///
|
|
342
|
+
/// This will be the sum of values returned by `BNNSGraphGetInputCount` and `BNNSGraphGetOutputCount`.
|
|
343
|
+
///
|
|
344
|
+
/// Arguments:
|
|
345
|
+
/// - `graph`: object to query.
|
|
346
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
347
|
+
///
|
|
348
|
+
/// Returns:
|
|
349
|
+
/// The number of output arguments on success, or `SIZE_T_MAX` on failure.
|
|
350
|
+
size_t BNNSGraphGetArgumentCount(bnns_graph_t graph,
|
|
351
|
+
const char *_Nullable function)
|
|
352
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
353
|
+
|
|
354
|
+
/// Returns number of callable functions in this graph.
|
|
355
|
+
///
|
|
356
|
+
/// Arguments:
|
|
357
|
+
/// - `graph`: object to query.
|
|
358
|
+
///
|
|
359
|
+
/// Returns:
|
|
360
|
+
/// The number of callable functions on success, or `SIZE_T_MAX` on failure.
|
|
361
|
+
size_t BNNSGraphGetFunctionCount(bnns_graph_t graph)
|
|
362
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
363
|
+
|
|
364
|
+
/// Extracts argument names of inputs to a graph function
|
|
365
|
+
///
|
|
366
|
+
/// Arguments:
|
|
367
|
+
/// - `graph`: object to query.
|
|
368
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
369
|
+
/// - `input_names_count`: number of elements in `input_names`.
|
|
370
|
+
/// - `input_names`: array of string pointers to populate.
|
|
371
|
+
/// On exit `input_names[i]` will be set to a read-only pointer to a string containing
|
|
372
|
+
/// the i-th argument name, for i in [0, min(num_inputs, input_names_count)).
|
|
373
|
+
///
|
|
374
|
+
/// Returns:
|
|
375
|
+
/// 0 on success, nonzero on failure.
|
|
376
|
+
/// Failure may be caused by either invalid values of `graph` or `function`.
|
|
377
|
+
int BNNSGraphGetInputNames(bnns_graph_t graph,
|
|
378
|
+
const char *_Nullable function,
|
|
379
|
+
size_t input_names_count,
|
|
380
|
+
char const *_Nullable *_Nonnull input_names)
|
|
381
|
+
__asm__("_BNNSGraphGetInputNames_v2")
|
|
382
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
383
|
+
|
|
384
|
+
/// Extracts argument names of outputs to a graph function
|
|
385
|
+
///
|
|
386
|
+
/// Arguments:
|
|
387
|
+
/// - `graph`: object to query.
|
|
388
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
389
|
+
/// - `output_names_count`: number of elements in `output_names`.
|
|
390
|
+
/// - `output_names`: array of string pointers to populate.
|
|
391
|
+
/// On exit `output_names[i]` will be set to a read-only pointer to a string containing
|
|
392
|
+
/// the i-th argument name, for i in [0, min(num_outputs, output_names_count)).
|
|
393
|
+
///
|
|
394
|
+
/// Returns:
|
|
395
|
+
/// 0 on success, nonzero on failure.
|
|
396
|
+
/// Failure may be caused by either invalid values of `graph` or `function`.
|
|
397
|
+
int BNNSGraphGetOutputNames(bnns_graph_t graph,
|
|
398
|
+
const char *_Nullable function,
|
|
399
|
+
size_t output_names_count,
|
|
400
|
+
char const *_Nullable *_Nonnull output_names)
|
|
401
|
+
__asm__("_BNNSGraphGetOutputNames_v2")
|
|
402
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
403
|
+
|
|
404
|
+
/// Extracts names of argument to a graph function
|
|
405
|
+
///
|
|
406
|
+
/// This will be the concatenation of the results from `BNNSGraphGetOutputNames` and `BNNSGraphGetInputNames`
|
|
407
|
+
///
|
|
408
|
+
/// Arguments:
|
|
409
|
+
/// - `graph`: object to query.
|
|
410
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
411
|
+
/// - `argument_names_count`: number of elements in `argument_names`.
|
|
412
|
+
/// - `argument_names`: array of string pointers to populate.
|
|
413
|
+
/// On exit `argument_names[i]` will be set to a read-only pointer to a string containing
|
|
414
|
+
/// the i-th argument name, for i in [0, min(num_argument, argument_names_count)).
|
|
415
|
+
///
|
|
416
|
+
/// Returns:
|
|
417
|
+
/// 0 on success, nonzero on failure.
|
|
418
|
+
/// Failure may be caused by either invalid values of `graph` or `function`.
|
|
419
|
+
int BNNSGraphGetArgumentNames(bnns_graph_t graph,
|
|
420
|
+
const char *_Nullable function,
|
|
421
|
+
size_t argument_names_count,
|
|
422
|
+
char const *_Nullable *_Nonnull argument_names)
|
|
423
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
424
|
+
|
|
425
|
+
/// Extracts names of callable functions in the graph
|
|
426
|
+
///
|
|
427
|
+
/// Arguments:
|
|
428
|
+
/// - `graph`: object to query.
|
|
429
|
+
/// - `function_name_count`: number of elements in `function_names`
|
|
430
|
+
/// - `function_names`: array of string pointers to populate.
|
|
431
|
+
/// On exit `function_names[i]` will be set to a read-only pointer to a string containing
|
|
432
|
+
/// the i-th function name, for i in [0, min(num_functions, function_name_length)).
|
|
433
|
+
///
|
|
434
|
+
/// Returns:
|
|
435
|
+
/// 0 on success, nonzero on failure.
|
|
436
|
+
/// Failure may be caused by either invalid values of `graph`.
|
|
437
|
+
int BNNSGraphGetFunctionNames(bnns_graph_t graph,
|
|
438
|
+
size_t function_name_count,
|
|
439
|
+
char const *_Nullable *_Nonnull function_names)
|
|
440
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
441
|
+
|
|
442
|
+
/// Describes the intent of an argument
|
|
443
|
+
///
|
|
444
|
+
/// - `BNNSGraphArgumentIntentIn` - argument provides an input tensor
|
|
445
|
+
/// - `BNNSGraphArgumentIntentOut` - argument provide an output tensor
|
|
446
|
+
/// - `BNNSGraphArgumentIntentInOut` - argument is an input and then updated in-place to provide an output as well
|
|
447
|
+
BNNS_ENUM( BNNSGraphArgumentIntent, uint32_t,
|
|
448
|
+
BNNSGraphArgumentIntentIn __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 1,
|
|
449
|
+
BNNSGraphArgumentIntentOut __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 2,
|
|
450
|
+
BNNSGraphArgumentIntentInOut __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = BNNSGraphArgumentIntentIn | BNNSGraphArgumentIntentOut,
|
|
451
|
+
);
|
|
452
|
+
|
|
453
|
+
/// Returns intents of arguments
|
|
454
|
+
///
|
|
455
|
+
/// Arguments:
|
|
456
|
+
/// - `graph`: object to query.
|
|
457
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
458
|
+
/// - `argument_intents_count`: number of elements in `argument_intents`.
|
|
459
|
+
/// - `argument_intents`: array of intents to populate.
|
|
460
|
+
/// On exit `argument_intents[i]` will be set to a value indicating the intent of
|
|
461
|
+
/// the i-th argument name, for i in [0, min(num_argument, argument_intents_count)).
|
|
462
|
+
///
|
|
463
|
+
/// Returns:
|
|
464
|
+
/// 0 on success, nonzero on failure.
|
|
465
|
+
/// Failure may be caused by either invalid values of `graph` or `function`.
|
|
466
|
+
int BNNSGraphGetArgumentIntents(bnns_graph_t graph,
|
|
467
|
+
const char *_Nullable function,
|
|
468
|
+
size_t argument_intents_count,
|
|
469
|
+
BNNSGraphArgumentIntent *_Nonnull argument_intents)
|
|
470
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
471
|
+
|
|
472
|
+
/// Returns index into arguments[] array for given function argument.
|
|
473
|
+
///
|
|
474
|
+
/// Returns the position in the arguments[] array for a call to `BNNSGraphExecute` or `BNNSGraphContextExecute` for the given argument.
|
|
475
|
+
///
|
|
476
|
+
/// Arguments:
|
|
477
|
+
/// - `graph`: object to query.
|
|
478
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
479
|
+
/// - `argument`: name of input/output argument to query
|
|
480
|
+
///
|
|
481
|
+
/// Returns:
|
|
482
|
+
/// Index of argument on success, or `SIZE_T_MAX` on failure.
|
|
483
|
+
size_t BNNSGraphGetArgumentPosition(const bnns_graph_t graph,
|
|
484
|
+
const char *_Nullable function,
|
|
485
|
+
const char *_Nonnull argument)
|
|
486
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
487
|
+
|
|
488
|
+
/// Returns the interleave factors for arguments, if present
|
|
489
|
+
///
|
|
490
|
+
/// If any arguments to the function are specified with an interleave factor (e.g. using
|
|
491
|
+
/// the `interleave` option to `tensor_buffer` in MIL), this function can be
|
|
492
|
+
/// used to retrieve the interleave factor array.
|
|
493
|
+
///
|
|
494
|
+
/// Arguments:
|
|
495
|
+
/// - `graph`: object to query.
|
|
496
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
497
|
+
/// - `argument_count`: number of elements in `argument_interleave` and in `argument_interleave_counts`.
|
|
498
|
+
/// - `argument_interleave`: array of pointers to interleave factors to populate.
|
|
499
|
+
/// On exit `argument_interleave[i]` will be set to either:
|
|
500
|
+
/// - `NULL` if argument `i` has no interleave factor; or
|
|
501
|
+
/// - a pointer into the graph object containing the interleave factors that contains `argument_interleave_counts[i]` elements.
|
|
502
|
+
/// Only the first [0, min(argument_count, argument_interleave)) entries are set.
|
|
503
|
+
/// - `argument_interleave_counts`: gives the size of the array pointed to by `argument_interleave[i]`, or is set to 0
|
|
504
|
+
/// if `argument_interleave[i]` is set to `NULL`.
|
|
505
|
+
///
|
|
506
|
+
/// Returns:
|
|
507
|
+
/// 0 on success, nonzero on failure.
|
|
508
|
+
/// Failure may be caused by either invalid values of `graph` or `function`.
|
|
509
|
+
int BNNSGraphGetArgumentInterleaveFactors(bnns_graph_t graph,
|
|
510
|
+
const char *_Nullable function,
|
|
511
|
+
size_t argument_count,
|
|
512
|
+
const uint16_t *_Nullable *_Nonnull argument_interleave,
|
|
513
|
+
size_t *_Nonnull argument_interleave_counts)
|
|
514
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
515
|
+
|
|
516
|
+
#pragma mark - Execution - without context
|
|
517
|
+
|
|
518
|
+
/// Used to specify the interpretation of the `arguments` argument to `BNNSGraphContextExecute()`.
|
|
519
|
+
/// `BNNSGraphArgumentTypePointer`: arguments[i] is a pointer to the raw data for the tensor
|
|
520
|
+
/// `BNNSGraphArgumentTypeTensor`: arguments[i] is a pointer to a BNNSTensor
|
|
521
|
+
/// The layout and sizes of inputs must either be zero, or must match the source model.
|
|
522
|
+
/// The layout and sizes of the output will be set by `BNNSGraphContextExecute()`.
|
|
523
|
+
BNNS_ENUM(BNNSGraphArgumentType, uint32_t,
|
|
524
|
+
BNNSGraphArgumentTypePointer __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 0,
|
|
525
|
+
BNNSGraphArgumentTypeTensor __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = 2,
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
/// Describes data associated with an input or output argument
|
|
529
|
+
///
|
|
530
|
+
/// Exactly one of descriptor or data_ptr should be set based on the configuration specified with `BNNSGraphContextSetArgumentType()`
|
|
531
|
+
typedef struct {
|
|
532
|
+
union {
|
|
533
|
+
BNNSTensor *_Nullable tensor; ///< Pointer to BNNSTensor
|
|
534
|
+
BNNSNDArrayDescriptor *_Nullable descriptor; ///< Pointer to BNNSNDArrayDescriptor (deprecated, use BNNSTensor instead)
|
|
535
|
+
void *_Nullable data_ptr; ///< Direct pointer to numerical data
|
|
536
|
+
};
|
|
537
|
+
size_t data_ptr_size; ///< size in bytes of `data_ptr`, if set
|
|
538
|
+
} bnns_graph_argument_t;
|
|
539
|
+
|
|
540
|
+
#pragma mark - Graph Context
|
|
541
|
+
|
|
542
|
+
/// Allocates and initializes a `bnns_graph_context_t`
|
|
543
|
+
///
|
|
544
|
+
/// Arguments:
|
|
545
|
+
/// - `graph`: object to be wrapped into the context. Must remain valid for the lifetime of returned context.
|
|
546
|
+
///
|
|
547
|
+
/// Returns:
|
|
548
|
+
/// - New context on success, or `(bnns_graph_context_t) { .data = NULL, .size = 0 }` on failure.
|
|
549
|
+
/// The object must be destroyed through a call to `BNNSGraphContextDestroy`.
|
|
550
|
+
///
|
|
551
|
+
/// @seealso `BNNSGraphContextDestroy`
|
|
552
|
+
bnns_graph_context_t BNNSGraphContextMake(const bnns_graph_t graph)
|
|
553
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
554
|
+
|
|
555
|
+
/// Make a new graph context with streaming support for the given function
|
|
556
|
+
///
|
|
557
|
+
/// Use this function in place of `BNNSGraphContextMake` to create a context for use with a model
|
|
558
|
+
/// compiled with the `BNNSOption` attribute `StateMode=Streaming` enabled. In addition to the
|
|
559
|
+
/// regular work performed by `BNNSGraphContextMake`, this call will also allocate ring-buffer
|
|
560
|
+
/// backed memory for all inout (i.e. CoreML `state`) arguments of the given function. Calls to
|
|
561
|
+
/// `BNNSGraphContextExecute()` with this function will ignore any user-provided pointers for
|
|
562
|
+
/// inout arguments and will use the internal ring-buffer instead. Upon return from the call, any
|
|
563
|
+
/// user-provided `bnns_argument_t` will be set to point to the ring-buffer memory.
|
|
564
|
+
/// The internal ring buffer will then be advanced by the distance determined by analysis of the compiled
|
|
565
|
+
/// program ready for use in the next frame.
|
|
566
|
+
///
|
|
567
|
+
/// If the function was not compiled with the BNNSOption parameter StateMode=Streaming, this call will fail.
|
|
568
|
+
///
|
|
569
|
+
/// If a state does not appear in the `initial_states` list, it will be initialized to all zeros.
|
|
570
|
+
///
|
|
571
|
+
/// Arguments:
|
|
572
|
+
/// - `graph`: object to be wrapped into the context. Must remain valid for the lifetime of returned context.
|
|
573
|
+
/// - `function`: function to initialize state for. It may be `NULL` if there is only one function.
|
|
574
|
+
/// - `initial_states_count`: Number of initial states contained in the array `inital_states`. May be 0.
|
|
575
|
+
/// - `initial_states`: Array of BNNSTensors describing data to be used to initialize each state.
|
|
576
|
+
/// `initial_state[i]` is used to intialize the state with name
|
|
577
|
+
/// `initial_state[i]->name`.
|
|
578
|
+
///
|
|
579
|
+
/// Returns:
|
|
580
|
+
/// - New context on success, or `(bnns_graph_context_t) { .data = NULL, .size = 0 }` on failure.
|
|
581
|
+
/// The object must be destroyed through a call to `BNNSGraphContextDestroy`.
|
|
582
|
+
bnns_graph_context_t BNNSGraphContextMakeStreaming(bnns_graph_t graph,
|
|
583
|
+
const char *_Nullable function,
|
|
584
|
+
size_t initial_states_count,
|
|
585
|
+
BNNSTensor const *_Nullable initial_states)
|
|
586
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
587
|
+
|
|
588
|
+
/// Destroys a graph context created through a call to `BNNSGraphContextMake` or `BNNSGraphContextMakeStreaming`
|
|
589
|
+
///
|
|
590
|
+
/// Arguments:
|
|
591
|
+
/// `context`: object to be destroyed
|
|
592
|
+
void BNNSGraphContextDestroy(bnns_graph_context_t context)
|
|
593
|
+
__asm__("_BNNSGraphContextDestroy_v2")
|
|
594
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
595
|
+
|
|
596
|
+
/// Specifies the dynamic shapes for a graph and infers (if possible) output shapes
|
|
597
|
+
///
|
|
598
|
+
/// Notes:
|
|
599
|
+
/// - It is an error to call this function before all existing calls to `BNNSGraphContextExecute()` using the same context complete.
|
|
600
|
+
/// - Required workspace size for `BNNSGraphContextExecute()` may change as a result of this call.
|
|
601
|
+
/// - This function does not set dynamic strides as required by some arguments.
|
|
602
|
+
/// Arguments with dynamic strides must be provided as `BNNSTensor`s.
|
|
603
|
+
/// Use `BNNSGraphContextSetArgumentType` to set the argument type to `BNNSGraphArgumentTypeTensor`, and provide
|
|
604
|
+
/// `BNNSTensor` pointers in `bnns_graph_argument_t`.
|
|
605
|
+
///
|
|
606
|
+
/// Arguments:
|
|
607
|
+
/// - `context`: context for which to set dynamic shapes
|
|
608
|
+
/// - `function`: specific function to be set shapes for. It may be `NULL` if there is only one function.
|
|
609
|
+
/// - `shapes_count`: number of elements in array shapes
|
|
610
|
+
/// - `shapes`: array of shapes for outputs and inputs, in the same order as will be passed for `BNNSGraphContextExecute()`
|
|
611
|
+
/// On entry, input shapes are read from this array, unless indicated otherwise by setting `shapes[idx].rank = 0`, in which
|
|
612
|
+
/// case the constant or default value from the source model will be used. If a non-zero value is specified that does not match a constant
|
|
613
|
+
/// size in the source model, an error is generated. Output shapes are not read.
|
|
614
|
+
/// On exit, output shapes that have `shapes[idx].rank != 0` will be set to an upper bound on the expected output shape.
|
|
615
|
+
/// If the output shape cannot be deduced as it depends on input data values, the value of `shapes[idx].size[d]` will be set
|
|
616
|
+
/// to zero for that dimension.
|
|
617
|
+
///
|
|
618
|
+
/// Returns:
|
|
619
|
+
/// - `0` on success if all tensor shapes were exactly determined (workspace size is exact)
|
|
620
|
+
/// - `1` on success if one or more tensor shapes are merely bounds, but no tensor is unbounded (workspace size is bounded)
|
|
621
|
+
/// - `2` on success if one or more tensor shapes are unbounded (BNNS will need to allocate during execution)
|
|
622
|
+
/// - `< 0` on failure.
|
|
623
|
+
int BNNSGraphContextSetDynamicShapes(bnns_graph_context_t context,
|
|
624
|
+
char const *_Nullable function,
|
|
625
|
+
size_t shapes_count,
|
|
626
|
+
bnns_graph_shape_t *_Nonnull shapes)
|
|
627
|
+
__asm__("_BNNSGraphContextSetDynamicShapes_v2")
|
|
628
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
629
|
+
|
|
630
|
+
/// Sets the batch size for a graph
|
|
631
|
+
///
|
|
632
|
+
/// This is a special case of `BNNSGraphContextSetDynamicShapes()` where the only dynamic sizes that occur are the first index
|
|
633
|
+
/// of their tensor (i.e. the batch dimension) and are all equal. This allows just passing a single `batch_size` constant.
|
|
634
|
+
///
|
|
635
|
+
/// Notes:
|
|
636
|
+
/// - It is an error to call this function before all existing calls to `BNNSGraphContextExecute()` complete.
|
|
637
|
+
/// - Required workspace size for `BNNSGraphContextExecute()` may change as a result of this call.
|
|
638
|
+
/// - If the graph has dynamic sizes other than batch size, then `BNNSGraphContextSetDynamicShapes()` must be used instead
|
|
639
|
+
/// - This function does not set dynamic strides as required by some arguments.
|
|
640
|
+
/// Arguments with dynamic strides must be provided as `BNNSTensor`s.
|
|
641
|
+
/// Use `BNNSGraphContextSetArgumentType` to set the argument type to `BNNSGraphArgumentTypeTensor`, and provide
|
|
642
|
+
/// `BNNSTensor` pointers in `bnns_graph_argument_t`.
|
|
643
|
+
///
|
|
644
|
+
/// Arguments:
|
|
645
|
+
/// - `context`: context for which to set dynamic shapes
|
|
646
|
+
/// - `function`: specific function to be set shapes for. It may be `NULL` if there is only one function.
|
|
647
|
+
/// - `batch_size`: the batch size to set
|
|
648
|
+
///
|
|
649
|
+
/// Returns:
|
|
650
|
+
/// - 0 on success, non-zero on failure
|
|
651
|
+
int BNNSGraphContextSetBatchSize(bnns_graph_context_t context,
|
|
652
|
+
char const *_Nullable function,
|
|
653
|
+
uint64_t batch_size)
|
|
654
|
+
__asm__("_BNNSGraphContextSetBatchSize_v2")
|
|
655
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
656
|
+
|
|
657
|
+
/// Sets the type used to interpret the `arguments` argument to `BNNSGraphContextExecute()`.
|
|
658
|
+
///
|
|
659
|
+
/// Notes:
|
|
660
|
+
/// - Some arguments require dynamic strides. These must be provided as `BNNSTensor`s.
|
|
661
|
+
/// Use `BNNSGraphContextSetArgumentType` to set the argument type to `BNNSGraphArgumentTypeTensor`, and provide
|
|
662
|
+
/// `BNNSTensor` pointers in `bnns_graph_argument_t`.
|
|
663
|
+
///
|
|
664
|
+
/// Arguments:
|
|
665
|
+
/// - `context`: for which to enable signposts
|
|
666
|
+
/// - `argument_type`: argument type to set, default is `BNNSGraphArgumentTypePointer`
|
|
667
|
+
///
|
|
668
|
+
/// Returns:
|
|
669
|
+
/// - 0 on success, non-zero on failure
|
|
670
|
+
int BNNSGraphContextSetArgumentType(bnns_graph_context_t context,
|
|
671
|
+
BNNSGraphArgumentType argument_type)
|
|
672
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
673
|
+
|
|
674
|
+
/// Enables debug mode, checks intermediate tensors for nans and infs.
|
|
675
|
+
/// Not for use in production code.
|
|
676
|
+
void BNNSGraphContextEnableNanAndInfChecks(bnns_graph_context_t context,
|
|
677
|
+
bool enable_check_for_nans_inf)
|
|
678
|
+
__asm__("_BNNSGraphContextEnableNanAndInfChecks")
|
|
679
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
680
|
+
|
|
681
|
+
/// Sets streaming advancement amount for cases with dynamically shaped inputs.
|
|
682
|
+
///
|
|
683
|
+
/// For models compiled with the `BNNSOption` attribute `StateMode=Streaming` enabled, where
|
|
684
|
+
/// `slice_update` ops use an update parameter of dynamic shape, BNNS cannot unambigiously
|
|
685
|
+
/// determine the streaming advancement size. Instead the user must use this function *prior* to calling
|
|
686
|
+
/// `BNNSGraphContextExecute()` to set the advancement size for each frame.
|
|
687
|
+
///
|
|
688
|
+
/// The internal state pointer will then be advanced by `advance_count` elements in the streaming
|
|
689
|
+
/// dimension prior to returning from `BNNSGraphContextExecute()`. The BNNS streaming APIs
|
|
690
|
+
/// do not support models that require different advancement amounts for different states.
|
|
691
|
+
int BNNSGraphContextSetStreamingAdvanceCount(const bnns_graph_context_t context,
|
|
692
|
+
size_t advance_count)
|
|
693
|
+
__API_AVAILABLE(macos(15.4), ios(18.4), watchos(11.4), tvos(18.4));
|
|
694
|
+
|
|
695
|
+
#pragma mark - Execution - with Graph Context
|
|
696
|
+
|
|
697
|
+
/// Executes the specified function with the provided context
|
|
698
|
+
///
|
|
699
|
+
/// The same context must only be used by a single thread at a time.
|
|
700
|
+
///
|
|
701
|
+
/// If the underlying model contains dynamic shaped inputs or outputs, these must be set prior to calling this routine through a call
|
|
702
|
+
/// to either `BNNSGraphContextSetDynamicShapes` or `BNNSGraphContextSetBatchSize`. The shapes should not
|
|
703
|
+
/// be modified again until this routine has returned.
|
|
704
|
+
///
|
|
705
|
+
/// This routine performs no memory allocation if the following conditions are met:
|
|
706
|
+
/// - workspace is not `NULL`.
|
|
707
|
+
/// - the graph does not contain tensors whose shape BNNS could not bound prior to this call.
|
|
708
|
+
/// - no new shape information is supplied via `arguments`.
|
|
709
|
+
/// - all output storage is provided explicitly by the user.
|
|
710
|
+
/// If any of these points is not the case, the user may control allocation by registering suitable callbacks via the functions
|
|
711
|
+
/// `BNNSGraphContextSetWorkspaceAllocationCallback` and `BNNSGraphContextSetOutputAllocationCallback`.
|
|
712
|
+
///
|
|
713
|
+
/// If the output allocation policy has been set to `bnns_managed=true`, the context must not be used in another call to
|
|
714
|
+
/// `BNNSGraphContextExecute` until the outputs are no longer needed (as they may be reused or deallocated).
|
|
715
|
+
///
|
|
716
|
+
/// Arguments:
|
|
717
|
+
/// - `context`: is the context to be executed.
|
|
718
|
+
/// - `function`: specific function to be executed. It may be `NULL` if there is only one function.
|
|
719
|
+
/// - `argument_count`: number of elements in `arguments`.
|
|
720
|
+
/// - `arguments`: array of `bnns_graph_argument_t` objects supply input data and memory allocated to hold the output.
|
|
721
|
+
/// Arguments are ordered such that outputs precede inputs, in the same order as they appear the source function's output and input
|
|
722
|
+
/// blocks. The position of an argument can be looked up by its source name using the BNNSGraphGetArgumentPosition() function.
|
|
723
|
+
/// If `.data_ptr=NULL` or `.tensor.data=NULL` for an output, one will be allocated for the user.
|
|
724
|
+
/// - `workspace_size`: size in bytes of `workspace`, or zero if `workspace==NULL`.
|
|
725
|
+
/// - `workspace`: scratch memory to be used during execution. MUST be page-aligned.
|
|
726
|
+
/// May be freed or reused by the user upon return.
|
|
727
|
+
/// If `NULL` is passed, the routine will allocate its own workspace.
|
|
728
|
+
///
|
|
729
|
+
/// Returns:
|
|
730
|
+
/// - 0 on success, non-zero on failure
|
|
731
|
+
///
|
|
732
|
+
/// @seealso `BNNSGraphContextMake`, `BNNSGraphContextGetWorkspaceSize`,
|
|
733
|
+
/// `BNNSGraphContextSetArgumentType`, `BNNSGraphContextSetDynamicShapes`
|
|
734
|
+
int BNNSGraphContextExecute(bnns_graph_context_t context,
|
|
735
|
+
const char *_Nullable function,
|
|
736
|
+
size_t argument_count,
|
|
737
|
+
bnns_graph_argument_t *_Nonnull arguments,
|
|
738
|
+
size_t workspace_size,
|
|
739
|
+
char* _Nullable workspace)
|
|
740
|
+
__asm__("_BNNSGraphContextExecute_v2")
|
|
741
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
742
|
+
|
|
743
|
+
/// Returns the minimum size in bytes of the workspace argument that should be passed to `BNNSGraphContextExecute()`.
|
|
744
|
+
///
|
|
745
|
+
/// If `BNNSGraphContextSetBatchSize` or `BNNSGraphContextSetDynamicShapes` is called, then this function
|
|
746
|
+
/// should be call afterwards to obtain a new workspace size.
|
|
747
|
+
/// Due to memory layout algorithms being heuristic in nature, there is no guarantee that workspace size is monotonic
|
|
748
|
+
/// with any dynamic size. That is to say that the case with the maximum dynamic size may not be an upper bound on workspace
|
|
749
|
+
/// required for smaller sizes.
|
|
750
|
+
///
|
|
751
|
+
/// Arguments:
|
|
752
|
+
/// - `graph`: is the graph to be executed
|
|
753
|
+
/// - `function`: specific function to be executed. It may be `NULL` if there is only one function.
|
|
754
|
+
///
|
|
755
|
+
/// Returns:
|
|
756
|
+
/// - size in bytes of required workspace, or `SIZE_T_MAX` on failure (invalid graph, invalid function, or function contains dynamic shapes).
|
|
757
|
+
size_t BNNSGraphContextGetWorkspaceSize(bnns_graph_context_t context,
|
|
758
|
+
const char *_Nullable function)
|
|
759
|
+
__asm__("_BNNSGraphContextGetWorkspaceSize_v2")
|
|
760
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
761
|
+
|
|
762
|
+
#pragma mark - Graph Context Query
|
|
763
|
+
|
|
764
|
+
/// Fills tensor descriptor for a given function argument.
|
|
765
|
+
///
|
|
766
|
+
/// If the shape has been modified for this context, such as by calling `BNNSGraphContextSetDynamicShapes()`,
|
|
767
|
+
/// then this routine will return that modified shape.
|
|
768
|
+
///
|
|
769
|
+
/// Arguments:
|
|
770
|
+
/// - `context`: object to query.
|
|
771
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
772
|
+
/// - `argument`: name of input/output argument to query
|
|
773
|
+
/// - `fill_known_dynamic_shapes`: if `true`, any dynamic shapes are replaced with shapes that will be used on next
|
|
774
|
+
/// execution of `context`, either drawn from default shapes in the source model or supplied by a preceding call to
|
|
775
|
+
/// `BNNSGraphContextSetDynamicShapes()` or `BNNSGraphContextSetBatchSize()`.
|
|
776
|
+
/// Otherwise dynamically-sized dimensions are indicated by a value of -1 in shape/stride as appropriate.
|
|
777
|
+
/// - `tensor`: pointer to `BNNSTensor` to be filled by this routine.
|
|
778
|
+
/// On return all fields except `.data` and `.data_size_in_bytes` will have been populated.
|
|
779
|
+
///
|
|
780
|
+
/// Returns:
|
|
781
|
+
/// 0 on success and a non-zero on failure.
|
|
782
|
+
int BNNSGraphContextGetTensor(bnns_graph_context_t context,
|
|
783
|
+
const char *_Nullable function,
|
|
784
|
+
const char *_Nonnull argument,
|
|
785
|
+
bool fill_known_dynamic_shapes,
|
|
786
|
+
BNNSTensor *_Nonnull tensor)
|
|
787
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
788
|
+
|
|
789
|
+
/// Fills the strides member of a BNNSTensor for compatibility with a given model input or output based on its current shape
|
|
790
|
+
///
|
|
791
|
+
/// All sizes must be fully specified (i.e. not `< 0`). If the input or output is a tensor, contiguous strides will be filled in.
|
|
792
|
+
/// If the input or output is a tensor buffer, the strides will be filled in according to the specification in the model that was
|
|
793
|
+
/// compiled to the given graph.
|
|
794
|
+
///
|
|
795
|
+
/// Arguments:
|
|
796
|
+
/// - `graph`: ir to query.
|
|
797
|
+
/// - `function`: function to query. It may be `NULL` if there is only one function.
|
|
798
|
+
/// - `argument`: name of input/output argument to query
|
|
799
|
+
/// - `tensor`: pointer to `BNNSTensor` to be filled by this routine.
|
|
800
|
+
/// On return the first `tensor.rank` elements will have been overwritten with the strides BNNS expects.
|
|
801
|
+
///
|
|
802
|
+
/// Returns:
|
|
803
|
+
/// 0 on success and a non-zero on failure.
|
|
804
|
+
int BNNSGraphTensorFillStrides(bnns_graph_t graph,
|
|
805
|
+
const char *_Nullable function,
|
|
806
|
+
const char *_Nonnull argument,
|
|
807
|
+
BNNSTensor *_Nonnull tensor)
|
|
808
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
809
|
+
|
|
810
|
+
#pragma mark - Graph Context Memory Management
|
|
811
|
+
|
|
812
|
+
/// Sets allocation/free callbacks for internal workspace
|
|
813
|
+
///
|
|
814
|
+
/// In the case that the required workspace cannot be bounded prior to execution (for example if tensor sizes depend on the
|
|
815
|
+
/// input data), BNNS will need to allocate workspace during execution. If the user wishes to override BNNS's default memory
|
|
816
|
+
/// allocation mechanism, they may provide allocation and free routines here.
|
|
817
|
+
///
|
|
818
|
+
/// Note that the `free` function will typically only be called when the context is destroyed, however workspace is only
|
|
819
|
+
/// required during the actual execution. As such users may wish to make memory in this allocation purgable or free it
|
|
820
|
+
/// between calls to `BNNSGraphContextExecute()`.
|
|
821
|
+
///
|
|
822
|
+
/// If the same value of `user_memory_context` is supplied to both `BNNSGraphContextSetWorkspaceAllocationCallback`
|
|
823
|
+
/// and to `BNNSGraphContextSetOutputAllocationCallback`, the `free` function will only be called once rather than twice.
|
|
824
|
+
///
|
|
825
|
+
/// Arguments:
|
|
826
|
+
/// - `context`: context to set callbacks for
|
|
827
|
+
/// - `realloc`: routine for (re)allocation of workspace. If `NULL` is passed then `free` must also be `NULL`, and routine will
|
|
828
|
+
/// reset context to the default BNNS allocation mechanism.
|
|
829
|
+
/// - `free`: routine to free all previous allocated data. Must match nullity of `realloc`. If `NULL` is passed then `realloc`
|
|
830
|
+
/// must also be `NULL`, and routine will reset context to the default BNNS allocation mechanism.
|
|
831
|
+
/// - `user_memory_context_size`: size in bytes of `user_memory_context`
|
|
832
|
+
/// - `user_memory_context`: pointer that will be passed unmodified by BNNS in all calls to `realloc` and `free`
|
|
833
|
+
///
|
|
834
|
+
/// Returns:
|
|
835
|
+
/// - 0 on success, non-zero on failure
|
|
836
|
+
int BNNSGraphContextSetWorkspaceAllocationCallback(bnns_graph_context_t context,
|
|
837
|
+
bnns_graph_realloc_fn_t _Nullable realloc,
|
|
838
|
+
bnns_graph_free_all_fn_t _Nullable free,
|
|
839
|
+
size_t user_memory_context_size,
|
|
840
|
+
void *_Nullable user_memory_context)
|
|
841
|
+
__asm__("_BNNSGraphContextSetWorkspaceAllocationCallback_v2")
|
|
842
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
843
|
+
|
|
844
|
+
/// Sets allocation/free callbacks for function outputs
|
|
845
|
+
///
|
|
846
|
+
/// In the case that the output shape cannot be bounded prior to execution, the user may pass a NULL data pointer, and BNNS
|
|
847
|
+
/// will allocation the memory within the given context. If the user wishes to override BNNS's default memory
|
|
848
|
+
/// allocation mechanism for outputs, they may provide allocation and free routines here.
|
|
849
|
+
///
|
|
850
|
+
/// If the same value of `user_memory_context` is supplied to both `BNNSGraphContextSetWorkspaceAllocationCallback`
|
|
851
|
+
/// and to `BNNSGraphContextSetOutputAllocationCallback`, the `free` function will only be called once rather than twice.
|
|
852
|
+
///
|
|
853
|
+
/// Arguments:
|
|
854
|
+
/// - `context`: context to set callbacks for
|
|
855
|
+
/// - `realloc`: routine for (re)allocation of outputs. If `NULL` is passed then `free` must also be `NULL`, and routine will
|
|
856
|
+
/// reset context to the default BNNS allocation mechanism.
|
|
857
|
+
/// - `free`: routine to free all previous allocated data. Must match nullity of `realloc`. If `NULL` is passed then `realloc`
|
|
858
|
+
/// must also be `NULL`, and routine will reset context to the default BNNS allocation mechanism.
|
|
859
|
+
/// - `user_memory_context_size`: size in bytes of `user_memory_context`
|
|
860
|
+
/// - `user_memory_context`: pointer that will be passed unmodified by BNNS in all calls to `realloc` and `free`
|
|
861
|
+
///
|
|
862
|
+
/// Returns:
|
|
863
|
+
/// - 0 on success, non-zero on failure
|
|
864
|
+
int BNNSGraphContextSetOutputAllocationCallback(bnns_graph_context_t context,
|
|
865
|
+
bnns_graph_realloc_fn_t _Nullable realloc,
|
|
866
|
+
bnns_graph_free_all_fn_t _Nullable free,
|
|
867
|
+
size_t user_memory_context_size,
|
|
868
|
+
void *_Nullable user_memory_context)
|
|
869
|
+
__asm__("_BNNSGraphContextSetOutputAllocationCallback_v2")
|
|
870
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
871
|
+
|
|
872
|
+
/// Execution time message logging callback setter
|
|
873
|
+
///
|
|
874
|
+
/// Specifies customized callback function for execution-time message reporting.
|
|
875
|
+
/// When unspecified, default callback functions log messages onto `os_log`.
|
|
876
|
+
///
|
|
877
|
+
/// - `context`: context to set callbacks for
|
|
878
|
+
/// - `log_callback_fn`: routine that customizes the message reporting for all execution-time routines
|
|
879
|
+
/// - `additional_logging_arguments`: additional user-set data for the message logging functions to pass onto the callback functions unaltered
|
|
880
|
+
int BNNSGraphContextSetMessageLogCallback(bnns_graph_context_t context,
|
|
881
|
+
bnns_graph_execute_message_fn_t _Nonnull log_callback_fn,
|
|
882
|
+
bnns_user_message_data_t * _Nullable additional_logging_arguments)
|
|
883
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
884
|
+
|
|
885
|
+
/// Sets mask for log messages that are logged (either via `os_log` or the user specified callback)
|
|
886
|
+
///
|
|
887
|
+
/// - `context`: context to set callbacks for
|
|
888
|
+
/// - `log_level_mask`: bitmask of levels to log for
|
|
889
|
+
/// (Default is BNNSGraphMessageLevelUnsupported | BNNSGraphMessageLevelWarning | BNNSGraphMessageLevelError)
|
|
890
|
+
int BNNSGraphContextSetMessageLogMask(bnns_graph_context_t context,
|
|
891
|
+
uint32_t log_level_mask)
|
|
892
|
+
__API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
|
|
893
|
+
|
|
894
|
+
#ifdef __cplusplus
|
|
895
|
+
} // extern "C"
|
|
896
|
+
#endif
|
|
897
|
+
|
|
898
|
+
#if __has_feature(assume_nonnull)
|
|
899
|
+
_Pragma("clang assume_nonnull end")
|
|
900
|
+
#else
|
|
901
|
+
#undef _Nullable
|
|
902
|
+
#undef _Null_unspecified
|
|
903
|
+
#undef _Nonnull
|
|
904
|
+
#endif
|
|
905
|
+
|
|
906
|
+
#undef BNNS_ENUM
|
|
907
|
+
|
|
908
|
+
#if !__has_include( <Availability.h> )
|
|
909
|
+
#undef __API_AVAILABLE
|
|
910
|
+
#undef __API_DEPRECATED_WITH_REPLACEMENT
|
|
911
|
+
#endif
|
|
912
|
+
|
|
913
|
+
#endif /* __BNNS_GRAPH_HEADER__ */
|