diff --git a/metal/Podfile b/metal/Podfile index 87b3324209bdef84f1f56883394e4f992708d8d8..6e9a6c6e3713ceaafc8d1769d7ec731ecc78b615 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 e224d504276ad82108cfab8b642d2c565135d454..9f8c94edcc063bfe1692186997a19ad7a8645050 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 de579675e07b8ffb8869464bebe203b591fa7778..46c65bd36a9ab7027b1cb7a81533dcd553ccb62e 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 03c13c2286150ad7416086bec99d2c46ccca6efc..a49b388843705879bce542509fb7a1273a6a8d36 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 16be3b681122de83e380d47b840b7d0486f71f86..64911398b627893770cfe3d1662d0e0983a10d82 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 9a242f5617b70735d26c1f0c84d9a94640da567d..74fa89d93e042f90fe1b590a596ec584fff67f6d 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 0000000000000000000000000000000000000000..7e1f66855e45453eee9fdbe034a309aee44ff960 --- /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 1d8d50e1c99cc1b7fa3d7e396c3776473f53eb55..2b710c1711fe5799ae92c36663ad6de0120f4ab3 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 0000000000000000000000000000000000000000..4a324fc1447c9d91ed751f9dbe13786df30f065a --- /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 0000000000000000000000000000000000000000..cb4dfcfed95671fcf6dca7b01068d171ad562443 --- /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 0000000000000000000000000000000000000000..18d981003d68d0546c4804ac2ff47dd97c6e7921 --- /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 Binary files /dev/null and b/metal/paddle-mobile-unit-test/paddle-mobile-unit-test.xcodeproj/project.xcworkspace/xcuserdata/liuruilong.xcuserdatad/UserInterfaceState.xcuserstate differ 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 0000000000000000000000000000000000000000..994fb8e4886aba91298c168a1b06888d8825b655 --- /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 0000000000000000000000000000000000000000..27a740aaa1e0242e79b125289465bdcbeb4686f5 --- /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 0000000000000000000000000000000000000000..d8db8d65fd79fd541b2b7eba75c7378af3448f9c --- /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 0000000000000000000000000000000000000000..da4a164c918651cdd1e11dca5cc62c333f097601 --- /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 0000000000000000000000000000000000000000..f83f6fd5810b9c852cf98563d82d5ed1e84ff893 --- /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 0000000000000000000000000000000000000000..03c13c2286150ad7416086bec99d2c46ccca6efc --- /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 0000000000000000000000000000000000000000..16be3b681122de83e380d47b840b7d0486f71f86 --- /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 0000000000000000000000000000000000000000..8a1f82939544df42f8601f38dc2bee60e6201589 --- /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 0000000000000000000000000000000000000000..7c83f42ceca9f68af4f45064cb29c9e3a3512b8e --- /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 50f16e4d7cfc755905c68ced31769d3ac1dd1049..067e2a5bea9382a8f2ffebfd809d2c8217631975 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 40a80d2ddf200b6428c974719dd2d7201692424b..0dcb3151e21cc0f3968a07da39366d4ba5fd5813 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 472c588430a383d8bd4dc1198cbf67dd69cd33a3..c68b68e1caffcadc2adb2b4ddf245c89b2c5a223 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 1f24a1642edb24fe1f346f6713a01c76abc0593b..81f3aacba8dded3341237e05f9afbc1e04f70596 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 9c22f04bb645ec25951f4f11fd0de0a5807339e6..983a3acb9943f2e549b07d095c7dd4a23c1e96d9 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 957ffe4b310c6cfb56d144807258e385293a9b95..438c89e59eb7e9a2ef315997b9d8d1f3a44a5462 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 06b40110dd415f7555fdab57c3a408c3da3cbea8..b94f0286f43ec482353ff278c6c104da77f47315 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 026759df304ed470fc148b0ac2a29e061d6040d1..77e32908b30ad7a843a583b47c2a11b76d19f3b9 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 beed19b65375a91cb96c38c35633819c2575eafb..7ffcd97f4418f17cd7085c5d03e8b58b45c623fd 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 {