From 9dc83fa1e6f07caea704139297e98286eb13096c Mon Sep 17 00:00:00 2001 From: liuruilong Date: Fri, 10 Aug 2018 20:17:56 +0800 Subject: [PATCH] add ios gpu demo --- metal/Podfile | 5 + .../project.pbxproj | 8 + .../xcschemes/paddle-mobile-demo.xcscheme | 2 +- .../xcschemes/xcschememanagement.plist | 2 +- .../Base.lproj/Main.storyboard | 165 ++++++- .../paddle-mobile-demo/Info.plist | 4 + .../paddle-mobile-demo/MetalHelper.swift | 29 +- .../paddle-mobile-demo/ModelHelper.swift | 89 ++++ .../paddle-mobile-demo/ViewController.swift | 187 +++++--- .../project.pbxproj | 428 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../UserInterfaceState.xcuserstate | Bin 0 -> 5178 bytes .../xcschemes/xcschememanagement.plist | 14 + .../paddle-mobile-unit-test/AppDelegate.swift | 46 ++ .../AppIcon.appiconset/Contents.json | 98 ++++ .../Assets.xcassets/Contents.json | 6 + .../Base.lproj/LaunchScreen.storyboard | 25 + .../Base.lproj/Main.storyboard | 24 + .../paddle-mobile-unit-test/Info.plist | 45 ++ .../ViewController.swift | 20 + .../xcschemes/paddle-mobile.xcscheme | 80 ++++ .../xcschemes/xcschememanagement.plist | 10 +- .../paddle-mobile/Executor.swift | 15 +- .../paddle-mobile/paddle-mobile/Loader.swift | 2 +- .../Operators/Kernels/ConvAddKernel.swift | 1 - .../Operators/Kernels/PoolKernel.swift | 1 - .../Operators/Kernels/ReshapeKernel.swift | 1 - .../Operators/Kernels/SoftmaxKernel.swift | 1 - .../paddle-mobile/Program/Scope.swift | 3 + .../paddle-mobile/framework/Tensor.swift | 2 +- 31 files changed, 1247 insertions(+), 81 deletions(-) create mode 100644 metal/paddle-mobile-demo/paddle-mobile-demo/ModelHelper.swift create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/Contents.json create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/LaunchScreen.storyboard create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/Main.storyboard create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Info.plist create mode 100644 metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift create mode 100644 metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile.xcscheme diff --git a/metal/Podfile b/metal/Podfile index 87b3324209..6e9a6c6e37 100644 --- a/metal/Podfile +++ b/metal/Podfile @@ -12,3 +12,8 @@ target 'paddle-mobile' do project 'paddle-mobile/paddle-mobile.xcodeproj' pod 'SwiftProtobuf', '~> 1.0' end + +target 'paddle-mobile-unit-test' do + project 'paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj' + pod 'SwiftProtobuf', '~> 1.0' +end diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj index e224d50427..9f8c94edcc 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/project.pbxproj @@ -218,6 +218,8 @@ FC3602C82108580600FACB58 /* MetalHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC3602C72108580600FACB58 /* MetalHelper.swift */; }; FCD04E6320F3146B0007374F /* params in Resources */ = {isa = PBXBuildFile; fileRef = FCD04E6120F3146A0007374F /* params */; }; FCD04E6420F3146B0007374F /* model in Resources */ = {isa = PBXBuildFile; fileRef = FCD04E6220F3146A0007374F /* model */; }; + FCDFD3FB211D72C3005AB38B /* ModelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCDFD3FA211D72C3005AB38B /* ModelHelper.swift */; }; + FCDFD41B211D91C7005AB38B /* synset.txt in Resources */ = {isa = PBXBuildFile; fileRef = FCDFD41A211D91C7005AB38B /* synset.txt */; }; FCEBEC2C20E1391F00C0B14D /* paddle_mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FCEBEC2B20E1391F00C0B14D /* paddle_mobile.framework */; }; FCEBEC2D20E1391F00C0B14D /* paddle_mobile.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FCEBEC2B20E1391F00C0B14D /* paddle_mobile.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; FCEEE7D4210627A000444BEC /* banana.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = FCEEE7D3210627A000444BEC /* banana.jpeg */; }; @@ -453,6 +455,8 @@ FC3602C72108580600FACB58 /* MetalHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MetalHelper.swift; sourceTree = ""; }; FCD04E6120F3146A0007374F /* params */ = {isa = PBXFileReference; lastKnownFileType = file; path = params; sourceTree = ""; }; FCD04E6220F3146A0007374F /* model */ = {isa = PBXFileReference; lastKnownFileType = file; path = model; sourceTree = ""; }; + FCDFD3FA211D72C3005AB38B /* ModelHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelHelper.swift; sourceTree = ""; }; + FCDFD41A211D91C7005AB38B /* synset.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = synset.txt; sourceTree = ""; }; FCEBEC2B20E1391F00C0B14D /* paddle_mobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = paddle_mobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; FCEEE7D3210627A000444BEC /* banana.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = banana.jpeg; sourceTree = ""; }; /* End PBXFileReference section */ @@ -519,6 +523,7 @@ FC039B8A20E11C560081E9F8 /* LaunchScreen.storyboard */, FC039B8D20E11C560081E9F8 /* Info.plist */, FC3602C72108580600FACB58 /* MetalHelper.swift */, + FCDFD3FA211D72C3005AB38B /* ModelHelper.swift */, ); path = "paddle-mobile-demo"; sourceTree = ""; @@ -526,6 +531,7 @@ FC0E2C1D20EDC030009C1FAC /* images */ = { isa = PBXGroup; children = ( + FCDFD41A211D91C7005AB38B /* synset.txt */, FCEEE7D3210627A000444BEC /* banana.jpeg */, FC0E2C1E20EDC030009C1FAC /* apple.jpg */, ); @@ -946,6 +952,7 @@ FC0E2D5D20EDC03C009C1FAC /* batch_norm_15.w_1 in Resources */, FC0E2D2820EDC03B009C1FAC /* batch_norm_23.w_0 in Resources */, FC0E2D3B20EDC03C009C1FAC /* conv2d_29.b_0 in Resources */, + FCDFD41B211D91C7005AB38B /* synset.txt in Resources */, FC0E2D4120EDC03C009C1FAC /* batch_norm_30.w_1 in Resources */, FC0E2D1E20EDC03B009C1FAC /* batch_norm_10.w_2 in Resources */, FC0E2D0F20EDC03B009C1FAC /* batch_norm_5.w_0 in Resources */, @@ -1077,6 +1084,7 @@ buildActionMask = 2147483647; files = ( FC039B8420E11C550081E9F8 /* ViewController.swift in Sources */, + FCDFD3FB211D72C3005AB38B /* ModelHelper.swift in Sources */, FC013928210204A3008100E3 /* PreProcessKernel.metal in Sources */, FC039B8220E11C550081E9F8 /* AppDelegate.swift in Sources */, FC3602C82108580600FACB58 /* MetalHelper.swift in Sources */, diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile-demo.xcscheme b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile-demo.xcscheme index de579675e0..46c65bd36a 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile-demo.xcscheme +++ b/metal/paddle-mobile-demo/paddle-mobile-demo.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile-demo.xcscheme @@ -42,7 +42,7 @@ paddle-mobile-demo.xcscheme orderHint - 3 + 2 SuppressBuildableAutocreation diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard index 03c13c2286..a49b388843 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Base.lproj/Main.storyboard @@ -1,7 +1,11 @@ - + + + + - + + @@ -9,16 +13,171 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist b/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist index 16be3b6811..64911398b6 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/Info.plist @@ -20,6 +20,10 @@ 1 LSRequiresIPhoneOS + NSCameraUsageDescription + use camera + NSPhotoLibraryUsageDescription + use album UILaunchStoryboardName LaunchScreen UIMainStoryboardFile diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift index 9a242f5617..74fa89d93e 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/MetalHelper.swift @@ -7,17 +7,42 @@ // import Metal -import paddle_mobile +import MetalKit import Foundation - +import paddle_mobile +import MetalPerformanceShaders class MetalHelper { let device: MTLDevice let queue: MTLCommandQueue + let textureLoader: MTKTextureLoader static let shared: MetalHelper = MetalHelper.init() private init(){ device = MTLCreateSystemDefaultDevice()! queue = device.makeCommandQueue()! + textureLoader = MTKTextureLoader.init(device: device) + } + + static func scaleTexture(queue: MTLCommandQueue, input: MTLTexture, size:(width: Int, height: Int), complete: @escaping (MTLTexture) -> Void) { + let tmpTextureDes = MTLTextureDescriptor.init() + tmpTextureDes.width = size.width + tmpTextureDes.height = size.height + tmpTextureDes.depth = 1 + tmpTextureDes.usage = [.shaderRead, .shaderWrite] + tmpTextureDes.pixelFormat = .rgba32Float + tmpTextureDes.textureType = .type2D + tmpTextureDes.storageMode = .shared + tmpTextureDes.cpuCacheMode = .defaultCache + let dest = MetalHelper.shared.device.makeTexture(descriptor: tmpTextureDes) + + let scale = MPSImageLanczosScale.init(device: MetalHelper.shared.device) + + let buffer = queue.makeCommandBuffer() + scale.encode(commandBuffer: buffer!, sourceTexture: input, destinationTexture: dest!) + buffer?.addCompletedHandler({ (buffer) in + complete(dest!) + }) + buffer?.commit() } } diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/ModelHelper.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/ModelHelper.swift new file mode 100644 index 0000000000..7e1f66855e --- /dev/null +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/ModelHelper.swift @@ -0,0 +1,89 @@ +// +// ModelHelper.swift +// paddle-mobile-demo +// +// Created by liuRuiLong on 2018/8/10. +// Copyright © 2018年 orange. All rights reserved. +// + +import UIKit +import MetalKit +import Foundation +import paddle_mobile +import MetalPerformanceShaders + +class PreProccess: CusomKernel { + init(device: MTLDevice) { + let s = CusomKernel.Shape.init(inWidth: 224, inHeight: 224, inChannel: 3) + super.init(device: device, inFunctionName: "preprocess", outputDim: s, usePaddleMobileLib: false) + } +} + +let modelHelperMap: [SupportModel : ModelHelper] = [.mobilenet : MobileNetHelper.init()] + +enum SupportModel: String{ + case mobilenet = "mobilenet" + static func supportedModels() -> [SupportModel] { + return [.mobilenet] + } +} + +protocol ModelHelper { + var dim: [Int] { get } + var modelPath: String { get } + var paramPath: String { get } + var modelDir: String { get } + var preprocessKernel: CusomKernel { get } + func getTexture(image: CGImage, getTexture: @escaping (MTLTexture) -> Void) + func resultStr(res: [Float]) -> String +} + +extension ModelHelper { + func getTexture(image: CGImage, getTexture: @escaping (MTLTexture) -> Void) { + let texture = try? MetalHelper.shared.textureLoader.newTexture(cgImage: image, options: [:]) ?! " texture loader error" + MetalHelper.scaleTexture(queue: MetalHelper.shared.queue, input: texture!, size: (224, 224)) { (resTexture) in + getTexture(resTexture) + } + } +} + +struct MobileNetHelper: ModelHelper{ + class PreWords { + var contents: [String] = [] + init(fileName: String, type: String = "txt", inBundle: Bundle = Bundle.main) { + if let filePath = inBundle.path(forResource: fileName, ofType: type) { + let string = try! String.init(contentsOfFile: filePath) + contents = string.components(separatedBy: CharacterSet.newlines).filter{$0.count > 10}.map{ + String($0[$0.index($0.startIndex, offsetBy: 10)...]) + } + }else{ + fatalError("no file call \(fileName)") + } + } + subscript(index: Int) -> String{ + return contents[index] + } + } + let labels = PreWords.init(fileName: "synset") + + func resultStr(res: [Float]) -> String { + var s: [String] = [] + res.top(r: 5).enumerated().forEach{ + s.append(String(format: "%d: %@ (%3.2f%%)", $0 + 1, labels[$1.0], $1.1 * 100)) + } + return s.joined(separator: "\n") + } + + var preprocessKernel: CusomKernel + let dim = [1, 224, 224, 3] + let modelPath: String + let paramPath: String + let modelDir: String + + init() { + modelPath = Bundle.main.path(forResource: "model", ofType: nil) ?! "model null" + paramPath = Bundle.main.path(forResource: "params", ofType: nil) ?! "para null" + modelDir = "" + preprocessKernel = PreProccess.init(device: MetalHelper.shared.device) + } +} diff --git a/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift b/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift index 1d8d50e1c9..2b710c1711 100644 --- a/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift +++ b/metal/paddle-mobile-demo/paddle-mobile-demo/ViewController.swift @@ -17,91 +17,154 @@ import MetalKit import paddle_mobile import MetalPerformanceShaders -let openTest: Bool = false - -class PreProccess: CusomKernel { - init(device: MTLDevice) { - let s = CusomKernel.Shape.init(inWidth: 224, inHeight: 224, inChannel: 3) - super.init(device: device, inFunctionName: "preprocess", outputDim: s, usePaddleMobileLib: false) - } -} +let threadSupport = [1] class ViewController: UIViewController { - var textureLoader: MTKTextureLoader! - var program: Program! - var executor: Executor! - var preprocessKernel: PreProccess! + @IBOutlet weak var selectImageView: UIImageView! + @IBOutlet weak var elapsedTimeLabel: UILabel! + @IBOutlet weak var resultLabel: UILabel! + @IBOutlet weak var modelPickerView: UIPickerView! + @IBOutlet weak var threadPickerView: UIPickerView! + var selectImage: UIImage? + + var program: Program? + var executor: Executor? + var modelType: SupportModel = .mobilenet + var modelHelper: ModelHelper { + return modelHelperMap[modelType] ?! " has no this type " + } + var threadNum = 1 -// let queue: MTLCommandQueue - func scaleTexture(queue: MTLCommandQueue, input: MTLTexture, complete: @escaping (MTLTexture) -> Void) { - let tmpTextureDes = MTLTextureDescriptor.init() - tmpTextureDes.width = 224 - tmpTextureDes.height = 224 - tmpTextureDes.depth = 1 - tmpTextureDes.usage = [.shaderRead, .shaderWrite] - tmpTextureDes.pixelFormat = .rgba32Float - tmpTextureDes.textureType = .type2D - tmpTextureDes.storageMode = .shared - tmpTextureDes.cpuCacheMode = .defaultCache - let dest = MetalHelper.shared.device.makeTexture(descriptor: tmpTextureDes) - - let scale = MPSImageLanczosScale.init(device: MetalHelper.shared.device) - - let buffer = queue.makeCommandBuffer() - scale.encode(commandBuffer: buffer!, sourceTexture: input, destinationTexture: dest!) - buffer?.addCompletedHandler({ (buffer) in - complete(dest!) - }) - buffer?.commit() + @IBAction func loadAct(_ sender: Any) { + let inModelHelper = modelHelper + let queue = MetalHelper.shared.queue + let loader = Loader.init() + do { + let modelPath = inModelHelper.modelPath + let paraPath = inModelHelper.paramPath + + program = try loader.load(device: MetalHelper.shared.device, modelPath: modelPath, paraPath: paraPath) + executor = try Executor.init(inDevice: MetalHelper.shared.device, inQueue: queue, inProgram: program!) + } catch let error { + print(error) + } } - func unitTest() { - let unitTest = PaddleMobileUnitTest.init(inDevice: MetalHelper.shared.device, inQueue: MetalHelper.shared.queue) - unitTest.testConvAddBnRelu() + @IBAction func selectImageAct(_ sender: Any) { + let imagePicker = UIImagePickerController() + imagePicker.sourceType = .camera + imagePicker.delegate = self + self.present(imagePicker, animated: true, completion: nil) } - override func touchesBegan(_ touches: Set, with event: UIEvent?) { - super.touchesBegan(touches, with: event) - // return - let queue = MetalHelper.shared.queue + @IBAction func clearAct(_ sender: Any) { + executor?.clear() + program = nil + executor = nil - textureLoader = MTKTextureLoader.init(device: MetalHelper.shared.device) - guard let appleImage = UIImage.init(named: "banana.jpeg"), let cgImage = appleImage.cgImage else { - fatalError(" image nil !") + } + + @IBAction func predictAct(_ sender: Any) { + guard let inImage = selectImage, let cgImage = inImage.cgImage else { + resultLabel.text = "请选择图片 ! " + return } - let texture = try? textureLoader.newTexture(cgImage: cgImage, options: [:]) ?! " texture loader error" - - guard let inTexture = texture else { - fatalError(" texture is nil !") + guard let inExecutor = executor else { + resultLabel.text = "请先 load ! " + return } - scaleTexture(queue: queue, input: inTexture) { (inputTexture) in + modelHelper.getTexture(image: cgImage) { [weak self] (texture) in + guard let sSelf = self else { + fatalError() + } do { - try self.executor.predict(input: inputTexture, expect: [1, 224, 224, 3], completionHandle: { (result) in - print(result.resultArr.top(r: 5)) - }, preProcessKernle: self.preprocessKernel) + try inExecutor.predict(input: texture, expect: [1, 224, 224, 3], completionHandle: { (result) in + }, preProcessKernle: sSelf.modelHelper.preprocessKernel) + + let startDate = Date.init() + for i in 0..<10 { + try inExecutor.predict(input: texture, expect: [1, 224, 224, 3], completionHandle: { (result) in + if i == 9 { + let time = Date.init().timeIntervalSince(startDate) + DispatchQueue.main.async { + sSelf.resultLabel.text = sSelf.modelHelper.resultStr(res: result.resultArr) + sSelf.elapsedTimeLabel.text = "平均耗时: \(time/10.0) ms" + } + } + }, preProcessKernle: sSelf.modelHelper.preprocessKernel) + } } catch let error { print(error) } } } - + override func viewDidLoad() { super.viewDidLoad() + modelPickerView.delegate = self + modelPickerView.dataSource = self + threadPickerView.delegate = self + threadPickerView.dataSource = self - let queue = MetalHelper.shared.queue - let loader = Loader.init() - preprocessKernel = PreProccess.init(device: MetalHelper.shared.device) + selectImage = UIImage.init(named: "banana.jpeg") + selectImageView.image = selectImage + } +} - do { - let modelPath = Bundle.main.path(forResource: "model", ofType: nil) ?! "model null" - let paraPath = Bundle.main.path(forResource: "params", ofType: nil) ?! "para null" - program = try loader.load(device: MetalHelper.shared.device, modelPath: modelPath, paraPath: paraPath) - executor = try Executor.init(inDevice: MetalHelper.shared.device, inQueue: queue, inProgram: program) - } catch let error { - print(error) +extension ViewController: UIPickerViewDataSource, UIPickerViewDelegate{ + func numberOfComponents(in pickerView: UIPickerView) -> Int { + if pickerView == modelPickerView { + return 1 + } else if pickerView == threadPickerView { + return 1 + } else { + fatalError() + } + } + + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { + if pickerView == modelPickerView { + return SupportModel.supportedModels().count + } else if pickerView == threadPickerView { + return threadSupport.count + } else { + fatalError() + } + } + + public func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? { + if pickerView == modelPickerView { + return SupportModel.supportedModels()[row].rawValue + } else if pickerView == threadPickerView { + return "\(threadSupport[row])" + } else { + fatalError() + } + } + + public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { + if pickerView == modelPickerView { + self.modelType = SupportModel.supportedModels()[row] + } else if pickerView == threadPickerView { + self.threadNum = threadSupport[row] + } else { + fatalError() } } } +extension ViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate { + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { + picker.dismiss(animated: true){[weak self] in + guard let sSelf = self, let image = info["UIImagePickerControllerOriginalImage"] as? UIImage else{ + fatalError("no image") + } + sSelf.selectImage = image + sSelf.selectImageView.image = image + } + } +} + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..4a324fc144 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.pbxproj @@ -0,0 +1,428 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 168DA950D7D6CF91EBF70A17 /* Pods_paddle_mobile_unit_test.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8BCD4792E483BFEE9F5523DE /* Pods_paddle_mobile_unit_test.framework */; }; + FC91818D211DAE9A00B6F354 /* paddle_mobile.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC91818C211DAE9A00B6F354 /* paddle_mobile.framework */; }; + FC91818E211DAE9A00B6F354 /* paddle_mobile.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FC91818C211DAE9A00B6F354 /* paddle_mobile.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + FCDFD409211D9185005AB38B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCDFD408211D9185005AB38B /* AppDelegate.swift */; }; + FCDFD40B211D9185005AB38B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCDFD40A211D9185005AB38B /* ViewController.swift */; }; + FCDFD40E211D9185005AB38B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FCDFD40C211D9185005AB38B /* Main.storyboard */; }; + FCDFD410211D9187005AB38B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FCDFD40F211D9187005AB38B /* Assets.xcassets */; }; + FCDFD413211D9187005AB38B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FCDFD411211D9187005AB38B /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + FC91818F211DAE9B00B6F354 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + FC91818E211DAE9A00B6F354 /* paddle_mobile.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 5CC132C848027BE970FB2637 /* Pods-paddle-mobile-unit-test.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-paddle-mobile-unit-test.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-paddle-mobile-unit-test/Pods-paddle-mobile-unit-test.debug.xcconfig"; sourceTree = ""; }; + 72F34AE9677943FC580DE7F4 /* Pods-paddle-mobile-unit-test.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-paddle-mobile-unit-test.release.xcconfig"; path = "../Pods/Target Support Files/Pods-paddle-mobile-unit-test/Pods-paddle-mobile-unit-test.release.xcconfig"; sourceTree = ""; }; + 8BCD4792E483BFEE9F5523DE /* Pods_paddle_mobile_unit_test.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_paddle_mobile_unit_test.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FC91818C211DAE9A00B6F354 /* paddle_mobile.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = paddle_mobile.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FCDFD405211D9185005AB38B /* paddle-mobile-unit-test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "paddle-mobile-unit-test.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FCDFD408211D9185005AB38B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + FCDFD40A211D9185005AB38B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + FCDFD40D211D9185005AB38B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + FCDFD40F211D9187005AB38B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + FCDFD412211D9187005AB38B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + FCDFD414211D9187005AB38B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FCDFD402211D9185005AB38B /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + FC91818D211DAE9A00B6F354 /* paddle_mobile.framework in Frameworks */, + 168DA950D7D6CF91EBF70A17 /* Pods_paddle_mobile_unit_test.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + CF78F766C11CC8AD67269581 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 8BCD4792E483BFEE9F5523DE /* Pods_paddle_mobile_unit_test.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + F752428B187BC4E0928ACD3D /* Pods */ = { + isa = PBXGroup; + children = ( + 5CC132C848027BE970FB2637 /* Pods-paddle-mobile-unit-test.debug.xcconfig */, + 72F34AE9677943FC580DE7F4 /* Pods-paddle-mobile-unit-test.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + FCDFD3FC211D9185005AB38B = { + isa = PBXGroup; + children = ( + FC91818C211DAE9A00B6F354 /* paddle_mobile.framework */, + FCDFD407211D9185005AB38B /* paddle-mobile-unit-test */, + FCDFD406211D9185005AB38B /* Products */, + F752428B187BC4E0928ACD3D /* Pods */, + CF78F766C11CC8AD67269581 /* Frameworks */, + ); + sourceTree = ""; + }; + FCDFD406211D9185005AB38B /* Products */ = { + isa = PBXGroup; + children = ( + FCDFD405211D9185005AB38B /* paddle-mobile-unit-test.app */, + ); + name = Products; + sourceTree = ""; + }; + FCDFD407211D9185005AB38B /* paddle-mobile-unit-test */ = { + isa = PBXGroup; + children = ( + FCDFD408211D9185005AB38B /* AppDelegate.swift */, + FCDFD40A211D9185005AB38B /* ViewController.swift */, + FCDFD40C211D9185005AB38B /* Main.storyboard */, + FCDFD40F211D9187005AB38B /* Assets.xcassets */, + FCDFD411211D9187005AB38B /* LaunchScreen.storyboard */, + FCDFD414211D9187005AB38B /* Info.plist */, + ); + path = "paddle-mobile-unit-test"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FCDFD404211D9185005AB38B /* paddle-mobile-unit-test */ = { + isa = PBXNativeTarget; + buildConfigurationList = FCDFD417211D9187005AB38B /* Build configuration list for PBXNativeTarget "paddle-mobile-unit-test" */; + buildPhases = ( + 5F5A9A9DC0C6307DEA4294C1 /* [CP] Check Pods Manifest.lock */, + FCDFD401211D9185005AB38B /* Sources */, + FCDFD402211D9185005AB38B /* Frameworks */, + FCDFD403211D9185005AB38B /* Resources */, + 53A2089068F9D64BB96D4322 /* [CP] Embed Pods Frameworks */, + FC91818F211DAE9B00B6F354 /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "paddle-mobile-unit-test"; + productName = "paddle-mobile-unit-test"; + productReference = FCDFD405211D9185005AB38B /* paddle-mobile-unit-test.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FCDFD3FD211D9185005AB38B /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0940; + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = orange; + TargetAttributes = { + FCDFD404211D9185005AB38B = { + CreatedOnToolsVersion = 9.4.1; + }; + }; + }; + buildConfigurationList = FCDFD400211D9185005AB38B /* Build configuration list for PBXProject "paddle-mobile-unit-test" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = FCDFD3FC211D9185005AB38B; + productRefGroup = FCDFD406211D9185005AB38B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FCDFD404211D9185005AB38B /* paddle-mobile-unit-test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + FCDFD403211D9185005AB38B /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FCDFD413211D9187005AB38B /* LaunchScreen.storyboard in Resources */, + FCDFD410211D9187005AB38B /* Assets.xcassets in Resources */, + FCDFD40E211D9185005AB38B /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 53A2089068F9D64BB96D4322 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${SRCROOT}/../Pods/Target Support Files/Pods-paddle-mobile-unit-test/Pods-paddle-mobile-unit-test-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-paddle-mobile-unit-test/Pods-paddle-mobile-unit-test-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 5F5A9A9DC0C6307DEA4294C1 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-paddle-mobile-unit-test-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FCDFD401211D9185005AB38B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FCDFD40B211D9185005AB38B /* ViewController.swift in Sources */, + FCDFD409211D9185005AB38B /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + FCDFD40C211D9185005AB38B /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FCDFD40D211D9185005AB38B /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + FCDFD411211D9187005AB38B /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + FCDFD412211D9187005AB38B /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + FCDFD415211D9187005AB38B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.4; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + FCDFD416211D9187005AB38B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 11.4; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + FCDFD418211D9187005AB38B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5CC132C848027BE970FB2637 /* Pods-paddle-mobile-unit-test.debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = A798K58VVL; + INFOPLIST_FILE = "paddle-mobile-unit-test/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "orange.paddle-mobile-unit-test"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + FCDFD419211D9187005AB38B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 72F34AE9677943FC580DE7F4 /* Pods-paddle-mobile-unit-test.release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = A798K58VVL; + INFOPLIST_FILE = "paddle-mobile-unit-test/Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = "orange.paddle-mobile-unit-test"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FCDFD400211D9185005AB38B /* Build configuration list for PBXProject "paddle-mobile-unit-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FCDFD415211D9187005AB38B /* Debug */, + FCDFD416211D9187005AB38B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FCDFD417211D9187005AB38B /* Build configuration list for PBXNativeTarget "paddle-mobile-unit-test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FCDFD418211D9187005AB38B /* Debug */, + FCDFD419211D9187005AB38B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FCDFD3FD211D9185005AB38B /* Project object */; +} diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..cb4dfcfed9 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000000000000000000000000000000000000..775d17b268941d24e8e9ebd7ac5ae26c2c0dbda9 GIT binary patch literal 5178 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 T!#+NMVVozq(|IPp)i?hKOm_U^ literal 0 HcmV?d00001 diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000000..994fb8e488 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + paddle-mobile-unit-test.xcscheme + + orderHint + 6 + + + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift new file mode 100644 index 0000000000..27a740aaa1 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/AppDelegate.swift @@ -0,0 +1,46 @@ +// +// AppDelegate.swift +// paddle-mobile-unit-test +// +// Created by liuRuiLong on 2018/8/10. +// Copyright © 2018年 orange. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + func applicationWillResignActive(_ application: UIApplication) { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. + } + + func applicationDidEnterBackground(_ application: UIApplication) { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. + } + + func applicationWillEnterForeground(_ application: UIApplication) { + // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. + } + + func applicationDidBecomeActive(_ application: UIApplication) { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. + } + + func applicationWillTerminate(_ application: UIApplication) { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + } + + +} + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/AppIcon.appiconset/Contents.json b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..d8db8d65fd --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/Contents.json b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/Contents.json new file mode 100644 index 0000000000..da4a164c91 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/LaunchScreen.storyboard b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000..f83f6fd581 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/Main.storyboard b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/Main.storyboard new file mode 100644 index 0000000000..03c13c2286 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Info.plist b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Info.plist new file mode 100644 index 0000000000..16be3b6811 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift new file mode 100644 index 0000000000..8a1f829395 --- /dev/null +++ b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test/ViewController.swift @@ -0,0 +1,20 @@ +// +// ViewController.swift +// paddle-mobile-unit-test +// +// Created by liuRuiLong on 2018/8/10. +// Copyright © 2018年 orange. All rights reserved. +// + +import UIKit +import paddle_mobile + +class ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + print(" done ") + } + +} + diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile.xcscheme b/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile.xcscheme new file mode 100644 index 0000000000..7c83f42cec --- /dev/null +++ b/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/paddle-mobile.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist b/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist index 50f16e4d7c..067e2a5bea 100644 --- a/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/metal/paddle-mobile/paddle-mobile.xcodeproj/xcuserdata/liuruilong.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,15 @@ paddle-mobile.xcscheme orderHint - 4 + 0 + + + SuppressBuildableAutocreation + + FC039B6920E11C3C0081E9F8 + + primary + diff --git a/metal/paddle-mobile/paddle-mobile/Executor.swift b/metal/paddle-mobile/paddle-mobile/Executor.swift index 40a80d2ddf..0dcb3151e2 100644 --- a/metal/paddle-mobile/paddle-mobile/Executor.swift +++ b/metal/paddle-mobile/paddle-mobile/Executor.swift @@ -17,10 +17,11 @@ import Foundation public class ResultHolder { public let dim: [Int] public let resultArr: [P] - - public init(inDim: [Int], inResult: [P]) { + public let elapsedTime: Double + public init(inDim: [Int], inResult: [P], inElapsedTime: Double) { dim = inDim resultArr = inResult + elapsedTime = inElapsedTime } } @@ -127,8 +128,7 @@ public class Executor { let afterDate = Date.init() - print(" encoder end ! time: \(afterDate.timeIntervalSince(beforeDate))") - + guard let outputVar = self.program.scope.output() else { fatalError("output nil") } @@ -138,11 +138,16 @@ public class Executor { } let resultHodlder = ResultHolder

.init(inDim: output.dim.dims, inResult: output.metalTexture.floatArray(res: { (p:P) -> P in return p - })) + }), inElapsedTime: afterDate.timeIntervalSince(beforeDate)) completionHandle(resultHodlder) } buffer.commit() } + + public func clear() { + program.scope.clear() + } + } //public let paddle_executor: Executor = Executor.init() diff --git a/metal/paddle-mobile/paddle-mobile/Loader.swift b/metal/paddle-mobile/paddle-mobile/Loader.swift index 472c588430..c68b68e1ca 100644 --- a/metal/paddle-mobile/paddle-mobile/Loader.swift +++ b/metal/paddle-mobile/paddle-mobile/Loader.swift @@ -170,7 +170,7 @@ public class Loader { } } else { if varDesc.name == fetchKey { - scope[varDesc.name] = ResultHolder

.init(inDim: [], inResult: []) + scope[varDesc.name] = ResultHolder

.init(inDim: [], inResult: [], inElapsedTime: 0.0) } else if varDesc.name == feedKey { } } diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift index 1f24a1642e..81f3aacba8 100644 --- a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift +++ b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ConvAddKernel.swift @@ -36,7 +36,6 @@ class ConvAddKernel: Kernel, Computable { throw PaddleMobileError.predictError(message: " encode is nil") } - print("Conv add compute") encoder.setTexture(param.input.metalTexture, index: 0) encoder.setTexture(param.output.metalTexture, index: 1) encoder.setBytes(&metalParam, length: MemoryLayout.size, index: 0) diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PoolKernel.swift b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PoolKernel.swift index 9c22f04bb6..983a3acb99 100644 --- a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PoolKernel.swift +++ b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PoolKernel.swift @@ -29,7 +29,6 @@ class PoolKernel: Kernel, Computable{ guard let encoder = commandBuffer.makeComputeCommandEncoder() else { throw PaddleMobileError.predictError(message: " encoder is nil") } - print("Pool compute") encoder.setTexture(param.input.metalTexture, index: 0) encoder.setTexture(param.output.metalTexture, index: 1) var poolType: Int32 diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ReshapeKernel.swift b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ReshapeKernel.swift index 957ffe4b31..438c89e59e 100644 --- a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ReshapeKernel.swift +++ b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/ReshapeKernel.swift @@ -23,7 +23,6 @@ class ReshapeKernel: Kernel, Computable{ guard let encoder = commandBuffer.makeComputeCommandEncoder() else { throw PaddleMobileError.predictError(message: " encoder is nil") } - print("Reshape compute") encoder.setTexture(param.input.metalTexture, index: 0) encoder.setTexture(param.output.metalTexture, index: 1) encoder.dispatch(computePipline: pipline, outTexture: param.output.metalTexture) diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/SoftmaxKernel.swift b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/SoftmaxKernel.swift index 06b40110dd..b94f0286f4 100644 --- a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/SoftmaxKernel.swift +++ b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/SoftmaxKernel.swift @@ -20,7 +20,6 @@ class SoftmaxKernel: Kernel, Computable{ guard let encoder = commandBuffer.makeComputeCommandEncoder() else { throw PaddleMobileError.predictError(message: " encoder is nil") } - print("softmax compute") encoder.setTexture(param.input.metalTexture, index: 0) encoder.setTexture(param.output.metalTexture, index: 1) encoder.dispatch(computePipline: pipline, outTexture: param.output.metalTexture) diff --git a/metal/paddle-mobile/paddle-mobile/Program/Scope.swift b/metal/paddle-mobile/paddle-mobile/Program/Scope.swift index 026759df30..77e32908b3 100644 --- a/metal/paddle-mobile/paddle-mobile/Program/Scope.swift +++ b/metal/paddle-mobile/paddle-mobile/Program/Scope.swift @@ -49,4 +49,7 @@ class Scope { } + func clear(){ + vars.removeAll() + } } diff --git a/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift b/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift index beed19b653..7ffcd97f44 100644 --- a/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift +++ b/metal/paddle-mobile/paddle-mobile/framework/Tensor.swift @@ -175,7 +175,7 @@ class Tensor: Tensorial { fatalError(" not support !") } //TODO: release -// data.release() + data.release() } var width: Int { -- GitLab