├── .gitignore
├── CMakeLists.txt
├── README.md
├── android
├── app
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── tencent
│ │ │ └── makeup
│ │ │ ├── MainActivity.java
│ │ │ └── StableDiffusion.java
│ │ ├── jni
│ │ ├── CMakeLists.txt
│ │ ├── json.hpp
│ │ ├── makeup_jni.cpp
│ │ ├── ncnn-20240410-android-vulkan
│ │ │ └── arm64-v8a
│ │ │ │ ├── include
│ │ │ │ ├── glslang
│ │ │ │ │ ├── Include
│ │ │ │ │ │ ├── BaseTypes.h
│ │ │ │ │ │ ├── Common.h
│ │ │ │ │ │ ├── ConstantUnion.h
│ │ │ │ │ │ ├── InfoSink.h
│ │ │ │ │ │ ├── InitializeGlobals.h
│ │ │ │ │ │ ├── PoolAlloc.h
│ │ │ │ │ │ ├── ResourceLimits.h
│ │ │ │ │ │ ├── ShHandle.h
│ │ │ │ │ │ ├── SpirvIntrinsics.h
│ │ │ │ │ │ ├── Types.h
│ │ │ │ │ │ ├── arrays.h
│ │ │ │ │ │ ├── glslang_c_interface.h
│ │ │ │ │ │ ├── glslang_c_shader_types.h
│ │ │ │ │ │ └── intermediate.h
│ │ │ │ │ ├── MachineIndependent
│ │ │ │ │ │ ├── Initialize.h
│ │ │ │ │ │ ├── LiveTraverser.h
│ │ │ │ │ │ ├── ParseHelper.h
│ │ │ │ │ │ ├── RemoveTree.h
│ │ │ │ │ │ ├── Scan.h
│ │ │ │ │ │ ├── ScanContext.h
│ │ │ │ │ │ ├── SymbolTable.h
│ │ │ │ │ │ ├── Versions.h
│ │ │ │ │ │ ├── attribute.h
│ │ │ │ │ │ ├── gl_types.h
│ │ │ │ │ │ ├── glslang_tab.cpp.h
│ │ │ │ │ │ ├── iomapper.h
│ │ │ │ │ │ ├── localintermediate.h
│ │ │ │ │ │ ├── parseVersions.h
│ │ │ │ │ │ ├── preprocessor
│ │ │ │ │ │ │ ├── PpContext.h
│ │ │ │ │ │ │ └── PpTokens.h
│ │ │ │ │ │ ├── propagateNoContraction.h
│ │ │ │ │ │ └── reflection.h
│ │ │ │ │ ├── Public
│ │ │ │ │ │ ├── ResourceLimits.h
│ │ │ │ │ │ ├── ShaderLang.h
│ │ │ │ │ │ └── resource_limits_c.h
│ │ │ │ │ ├── SPIRV
│ │ │ │ │ │ ├── GLSL.ext.AMD.h
│ │ │ │ │ │ ├── GLSL.ext.ARM.h
│ │ │ │ │ │ ├── GLSL.ext.EXT.h
│ │ │ │ │ │ ├── GLSL.ext.KHR.h
│ │ │ │ │ │ ├── GLSL.ext.NV.h
│ │ │ │ │ │ ├── GLSL.std.450.h
│ │ │ │ │ │ ├── GlslangToSpv.h
│ │ │ │ │ │ ├── Logger.h
│ │ │ │ │ │ ├── NonSemanticDebugPrintf.h
│ │ │ │ │ │ ├── NonSemanticShaderDebugInfo100.h
│ │ │ │ │ │ ├── SPVRemapper.h
│ │ │ │ │ │ ├── SpvBuilder.h
│ │ │ │ │ │ ├── SpvTools.h
│ │ │ │ │ │ ├── bitutils.h
│ │ │ │ │ │ ├── disassemble.h
│ │ │ │ │ │ ├── doc.h
│ │ │ │ │ │ ├── hex_float.h
│ │ │ │ │ │ ├── spirv.hpp
│ │ │ │ │ │ └── spvIR.h
│ │ │ │ │ └── build_info.h
│ │ │ │ └── ncnn
│ │ │ │ │ ├── allocator.h
│ │ │ │ │ ├── benchmark.h
│ │ │ │ │ ├── blob.h
│ │ │ │ │ ├── c_api.h
│ │ │ │ │ ├── command.h
│ │ │ │ │ ├── cpu.h
│ │ │ │ │ ├── datareader.h
│ │ │ │ │ ├── gpu.h
│ │ │ │ │ ├── layer.h
│ │ │ │ │ ├── layer_shader_type.h
│ │ │ │ │ ├── layer_shader_type_enum.h
│ │ │ │ │ ├── layer_type.h
│ │ │ │ │ ├── layer_type_enum.h
│ │ │ │ │ ├── mat.h
│ │ │ │ │ ├── modelbin.h
│ │ │ │ │ ├── ncnn_export.h
│ │ │ │ │ ├── net.h
│ │ │ │ │ ├── option.h
│ │ │ │ │ ├── paramdict.h
│ │ │ │ │ ├── pipeline.h
│ │ │ │ │ ├── pipelinecache.h
│ │ │ │ │ ├── platform.h
│ │ │ │ │ ├── simplemath.h
│ │ │ │ │ ├── simpleocv.h
│ │ │ │ │ ├── simpleomp.h
│ │ │ │ │ ├── simplestl.h
│ │ │ │ │ ├── simplevk.h
│ │ │ │ │ └── vulkan_header_fix.h
│ │ │ │ └── lib
│ │ │ │ ├── cmake
│ │ │ │ ├── OGLCompilerTargets.cmake
│ │ │ │ ├── OSDependentTargets.cmake
│ │ │ │ ├── SPIRVTargets.cmake
│ │ │ │ ├── glslang-default-resource-limitsTargets.cmake
│ │ │ │ ├── glslang
│ │ │ │ │ ├── glslang-config-version.cmake
│ │ │ │ │ ├── glslang-config.cmake
│ │ │ │ │ ├── glslang-targets-release.cmake
│ │ │ │ │ └── glslang-targets.cmake
│ │ │ │ ├── glslangTargets.cmake
│ │ │ │ └── ncnn
│ │ │ │ │ ├── ncnn-release.cmake
│ │ │ │ │ ├── ncnn.cmake
│ │ │ │ │ └── ncnnConfig.cmake
│ │ │ │ ├── libGenericCodeGen.a
│ │ │ │ ├── libMachineIndependent.a
│ │ │ │ ├── libOGLCompiler.a
│ │ │ │ ├── libOSDependent.a
│ │ │ │ ├── libSPIRV.a
│ │ │ │ ├── libglslang-default-resource-limits.a
│ │ │ │ ├── libglslang.a
│ │ │ │ ├── libncnn.a
│ │ │ │ └── pkgconfig
│ │ │ │ └── ncnn.pc
│ │ ├── safetensors.hh
│ │ ├── simdjson.h
│ │ ├── tokenizer.h
│ │ └── utils.h
│ │ └── res
│ │ ├── layout
│ │ └── main.xml
│ │ └── values
│ │ └── strings.xml
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── local.properties
└── settings.gradle
├── chat.cpp
├── gemm.h
├── getmem.h
├── json.hpp
├── make_lite_weight.py
├── qwen2_layers.h
├── qwen2_model.h
├── run.sh
├── safetensors.hh
├── simdjson.h
├── tokenizer.h
└── utils.h
/.gitignore:
--------------------------------------------------------------------------------
1 | Qwen1.5-*
2 | .vscode
3 | build
4 | */.gradle
5 | *.idea
6 | *.cxx
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(chat)
3 |
4 | set(CMAKE_CXX_STANDARD 11)
5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-register -O2")
6 |
7 | find_package(OpenMP REQUIRED)
8 | if(OPENMP_FOUND)
9 | message("OPENMP FOUND")
10 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
11 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
12 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
13 | else()
14 | message(FATAL_ERROR "OpenMP Not Found!")
15 | endif()
16 |
17 | find_package(ncnn REQUIRED)
18 |
19 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
20 |
21 | add_executable(chat chat.cpp)
22 | target_link_libraries(chat ncnn ${OpenMP_LIBRARIES})
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # llm-cpp
2 |
3 | ### Performance
4 | In M1, prefill 128 token and decode 128 token:
5 | | model | prefill(token/s) | decode(token/s) | RAM |
6 | | --------------------------- | ---------------- | --------------- | ----- |
7 | | Qwen1.5-0.5B-Chat-GPTQ-Int4 | 281 | 103 | 360M |
8 | | Qwen1.5-1.8B-Chat-GPTQ-Int4 | 79 | 39 | 1100M |
9 |
10 | ### Implement & Feature detail
11 | - 支持直接加载huggingface格式的模型
12 | - 通过加载config.json文件动态构建blob和layer依赖关系并建立ncnn模型图
13 | - 使用nn.Module的风格进行blob和layer绑定
14 | - 直接加载safetensor格式权重并给模型的层进行赋值
15 | - 支持超大模型的多safetensor加载
16 | - 提前预处理权重,硬盘&内存占用小
17 | - 支持embed和lm_head的权重共享(主要是0.5B模型)
18 | - 支持GPTQ-Int4量化(偷懒了,把代码写死了),int8&fp16混合激活
19 | - 支持kv cache,使用fp16存储(没做连续对话,所以kv cache不大,不压缩了)
20 | - 支持Qwen1.5-xxB-Chat-GPTQ-Int4模型
21 | - 两种输出模式
22 | - 使用argmax的确定性输出
23 | - 使用概率采样的不确定性输出
24 |
25 | ### How to use
26 | ```bash
27 | # download model
28 | git lfs install && git clone https://huggingface.co/Qwen/Qwen1.5-0.5B-Chat-GPTQ-Int4
29 | # convert model to save disk and ram
30 | python make_lite_weight.py --input_model Qwen1.5-0.5B-Chat-GPTQ-Int4
31 | # build & run
32 | bash run.sh
33 | ```
34 |
35 | ### References
36 | - model from : https://huggingface.co/Qwen
37 | - runtime manager from : https://github.com/Tencent/ncnn
38 | - load json file from : https://github.com/nlohmann/json/tree/develop
39 | - load safetensors file from: https://github.com/syoyo/safetensors-cpp
40 | - tokenizer implement from: https://github.com/harrisonvanderbyl/rwkv-cpp-accelerated
41 | - ProgressBar from: https://github.com/gipert/progressbar/tree/master
42 | - armpl from: https://developer.arm.com/documentation/101004/2404?lang=en
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | buildToolsVersion "29.0.2"
6 | ndkVersion '26.3.11579264'
7 |
8 | defaultConfig {
9 | applicationId "com.tencent.makeup"
10 | archivesBaseName = "$applicationId"
11 |
12 | ndk {
13 | moduleName "ncnn"
14 | abiFilters "arm64-v8a"
15 | }
16 | minSdkVersion 28
17 | }
18 |
19 | externalNativeBuild {
20 | cmake {
21 | version "3.10.2"
22 | path file('src/main/jni/CMakeLists.txt')
23 | }
24 | }
25 | dependencies {
26 | implementation 'com.android.support:support-v4:24.0.0'
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
13 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/tencent/makeup/MainActivity.java:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | package com.tencent.makeup;
16 | import android.annotation.SuppressLint;
17 | import android.content.Context;
18 |
19 | import android.app.Activity;
20 | import android.content.Intent;
21 | import android.content.pm.PackageManager;
22 | import android.content.res.AssetManager;
23 | import android.graphics.Bitmap;
24 | import android.graphics.BitmapFactory;
25 | import android.graphics.Matrix;
26 | import android.media.ExifInterface;
27 | import android.net.Uri;
28 | import android.os.Bundle;
29 | import android.support.v4.app.ActivityCompat;
30 | import android.util.Log;
31 | import android.view.MotionEvent;
32 | import android.view.View;
33 | import android.view.WindowManager;
34 | import android.widget.Button;
35 | import android.widget.EditText;
36 | import android.widget.ImageView;
37 | import android.widget.Toast;
38 | import android.widget.TextView;
39 |
40 | import java.io.File;
41 | import java.io.FileNotFoundException;
42 | import java.io.FileOutputStream;
43 | import java.io.IOException;
44 | import java.io.InputStream;
45 | import java.util.ArrayList;
46 | import java.util.List;
47 |
48 | public class MainActivity extends Activity
49 | {
50 |
51 |
52 | private static final int REQUEST_EXTERNAL_STORAGE = 1;
53 | private static String[] PERMISSIONS_STORAGE = {
54 | "android.permission.READ_EXTERNAL_STORAGE",
55 | "android.permission.WRITE_EXTERNAL_STORAGE"
56 | };
57 |
58 | public void verifyStoragePermission(Activity activity){
59 | try{
60 | int permission = ActivityCompat.checkSelfPermission(activity,"android.permission.WRITE_EXTERNAL_STORAGE");
61 | if(permission!= PackageManager.PERMISSION_GRANTED){
62 | ActivityCompat.requestPermissions(activity,PERMISSIONS_STORAGE, REQUEST_EXTERNAL_STORAGE);
63 | }
64 | }catch (Exception e){
65 | e.printStackTrace();
66 | e.printStackTrace();
67 | }
68 | }
69 |
70 | private StableDiffusion sd = new StableDiffusion();
71 |
72 | private Button sendButton;
73 | private TextView showText;
74 | private EditText inText;
75 |
76 | /** Called when the activity is first created. */
77 | @SuppressLint("MissingInflatedId")
78 | @Override
79 | public void onCreate(Bundle savedInstanceState)
80 | {
81 | super.onCreate(savedInstanceState);
82 | setContentView(R.layout.main);
83 |
84 | verifyStoragePermission(this);
85 |
86 | showText = (TextView) findViewById(R.id.showText);
87 | inText = (EditText) findViewById(R.id.inText);
88 | sendButton = (Button) findViewById(R.id.sendBtn);
89 |
90 | String path = "/data/data/com.tencent.makeup/files/";
91 | File directory = new File(path);
92 | File[] filesAndDirectories = directory.listFiles();
93 | List folderNameArray = new ArrayList<>();
94 | if (filesAndDirectories != null) {
95 | for (File file : filesAndDirectories) {
96 | if (file.isDirectory()) {
97 | folderNameArray.add(file.getName());
98 | }
99 | }
100 | }
101 | String[] folderName = folderNameArray.toArray(new String[folderNameArray.size()]);
102 |
103 | String target = "Qwen1.5-1.8B";
104 | for (String folder : folderName) {
105 | if (folder.startsWith(target)) {
106 | target = path + folder;
107 | Log.i("LLM","get model: " + target);
108 | boolean ret_init = sd.Init(target);
109 | }
110 | }
111 |
112 | final String finalTarget = target;
113 | showText.setText("");
114 | showText.append("model path: " + finalTarget + "\n\n");
115 |
116 | sendButton.setOnClickListener(new View.OnClickListener() {
117 | @Override
118 | public void onClick(View arg0) {
119 | showText.setText("");
120 | showText.append("model path: " + finalTarget + "\n\n");
121 |
122 | String input = inText.getText().toString();
123 | showText.append(" user: "+input+"\n\n");
124 |
125 | String output = sd.gen(input);
126 | showText.append("robot: "+output+"\n");
127 |
128 | inText.getText().clear();
129 | }
130 | });
131 |
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/android/app/src/main/java/com/tencent/makeup/StableDiffusion.java:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | package com.tencent.makeup;
16 |
17 | import android.content.res.AssetManager;
18 | import android.graphics.Bitmap;
19 |
20 | public class StableDiffusion
21 | {
22 | public native boolean Init(String modelpath);
23 |
24 | public native String gen(String prompt);
25 |
26 | static {
27 | System.loadLibrary("makeup");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | project(makeup)
2 |
3 | cmake_minimum_required(VERSION 3.10)
4 |
5 | set(CMAKE_CXX_STANDARD 11)
6 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-register -O3 -march=armv8-a+fp16+dotprod")
7 |
8 | # OpenMP
9 | find_package(OpenMP REQUIRED)
10 | if(OPENMP_FOUND)
11 | message("OPENMP FOUND")
12 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
13 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
14 | set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
15 | endif()
16 |
17 | # ncnn
18 | set(ncnn_DIR ${CMAKE_SOURCE_DIR}/ncnn-20240410-android-vulkan/${ANDROID_ABI}/lib/cmake/ncnn)
19 | find_package(ncnn REQUIRED)
20 |
21 |
22 | add_library(${PROJECT_NAME} SHARED makeup_jni.cpp)
23 |
24 | target_link_libraries(${PROJECT_NAME} ncnn ${OpenMP_LIBRARIES})
25 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Include/InfoSink.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // All rights reserved.
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions
7 | // are met:
8 | //
9 | // Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | //
12 | // Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following
14 | // disclaimer in the documentation and/or other materials provided
15 | // with the distribution.
16 | //
17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 | // contributors may be used to endorse or promote products derived
19 | // from this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 | //
34 |
35 | #ifndef _INFOSINK_INCLUDED_
36 | #define _INFOSINK_INCLUDED_
37 |
38 | #include "../Include/Common.h"
39 | #include
40 |
41 | namespace glslang {
42 |
43 | //
44 | // TPrefixType is used to centralize how info log messages start.
45 | // See below.
46 | //
47 | enum TPrefixType {
48 | EPrefixNone,
49 | EPrefixWarning,
50 | EPrefixError,
51 | EPrefixInternalError,
52 | EPrefixUnimplemented,
53 | EPrefixNote
54 | };
55 |
56 | enum TOutputStream {
57 | ENull = 0,
58 | EDebugger = 0x01,
59 | EStdOut = 0x02,
60 | EString = 0x04,
61 | };
62 | //
63 | // Encapsulate info logs for all objects that have them.
64 | //
65 | // The methods are a general set of tools for getting a variety of
66 | // messages and types inserted into the log.
67 | //
68 | class TInfoSinkBase {
69 | public:
70 | TInfoSinkBase() : outputStream(4) {}
71 | void erase() { sink.erase(); }
72 | TInfoSinkBase& operator<<(const TPersistString& t) { append(t); return *this; }
73 | TInfoSinkBase& operator<<(char c) { append(1, c); return *this; }
74 | TInfoSinkBase& operator<<(const char* s) { append(s); return *this; }
75 | TInfoSinkBase& operator<<(int n) { append(String(n)); return *this; }
76 | TInfoSinkBase& operator<<(unsigned int n) { append(String(n)); return *this; }
77 | TInfoSinkBase& operator<<(float n) { const int size = 40; char buf[size];
78 | snprintf(buf, size, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ? "%f" : "%g", n);
79 | append(buf);
80 | return *this; }
81 | TInfoSinkBase& operator+(const TPersistString& t) { append(t); return *this; }
82 | TInfoSinkBase& operator+(const TString& t) { append(t); return *this; }
83 | TInfoSinkBase& operator<<(const TString& t) { append(t); return *this; }
84 | TInfoSinkBase& operator+(const char* s) { append(s); return *this; }
85 | const char* c_str() const { return sink.c_str(); }
86 | void prefix(TPrefixType message) {
87 | switch(message) {
88 | case EPrefixNone: break;
89 | case EPrefixWarning: append("WARNING: "); break;
90 | case EPrefixError: append("ERROR: "); break;
91 | case EPrefixInternalError: append("INTERNAL ERROR: "); break;
92 | case EPrefixUnimplemented: append("UNIMPLEMENTED: "); break;
93 | case EPrefixNote: append("NOTE: "); break;
94 | default: append("UNKNOWN ERROR: "); break;
95 | }
96 | }
97 | void location(const TSourceLoc& loc) {
98 | const int maxSize = 24;
99 | char locText[maxSize];
100 | snprintf(locText, maxSize, ":%d", loc.line);
101 | append(loc.getStringNameOrNum(false).c_str());
102 | append(locText);
103 | append(": ");
104 | }
105 | void message(TPrefixType message, const char* s) {
106 | prefix(message);
107 | append(s);
108 | append("\n");
109 | }
110 | void message(TPrefixType message, const char* s, const TSourceLoc& loc) {
111 | prefix(message);
112 | location(loc);
113 | append(s);
114 | append("\n");
115 | }
116 |
117 | void setOutputStream(int output = 4)
118 | {
119 | outputStream = output;
120 | }
121 |
122 | protected:
123 | void append(const char* s);
124 |
125 | void append(int count, char c);
126 | void append(const TPersistString& t);
127 | void append(const TString& t);
128 |
129 | void checkMem(size_t growth) { if (sink.capacity() < sink.size() + growth + 2)
130 | sink.reserve(sink.capacity() + sink.capacity() / 2); }
131 | void appendToStream(const char* s);
132 | TPersistString sink;
133 | int outputStream;
134 | };
135 |
136 | } // end namespace glslang
137 |
138 | class TInfoSink {
139 | public:
140 | glslang::TInfoSinkBase info;
141 | glslang::TInfoSinkBase debug;
142 | };
143 |
144 | #endif // _INFOSINK_INCLUDED_
145 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Include/InitializeGlobals.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // All rights reserved.
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions
7 | // are met:
8 | //
9 | // Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | //
12 | // Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following
14 | // disclaimer in the documentation and/or other materials provided
15 | // with the distribution.
16 | //
17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 | // contributors may be used to endorse or promote products derived
19 | // from this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 | //
34 |
35 | #ifndef __INITIALIZE_GLOBALS_INCLUDED_
36 | #define __INITIALIZE_GLOBALS_INCLUDED_
37 |
38 | namespace glslang {
39 |
40 | inline bool InitializePoolIndex() { return true; } // DEPRECATED: No need to call
41 |
42 | } // end namespace glslang
43 |
44 | #endif // __INITIALIZE_GLOBALS_INCLUDED_
45 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Include/ResourceLimits.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // Copyright (C) 2013 LunarG, Inc.
4 | //
5 | // All rights reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions
9 | // are met:
10 | //
11 | // Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | //
14 | // Redistributions in binary form must reproduce the above
15 | // copyright notice, this list of conditions and the following
16 | // disclaimer in the documentation and/or other materials provided
17 | // with the distribution.
18 | //
19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
20 | // contributors may be used to endorse or promote products derived
21 | // from this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 | // POSSIBILITY OF SUCH DAMAGE.
35 | //
36 |
37 | #ifndef _RESOURCE_LIMITS_INCLUDED_
38 | #define _RESOURCE_LIMITS_INCLUDED_
39 |
40 | struct TLimits {
41 | bool nonInductiveForLoops;
42 | bool whileLoops;
43 | bool doWhileLoops;
44 | bool generalUniformIndexing;
45 | bool generalAttributeMatrixVectorIndexing;
46 | bool generalVaryingIndexing;
47 | bool generalSamplerIndexing;
48 | bool generalVariableIndexing;
49 | bool generalConstantMatrixVectorIndexing;
50 | };
51 |
52 | struct TBuiltInResource {
53 | int maxLights;
54 | int maxClipPlanes;
55 | int maxTextureUnits;
56 | int maxTextureCoords;
57 | int maxVertexAttribs;
58 | int maxVertexUniformComponents;
59 | int maxVaryingFloats;
60 | int maxVertexTextureImageUnits;
61 | int maxCombinedTextureImageUnits;
62 | int maxTextureImageUnits;
63 | int maxFragmentUniformComponents;
64 | int maxDrawBuffers;
65 | int maxVertexUniformVectors;
66 | int maxVaryingVectors;
67 | int maxFragmentUniformVectors;
68 | int maxVertexOutputVectors;
69 | int maxFragmentInputVectors;
70 | int minProgramTexelOffset;
71 | int maxProgramTexelOffset;
72 | int maxClipDistances;
73 | int maxComputeWorkGroupCountX;
74 | int maxComputeWorkGroupCountY;
75 | int maxComputeWorkGroupCountZ;
76 | int maxComputeWorkGroupSizeX;
77 | int maxComputeWorkGroupSizeY;
78 | int maxComputeWorkGroupSizeZ;
79 | int maxComputeUniformComponents;
80 | int maxComputeTextureImageUnits;
81 | int maxComputeImageUniforms;
82 | int maxComputeAtomicCounters;
83 | int maxComputeAtomicCounterBuffers;
84 | int maxVaryingComponents;
85 | int maxVertexOutputComponents;
86 | int maxGeometryInputComponents;
87 | int maxGeometryOutputComponents;
88 | int maxFragmentInputComponents;
89 | int maxImageUnits;
90 | int maxCombinedImageUnitsAndFragmentOutputs;
91 | int maxCombinedShaderOutputResources;
92 | int maxImageSamples;
93 | int maxVertexImageUniforms;
94 | int maxTessControlImageUniforms;
95 | int maxTessEvaluationImageUniforms;
96 | int maxGeometryImageUniforms;
97 | int maxFragmentImageUniforms;
98 | int maxCombinedImageUniforms;
99 | int maxGeometryTextureImageUnits;
100 | int maxGeometryOutputVertices;
101 | int maxGeometryTotalOutputComponents;
102 | int maxGeometryUniformComponents;
103 | int maxGeometryVaryingComponents;
104 | int maxTessControlInputComponents;
105 | int maxTessControlOutputComponents;
106 | int maxTessControlTextureImageUnits;
107 | int maxTessControlUniformComponents;
108 | int maxTessControlTotalOutputComponents;
109 | int maxTessEvaluationInputComponents;
110 | int maxTessEvaluationOutputComponents;
111 | int maxTessEvaluationTextureImageUnits;
112 | int maxTessEvaluationUniformComponents;
113 | int maxTessPatchComponents;
114 | int maxPatchVertices;
115 | int maxTessGenLevel;
116 | int maxViewports;
117 | int maxVertexAtomicCounters;
118 | int maxTessControlAtomicCounters;
119 | int maxTessEvaluationAtomicCounters;
120 | int maxGeometryAtomicCounters;
121 | int maxFragmentAtomicCounters;
122 | int maxCombinedAtomicCounters;
123 | int maxAtomicCounterBindings;
124 | int maxVertexAtomicCounterBuffers;
125 | int maxTessControlAtomicCounterBuffers;
126 | int maxTessEvaluationAtomicCounterBuffers;
127 | int maxGeometryAtomicCounterBuffers;
128 | int maxFragmentAtomicCounterBuffers;
129 | int maxCombinedAtomicCounterBuffers;
130 | int maxAtomicCounterBufferSize;
131 | int maxTransformFeedbackBuffers;
132 | int maxTransformFeedbackInterleavedComponents;
133 | int maxCullDistances;
134 | int maxCombinedClipAndCullDistances;
135 | int maxSamples;
136 | int maxMeshOutputVerticesNV;
137 | int maxMeshOutputPrimitivesNV;
138 | int maxMeshWorkGroupSizeX_NV;
139 | int maxMeshWorkGroupSizeY_NV;
140 | int maxMeshWorkGroupSizeZ_NV;
141 | int maxTaskWorkGroupSizeX_NV;
142 | int maxTaskWorkGroupSizeY_NV;
143 | int maxTaskWorkGroupSizeZ_NV;
144 | int maxMeshViewCountNV;
145 | int maxMeshOutputVerticesEXT;
146 | int maxMeshOutputPrimitivesEXT;
147 | int maxMeshWorkGroupSizeX_EXT;
148 | int maxMeshWorkGroupSizeY_EXT;
149 | int maxMeshWorkGroupSizeZ_EXT;
150 | int maxTaskWorkGroupSizeX_EXT;
151 | int maxTaskWorkGroupSizeY_EXT;
152 | int maxTaskWorkGroupSizeZ_EXT;
153 | int maxMeshViewCountEXT;
154 | int maxDualSourceDrawBuffersEXT;
155 |
156 | TLimits limits;
157 | };
158 |
159 | #endif // _RESOURCE_LIMITS_INCLUDED_
160 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Include/ShHandle.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // All rights reserved.
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions
7 | // are met:
8 | //
9 | // Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | //
12 | // Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following
14 | // disclaimer in the documentation and/or other materials provided
15 | // with the distribution.
16 | //
17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 | // contributors may be used to endorse or promote products derived
19 | // from this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 | //
34 |
35 | #ifndef _SHHANDLE_INCLUDED_
36 | #define _SHHANDLE_INCLUDED_
37 |
38 | //
39 | // Machine independent part of the compiler private objects
40 | // sent as ShHandle to the driver.
41 | //
42 | // This should not be included by driver code.
43 | //
44 |
45 | #define SH_EXPORTING
46 | #include "../Public/ShaderLang.h"
47 | #include "../MachineIndependent/Versions.h"
48 | #include "InfoSink.h"
49 |
50 | class TCompiler;
51 | class TLinker;
52 | class TUniformMap;
53 |
54 | //
55 | // The base class used to back handles returned to the driver.
56 | //
57 | class TShHandleBase {
58 | public:
59 | TShHandleBase() { pool = new glslang::TPoolAllocator; }
60 | virtual ~TShHandleBase() { delete pool; }
61 | virtual TCompiler* getAsCompiler() { return nullptr; }
62 | virtual TLinker* getAsLinker() { return nullptr; }
63 | virtual TUniformMap* getAsUniformMap() { return nullptr; }
64 | virtual glslang::TPoolAllocator* getPool() const { return pool; }
65 | private:
66 | glslang::TPoolAllocator* pool;
67 | };
68 |
69 | //
70 | // The base class for the machine dependent linker to derive from
71 | // for managing where uniforms live.
72 | //
73 | class TUniformMap : public TShHandleBase {
74 | public:
75 | TUniformMap() { }
76 | virtual ~TUniformMap() { }
77 | virtual TUniformMap* getAsUniformMap() { return this; }
78 | virtual int getLocation(const char* name) = 0;
79 | virtual TInfoSink& getInfoSink() { return infoSink; }
80 | TInfoSink infoSink;
81 | };
82 |
83 | class TIntermNode;
84 |
85 | //
86 | // The base class for the machine dependent compiler to derive from
87 | // for managing object code from the compile.
88 | //
89 | class TCompiler : public TShHandleBase {
90 | public:
91 | TCompiler(EShLanguage l, TInfoSink& sink) : infoSink(sink) , language(l), haveValidObjectCode(false) { }
92 | virtual ~TCompiler() { }
93 | EShLanguage getLanguage() { return language; }
94 | virtual TInfoSink& getInfoSink() { return infoSink; }
95 |
96 | virtual bool compile(TIntermNode* root, int version = 0, EProfile profile = ENoProfile) = 0;
97 |
98 | virtual TCompiler* getAsCompiler() { return this; }
99 | virtual bool linkable() { return haveValidObjectCode; }
100 |
101 | TInfoSink& infoSink;
102 | protected:
103 | TCompiler& operator=(TCompiler&);
104 |
105 | EShLanguage language;
106 | bool haveValidObjectCode;
107 | };
108 |
109 | //
110 | // Link operations are based on a list of compile results...
111 | //
112 | typedef glslang::TVector TCompilerList;
113 | typedef glslang::TVector THandleList;
114 |
115 | //
116 | // The base class for the machine dependent linker to derive from
117 | // to manage the resulting executable.
118 | //
119 |
120 | class TLinker : public TShHandleBase {
121 | public:
122 | TLinker(EShExecutable e, TInfoSink& iSink) :
123 | infoSink(iSink),
124 | executable(e),
125 | haveReturnableObjectCode(false),
126 | appAttributeBindings(nullptr),
127 | fixedAttributeBindings(nullptr),
128 | excludedAttributes(nullptr),
129 | excludedCount(0),
130 | uniformBindings(nullptr) { }
131 | virtual TLinker* getAsLinker() { return this; }
132 | virtual ~TLinker() { }
133 | virtual bool link(TCompilerList&, TUniformMap*) = 0;
134 | virtual bool link(THandleList&) { return false; }
135 | virtual void setAppAttributeBindings(const ShBindingTable* t) { appAttributeBindings = t; }
136 | virtual void setFixedAttributeBindings(const ShBindingTable* t) { fixedAttributeBindings = t; }
137 | virtual void getAttributeBindings(ShBindingTable const **t) const = 0;
138 | virtual void setExcludedAttributes(const int* attributes, int count) { excludedAttributes = attributes; excludedCount = count; }
139 | virtual ShBindingTable* getUniformBindings() const { return uniformBindings; }
140 | virtual const void* getObjectCode() const { return nullptr; } // a real compiler would be returning object code here
141 | virtual TInfoSink& getInfoSink() { return infoSink; }
142 | TInfoSink& infoSink;
143 | protected:
144 | TLinker& operator=(TLinker&);
145 | EShExecutable executable;
146 | bool haveReturnableObjectCode; // true when objectCode is acceptable to send to driver
147 |
148 | const ShBindingTable* appAttributeBindings;
149 | const ShBindingTable* fixedAttributeBindings;
150 | const int* excludedAttributes;
151 | int excludedCount;
152 | ShBindingTable* uniformBindings; // created by the linker
153 | };
154 |
155 | //
156 | // This is the interface between the machine independent code
157 | // and the machine dependent code.
158 | //
159 | // The machine dependent code should derive from the classes
160 | // above. Then Construct*() and Delete*() will create and
161 | // destroy the machine dependent objects, which contain the
162 | // above machine independent information.
163 | //
164 | TCompiler* ConstructCompiler(EShLanguage, int);
165 |
166 | TShHandleBase* ConstructLinker(EShExecutable, int);
167 | TShHandleBase* ConstructBindings();
168 | void DeleteLinker(TShHandleBase*);
169 | void DeleteBindingList(TShHandleBase* bindingList);
170 |
171 | TUniformMap* ConstructUniformMap();
172 | void DeleteCompiler(TCompiler*);
173 |
174 | void DeleteUniformMap(TUniformMap*);
175 |
176 | #endif // _SHHANDLE_INCLUDED_
177 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Include/SpirvIntrinsics.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright(C) 2021 Advanced Micro Devices, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 | //
35 |
36 | #pragma once
37 |
38 | #ifndef GLSLANG_WEB
39 |
40 | //
41 | // GL_EXT_spirv_intrinsics
42 | //
43 | #include "Common.h"
44 |
45 | namespace glslang {
46 |
47 | class TIntermTyped;
48 | class TIntermConstantUnion;
49 | class TType;
50 |
51 | // SPIR-V requirements
52 | struct TSpirvRequirement {
53 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
54 |
55 | // capability = [..]
56 | TSet extensions;
57 | // extension = [..]
58 | TSet capabilities;
59 | };
60 |
61 | // SPIR-V execution modes
62 | struct TSpirvExecutionMode {
63 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
64 |
65 | // spirv_execution_mode
66 | TMap> modes;
67 | // spirv_execution_mode_id
68 | TMap > modeIds;
69 | };
70 |
71 | // SPIR-V decorations
72 | struct TSpirvDecorate {
73 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
74 |
75 | // spirv_decorate
76 | TMap > decorates;
77 | // spirv_decorate_id
78 | TMap> decorateIds;
79 | // spirv_decorate_string
80 | TMap > decorateStrings;
81 | };
82 |
83 | // SPIR-V instruction
84 | struct TSpirvInstruction {
85 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
86 |
87 | TSpirvInstruction() { set = ""; id = -1; }
88 |
89 | bool operator==(const TSpirvInstruction& rhs) const { return set == rhs.set && id == rhs.id; }
90 | bool operator!=(const TSpirvInstruction& rhs) const { return !operator==(rhs); }
91 |
92 | // spirv_instruction
93 | TString set;
94 | int id;
95 | };
96 |
97 | // SPIR-V type parameter
98 | struct TSpirvTypeParameter {
99 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
100 |
101 | TSpirvTypeParameter(const TIntermConstantUnion* arg)
102 | {
103 | constant = arg;
104 | type = nullptr;
105 | }
106 |
107 | TSpirvTypeParameter(const TType *arg)
108 | {
109 | constant = nullptr;
110 | type = arg;
111 | }
112 |
113 | bool operator==(const TSpirvTypeParameter& rhs) const;
114 | bool operator!=(const TSpirvTypeParameter& rhs) const { return !operator==(rhs); }
115 |
116 | const TIntermConstantUnion* constant; // Constant expression
117 | const TType* type; // Type specifier
118 | };
119 |
120 | typedef TVector TSpirvTypeParameters;
121 |
122 | // SPIR-V type
123 | struct TSpirvType {
124 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
125 |
126 | bool operator==(const TSpirvType& rhs) const
127 | {
128 | return spirvInst == rhs.spirvInst && typeParams == rhs.typeParams;
129 | }
130 | bool operator!=(const TSpirvType& rhs) const { return !operator==(rhs); }
131 |
132 | // spirv_type
133 | TSpirvInstruction spirvInst;
134 | TSpirvTypeParameters typeParams;
135 | };
136 |
137 | } // end namespace glslang
138 |
139 | #endif // GLSLANG_WEB
140 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/Initialize.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // Copyright (C) 2013-2016 LunarG, Inc.
4 | //
5 | // All rights reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions
9 | // are met:
10 | //
11 | // Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | //
14 | // Redistributions in binary form must reproduce the above
15 | // copyright notice, this list of conditions and the following
16 | // disclaimer in the documentation and/or other materials provided
17 | // with the distribution.
18 | //
19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
20 | // contributors may be used to endorse or promote products derived
21 | // from this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 | // POSSIBILITY OF SUCH DAMAGE.
35 | //
36 |
37 | #ifndef _INITIALIZE_INCLUDED_
38 | #define _INITIALIZE_INCLUDED_
39 |
40 | #include "../Include/ResourceLimits.h"
41 | #include "../Include/Common.h"
42 | #include "../Include/ShHandle.h"
43 | #include "SymbolTable.h"
44 | #include "Versions.h"
45 |
46 | namespace glslang {
47 |
48 | //
49 | // This is made to hold parseable strings for almost all the built-in
50 | // functions and variables for one specific combination of version
51 | // and profile. (Some still need to be added programmatically.)
52 | // This is a base class for language-specific derivations, which
53 | // can be used for language independent builtins.
54 | //
55 | // The strings are organized by
56 | // commonBuiltins: intersection of all stages' built-ins, processed just once
57 | // stageBuiltins[]: anything a stage needs that's not in commonBuiltins
58 | //
59 | class TBuiltInParseables {
60 | public:
61 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
62 | TBuiltInParseables();
63 | virtual ~TBuiltInParseables();
64 | virtual void initialize(int version, EProfile, const SpvVersion& spvVersion) = 0;
65 | virtual void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage) = 0;
66 | virtual const TString& getCommonString() const { return commonBuiltins; }
67 | virtual const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; }
68 |
69 | virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable) = 0;
70 | virtual void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources) = 0;
71 |
72 | protected:
73 | TString commonBuiltins;
74 | TString stageBuiltins[EShLangCount];
75 | };
76 |
77 | //
78 | // This is a GLSL specific derivation of TBuiltInParseables. To present a stable
79 | // interface and match other similar code, it is called TBuiltIns, rather
80 | // than TBuiltInParseablesGlsl.
81 | //
82 | class TBuiltIns : public TBuiltInParseables {
83 | public:
84 | POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
85 | TBuiltIns();
86 | virtual ~TBuiltIns();
87 | void initialize(int version, EProfile, const SpvVersion& spvVersion);
88 | void initialize(const TBuiltInResource& resources, int version, EProfile, const SpvVersion& spvVersion, EShLanguage);
89 |
90 | void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable);
91 | void identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources);
92 |
93 | protected:
94 | void addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion);
95 | void relateTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage, TSymbolTable&);
96 | void add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion);
97 | void addSubpassSampling(TSampler, const TString& typeName, int version, EProfile profile);
98 | void addQueryFunctions(TSampler, const TString& typeName, int version, EProfile profile);
99 | void addImageFunctions(TSampler, const TString& typeName, int version, EProfile profile);
100 | void addSamplingFunctions(TSampler, const TString& typeName, int version, EProfile profile);
101 | void addGatherFunctions(TSampler, const TString& typeName, int version, EProfile profile);
102 |
103 | // Helpers for making textual representations of the permutations
104 | // of texturing/imaging functions.
105 | const char* postfixes[5];
106 | const char* prefixes[EbtNumTypes];
107 | int dimMap[EsdNumDims];
108 | };
109 |
110 | } // end namespace glslang
111 |
112 | #endif // _INITIALIZE_INCLUDED_
113 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/LiveTraverser.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2016 LunarG, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 | //
35 |
36 | #pragma once
37 |
38 | #include "../Include/Common.h"
39 | #include "reflection.h"
40 | #include "localintermediate.h"
41 |
42 | #include "gl_types.h"
43 |
44 | #include
45 | #include
46 |
47 | namespace glslang {
48 |
49 | //
50 | // The traverser: mostly pass through, except
51 | // - processing function-call nodes to push live functions onto the stack of functions to process
52 | // - processing selection nodes to trim semantically dead code
53 | //
54 | // This is in the glslang namespace directly so it can be a friend of TReflection.
55 | // This can be derived from to implement reflection database traversers or
56 | // binding mappers: anything that wants to traverse the live subset of the tree.
57 | //
58 |
59 | class TLiveTraverser : public TIntermTraverser {
60 | public:
61 | TLiveTraverser(const TIntermediate& i, bool traverseAll = false,
62 | bool preVisit = true, bool inVisit = false, bool postVisit = false) :
63 | TIntermTraverser(preVisit, inVisit, postVisit),
64 | intermediate(i), traverseAll(traverseAll)
65 | { }
66 |
67 | //
68 | // Given a function name, find its subroot in the tree, and push it onto the stack of
69 | // functions left to process.
70 | //
71 | void pushFunction(const TString& name)
72 | {
73 | TIntermSequence& globals = intermediate.getTreeRoot()->getAsAggregate()->getSequence();
74 | for (unsigned int f = 0; f < globals.size(); ++f) {
75 | TIntermAggregate* candidate = globals[f]->getAsAggregate();
76 | if (candidate && candidate->getOp() == EOpFunction && candidate->getName() == name) {
77 | destinations.push_back(candidate);
78 | break;
79 | }
80 | }
81 | }
82 |
83 | void pushGlobalReference(const TString& name)
84 | {
85 | TIntermSequence& globals = intermediate.getTreeRoot()->getAsAggregate()->getSequence();
86 | for (unsigned int f = 0; f < globals.size(); ++f) {
87 | TIntermAggregate* candidate = globals[f]->getAsAggregate();
88 | if (candidate && candidate->getOp() == EOpSequence &&
89 | candidate->getSequence().size() == 1 &&
90 | candidate->getSequence()[0]->getAsBinaryNode()) {
91 | TIntermBinary* binary = candidate->getSequence()[0]->getAsBinaryNode();
92 | TIntermSymbol* symbol = binary->getLeft()->getAsSymbolNode();
93 | if (symbol && symbol->getQualifier().storage == EvqGlobal &&
94 | symbol->getName() == name) {
95 | destinations.push_back(candidate);
96 | break;
97 | }
98 | }
99 | }
100 | }
101 |
102 | typedef std::list TDestinationStack;
103 | TDestinationStack destinations;
104 |
105 | protected:
106 | // To catch which function calls are not dead, and hence which functions must be visited.
107 | virtual bool visitAggregate(TVisit, TIntermAggregate* node)
108 | {
109 | if (!traverseAll)
110 | if (node->getOp() == EOpFunctionCall)
111 | addFunctionCall(node);
112 |
113 | return true; // traverse this subtree
114 | }
115 |
116 | // To prune semantically dead paths.
117 | virtual bool visitSelection(TVisit /* visit */, TIntermSelection* node)
118 | {
119 | if (traverseAll)
120 | return true; // traverse all code
121 |
122 | TIntermConstantUnion* constant = node->getCondition()->getAsConstantUnion();
123 | if (constant) {
124 | // cull the path that is dead
125 | if (constant->getConstArray()[0].getBConst() == true && node->getTrueBlock())
126 | node->getTrueBlock()->traverse(this);
127 | if (constant->getConstArray()[0].getBConst() == false && node->getFalseBlock())
128 | node->getFalseBlock()->traverse(this);
129 |
130 | return false; // don't traverse any more, we did it all above
131 | } else
132 | return true; // traverse the whole subtree
133 | }
134 |
135 | // Track live functions as well as uniforms, so that we don't visit dead functions
136 | // and only visit each function once.
137 | void addFunctionCall(TIntermAggregate* call)
138 | {
139 | // just use the map to ensure we process each function at most once
140 | if (liveFunctions.find(call->getName()) == liveFunctions.end()) {
141 | liveFunctions.insert(call->getName());
142 | pushFunction(call->getName());
143 | }
144 | }
145 |
146 | void addGlobalReference(const TString& name)
147 | {
148 | // just use the map to ensure we process each global at most once
149 | if (liveGlobals.find(name) == liveGlobals.end()) {
150 | liveGlobals.insert(name);
151 | pushGlobalReference(name);
152 | }
153 | }
154 |
155 | const TIntermediate& intermediate;
156 | typedef std::unordered_set TLiveFunctions;
157 | TLiveFunctions liveFunctions;
158 | typedef std::unordered_set TLiveGlobals;
159 | TLiveGlobals liveGlobals;
160 | bool traverseAll;
161 |
162 | private:
163 | // prevent copy & copy construct
164 | TLiveTraverser(TLiveTraverser&);
165 | TLiveTraverser& operator=(TLiveTraverser&);
166 | };
167 |
168 | } // namespace glslang
169 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/RemoveTree.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // All rights reserved.
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions
7 | // are met:
8 | //
9 | // Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | //
12 | // Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following
14 | // disclaimer in the documentation and/or other materials provided
15 | // with the distribution.
16 | //
17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 | // contributors may be used to endorse or promote products derived
19 | // from this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 | //
34 |
35 | #pragma once
36 |
37 | namespace glslang {
38 |
39 | void RemoveAllTreeNodes(TIntermNode*);
40 |
41 | } // end namespace glslang
42 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/ScanContext.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2013 LunarG, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 | //
35 |
36 | //
37 | // This holds context specific to the GLSL scanner, which
38 | // sits between the preprocessor scanner and parser.
39 | //
40 |
41 | #pragma once
42 |
43 | #include "ParseHelper.h"
44 |
45 | namespace glslang {
46 |
47 | class TPpContext;
48 | class TPpToken;
49 | class TParserToken;
50 |
51 | class TScanContext {
52 | public:
53 | explicit TScanContext(TParseContextBase& pc) :
54 | parseContext(pc),
55 | afterType(false), afterStruct(false),
56 | field(false), afterBuffer(false) { }
57 | virtual ~TScanContext() { }
58 |
59 | static void fillInKeywordMap();
60 | static void deleteKeywordMap();
61 |
62 | int tokenize(TPpContext*, TParserToken&);
63 |
64 | protected:
65 | TScanContext(TScanContext&);
66 | TScanContext& operator=(TScanContext&);
67 |
68 | int tokenizeIdentifier();
69 | int identifierOrType();
70 | int reservedWord();
71 | int identifierOrReserved(bool reserved);
72 | int es30ReservedFromGLSL(int version);
73 | int nonreservedKeyword(int esVersion, int nonEsVersion);
74 | int precisionKeyword();
75 | int matNxM();
76 | int dMat();
77 | int firstGenerationImage(bool inEs310);
78 | int secondGenerationImage();
79 |
80 | TParseContextBase& parseContext;
81 | bool afterType; // true if we've recognized a type, so can only be looking for an identifier
82 | bool afterStruct; // true if we've recognized the STRUCT keyword, so can only be looking for an identifier
83 | bool field; // true if we're on a field, right after a '.'
84 | bool afterBuffer; // true if we've recognized the BUFFER keyword
85 | TSourceLoc loc;
86 | TParserToken* parserToken;
87 | TPpToken* ppToken;
88 |
89 | const char* tokenText;
90 | int keyword;
91 | };
92 |
93 | } // end namespace glslang
94 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/attribute.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017 LunarG, Inc.
3 | // Copyright (C) 2018 Google, Inc.
4 | //
5 | // All rights reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions
9 | // are met:
10 | //
11 | // Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | //
14 | // Redistributions in binary form must reproduce the above
15 | // copyright notice, this list of conditions and the following
16 | // disclaimer in the documentation and/or other materials provided
17 | // with the distribution.
18 | //
19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
20 | // contributors may be used to endorse or promote products derived
21 | // from this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 | // POSSIBILITY OF SUCH DAMAGE.
35 | //
36 |
37 | #ifndef _ATTRIBUTE_INCLUDED_
38 | #define _ATTRIBUTE_INCLUDED_
39 |
40 | #include "../Include/Common.h"
41 | #include "../Include/ConstantUnion.h"
42 |
43 | namespace glslang {
44 |
45 | enum TAttributeType {
46 | EatNone,
47 | EatAllow_uav_condition,
48 | EatBranch,
49 | EatCall,
50 | EatDomain,
51 | EatEarlyDepthStencil,
52 | EatFastOpt,
53 | EatFlatten,
54 | EatForceCase,
55 | EatInstance,
56 | EatMaxTessFactor,
57 | EatNumThreads,
58 | EatMaxVertexCount,
59 | EatOutputControlPoints,
60 | EatOutputTopology,
61 | EatPartitioning,
62 | EatPatchConstantFunc,
63 | EatPatchSize,
64 | EatUnroll,
65 | EatLoop,
66 | EatBinding,
67 | EatGlobalBinding,
68 | EatLocation,
69 | EatInputAttachment,
70 | EatBuiltIn,
71 | EatPushConstant,
72 | EatConstantId,
73 | EatDependencyInfinite,
74 | EatDependencyLength,
75 | EatMinIterations,
76 | EatMaxIterations,
77 | EatIterationMultiple,
78 | EatPeelCount,
79 | EatPartialCount,
80 | EatFormatRgba32f,
81 | EatFormatRgba16f,
82 | EatFormatR32f,
83 | EatFormatRgba8,
84 | EatFormatRgba8Snorm,
85 | EatFormatRg32f,
86 | EatFormatRg16f,
87 | EatFormatR11fG11fB10f,
88 | EatFormatR16f,
89 | EatFormatRgba16,
90 | EatFormatRgb10A2,
91 | EatFormatRg16,
92 | EatFormatRg8,
93 | EatFormatR16,
94 | EatFormatR8,
95 | EatFormatRgba16Snorm,
96 | EatFormatRg16Snorm,
97 | EatFormatRg8Snorm,
98 | EatFormatR16Snorm,
99 | EatFormatR8Snorm,
100 | EatFormatRgba32i,
101 | EatFormatRgba16i,
102 | EatFormatRgba8i,
103 | EatFormatR32i,
104 | EatFormatRg32i,
105 | EatFormatRg16i,
106 | EatFormatRg8i,
107 | EatFormatR16i,
108 | EatFormatR8i,
109 | EatFormatRgba32ui,
110 | EatFormatRgba16ui,
111 | EatFormatRgba8ui,
112 | EatFormatR32ui,
113 | EatFormatRgb10a2ui,
114 | EatFormatRg32ui,
115 | EatFormatRg16ui,
116 | EatFormatRg8ui,
117 | EatFormatR16ui,
118 | EatFormatR8ui,
119 | EatFormatUnknown,
120 | EatNonWritable,
121 | EatNonReadable,
122 | EatSubgroupUniformControlFlow,
123 | };
124 |
125 | class TIntermAggregate;
126 |
127 | struct TAttributeArgs {
128 | TAttributeType name;
129 | const TIntermAggregate* args;
130 |
131 | // Obtain attribute as integer
132 | // Return false if it cannot be obtained
133 | bool getInt(int& value, int argNum = 0) const;
134 |
135 | // Obtain attribute as string, with optional to-lower transform
136 | // Return false if it cannot be obtained
137 | bool getString(TString& value, int argNum = 0, bool convertToLower = true) const;
138 |
139 | // How many arguments were provided to the attribute?
140 | int size() const;
141 |
142 | protected:
143 | const TConstUnion* getConstUnion(TBasicType basicType, int argNum) const;
144 | };
145 |
146 | typedef TList TAttributes;
147 |
148 | } // end namespace glslang
149 |
150 | #endif // _ATTRIBUTE_INCLUDED_
151 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/preprocessor/PpTokens.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3 | // All rights reserved.
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions
7 | // are met:
8 | //
9 | // Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | //
12 | // Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following
14 | // disclaimer in the documentation and/or other materials provided
15 | // with the distribution.
16 | //
17 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
18 | // contributors may be used to endorse or promote products derived
19 | // from this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | /****************************************************************************\
35 | Copyright (c) 2002, NVIDIA Corporation.
36 |
37 | NVIDIA Corporation("NVIDIA") supplies this software to you in
38 | consideration of your agreement to the following terms, and your use,
39 | installation, modification or redistribution of this NVIDIA software
40 | constitutes acceptance of these terms. If you do not agree with these
41 | terms, please do not use, install, modify or redistribute this NVIDIA
42 | software.
43 |
44 | In consideration of your agreement to abide by the following terms, and
45 | subject to these terms, NVIDIA grants you a personal, non-exclusive
46 | license, under NVIDIA's copyrights in this original NVIDIA software (the
47 | "NVIDIA Software"), to use, reproduce, modify and redistribute the
48 | NVIDIA Software, with or without modifications, in source and/or binary
49 | forms; provided that if you redistribute the NVIDIA Software, you must
50 | retain the copyright notice of NVIDIA, this notice and the following
51 | text and disclaimers in all such redistributions of the NVIDIA Software.
52 | Neither the name, trademarks, service marks nor logos of NVIDIA
53 | Corporation may be used to endorse or promote products derived from the
54 | NVIDIA Software without specific prior written permission from NVIDIA.
55 | Except as expressly stated in this notice, no other rights or licenses
56 | express or implied, are granted by NVIDIA herein, including but not
57 | limited to any patent rights that may be infringed by your derivative
58 | works or by other works in which the NVIDIA Software may be
59 | incorporated. No hardware is licensed hereunder.
60 |
61 | THE NVIDIA SOFTWARE IS BEING PROVIDED ON AN "AS IS" BASIS, WITHOUT
62 | WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
63 | INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF TITLE,
64 | NON-INFRINGEMENT, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
65 | ITS USE AND OPERATION EITHER ALONE OR IN COMBINATION WITH OTHER
66 | PRODUCTS.
67 |
68 | IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT,
69 | INCIDENTAL, EXEMPLARY, CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
70 | TO, LOST PROFITS; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
71 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) OR ARISING IN ANY WAY
72 | OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE
73 | NVIDIA SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
74 | TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
75 | NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
76 | \****************************************************************************/
77 |
78 | #ifndef PARSER_H
79 | #define PARSER_H
80 |
81 | namespace glslang {
82 |
83 | // Multi-character tokens
84 | enum EFixedAtoms {
85 | // single character tokens get their own char value as their token; start here for multi-character tokens
86 | PpAtomMaxSingle = 127,
87 |
88 | // replace bad character tokens with this, to avoid accidental aliasing with the below
89 | PpAtomBadToken,
90 |
91 | // Operators
92 |
93 | PPAtomAddAssign,
94 | PPAtomSubAssign,
95 | PPAtomMulAssign,
96 | PPAtomDivAssign,
97 | PPAtomModAssign,
98 |
99 | PpAtomRight,
100 | PpAtomLeft,
101 |
102 | PpAtomRightAssign,
103 | PpAtomLeftAssign,
104 | PpAtomAndAssign,
105 | PpAtomOrAssign,
106 | PpAtomXorAssign,
107 |
108 | PpAtomAnd,
109 | PpAtomOr,
110 | PpAtomXor,
111 |
112 | PpAtomEQ,
113 | PpAtomNE,
114 | PpAtomGE,
115 | PpAtomLE,
116 |
117 | PpAtomDecrement,
118 | PpAtomIncrement,
119 |
120 | PpAtomColonColon,
121 |
122 | PpAtomPaste,
123 |
124 | // Constants
125 |
126 | PpAtomConstInt,
127 | PpAtomConstUint,
128 | PpAtomConstInt64,
129 | PpAtomConstUint64,
130 | PpAtomConstInt16,
131 | PpAtomConstUint16,
132 | PpAtomConstFloat,
133 | PpAtomConstDouble,
134 | PpAtomConstFloat16,
135 | PpAtomConstString,
136 |
137 | // Identifiers
138 | PpAtomIdentifier,
139 |
140 | // preprocessor "keywords"
141 |
142 | PpAtomDefine,
143 | PpAtomUndef,
144 |
145 | PpAtomIf,
146 | PpAtomIfdef,
147 | PpAtomIfndef,
148 | PpAtomElse,
149 | PpAtomElif,
150 | PpAtomEndif,
151 |
152 | PpAtomLine,
153 | PpAtomPragma,
154 | PpAtomError,
155 |
156 | // #version ...
157 | PpAtomVersion,
158 | PpAtomCore,
159 | PpAtomCompatibility,
160 | PpAtomEs,
161 |
162 | // #extension
163 | PpAtomExtension,
164 |
165 | // __LINE__, __FILE__, __VERSION__
166 |
167 | PpAtomLineMacro,
168 | PpAtomFileMacro,
169 | PpAtomVersionMacro,
170 |
171 | // #include
172 | PpAtomInclude,
173 |
174 | PpAtomLast,
175 | };
176 |
177 | } // end namespace glslang
178 |
179 | #endif /* not PARSER_H */
180 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/MachineIndependent/propagateNoContraction.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2015-2016 Google, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of Google Inc. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 |
35 | //
36 | // Visit the nodes in the glslang intermediate tree representation to
37 | // propagate 'noContraction' qualifier.
38 | //
39 |
40 | #pragma once
41 |
42 | #include "../Include/intermediate.h"
43 |
44 | namespace glslang {
45 |
46 | // Propagates the 'precise' qualifier for objects (objects marked with
47 | // 'noContraction' qualifier) from the shader source specified 'precise'
48 | // variables to all the involved objects, and add 'noContraction' qualifier for
49 | // the involved arithmetic operations.
50 | // Note that the same qualifier: 'noContraction' is used in both object nodes
51 | // and arithmetic operation nodes, but has different meaning. For object nodes,
52 | // 'noContraction' means the object is 'precise'; and for arithmetic operation
53 | // nodes, it means the operation should not be contracted.
54 | void PropagateNoContraction(const glslang::TIntermediate& intermediate);
55 | };
56 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Public/ResourceLimits.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2016 Google, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of Google Inc. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 |
35 | #ifndef _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
36 | #define _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
37 |
38 | #include
39 |
40 | #include "../Include/ResourceLimits.h"
41 |
42 | // Return pointer to user-writable Resource to pass through API in
43 | // future-proof way.
44 | extern TBuiltInResource* GetResources();
45 |
46 | // These are the default resources for TBuiltInResources, used for both
47 | // - parsing this string for the case where the user didn't supply one,
48 | // - dumping out a template for user construction of a config file.
49 | extern const TBuiltInResource* GetDefaultResources();
50 |
51 | // Returns the DefaultTBuiltInResource as a human-readable string.
52 | std::string GetDefaultTBuiltInResourceString();
53 |
54 | // Decodes the resource limits from |config| to |resources|.
55 | void DecodeResourceLimits(TBuiltInResource* resources, char* config);
56 |
57 | #endif // _STAND_ALONE_RESOURCE_LIMITS_INCLUDED_
58 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/Public/resource_limits_c.h:
--------------------------------------------------------------------------------
1 | /**
2 | BSD 2-Clause License
3 |
4 | Copyright (c) 2020, Travis Fort
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without
8 | modification, are permitted provided that the following conditions are met:
9 |
10 | 1. Redistributions of source code must retain the above copyright notice, this
11 | list of conditions and the following disclaimer.
12 |
13 | 2. Redistributions in binary form must reproduce the above copyright notice,
14 | this list of conditions and the following disclaimer in the documentation
15 | and/or other materials provided with the distribution.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | **/
28 |
29 | #ifndef _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
30 | #define _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
31 |
32 | #include "../Include/glslang_c_interface.h"
33 |
34 | #ifdef __cplusplus
35 | extern "C" {
36 | #endif
37 |
38 | // Returns a struct that can be use to create custom resource values.
39 | glslang_resource_t* glslang_resource(void);
40 |
41 | // These are the default resources for TBuiltInResources, used for both
42 | // - parsing this string for the case where the user didn't supply one,
43 | // - dumping out a template for user construction of a config file.
44 | const glslang_resource_t* glslang_default_resource(void);
45 |
46 | // Returns the DefaultTBuiltInResource as a human-readable string.
47 | // NOTE: User is responsible for freeing this string.
48 | const char* glslang_default_resource_string();
49 |
50 | // Decodes the resource limits from |config| to |resources|.
51 | void glslang_decode_resource_limits(glslang_resource_t* resources, char* config);
52 |
53 | #ifdef __cplusplus
54 | }
55 | #endif
56 |
57 | #endif // _STAND_ALONE_RESOURCE_LIMITS_C_INCLUDED_
58 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GLSL.ext.AMD.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2014-2016 The Khronos Group Inc.
3 | **
4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy
5 | ** of this software and/or associated documentation files (the "Materials"),
6 | ** to deal in the Materials without restriction, including without limitation
7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | ** and/or sell copies of the Materials, and to permit persons to whom the
9 | ** Materials are furnished to do so, subject to the following conditions:
10 | **
11 | ** The above copyright notice and this permission notice shall be included in
12 | ** all copies or substantial portions of the Materials.
13 | **
14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
24 | ** IN THE MATERIALS.
25 | */
26 |
27 | #ifndef GLSLextAMD_H
28 | #define GLSLextAMD_H
29 |
30 | static const int GLSLextAMDVersion = 100;
31 | static const int GLSLextAMDRevision = 7;
32 |
33 | // SPV_AMD_shader_ballot
34 | static const char* const E_SPV_AMD_shader_ballot = "SPV_AMD_shader_ballot";
35 |
36 | enum ShaderBallotAMD {
37 | ShaderBallotBadAMD = 0, // Don't use
38 |
39 | SwizzleInvocationsAMD = 1,
40 | SwizzleInvocationsMaskedAMD = 2,
41 | WriteInvocationAMD = 3,
42 | MbcntAMD = 4,
43 |
44 | ShaderBallotCountAMD
45 | };
46 |
47 | // SPV_AMD_shader_trinary_minmax
48 | static const char* const E_SPV_AMD_shader_trinary_minmax = "SPV_AMD_shader_trinary_minmax";
49 |
50 | enum ShaderTrinaryMinMaxAMD {
51 | ShaderTrinaryMinMaxBadAMD = 0, // Don't use
52 |
53 | FMin3AMD = 1,
54 | UMin3AMD = 2,
55 | SMin3AMD = 3,
56 | FMax3AMD = 4,
57 | UMax3AMD = 5,
58 | SMax3AMD = 6,
59 | FMid3AMD = 7,
60 | UMid3AMD = 8,
61 | SMid3AMD = 9,
62 |
63 | ShaderTrinaryMinMaxCountAMD
64 | };
65 |
66 | // SPV_AMD_shader_explicit_vertex_parameter
67 | static const char* const E_SPV_AMD_shader_explicit_vertex_parameter = "SPV_AMD_shader_explicit_vertex_parameter";
68 |
69 | enum ShaderExplicitVertexParameterAMD {
70 | ShaderExplicitVertexParameterBadAMD = 0, // Don't use
71 |
72 | InterpolateAtVertexAMD = 1,
73 |
74 | ShaderExplicitVertexParameterCountAMD
75 | };
76 |
77 | // SPV_AMD_gcn_shader
78 | static const char* const E_SPV_AMD_gcn_shader = "SPV_AMD_gcn_shader";
79 |
80 | enum GcnShaderAMD {
81 | GcnShaderBadAMD = 0, // Don't use
82 |
83 | CubeFaceIndexAMD = 1,
84 | CubeFaceCoordAMD = 2,
85 | TimeAMD = 3,
86 |
87 | GcnShaderCountAMD
88 | };
89 |
90 | // SPV_AMD_gpu_shader_half_float
91 | static const char* const E_SPV_AMD_gpu_shader_half_float = "SPV_AMD_gpu_shader_half_float";
92 |
93 | // SPV_AMD_texture_gather_bias_lod
94 | static const char* const E_SPV_AMD_texture_gather_bias_lod = "SPV_AMD_texture_gather_bias_lod";
95 |
96 | // SPV_AMD_gpu_shader_int16
97 | static const char* const E_SPV_AMD_gpu_shader_int16 = "SPV_AMD_gpu_shader_int16";
98 |
99 | // SPV_AMD_shader_image_load_store_lod
100 | static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader_image_load_store_lod";
101 |
102 | // SPV_AMD_shader_fragment_mask
103 | static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask";
104 |
105 | // SPV_AMD_gpu_shader_half_float_fetch
106 | static const char* const E_SPV_AMD_gpu_shader_half_float_fetch = "SPV_AMD_gpu_shader_half_float_fetch";
107 |
108 | #endif // #ifndef GLSLextAMD_H
109 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GLSL.ext.ARM.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2022 ARM Limited
3 | **
4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy
5 | ** of this software and/or associated documentation files (the "Materials"),
6 | ** to deal in the Materials without restriction, including without limitation
7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | ** and/or sell copies of the Materials, and to permit persons to whom the
9 | ** Materials are furnished to do so, subject to the following conditions:
10 | **
11 | ** The above copyright notice and this permission notice shall be included in
12 | ** all copies or substantial portions of the Materials.
13 | **
14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
24 | ** IN THE MATERIALS.
25 | */
26 |
27 | #ifndef GLSLextARM_H
28 | #define GLSLextARM_H
29 |
30 | static const int GLSLextARMVersion = 100;
31 | static const int GLSLextARMRevision = 1;
32 |
33 | static const char * const E_SPV_ARM_core_builtins = "SPV_ARM_core_builtins";
34 |
35 | #endif // #ifndef GLSLextARM_H
36 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GLSL.ext.EXT.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2014-2016 The Khronos Group Inc.
3 | **
4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy
5 | ** of this software and/or associated documentation files (the "Materials"),
6 | ** to deal in the Materials without restriction, including without limitation
7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | ** and/or sell copies of the Materials, and to permit persons to whom the
9 | ** Materials are furnished to do so, subject to the following conditions:
10 | **
11 | ** The above copyright notice and this permission notice shall be included in
12 | ** all copies or substantial portions of the Materials.
13 | **
14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
24 | ** IN THE MATERIALS.
25 | */
26 |
27 | #ifndef GLSLextEXT_H
28 | #define GLSLextEXT_H
29 |
30 | static const int GLSLextEXTVersion = 100;
31 | static const int GLSLextEXTRevision = 2;
32 |
33 | static const char* const E_SPV_EXT_shader_stencil_export = "SPV_EXT_shader_stencil_export";
34 | static const char* const E_SPV_EXT_shader_viewport_index_layer = "SPV_EXT_shader_viewport_index_layer";
35 | static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered";
36 | static const char* const E_SPV_EXT_fragment_invocation_density = "SPV_EXT_fragment_invocation_density";
37 | static const char* const E_SPV_EXT_demote_to_helper_invocation = "SPV_EXT_demote_to_helper_invocation";
38 | static const char* const E_SPV_EXT_shader_atomic_float_add = "SPV_EXT_shader_atomic_float_add";
39 | static const char* const E_SPV_EXT_shader_atomic_float16_add = "SPV_EXT_shader_atomic_float16_add";
40 | static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader_atomic_float_min_max";
41 | static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
42 | static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image";
43 | static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
44 |
45 | #endif // #ifndef GLSLextEXT_H
46 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GLSL.ext.KHR.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2014-2020 The Khronos Group Inc.
3 | ** Modifications Copyright (C) 2020 Advanced Micro Devices, Inc. All rights reserved.
4 | **
5 | ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 | ** of this software and/or associated documentation files (the "Materials"),
7 | ** to deal in the Materials without restriction, including without limitation
8 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 | ** and/or sell copies of the Materials, and to permit persons to whom the
10 | ** Materials are furnished to do so, subject to the following conditions:
11 | **
12 | ** The above copyright notice and this permission notice shall be included in
13 | ** all copies or substantial portions of the Materials.
14 | **
15 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
16 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
17 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
18 | **
19 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
25 | ** IN THE MATERIALS.
26 | */
27 |
28 | #ifndef GLSLextKHR_H
29 | #define GLSLextKHR_H
30 |
31 | static const int GLSLextKHRVersion = 100;
32 | static const int GLSLextKHRRevision = 3;
33 |
34 | static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
35 | static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
36 | static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group";
37 | static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview";
38 | static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
39 | static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage";
40 | static const char* const E_SPV_KHR_8bit_storage = "SPV_KHR_8bit_storage";
41 | static const char* const E_SPV_KHR_storage_buffer_storage_class = "SPV_KHR_storage_buffer_storage_class";
42 | static const char* const E_SPV_KHR_post_depth_coverage = "SPV_KHR_post_depth_coverage";
43 | static const char* const E_SPV_KHR_vulkan_memory_model = "SPV_KHR_vulkan_memory_model";
44 | static const char* const E_SPV_EXT_physical_storage_buffer = "SPV_EXT_physical_storage_buffer";
45 | static const char* const E_SPV_KHR_physical_storage_buffer = "SPV_KHR_physical_storage_buffer";
46 | static const char* const E_SPV_EXT_fragment_shader_interlock = "SPV_EXT_fragment_shader_interlock";
47 | static const char* const E_SPV_KHR_shader_clock = "SPV_KHR_shader_clock";
48 | static const char* const E_SPV_KHR_non_semantic_info = "SPV_KHR_non_semantic_info";
49 | static const char* const E_SPV_KHR_ray_tracing = "SPV_KHR_ray_tracing";
50 | static const char* const E_SPV_KHR_ray_query = "SPV_KHR_ray_query";
51 | static const char* const E_SPV_KHR_fragment_shading_rate = "SPV_KHR_fragment_shading_rate";
52 | static const char* const E_SPV_KHR_terminate_invocation = "SPV_KHR_terminate_invocation";
53 | static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_workgroup_memory_explicit_layout";
54 | static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
55 | static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
56 | static const char* const E_SPV_AMD_shader_early_and_late_fragment_tests = "SPV_AMD_shader_early_and_late_fragment_tests";
57 | static const char* const E_SPV_KHR_ray_tracing_position_fetch = "SPV_KHR_ray_tracing_position_fetch";
58 | static const char* const E_SPV_KHR_cooperative_matrix = "SPV_KHR_cooperative_matrix";
59 |
60 | #endif // #ifndef GLSLextKHR_H
61 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GLSL.ext.NV.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2014-2017 The Khronos Group Inc.
3 | **
4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy
5 | ** of this software and/or associated documentation files (the "Materials"),
6 | ** to deal in the Materials without restriction, including without limitation
7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | ** and/or sell copies of the Materials, and to permit persons to whom the
9 | ** Materials are furnished to do so, subject to the following conditions:
10 | **
11 | ** The above copyright notice and this permission notice shall be included in
12 | ** all copies or substantial portions of the Materials.
13 | **
14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
24 | ** IN THE MATERIALS.
25 | */
26 |
27 | #ifndef GLSLextNV_H
28 | #define GLSLextNV_H
29 |
30 | enum BuiltIn;
31 | enum Decoration;
32 | enum Op;
33 | enum Capability;
34 |
35 | static const int GLSLextNVVersion = 100;
36 | static const int GLSLextNVRevision = 11;
37 |
38 | //SPV_NV_sample_mask_override_coverage
39 | const char* const E_SPV_NV_sample_mask_override_coverage = "SPV_NV_sample_mask_override_coverage";
40 |
41 | //SPV_NV_geometry_shader_passthrough
42 | const char* const E_SPV_NV_geometry_shader_passthrough = "SPV_NV_geometry_shader_passthrough";
43 |
44 | //SPV_NV_viewport_array2
45 | const char* const E_SPV_NV_viewport_array2 = "SPV_NV_viewport_array2";
46 | const char* const E_ARB_shader_viewport_layer_array = "SPV_ARB_shader_viewport_layer_array";
47 |
48 | //SPV_NV_stereo_view_rendering
49 | const char* const E_SPV_NV_stereo_view_rendering = "SPV_NV_stereo_view_rendering";
50 |
51 | //SPV_NVX_multiview_per_view_attributes
52 | const char* const E_SPV_NVX_multiview_per_view_attributes = "SPV_NVX_multiview_per_view_attributes";
53 |
54 | //SPV_NV_shader_subgroup_partitioned
55 | const char* const E_SPV_NV_shader_subgroup_partitioned = "SPV_NV_shader_subgroup_partitioned";
56 |
57 | //SPV_NV_fragment_shader_barycentric
58 | const char* const E_SPV_NV_fragment_shader_barycentric = "SPV_NV_fragment_shader_barycentric";
59 |
60 | //SPV_NV_compute_shader_derivatives
61 | const char* const E_SPV_NV_compute_shader_derivatives = "SPV_NV_compute_shader_derivatives";
62 |
63 | //SPV_NV_shader_image_footprint
64 | const char* const E_SPV_NV_shader_image_footprint = "SPV_NV_shader_image_footprint";
65 |
66 | //SPV_NV_mesh_shader
67 | const char* const E_SPV_NV_mesh_shader = "SPV_NV_mesh_shader";
68 |
69 | //SPV_NV_raytracing
70 | const char* const E_SPV_NV_ray_tracing = "SPV_NV_ray_tracing";
71 |
72 | //SPV_NV_ray_tracing_motion_blur
73 | const char* const E_SPV_NV_ray_tracing_motion_blur = "SPV_NV_ray_tracing_motion_blur";
74 |
75 | //SPV_NV_shading_rate
76 | const char* const E_SPV_NV_shading_rate = "SPV_NV_shading_rate";
77 |
78 | //SPV_NV_cooperative_matrix
79 | const char* const E_SPV_NV_cooperative_matrix = "SPV_NV_cooperative_matrix";
80 |
81 | //SPV_NV_shader_sm_builtins
82 | const char* const E_SPV_NV_shader_sm_builtins = "SPV_NV_shader_sm_builtins";
83 |
84 | //SPV_NV_shader_execution_reorder
85 | const char* const E_SPV_NV_shader_invocation_reorder = "SPV_NV_shader_invocation_reorder";
86 |
87 | #endif // #ifndef GLSLextNV_H
88 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GLSL.std.450.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (c) 2014-2016 The Khronos Group Inc.
3 | **
4 | ** Permission is hereby granted, free of charge, to any person obtaining a copy
5 | ** of this software and/or associated documentation files (the "Materials"),
6 | ** to deal in the Materials without restriction, including without limitation
7 | ** the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | ** and/or sell copies of the Materials, and to permit persons to whom the
9 | ** Materials are furnished to do so, subject to the following conditions:
10 | **
11 | ** The above copyright notice and this permission notice shall be included in
12 | ** all copies or substantial portions of the Materials.
13 | **
14 | ** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
15 | ** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
16 | ** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
17 | **
18 | ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 | ** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 | ** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 | ** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
24 | ** IN THE MATERIALS.
25 | */
26 |
27 | #ifndef GLSLstd450_H
28 | #define GLSLstd450_H
29 |
30 | static const int GLSLstd450Version = 100;
31 | static const int GLSLstd450Revision = 1;
32 |
33 | enum GLSLstd450 {
34 | GLSLstd450Bad = 0, // Don't use
35 |
36 | GLSLstd450Round = 1,
37 | GLSLstd450RoundEven = 2,
38 | GLSLstd450Trunc = 3,
39 | GLSLstd450FAbs = 4,
40 | GLSLstd450SAbs = 5,
41 | GLSLstd450FSign = 6,
42 | GLSLstd450SSign = 7,
43 | GLSLstd450Floor = 8,
44 | GLSLstd450Ceil = 9,
45 | GLSLstd450Fract = 10,
46 |
47 | GLSLstd450Radians = 11,
48 | GLSLstd450Degrees = 12,
49 | GLSLstd450Sin = 13,
50 | GLSLstd450Cos = 14,
51 | GLSLstd450Tan = 15,
52 | GLSLstd450Asin = 16,
53 | GLSLstd450Acos = 17,
54 | GLSLstd450Atan = 18,
55 | GLSLstd450Sinh = 19,
56 | GLSLstd450Cosh = 20,
57 | GLSLstd450Tanh = 21,
58 | GLSLstd450Asinh = 22,
59 | GLSLstd450Acosh = 23,
60 | GLSLstd450Atanh = 24,
61 | GLSLstd450Atan2 = 25,
62 |
63 | GLSLstd450Pow = 26,
64 | GLSLstd450Exp = 27,
65 | GLSLstd450Log = 28,
66 | GLSLstd450Exp2 = 29,
67 | GLSLstd450Log2 = 30,
68 | GLSLstd450Sqrt = 31,
69 | GLSLstd450InverseSqrt = 32,
70 |
71 | GLSLstd450Determinant = 33,
72 | GLSLstd450MatrixInverse = 34,
73 |
74 | GLSLstd450Modf = 35, // second operand needs an OpVariable to write to
75 | GLSLstd450ModfStruct = 36, // no OpVariable operand
76 | GLSLstd450FMin = 37,
77 | GLSLstd450UMin = 38,
78 | GLSLstd450SMin = 39,
79 | GLSLstd450FMax = 40,
80 | GLSLstd450UMax = 41,
81 | GLSLstd450SMax = 42,
82 | GLSLstd450FClamp = 43,
83 | GLSLstd450UClamp = 44,
84 | GLSLstd450SClamp = 45,
85 | GLSLstd450FMix = 46,
86 | GLSLstd450IMix = 47, // Reserved
87 | GLSLstd450Step = 48,
88 | GLSLstd450SmoothStep = 49,
89 |
90 | GLSLstd450Fma = 50,
91 | GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to
92 | GLSLstd450FrexpStruct = 52, // no OpVariable operand
93 | GLSLstd450Ldexp = 53,
94 |
95 | GLSLstd450PackSnorm4x8 = 54,
96 | GLSLstd450PackUnorm4x8 = 55,
97 | GLSLstd450PackSnorm2x16 = 56,
98 | GLSLstd450PackUnorm2x16 = 57,
99 | GLSLstd450PackHalf2x16 = 58,
100 | GLSLstd450PackDouble2x32 = 59,
101 | GLSLstd450UnpackSnorm2x16 = 60,
102 | GLSLstd450UnpackUnorm2x16 = 61,
103 | GLSLstd450UnpackHalf2x16 = 62,
104 | GLSLstd450UnpackSnorm4x8 = 63,
105 | GLSLstd450UnpackUnorm4x8 = 64,
106 | GLSLstd450UnpackDouble2x32 = 65,
107 |
108 | GLSLstd450Length = 66,
109 | GLSLstd450Distance = 67,
110 | GLSLstd450Cross = 68,
111 | GLSLstd450Normalize = 69,
112 | GLSLstd450FaceForward = 70,
113 | GLSLstd450Reflect = 71,
114 | GLSLstd450Refract = 72,
115 |
116 | GLSLstd450FindILsb = 73,
117 | GLSLstd450FindSMsb = 74,
118 | GLSLstd450FindUMsb = 75,
119 |
120 | GLSLstd450InterpolateAtCentroid = 76,
121 | GLSLstd450InterpolateAtSample = 77,
122 | GLSLstd450InterpolateAtOffset = 78,
123 |
124 | GLSLstd450NMin = 79,
125 | GLSLstd450NMax = 80,
126 | GLSLstd450NClamp = 81,
127 |
128 | GLSLstd450Count
129 | };
130 |
131 | #endif // #ifndef GLSLstd450_H
132 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/GlslangToSpv.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2014 LunarG, Inc.
3 | // Copyright (C) 2015-2018 Google, Inc.
4 | //
5 | // All rights reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions
9 | // are met:
10 | //
11 | // Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | //
14 | // Redistributions in binary form must reproduce the above
15 | // copyright notice, this list of conditions and the following
16 | // disclaimer in the documentation and/or other materials provided
17 | // with the distribution.
18 | //
19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
20 | // contributors may be used to endorse or promote products derived
21 | // from this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 | // POSSIBILITY OF SUCH DAMAGE.
35 |
36 | #pragma once
37 |
38 | #if defined(_MSC_VER) && _MSC_VER >= 1900
39 | #pragma warning(disable : 4464) // relative include path contains '..'
40 | #endif
41 |
42 | #include "SpvTools.h"
43 | #include "glslang/Include/intermediate.h"
44 |
45 | #include
46 | #include
47 |
48 | #include "Logger.h"
49 |
50 | namespace glslang {
51 |
52 | void GetSpirvVersion(std::string&);
53 | int GetSpirvGeneratorVersion();
54 | void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv,
55 | SpvOptions* options = nullptr);
56 | void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector& spirv,
57 | spv::SpvBuildLogger* logger, SpvOptions* options = nullptr);
58 | bool OutputSpvBin(const std::vector& spirv, const char* baseName);
59 | bool OutputSpvHex(const std::vector& spirv, const char* baseName, const char* varName);
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/Logger.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2016 Google, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of Google Inc. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 |
35 | #ifndef GLSLANG_SPIRV_LOGGER_H
36 | #define GLSLANG_SPIRV_LOGGER_H
37 |
38 | #include
39 | #include
40 |
41 | namespace spv {
42 |
43 | // A class for holding all SPIR-V build status messages, including
44 | // missing/TBD functionalities, warnings, and errors.
45 | class SpvBuildLogger {
46 | public:
47 | SpvBuildLogger() {}
48 |
49 | #ifdef GLSLANG_WEB
50 | void tbdFunctionality(const std::string& f) { }
51 | void missingFunctionality(const std::string& f) { }
52 | void warning(const std::string& w) { }
53 | void error(const std::string& e) { errors.push_back(e); }
54 | std::string getAllMessages() { return ""; }
55 | #else
56 |
57 | // Registers a TBD functionality.
58 | void tbdFunctionality(const std::string& f);
59 | // Registers a missing functionality.
60 | void missingFunctionality(const std::string& f);
61 |
62 | // Logs a warning.
63 | void warning(const std::string& w) { warnings.push_back(w); }
64 | // Logs an error.
65 | void error(const std::string& e) { errors.push_back(e); }
66 |
67 | // Returns all messages accumulated in the order of:
68 | // TBD functionalities, missing functionalities, warnings, errors.
69 | std::string getAllMessages() const;
70 | #endif
71 |
72 | private:
73 | SpvBuildLogger(const SpvBuildLogger&);
74 |
75 | std::vector tbdFeatures;
76 | std::vector missingFeatures;
77 | std::vector warnings;
78 | std::vector errors;
79 | };
80 |
81 | } // end spv namespace
82 |
83 | #endif // GLSLANG_SPIRV_LOGGER_H
84 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/NonSemanticDebugPrintf.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2020 The Khronos Group Inc.
2 | //
3 | // Permission is hereby granted, free of charge, to any person obtaining a
4 | // copy of this software and/or associated documentation files (the
5 | // "Materials"), to deal in the Materials without restriction, including
6 | // without limitation the rights to use, copy, modify, merge, publish,
7 | // distribute, sublicense, and/or sell copies of the Materials, and to
8 | // permit persons to whom the Materials are furnished to do so, subject to
9 | // the following conditions:
10 | //
11 | // The above copyright notice and this permission notice shall be included
12 | // in all copies or substantial portions of the Materials.
13 | //
14 | // MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
15 | // KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
16 | // SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
17 | // https://www.khronos.org/registry/
18 | //
19 | // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23 | // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 | // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 | // MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26 | //
27 |
28 | #ifndef SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
29 | #define SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | enum {
36 | NonSemanticDebugPrintfRevision = 1,
37 | NonSemanticDebugPrintfRevision_BitWidthPadding = 0x7fffffff
38 | };
39 |
40 | enum NonSemanticDebugPrintfInstructions {
41 | NonSemanticDebugPrintfDebugPrintf = 1,
42 | NonSemanticDebugPrintfInstructionsMax = 0x7fffffff
43 | };
44 |
45 |
46 | #ifdef __cplusplus
47 | }
48 | #endif
49 |
50 | #endif // SPIRV_UNIFIED1_NonSemanticDebugPrintf_H_
51 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/SpvTools.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2014-2016 LunarG, Inc.
3 | // Copyright (C) 2018 Google, Inc.
4 | //
5 | // All rights reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions
9 | // are met:
10 | //
11 | // Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | //
14 | // Redistributions in binary form must reproduce the above
15 | // copyright notice, this list of conditions and the following
16 | // disclaimer in the documentation and/or other materials provided
17 | // with the distribution.
18 | //
19 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
20 | // contributors may be used to endorse or promote products derived
21 | // from this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 | // POSSIBILITY OF SUCH DAMAGE.
35 |
36 | //
37 | // Call into SPIRV-Tools to disassemble, validate, and optimize.
38 | //
39 |
40 | #pragma once
41 | #ifndef GLSLANG_SPV_TOOLS_H
42 | #define GLSLANG_SPV_TOOLS_H
43 |
44 | #if ENABLE_OPT
45 | #include
46 | #include
47 | #include "spirv-tools/libspirv.h"
48 | #endif
49 |
50 | #include "glslang/MachineIndependent/localintermediate.h"
51 | #include "Logger.h"
52 |
53 | namespace glslang {
54 |
55 | struct SpvOptions {
56 | bool generateDebugInfo {false};
57 | bool stripDebugInfo {false};
58 | bool disableOptimizer {true};
59 | bool optimizeSize {false};
60 | bool disassemble {false};
61 | bool validate {false};
62 | bool emitNonSemanticShaderDebugInfo {false};
63 | bool emitNonSemanticShaderDebugSource{ false };
64 | };
65 |
66 | #if ENABLE_OPT
67 |
68 | // Translate glslang's view of target versioning to what SPIRV-Tools uses.
69 | spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger);
70 |
71 | // Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment.
72 | void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv);
73 |
74 | // Use the SPIRV-Tools disassembler to print SPIR-V with a provided SPIR-V environment.
75 | void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv,
76 | spv_target_env requested_context);
77 |
78 | // Apply the SPIRV-Tools validator to generated SPIR-V.
79 | void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector& spirv,
80 | spv::SpvBuildLogger*, bool prelegalization);
81 |
82 | // Apply the SPIRV-Tools optimizer to generated SPIR-V. HLSL SPIR-V is legalized in the process.
83 | void SpirvToolsTransform(const glslang::TIntermediate& intermediate, std::vector& spirv,
84 | spv::SpvBuildLogger*, const SpvOptions*);
85 |
86 | // Apply the SPIRV-Tools EliminateDeadInputComponents pass to generated SPIR-V. Put result in |spirv|.
87 | void SpirvToolsEliminateDeadInputComponents(spv_target_env target_env, std::vector& spirv,
88 | spv::SpvBuildLogger*);
89 |
90 | // Apply the SPIRV-Tools AnalyzeDeadOutputStores pass to generated SPIR-V. Put result in |live_locs|.
91 | // Return true if the result is valid.
92 | bool SpirvToolsAnalyzeDeadOutputStores(spv_target_env target_env, std::vector& spirv,
93 | std::unordered_set* live_locs,
94 | std::unordered_set* live_builtins, spv::SpvBuildLogger*);
95 |
96 | // Apply the SPIRV-Tools EliminateDeadOutputStores and AggressiveDeadCodeElimination passes to generated SPIR-V using
97 | // |live_locs|. Put result in |spirv|.
98 | void SpirvToolsEliminateDeadOutputStores(spv_target_env target_env, std::vector& spirv,
99 | std::unordered_set* live_locs,
100 | std::unordered_set* live_builtins, spv::SpvBuildLogger*);
101 |
102 | // Apply the SPIRV-Tools optimizer to strip debug info from SPIR-V. This is implicitly done by
103 | // SpirvToolsTransform if spvOptions->stripDebugInfo is set, but can be called separately if
104 | // optimization is disabled.
105 | void SpirvToolsStripDebugInfo(const glslang::TIntermediate& intermediate,
106 | std::vector& spirv, spv::SpvBuildLogger*);
107 |
108 | #endif
109 |
110 | } // end namespace glslang
111 |
112 | #endif // GLSLANG_SPV_TOOLS_H
113 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/bitutils.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015-2016 The Khronos Group Inc.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | #ifndef LIBSPIRV_UTIL_BITUTILS_H_
16 | #define LIBSPIRV_UTIL_BITUTILS_H_
17 |
18 | #include
19 | #include
20 |
21 | namespace spvutils {
22 |
23 | // Performs a bitwise copy of source to the destination type Dest.
24 | template
25 | Dest BitwiseCast(Src source) {
26 | Dest dest;
27 | static_assert(sizeof(source) == sizeof(dest),
28 | "BitwiseCast: Source and destination must have the same size");
29 | std::memcpy(static_cast(&dest), &source, sizeof(dest));
30 | return dest;
31 | }
32 |
33 | // SetBits returns an integer of type with bits set
34 | // for position through , counting from the least
35 | // significant bit. In particular when Num == 0, no positions are set to 1.
36 | // A static assert will be triggered if First + Num > sizeof(T) * 8, that is,
37 | // a bit that will not fit in the underlying type is set.
38 | template
39 | struct SetBits {
40 | static_assert(First < sizeof(T) * 8,
41 | "Tried to set a bit that is shifted too far.");
42 | const static T get = (T(1) << First) | SetBits::get;
43 | };
44 |
45 | template
46 | struct SetBits {
47 | const static T get = T(0);
48 | };
49 |
50 | // This is all compile-time so we can put our tests right here.
51 | static_assert(SetBits::get == uint32_t(0x00000000),
52 | "SetBits failed");
53 | static_assert(SetBits::get == uint32_t(0x00000001),
54 | "SetBits failed");
55 | static_assert(SetBits::get == uint32_t(0x80000000),
56 | "SetBits failed");
57 | static_assert(SetBits::get == uint32_t(0x00000006),
58 | "SetBits failed");
59 | static_assert(SetBits::get == uint32_t(0xc0000000),
60 | "SetBits failed");
61 | static_assert(SetBits::get == uint32_t(0x7FFFFFFF),
62 | "SetBits failed");
63 | static_assert(SetBits::get == uint32_t(0xFFFFFFFF),
64 | "SetBits failed");
65 | static_assert(SetBits::get == uint32_t(0xFFFF0000),
66 | "SetBits failed");
67 |
68 | static_assert(SetBits::get == uint64_t(0x0000000000000001LL),
69 | "SetBits failed");
70 | static_assert(SetBits::get == uint64_t(0x8000000000000000LL),
71 | "SetBits failed");
72 | static_assert(SetBits::get == uint64_t(0xc000000000000000LL),
73 | "SetBits failed");
74 | static_assert(SetBits::get == uint64_t(0x0000000080000000LL),
75 | "SetBits failed");
76 | static_assert(SetBits::get == uint64_t(0x00000000FFFF0000LL),
77 | "SetBits failed");
78 |
79 | } // namespace spvutils
80 |
81 | #endif // LIBSPIRV_UTIL_BITUTILS_H_
82 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/SPIRV/disassemble.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2014-2015 LunarG, Inc.
3 | //
4 | // All rights reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions
8 | // are met:
9 | //
10 | // Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | //
13 | // Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following
15 | // disclaimer in the documentation and/or other materials provided
16 | // with the distribution.
17 | //
18 | // Neither the name of 3Dlabs Inc. Ltd. nor the names of its
19 | // contributors may be used to endorse or promote products derived
20 | // from this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | // POSSIBILITY OF SUCH DAMAGE.
34 |
35 | //
36 | // Disassembler for SPIR-V.
37 | //
38 |
39 | #pragma once
40 | #ifndef disassembler_H
41 | #define disassembler_H
42 |
43 | #include
44 | #include
45 |
46 | namespace spv {
47 |
48 | // disassemble with glslang custom disassembler
49 | void Disassemble(std::ostream& out, const std::vector&);
50 |
51 | } // end namespace spv
52 |
53 | #endif // disassembler_H
54 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/glslang/build_info.h:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2020 The Khronos Group Inc.
2 | //
3 | // All rights reserved.
4 | //
5 | // Redistribution and use in source and binary forms, with or without
6 | // modification, are permitted provided that the following conditions
7 | // are met:
8 | //
9 | // Redistributions of source code must retain the above copyright
10 | // notice, this list of conditions and the following disclaimer.
11 | //
12 | // Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following
14 | // disclaimer in the documentation and/or other materials provided
15 | // with the distribution.
16 | //
17 | // Neither the name of The Khronos Group Inc. nor the names of its
18 | // contributors may be used to endorse or promote products derived
19 | // from this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | // COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28 | // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 | // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 | // ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | // POSSIBILITY OF SUCH DAMAGE.
33 |
34 | #ifndef GLSLANG_BUILD_INFO
35 | #define GLSLANG_BUILD_INFO
36 |
37 | #define GLSLANG_VERSION_MAJOR 12
38 | #define GLSLANG_VERSION_MINOR 3
39 | #define GLSLANG_VERSION_PATCH 1
40 | #define GLSLANG_VERSION_FLAVOR ""
41 |
42 | #define GLSLANG_VERSION_GREATER_THAN(major, minor, patch) \
43 | ((GLSLANG_VERSION_MAJOR) > (major) || ((major) == GLSLANG_VERSION_MAJOR && \
44 | ((GLSLANG_VERSION_MINOR) > (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
45 | (GLSLANG_VERSION_PATCH) > (patch)))))
46 |
47 | #define GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch) \
48 | ((GLSLANG_VERSION_MAJOR) > (major) || ((major) == GLSLANG_VERSION_MAJOR && \
49 | ((GLSLANG_VERSION_MINOR) > (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
50 | (GLSLANG_VERSION_PATCH >= (patch))))))
51 |
52 | #define GLSLANG_VERSION_LESS_THAN(major, minor, patch) \
53 | ((GLSLANG_VERSION_MAJOR) < (major) || ((major) == GLSLANG_VERSION_MAJOR && \
54 | ((GLSLANG_VERSION_MINOR) < (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
55 | (GLSLANG_VERSION_PATCH) < (patch)))))
56 |
57 | #define GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch) \
58 | ((GLSLANG_VERSION_MAJOR) < (major) || ((major) == GLSLANG_VERSION_MAJOR && \
59 | ((GLSLANG_VERSION_MINOR) < (minor) || ((minor) == GLSLANG_VERSION_MINOR && \
60 | (GLSLANG_VERSION_PATCH <= (patch))))))
61 |
62 | #endif // GLSLANG_BUILD_INFO
63 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/benchmark.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_BENCHMARK_H
16 | #define NCNN_BENCHMARK_H
17 |
18 | #include "layer.h"
19 | #include "mat.h"
20 | #include "platform.h"
21 |
22 | namespace ncnn {
23 |
24 | // get now timestamp in ms
25 | NCNN_EXPORT double get_current_time();
26 |
27 | // sleep milliseconds
28 | NCNN_EXPORT void sleep(unsigned long long int milliseconds = 1000);
29 |
30 | #if NCNN_BENCHMARK
31 |
32 | NCNN_EXPORT void benchmark(const Layer* layer, double start, double end);
33 | NCNN_EXPORT void benchmark(const Layer* layer, const Mat& bottom_blob, Mat& top_blob, double start, double end);
34 |
35 | #endif // NCNN_BENCHMARK
36 |
37 | } // namespace ncnn
38 |
39 | #endif // NCNN_BENCHMARK_H
40 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/blob.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_BLOB_H
16 | #define NCNN_BLOB_H
17 |
18 | #include "mat.h"
19 | #include "platform.h"
20 |
21 | namespace ncnn {
22 |
23 | class NCNN_EXPORT Blob
24 | {
25 | public:
26 | // empty
27 | Blob();
28 |
29 | public:
30 | #if NCNN_STRING
31 | // blob name
32 | std::string name;
33 | #endif // NCNN_STRING
34 | // layer index which produce this blob as output
35 | int producer;
36 | // layer index which need this blob as input
37 | int consumer;
38 | // shape hint
39 | Mat shape;
40 | };
41 |
42 | } // namespace ncnn
43 |
44 | #endif // NCNN_BLOB_H
45 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/command.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_COMMAND_H
16 | #define NCNN_COMMAND_H
17 |
18 | #include "platform.h"
19 |
20 | #if NCNN_VULKAN
21 |
22 | #include "mat.h"
23 |
24 | namespace ncnn {
25 |
26 | class Pipeline;
27 | #if NCNN_PLATFORM_API
28 | #if __ANDROID_API__ >= 26
29 | class ImportAndroidHardwareBufferPipeline;
30 | #endif // __ANDROID_API__ >= 26
31 | #endif // NCNN_PLATFORM_API
32 | class VkComputePrivate;
33 | class NCNN_EXPORT VkCompute
34 | {
35 | public:
36 | explicit VkCompute(const VulkanDevice* vkdev);
37 | virtual ~VkCompute();
38 |
39 | public:
40 | void record_upload(const Mat& src, VkMat& dst, const Option& opt);
41 |
42 | void record_upload(const Mat& src, VkImageMat& dst, const Option& opt);
43 |
44 | void record_download(const VkMat& src, Mat& dst, const Option& opt);
45 |
46 | void record_download(const VkImageMat& src, Mat& dst, const Option& opt);
47 |
48 | void record_buffer_to_image(const VkMat& src, VkImageMat& dst, const Option& opt);
49 |
50 | void record_image_to_buffer(const VkImageMat& src, VkMat& dst, const Option& opt);
51 |
52 | void record_clone(const Mat& src, VkMat& dst, const Option& opt);
53 |
54 | void record_clone(const Mat& src, VkImageMat& dst, const Option& opt);
55 |
56 | void record_clone(const VkMat& src, Mat& dst, const Option& opt);
57 |
58 | void record_clone(const VkImageMat& src, Mat& dst, const Option& opt);
59 |
60 | void record_clone(const VkMat& src, VkMat& dst, const Option& opt);
61 |
62 | void record_clone(const VkImageMat& src, VkImageMat& dst, const Option& opt);
63 |
64 | void record_clone(const VkMat& src, VkImageMat& dst, const Option& opt);
65 |
66 | void record_clone(const VkImageMat& src, VkMat& dst, const Option& opt);
67 |
68 | void record_pipeline(const Pipeline* pipeline, const std::vector& bindings, const std::vector& constants, const VkMat& dispatcher);
69 |
70 | void record_pipeline(const Pipeline* pipeline, const std::vector& bindings, const std::vector& constants, const VkImageMat& dispatcher);
71 |
72 | void record_pipeline(const Pipeline* pipeline, const std::vector& buffer_bindings, const std::vector& image_bindings, const std::vector& constants, const VkMat& dispatcher);
73 | void record_pipeline(const Pipeline* pipeline, const std::vector& buffer_bindings, const std::vector& image_bindings, const std::vector& constants, const VkImageMat& dispatcher);
74 | void record_pipeline(const Pipeline* pipeline, const std::vector& buffer_bindings, const std::vector& image_bindings, const std::vector& constants, const Mat& dispatcher);
75 |
76 | #if NCNN_BENCHMARK
77 | void record_write_timestamp(uint32_t query);
78 | #endif // NCNN_BENCHMARK
79 |
80 | #if NCNN_PLATFORM_API
81 | #if __ANDROID_API__ >= 26
82 | void record_import_android_hardware_buffer(const ImportAndroidHardwareBufferPipeline* pipeline, const VkImageMat& src, const VkMat& dst);
83 |
84 | void record_import_android_hardware_buffer(const ImportAndroidHardwareBufferPipeline* pipeline, const VkImageMat& src, const VkImageMat& dst);
85 | #endif // __ANDROID_API__ >= 26
86 | #endif // NCNN_PLATFORM_API
87 |
88 | int submit_and_wait();
89 |
90 | int reset();
91 |
92 | #if NCNN_BENCHMARK
93 | int create_query_pool(uint32_t query_count);
94 |
95 | int get_query_pool_results(uint32_t first_query, uint32_t query_count, std::vector& results);
96 | #endif // NCNN_BENCHMARK
97 |
98 | protected:
99 | const VulkanDevice* vkdev;
100 |
101 | void barrier_readwrite(const VkMat& binding);
102 | void barrier_readwrite(const VkImageMat& binding);
103 | void barrier_readonly(const VkImageMat& binding);
104 |
105 | private:
106 | VkComputePrivate* const d;
107 | };
108 |
109 | class VkTransferPrivate;
110 | class NCNN_EXPORT VkTransfer
111 | {
112 | public:
113 | explicit VkTransfer(const VulkanDevice* vkdev);
114 | virtual ~VkTransfer();
115 |
116 | public:
117 | void record_upload(const Mat& src, VkMat& dst, const Option& opt, bool flatten = true);
118 |
119 | void record_upload(const Mat& src, VkImageMat& dst, const Option& opt);
120 |
121 | int submit_and_wait();
122 |
123 | protected:
124 | const VulkanDevice* vkdev;
125 |
126 | private:
127 | VkTransferPrivate* const d;
128 | };
129 |
130 | } // namespace ncnn
131 |
132 | #endif // NCNN_VULKAN
133 |
134 | #endif // NCNN_COMMAND_H
135 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/cpu.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_CPU_H
16 | #define NCNN_CPU_H
17 |
18 | #include
19 |
20 | #if (defined _WIN32 && !(defined __MINGW32__))
21 | #define WIN32_LEAN_AND_MEAN
22 | #include
23 | #endif
24 | #if defined __ANDROID__ || defined __linux__
25 | #include // cpu_set_t
26 | #endif
27 |
28 | #include "platform.h"
29 |
30 | namespace ncnn {
31 |
32 | class NCNN_EXPORT CpuSet
33 | {
34 | public:
35 | CpuSet();
36 | void enable(int cpu);
37 | void disable(int cpu);
38 | void disable_all();
39 | bool is_enabled(int cpu) const;
40 | int num_enabled() const;
41 |
42 | public:
43 | #if (defined _WIN32 && !(defined __MINGW32__))
44 | ULONG_PTR mask;
45 | #endif
46 | #if defined __ANDROID__ || defined __linux__
47 | cpu_set_t cpu_set;
48 | #endif
49 | #if __APPLE__
50 | unsigned int policy;
51 | #endif
52 | };
53 |
54 | // test optional cpu features
55 | // edsp = armv7 edsp
56 | NCNN_EXPORT int cpu_support_arm_edsp();
57 | // neon = armv7 neon or aarch64 asimd
58 | NCNN_EXPORT int cpu_support_arm_neon();
59 | // vfpv4 = armv7 fp16 + fma
60 | NCNN_EXPORT int cpu_support_arm_vfpv4();
61 | // asimdhp = aarch64 asimd half precision
62 | NCNN_EXPORT int cpu_support_arm_asimdhp();
63 | // cpuid = aarch64 cpuid info
64 | NCNN_EXPORT int cpu_support_arm_cpuid();
65 | // asimddp = aarch64 asimd dot product
66 | NCNN_EXPORT int cpu_support_arm_asimddp();
67 | // asimdfhm = aarch64 asimd fhm
68 | NCNN_EXPORT int cpu_support_arm_asimdfhm();
69 | // bf16 = aarch64 bf16
70 | NCNN_EXPORT int cpu_support_arm_bf16();
71 | // i8mm = aarch64 i8mm
72 | NCNN_EXPORT int cpu_support_arm_i8mm();
73 | // sve = aarch64 sve
74 | NCNN_EXPORT int cpu_support_arm_sve();
75 | // sve2 = aarch64 sve2
76 | NCNN_EXPORT int cpu_support_arm_sve2();
77 | // svebf16 = aarch64 svebf16
78 | NCNN_EXPORT int cpu_support_arm_svebf16();
79 | // svei8mm = aarch64 svei8mm
80 | NCNN_EXPORT int cpu_support_arm_svei8mm();
81 | // svef32mm = aarch64 svef32mm
82 | NCNN_EXPORT int cpu_support_arm_svef32mm();
83 |
84 | // avx = x86 avx
85 | NCNN_EXPORT int cpu_support_x86_avx();
86 | // fma = x86 fma
87 | NCNN_EXPORT int cpu_support_x86_fma();
88 | // xop = x86 xop
89 | NCNN_EXPORT int cpu_support_x86_xop();
90 | // f16c = x86 f16c
91 | NCNN_EXPORT int cpu_support_x86_f16c();
92 | // avx2 = x86 avx2 + fma + f16c
93 | NCNN_EXPORT int cpu_support_x86_avx2();
94 | // avx_vnni = x86 avx vnni
95 | NCNN_EXPORT int cpu_support_x86_avx_vnni();
96 | // avx512 = x86 avx512f + avx512cd + avx512bw + avx512dq + avx512vl
97 | NCNN_EXPORT int cpu_support_x86_avx512();
98 | // avx512_vnni = x86 avx512 vnni
99 | NCNN_EXPORT int cpu_support_x86_avx512_vnni();
100 | // avx512_bf16 = x86 avx512 bf16
101 | NCNN_EXPORT int cpu_support_x86_avx512_bf16();
102 | // avx512_fp16 = x86 avx512 fp16
103 | NCNN_EXPORT int cpu_support_x86_avx512_fp16();
104 |
105 | // lsx = loongarch lsx
106 | NCNN_EXPORT int cpu_support_loongarch_lsx();
107 | // lasx = loongarch lasx
108 | NCNN_EXPORT int cpu_support_loongarch_lasx();
109 |
110 | // msa = mips mas
111 | NCNN_EXPORT int cpu_support_mips_msa();
112 | // mmi = loongson mmi
113 | NCNN_EXPORT int cpu_support_loongson_mmi();
114 |
115 | // v = riscv vector
116 | NCNN_EXPORT int cpu_support_riscv_v();
117 | // zfh = riscv half-precision float
118 | NCNN_EXPORT int cpu_support_riscv_zfh();
119 | // vlenb = riscv vector length in bytes
120 | NCNN_EXPORT int cpu_riscv_vlenb();
121 |
122 | // cpu info
123 | NCNN_EXPORT int get_cpu_count();
124 | NCNN_EXPORT int get_little_cpu_count();
125 | NCNN_EXPORT int get_big_cpu_count();
126 |
127 | NCNN_EXPORT int get_physical_cpu_count();
128 | NCNN_EXPORT int get_physical_little_cpu_count();
129 | NCNN_EXPORT int get_physical_big_cpu_count();
130 |
131 | // cpu l2 varies from 64k to 1M, but l3 can be zero
132 | NCNN_EXPORT int get_cpu_level2_cache_size();
133 | NCNN_EXPORT int get_cpu_level3_cache_size();
134 |
135 | // bind all threads on little clusters if powersave enabled
136 | // affects HMP arch cpu like ARM big.LITTLE
137 | // only implemented on android at the moment
138 | // switching powersave is expensive and not thread-safe
139 | // 0 = all cores enabled(default)
140 | // 1 = only little clusters enabled
141 | // 2 = only big clusters enabled
142 | // return 0 if success for setter function
143 | NCNN_EXPORT int get_cpu_powersave();
144 | NCNN_EXPORT int set_cpu_powersave(int powersave);
145 |
146 | // convenient wrapper
147 | NCNN_EXPORT const CpuSet& get_cpu_thread_affinity_mask(int powersave);
148 |
149 | // set explicit thread affinity
150 | NCNN_EXPORT int set_cpu_thread_affinity(const CpuSet& thread_affinity_mask);
151 |
152 | // runtime thread affinity info
153 | NCNN_EXPORT int is_current_thread_running_on_a53_a55();
154 |
155 | // misc function wrapper for openmp routines
156 | NCNN_EXPORT int get_omp_num_threads();
157 | NCNN_EXPORT void set_omp_num_threads(int num_threads);
158 |
159 | NCNN_EXPORT int get_omp_dynamic();
160 | NCNN_EXPORT void set_omp_dynamic(int dynamic);
161 |
162 | NCNN_EXPORT int get_omp_thread_num();
163 |
164 | NCNN_EXPORT int get_kmp_blocktime();
165 | NCNN_EXPORT void set_kmp_blocktime(int time_ms);
166 |
167 | // need to flush denormals on Intel Chipset.
168 | // Other architectures such as ARM can be added as needed.
169 | // 0 = DAZ OFF, FTZ OFF
170 | // 1 = DAZ ON , FTZ OFF
171 | // 2 = DAZ OFF, FTZ ON
172 | // 3 = DAZ ON, FTZ ON
173 | NCNN_EXPORT int get_flush_denormals();
174 | NCNN_EXPORT int set_flush_denormals(int flush_denormals);
175 |
176 | } // namespace ncnn
177 |
178 | #endif // NCNN_CPU_H
179 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/datareader.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_DATAREADER_H
16 | #define NCNN_DATAREADER_H
17 |
18 | #include "platform.h"
19 | #if NCNN_STDIO
20 | #include
21 | #endif
22 |
23 | #if NCNN_PLATFORM_API
24 | #if __ANDROID_API__ >= 9
25 | #include
26 | #endif
27 | #endif // NCNN_PLATFORM_API
28 |
29 | namespace ncnn {
30 |
31 | // data read wrapper
32 | class NCNN_EXPORT DataReader
33 | {
34 | public:
35 | DataReader();
36 | virtual ~DataReader();
37 |
38 | #if NCNN_STRING
39 | // parse plain param text
40 | // return 1 if scan success
41 | virtual int scan(const char* format, void* p) const;
42 | #endif // NCNN_STRING
43 |
44 | // read binary param and model data
45 | // return bytes read
46 | virtual size_t read(void* buf, size_t size) const;
47 |
48 | // get model data reference
49 | // return bytes referenced
50 | virtual size_t reference(size_t size, const void** buf) const;
51 | };
52 |
53 | #if NCNN_STDIO
54 | class DataReaderFromStdioPrivate;
55 | class NCNN_EXPORT DataReaderFromStdio : public DataReader
56 | {
57 | public:
58 | explicit DataReaderFromStdio(FILE* fp);
59 | virtual ~DataReaderFromStdio();
60 |
61 | #if NCNN_STRING
62 | virtual int scan(const char* format, void* p) const;
63 | #endif // NCNN_STRING
64 | virtual size_t read(void* buf, size_t size) const;
65 |
66 | private:
67 | DataReaderFromStdio(const DataReaderFromStdio&);
68 | DataReaderFromStdio& operator=(const DataReaderFromStdio&);
69 |
70 | private:
71 | DataReaderFromStdioPrivate* const d;
72 | };
73 | #endif // NCNN_STDIO
74 |
75 | class DataReaderFromMemoryPrivate;
76 | class NCNN_EXPORT DataReaderFromMemory : public DataReader
77 | {
78 | public:
79 | explicit DataReaderFromMemory(const unsigned char*& mem);
80 | virtual ~DataReaderFromMemory();
81 |
82 | #if NCNN_STRING
83 | virtual int scan(const char* format, void* p) const;
84 | #endif // NCNN_STRING
85 | virtual size_t read(void* buf, size_t size) const;
86 | virtual size_t reference(size_t size, const void** buf) const;
87 |
88 | private:
89 | DataReaderFromMemory(const DataReaderFromMemory&);
90 | DataReaderFromMemory& operator=(const DataReaderFromMemory&);
91 |
92 | private:
93 | DataReaderFromMemoryPrivate* const d;
94 | };
95 |
96 | #if NCNN_PLATFORM_API
97 | #if __ANDROID_API__ >= 9
98 | class DataReaderFromAndroidAssetPrivate;
99 | class NCNN_EXPORT DataReaderFromAndroidAsset : public DataReader
100 | {
101 | public:
102 | explicit DataReaderFromAndroidAsset(AAsset* asset);
103 | virtual ~DataReaderFromAndroidAsset();
104 |
105 | #if NCNN_STRING
106 | virtual int scan(const char* format, void* p) const;
107 | #endif // NCNN_STRING
108 | virtual size_t read(void* buf, size_t size) const;
109 |
110 | private:
111 | DataReaderFromAndroidAsset(const DataReaderFromAndroidAsset&);
112 | DataReaderFromAndroidAsset& operator=(const DataReaderFromAndroidAsset&);
113 |
114 | private:
115 | DataReaderFromAndroidAssetPrivate* const d;
116 | };
117 | #endif // __ANDROID_API__ >= 9
118 | #endif // NCNN_PLATFORM_API
119 |
120 | } // namespace ncnn
121 |
122 | #endif // NCNN_DATAREADER_H
123 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/layer_shader_type.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_LAYER_SHADER_TYPE_H
16 | #define NCNN_LAYER_SHADER_TYPE_H
17 |
18 | namespace ncnn {
19 |
20 | namespace LayerShaderType {
21 | enum LayerShaderType
22 | {
23 | #include "layer_shader_type_enum.h"
24 | };
25 | } // namespace LayerShaderType
26 |
27 | } // namespace ncnn
28 |
29 | #endif // NCNN_LAYER_SHADER_TYPE_H
30 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/layer_type.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_LAYER_TYPE_H
16 | #define NCNN_LAYER_TYPE_H
17 |
18 | namespace ncnn {
19 |
20 | namespace LayerType {
21 | enum LayerType
22 | {
23 | #include "layer_type_enum.h"
24 | CustomBit = (1 << 8),
25 | };
26 | } // namespace LayerType
27 |
28 | } // namespace ncnn
29 |
30 | #endif // NCNN_LAYER_TYPE_H
31 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/layer_type_enum.h:
--------------------------------------------------------------------------------
1 | // Layer Type Enum header
2 | //
3 | // This file is auto-generated by cmake, don't edit it.
4 |
5 | AbsVal = 0,
6 | ArgMax = 1,
7 | BatchNorm = 2,
8 | Bias = 3,
9 | BNLL = 4,
10 | Concat = 5,
11 | Convolution = 6,
12 | Crop = 7,
13 | Deconvolution = 8,
14 | Dropout = 9,
15 | Eltwise = 10,
16 | ELU = 11,
17 | Embed = 12,
18 | Exp = 13,
19 | Flatten = 14,
20 | InnerProduct = 15,
21 | Input = 16,
22 | Log = 17,
23 | LRN = 18,
24 | MemoryData = 19,
25 | MVN = 20,
26 | Pooling = 21,
27 | Power = 22,
28 | PReLU = 23,
29 | Proposal = 24,
30 | Reduction = 25,
31 | ReLU = 26,
32 | Reshape = 27,
33 | ROIPooling = 28,
34 | Scale = 29,
35 | Sigmoid = 30,
36 | Slice = 31,
37 | Softmax = 32,
38 | Split = 33,
39 | SPP = 34,
40 | TanH = 35,
41 | Threshold = 36,
42 | Tile = 37,
43 | RNN = 38,
44 | LSTM = 39,
45 | BinaryOp = 40,
46 | UnaryOp = 41,
47 | ConvolutionDepthWise = 42,
48 | Padding = 43,
49 | Squeeze = 44,
50 | ExpandDims = 45,
51 | Normalize = 46,
52 | Permute = 47,
53 | PriorBox = 48,
54 | DetectionOutput = 49,
55 | Interp = 50,
56 | DeconvolutionDepthWise = 51,
57 | ShuffleChannel = 52,
58 | InstanceNorm = 53,
59 | Clip = 54,
60 | Reorg = 55,
61 | YoloDetectionOutput = 56,
62 | Quantize = 57,
63 | Dequantize = 58,
64 | Yolov3DetectionOutput = 59,
65 | PSROIPooling = 60,
66 | ROIAlign = 61,
67 | Packing = 62,
68 | Requantize = 63,
69 | Cast = 64,
70 | HardSigmoid = 65,
71 | SELU = 66,
72 | HardSwish = 67,
73 | Noop = 68,
74 | PixelShuffle = 69,
75 | DeepCopy = 70,
76 | Mish = 71,
77 | StatisticsPooling = 72,
78 | Swish = 73,
79 | Gemm = 74,
80 | GroupNorm = 75,
81 | LayerNorm = 76,
82 | Softplus = 77,
83 | GRU = 78,
84 | MultiHeadAttention = 79,
85 | GELU = 80,
86 | Convolution1D = 81,
87 | Pooling1D = 82,
88 | ConvolutionDepthWise1D = 83,
89 | Convolution3D = 84,
90 | ConvolutionDepthWise3D = 85,
91 | Pooling3D = 86,
92 | MatMul = 87,
93 | Deconvolution1D = 88,
94 | DeconvolutionDepthWise1D = 89,
95 | Deconvolution3D = 90,
96 | DeconvolutionDepthWise3D = 91,
97 | Einsum = 92,
98 | DeformableConv2D = 93,
99 | GLU = 94,
100 | Fold = 95,
101 | Unfold = 96,
102 | GridSample = 97,
103 | CumulativeSum = 98,
104 | CopyTo = 99,
105 | Erf = 100,
106 | Diag = 101,
107 | CELU = 102,
108 | Shrink = 103,
109 |
110 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/modelbin.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_MODELBIN_H
16 | #define NCNN_MODELBIN_H
17 |
18 | #include "mat.h"
19 |
20 | namespace ncnn {
21 |
22 | class DataReader;
23 | class NCNN_EXPORT ModelBin
24 | {
25 | public:
26 | ModelBin();
27 | virtual ~ModelBin();
28 | // element type
29 | // 0 = auto
30 | // 1 = float32
31 | // 2 = float16
32 | // 3 = int8
33 | // load vec
34 | virtual Mat load(int w, int type) const;
35 | // load image
36 | virtual Mat load(int w, int h, int type) const;
37 | // load dim
38 | virtual Mat load(int w, int h, int c, int type) const;
39 | // load cube
40 | virtual Mat load(int w, int h, int d, int c, int type) const;
41 | };
42 |
43 | class ModelBinFromDataReaderPrivate;
44 | class NCNN_EXPORT ModelBinFromDataReader : public ModelBin
45 | {
46 | public:
47 | explicit ModelBinFromDataReader(const DataReader& dr);
48 | virtual ~ModelBinFromDataReader();
49 |
50 | virtual Mat load(int w, int type) const;
51 |
52 | private:
53 | ModelBinFromDataReader(const ModelBinFromDataReader&);
54 | ModelBinFromDataReader& operator=(const ModelBinFromDataReader&);
55 |
56 | private:
57 | ModelBinFromDataReaderPrivate* const d;
58 | };
59 |
60 | class ModelBinFromMatArrayPrivate;
61 | class NCNN_EXPORT ModelBinFromMatArray : public ModelBin
62 | {
63 | public:
64 | // construct from weight blob array
65 | explicit ModelBinFromMatArray(const Mat* weights);
66 | virtual ~ModelBinFromMatArray();
67 |
68 | virtual Mat load(int w, int type) const;
69 |
70 | private:
71 | ModelBinFromMatArray(const ModelBinFromMatArray&);
72 | ModelBinFromMatArray& operator=(const ModelBinFromMatArray&);
73 |
74 | private:
75 | ModelBinFromMatArrayPrivate* const d;
76 | };
77 |
78 | } // namespace ncnn
79 |
80 | #endif // NCNN_MODELBIN_H
81 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/ncnn_export.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef NCNN_EXPORT_H
3 | #define NCNN_EXPORT_H
4 |
5 | #ifdef NCNN_STATIC_DEFINE
6 | # define NCNN_EXPORT
7 | # define NCNN_NO_EXPORT
8 | #else
9 | # ifndef NCNN_EXPORT
10 | # ifdef ncnn_EXPORTS
11 | /* We are building this library */
12 | # define NCNN_EXPORT
13 | # else
14 | /* We are using this library */
15 | # define NCNN_EXPORT
16 | # endif
17 | # endif
18 |
19 | # ifndef NCNN_NO_EXPORT
20 | # define NCNN_NO_EXPORT
21 | # endif
22 | #endif
23 |
24 | #ifndef NCNN_DEPRECATED
25 | # define NCNN_DEPRECATED __attribute__ ((__deprecated__))
26 | #endif
27 |
28 | #ifndef NCNN_DEPRECATED_EXPORT
29 | # define NCNN_DEPRECATED_EXPORT NCNN_EXPORT NCNN_DEPRECATED
30 | #endif
31 |
32 | #ifndef NCNN_DEPRECATED_NO_EXPORT
33 | # define NCNN_DEPRECATED_NO_EXPORT NCNN_NO_EXPORT NCNN_DEPRECATED
34 | #endif
35 |
36 | #if 0 /* DEFINE_NO_DEPRECATED */
37 | # ifndef NCNN_NO_DEPRECATED
38 | # define NCNN_NO_DEPRECATED
39 | # endif
40 | #endif
41 |
42 | #endif /* NCNN_EXPORT_H */
43 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/option.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_OPTION_H
16 | #define NCNN_OPTION_H
17 |
18 | #include "platform.h"
19 |
20 | namespace ncnn {
21 |
22 | #if NCNN_VULKAN
23 | class VkAllocator;
24 | class PipelineCache;
25 | #endif // NCNN_VULKAN
26 |
27 | class Allocator;
28 | class NCNN_EXPORT Option
29 | {
30 | public:
31 | // default option
32 | Option();
33 |
34 | public:
35 | // light mode
36 | // intermediate blob will be recycled when enabled
37 | // enabled by default
38 | bool lightmode;
39 |
40 | // thread count
41 | // default value is the one returned by get_cpu_count()
42 | int num_threads;
43 |
44 | // blob memory allocator
45 | Allocator* blob_allocator;
46 |
47 | // workspace memory allocator
48 | Allocator* workspace_allocator;
49 |
50 | #if NCNN_VULKAN
51 | // blob memory allocator
52 | VkAllocator* blob_vkallocator;
53 |
54 | // workspace memory allocator
55 | VkAllocator* workspace_vkallocator;
56 |
57 | // staging memory allocator
58 | VkAllocator* staging_vkallocator;
59 |
60 | // pipeline cache
61 | PipelineCache* pipeline_cache;
62 | #endif // NCNN_VULKAN
63 |
64 | // the time openmp threads busy-wait for more work before going to sleep
65 | // default value is 20ms to keep the cores enabled
66 | // without too much extra power consumption afterwards
67 | int openmp_blocktime;
68 |
69 | // enable winograd convolution optimization
70 | // improve convolution 3x3 stride1 performance, may consume more memory
71 | // changes should be applied before loading network structure and weight
72 | // enabled by default
73 | bool use_winograd_convolution;
74 |
75 | // enable sgemm convolution optimization
76 | // improve convolution 1x1 stride1 performance, may consume more memory
77 | // changes should be applied before loading network structure and weight
78 | // enabled by default
79 | bool use_sgemm_convolution;
80 |
81 | // enable quantized int8 inference
82 | // use low-precision int8 path for quantized model
83 | // changes should be applied before loading network structure and weight
84 | // enabled by default
85 | bool use_int8_inference;
86 |
87 | // enable vulkan compute
88 | bool use_vulkan_compute;
89 |
90 | // enable bf16 data type for storage
91 | // improve most operator performance on all arm devices, may consume more memory
92 | bool use_bf16_storage;
93 |
94 | // enable options for gpu inference
95 | bool use_fp16_packed;
96 | bool use_fp16_storage;
97 | bool use_fp16_arithmetic;
98 | bool use_int8_packed;
99 | bool use_int8_storage;
100 | bool use_int8_arithmetic;
101 |
102 | // enable simd-friendly packed memory layout
103 | // improve all operator performance on all arm devices, will consume more memory
104 | // changes should be applied before loading network structure and weight
105 | // enabled by default
106 | bool use_packing_layout;
107 |
108 | bool use_shader_pack8;
109 |
110 | // subgroup option
111 | bool use_subgroup_basic;
112 | bool use_subgroup_vote;
113 | bool use_subgroup_ballot;
114 | bool use_subgroup_shuffle;
115 |
116 | // turn on for adreno
117 | bool use_image_storage;
118 | bool use_tensor_storage;
119 |
120 | bool use_reserved_0;
121 |
122 | // enable DAZ(Denormals-Are-Zero) and FTZ(Flush-To-Zero)
123 | // default value is 3
124 | // 0 = DAZ OFF, FTZ OFF
125 | // 1 = DAZ ON , FTZ OFF
126 | // 2 = DAZ OFF, FTZ ON
127 | // 3 = DAZ ON, FTZ ON
128 | int flush_denormals;
129 |
130 | bool use_local_pool_allocator;
131 |
132 | // enable local memory optimization for gpu inference
133 | bool use_shader_local_memory;
134 |
135 | // enable cooperative matrix optimization for gpu inference
136 | bool use_cooperative_matrix;
137 |
138 | // more fine-grained control of winograd convolution
139 | bool use_winograd23_convolution;
140 | bool use_winograd43_convolution;
141 | bool use_winograd63_convolution;
142 |
143 | // this option is turned on for A53/A55 automatically
144 | // but you can force this on/off if you wish
145 | bool use_a53_a55_optimized_kernel;
146 |
147 | // enable options for shared variables in gpu shader
148 | bool use_fp16_uniform;
149 | bool use_int8_uniform;
150 |
151 | bool use_reserved_9;
152 | bool use_reserved_10;
153 | bool use_reserved_11;
154 | };
155 |
156 | } // namespace ncnn
157 |
158 | #endif // NCNN_OPTION_H
159 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/paramdict.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_PARAMDICT_H
16 | #define NCNN_PARAMDICT_H
17 |
18 | #include "mat.h"
19 |
20 | // at most 32 parameters
21 | #define NCNN_MAX_PARAM_COUNT 32
22 |
23 | namespace ncnn {
24 |
25 | class DataReader;
26 | class Net;
27 | class ParamDictPrivate;
28 | class NCNN_EXPORT ParamDict
29 | {
30 | public:
31 | // empty
32 | ParamDict();
33 |
34 | virtual ~ParamDict();
35 |
36 | // copy
37 | ParamDict(const ParamDict&);
38 |
39 | // assign
40 | ParamDict& operator=(const ParamDict&);
41 |
42 | // get type
43 | int type(int id) const;
44 |
45 | // get int
46 | int get(int id, int def) const;
47 | // get float
48 | float get(int id, float def) const;
49 | // get array
50 | Mat get(int id, const Mat& def) const;
51 |
52 | // set int
53 | void set(int id, int i);
54 | // set float
55 | void set(int id, float f);
56 | // set array
57 | void set(int id, const Mat& v);
58 |
59 | protected:
60 | friend class Net;
61 |
62 | void clear();
63 |
64 | int load_param(const DataReader& dr);
65 | int load_param_bin(const DataReader& dr);
66 |
67 | private:
68 | ParamDictPrivate* const d;
69 | };
70 |
71 | } // namespace ncnn
72 |
73 | #endif // NCNN_PARAMDICT_H
74 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/pipeline.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_PIPELINE_H
16 | #define NCNN_PIPELINE_H
17 |
18 | #include "mat.h"
19 | #include "platform.h"
20 | #if NCNN_VULKAN
21 | #include "gpu.h"
22 | #endif // NCNN_VULKAN
23 |
24 | namespace ncnn {
25 |
26 | #if NCNN_VULKAN
27 | class Option;
28 | class PipelinePrivate;
29 | class NCNN_EXPORT Pipeline
30 | {
31 | public:
32 | explicit Pipeline(const VulkanDevice* vkdev);
33 | virtual ~Pipeline();
34 |
35 | public:
36 | void set_optimal_local_size_xyz(int w = 4, int h = 4, int c = 4);
37 | void set_optimal_local_size_xyz(const Mat& local_size_xyz);
38 | void set_local_size_xyz(int w, int h, int c);
39 |
40 | int create(const uint32_t* spv_data, size_t spv_data_size, const std::vector& specializations);
41 |
42 | int create(int shader_type_index, const Option& opt, const std::vector& specializations);
43 |
44 | public:
45 | VkShaderModule shader_module() const;
46 | VkDescriptorSetLayout descriptorset_layout() const;
47 | VkPipelineLayout pipeline_layout() const;
48 | VkPipeline pipeline() const;
49 | VkDescriptorUpdateTemplateKHR descriptor_update_template() const;
50 |
51 | const ShaderInfo& shader_info() const;
52 |
53 | uint32_t local_size_x() const;
54 | uint32_t local_size_y() const;
55 | uint32_t local_size_z() const;
56 |
57 | protected:
58 | void set_shader_module(VkShaderModule shader_module);
59 | void set_descriptorset_layout(VkDescriptorSetLayout descriptorset_layout);
60 | void set_pipeline_layout(VkPipelineLayout pipeline_layout);
61 | void set_pipeline(VkPipeline pipeline);
62 | void set_descriptor_update_template(VkDescriptorUpdateTemplateKHR descriptor_update_template);
63 |
64 | void set_shader_info(const ShaderInfo& shader_info);
65 |
66 | public:
67 | const VulkanDevice* vkdev;
68 |
69 | private:
70 | Pipeline(const Pipeline&);
71 | Pipeline& operator=(const Pipeline&);
72 |
73 | private:
74 | PipelinePrivate* const d;
75 | };
76 |
77 | #if NCNN_PLATFORM_API
78 | #if __ANDROID_API__ >= 26
79 | class VkCompute;
80 | class NCNN_EXPORT ImportAndroidHardwareBufferPipeline : private Pipeline
81 | {
82 | public:
83 | explicit ImportAndroidHardwareBufferPipeline(const VulkanDevice* vkdev);
84 | virtual ~ImportAndroidHardwareBufferPipeline();
85 |
86 | int create(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator, int type_to, int rotate_from, const Option& opt);
87 | int create(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator, int type_to, int rotate_from, int target_width, int target_height, const Option& opt);
88 | void destroy();
89 |
90 | friend class VkCompute;
91 |
92 | protected:
93 | int create_shader_module(const Option& opt);
94 | int create_sampler(VkAndroidHardwareBufferImageAllocator* ahb_im_allocator);
95 | int create_descriptorset_layout();
96 |
97 | public:
98 | int type_to;
99 | int rotate_from;
100 | bool need_resize;
101 |
102 | VkSampler sampler;
103 | };
104 | #endif // __ANDROID_API__ >= 26
105 | #endif // NCNN_PLATFORM_API
106 |
107 | #endif // NCNN_VULKAN
108 |
109 | } // namespace ncnn
110 |
111 | #endif // NCNN_PIPELINE_H
112 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/pipelinecache.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_PIPELINECACHE_H
16 | #define NCNN_PIPELINECACHE_H
17 |
18 | #include "platform.h"
19 |
20 | #include "mat.h"
21 | #include "gpu.h"
22 |
23 | namespace ncnn {
24 |
25 | #if NCNN_VULKAN
26 |
27 | class VulkanDevice;
28 | class PipelineCachePrivate;
29 | class NCNN_EXPORT PipelineCache
30 | {
31 | public:
32 | explicit PipelineCache(const VulkanDevice* _vkdev);
33 |
34 | virtual ~PipelineCache();
35 |
36 | void clear();
37 |
38 | int get_pipeline(const uint32_t* spv_data, size_t spv_data_size, const std::vector& specializations,
39 | uint32_t local_size_x, uint32_t local_size_y, uint32_t local_size_z,
40 | VkShaderModule* shader_module,
41 | VkDescriptorSetLayout* descriptorset_layout,
42 | VkPipelineLayout* pipeline_layout,
43 | VkPipeline* pipeline,
44 | VkDescriptorUpdateTemplateKHR* descriptor_update_template,
45 | ShaderInfo& shader_info) const;
46 |
47 | int get_pipeline(int shader_type_index, const Option& opt, const std::vector& specializations,
48 | uint32_t local_size_x, uint32_t local_size_y, uint32_t local_size_z,
49 | VkShaderModule* shader_module,
50 | VkDescriptorSetLayout* descriptorset_layout,
51 | VkPipelineLayout* pipeline_layout,
52 | VkPipeline* pipeline,
53 | VkDescriptorUpdateTemplateKHR* descriptor_update_template,
54 | ShaderInfo& shader_info) const;
55 |
56 | protected:
57 | int create_shader_module(int shader_type_index, const Option& opt, uint32_t local_size_x, uint32_t local_size_y, uint32_t local_size_z,
58 | VkShaderModule* _shader_module, ShaderInfo& si) const;
59 |
60 | int new_pipeline(VkShaderModule shader_module, const ShaderInfo& shader_info, const std::vector& specializations,
61 | VkDescriptorSetLayout* descriptorset_layout,
62 | VkPipelineLayout* pipeline_layout,
63 | VkPipeline* pipeline,
64 | VkDescriptorUpdateTemplateKHR* descriptor_update_template) const;
65 |
66 | protected:
67 | const VulkanDevice* vkdev;
68 |
69 | private:
70 | PipelineCache(const PipelineCache&);
71 | PipelineCache& operator=(const PipelineCache&);
72 |
73 | private:
74 | PipelineCachePrivate* const d;
75 | };
76 |
77 | #endif // NCNN_VULKAN
78 |
79 | } // namespace ncnn
80 |
81 | #endif // NCNN_PIPELINECACHE_H
82 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/simplemath.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_SIMPLEMATH_H
16 | #define NCNN_SIMPLEMATH_H
17 |
18 | #include "platform.h"
19 |
20 | #if NCNN_SIMPLEMATH
21 |
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 | /*
26 | * ====================================================
27 | * discrete functions
28 | * ====================================================
29 | */
30 | NCNN_EXPORT float fabs(float);
31 | NCNN_EXPORT float fabsf(float);
32 | NCNN_EXPORT float fmod(float, float);
33 | NCNN_EXPORT float floor(float);
34 | NCNN_EXPORT float floorf(float);
35 | NCNN_EXPORT float round(float);
36 | NCNN_EXPORT float roundf(float);
37 | NCNN_EXPORT float ceil(float);
38 | NCNN_EXPORT float ceilf(float);
39 | NCNN_EXPORT float fmaxf(float, float);
40 | NCNN_EXPORT float truncf(float);
41 | NCNN_EXPORT float frac(float);
42 | /*
43 | * ====================================================
44 | * trigonometric functions
45 | * ====================================================
46 | */
47 | NCNN_EXPORT float sinf(float);
48 | NCNN_EXPORT float cosf(float);
49 | NCNN_EXPORT float tanf(float);
50 | NCNN_EXPORT float asinf(float);
51 | NCNN_EXPORT float acosf(float);
52 | NCNN_EXPORT float atanf(float);
53 | NCNN_EXPORT float atan2f(float, float);
54 | NCNN_EXPORT float tanhf(float);
55 |
56 | /*
57 | * ====================================================
58 | * power functions
59 | * ====================================================
60 | */
61 | NCNN_EXPORT float sqrtf(float);
62 | NCNN_EXPORT float sqrt(float);
63 | NCNN_EXPORT float powf(float, float);
64 |
65 | /*
66 | * ====================================================
67 | * exponential and logarithm functions
68 | * ====================================================
69 | */
70 | NCNN_EXPORT float expf(float);
71 | NCNN_EXPORT float frexp(float, int*);
72 | NCNN_EXPORT float logf(float);
73 | NCNN_EXPORT float log(float);
74 | NCNN_EXPORT float log10f(float);
75 |
76 | /*
77 | * ====================================================
78 | * probability functions
79 | * ====================================================
80 | */
81 | NCNN_EXPORT float erf(float);
82 | NCNN_EXPORT float erff(float);
83 | NCNN_EXPORT float erfcf(float);
84 |
85 | /*
86 | * ====================================================
87 | * other functions
88 | * ====================================================
89 | */
90 | NCNN_EXPORT int msb(unsigned int);
91 | NCNN_EXPORT float fmaf(float, float, float);
92 | NCNN_EXPORT float copysignf(float, float);
93 | NCNN_EXPORT void fesetround(int);
94 | NCNN_EXPORT int fegetround();
95 | NCNN_EXPORT float nearbyintf(float);
96 |
97 | #ifdef __cplusplus
98 | } // extern "C"
99 | #endif
100 |
101 | #endif // NCNN_SIMPLEMATH
102 |
103 | #endif // NCNN_SIMPLEMATH_H
104 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/include/ncnn/simpleomp.h:
--------------------------------------------------------------------------------
1 | // Tencent is pleased to support the open source community by making ncnn available.
2 | //
3 | // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
4 | //
5 | // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
6 | // in compliance with the License. You may obtain a copy of the License at
7 | //
8 | // https://opensource.org/licenses/BSD-3-Clause
9 | //
10 | // Unless required by applicable law or agreed to in writing, software distributed
11 | // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12 | // CONDITIONS OF ANY KIND, either express or implied. See the License for the
13 | // specific language governing permissions and limitations under the License.
14 |
15 | #ifndef NCNN_SIMPLEOMP_H
16 | #define NCNN_SIMPLEOMP_H
17 |
18 | #include "platform.h"
19 |
20 | #if NCNN_SIMPLEOMP
21 |
22 | #include
23 |
24 | // This minimal openmp runtime implementation only supports the llvm openmp abi
25 | // and only supports #pragma omp parallel for num_threads(X)
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | NCNN_EXPORT int omp_get_max_threads();
32 |
33 | NCNN_EXPORT void omp_set_num_threads(int num_threads);
34 |
35 | NCNN_EXPORT int omp_get_dynamic();
36 |
37 | NCNN_EXPORT void omp_set_dynamic(int dynamic);
38 |
39 | NCNN_EXPORT int omp_get_num_threads();
40 |
41 | NCNN_EXPORT int omp_get_thread_num();
42 |
43 | NCNN_EXPORT int kmp_get_blocktime();
44 |
45 | NCNN_EXPORT void kmp_set_blocktime(int blocktime);
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif // NCNN_SIMPLEOMP
52 |
53 | #endif // NCNN_SIMPLEOMP_H
54 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/OGLCompilerTargets.cmake:
--------------------------------------------------------------------------------
1 |
2 | message(WARNING "Using `OGLCompilerTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.")
3 |
4 | if (NOT TARGET glslang::OGLCompiler)
5 | include("/home/runner/work/ncnn/ncnn/build-aarch64/install/lib/cmake/glslang/glslang-targets.cmake")
6 | endif()
7 |
8 | add_library(OGLCompiler ALIAS glslang::OGLCompiler)
9 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/OSDependentTargets.cmake:
--------------------------------------------------------------------------------
1 |
2 | message(WARNING "Using `OSDependentTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.")
3 |
4 | if (NOT TARGET glslang::OSDependent)
5 | include("/home/runner/work/ncnn/ncnn/build-aarch64/install/lib/cmake/glslang/glslang-targets.cmake")
6 | endif()
7 |
8 | add_library(OSDependent ALIAS glslang::OSDependent)
9 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/SPIRVTargets.cmake:
--------------------------------------------------------------------------------
1 |
2 | message(WARNING "Using `SPIRVTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.")
3 |
4 | if (NOT TARGET glslang::SPIRV)
5 | include("/home/runner/work/ncnn/ncnn/build-aarch64/install/lib/cmake/glslang/glslang-targets.cmake")
6 | endif()
7 |
8 | add_library(SPIRV ALIAS glslang::SPIRV)
9 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/glslang-default-resource-limitsTargets.cmake:
--------------------------------------------------------------------------------
1 |
2 | message(WARNING "Using `glslang-default-resource-limitsTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.")
3 |
4 | if (NOT TARGET glslang::glslang-default-resource-limits)
5 | include("${CMAKE_INSTALL_FULL_LIBDIR}/cmake/glslang/glslang-targets.cmake")
6 | endif()
7 |
8 | add_library(glslang-default-resource-limits ALIAS glslang::glslang-default-resource-limits)
9 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/glslang/glslang-config-version.cmake:
--------------------------------------------------------------------------------
1 | # This is a basic version file for the Config-mode of find_package().
2 | # It is used by write_basic_package_version_file() as input file for configure_file()
3 | # to create a version-file which can be installed along a config.cmake file.
4 | #
5 | # The created file sets PACKAGE_VERSION_EXACT if the current version string and
6 | # the requested version string are exactly the same and it sets
7 | # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
8 | # but only if the requested major version is the same as the current one.
9 | # The variable CVF_VERSION must be set before calling configure_file().
10 |
11 |
12 | set(PACKAGE_VERSION "12.3.1")
13 |
14 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
15 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
16 | else()
17 |
18 | if("12.3.1" MATCHES "^([0-9]+)\\.")
19 | set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
20 | if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
21 | string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
22 | endif()
23 | else()
24 | set(CVF_VERSION_MAJOR "12.3.1")
25 | endif()
26 |
27 | if(PACKAGE_FIND_VERSION_RANGE)
28 | # both endpoints of the range must have the expected major version
29 | math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
30 | if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
31 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
32 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
33 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
34 | elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
35 | AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
36 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
37 | set(PACKAGE_VERSION_COMPATIBLE TRUE)
38 | else()
39 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
40 | endif()
41 | else()
42 | if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
43 | set(PACKAGE_VERSION_COMPATIBLE TRUE)
44 | else()
45 | set(PACKAGE_VERSION_COMPATIBLE FALSE)
46 | endif()
47 |
48 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
49 | set(PACKAGE_VERSION_EXACT TRUE)
50 | endif()
51 | endif()
52 | endif()
53 |
54 |
55 | # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
56 | if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
57 | return()
58 | endif()
59 |
60 | # check that the installed version has the same 32/64bit-ness as the one which is currently searching:
61 | if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
62 | math(EXPR installedBits "8 * 8")
63 | set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
64 | set(PACKAGE_VERSION_UNSUITABLE TRUE)
65 | endif()
66 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/glslang/glslang-config.cmake:
--------------------------------------------------------------------------------
1 |
2 | ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
3 | ####### Any changes to this file will be overwritten by the next CMake run ####
4 | ####### The input file was glslang-config.cmake.in ########
5 |
6 | get_filename_component(PACKAGE_${CMAKE_FIND_PACKAGE_NAME}_COUNTER_1 "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
7 |
8 | macro(set_and_check _var _file)
9 | set(${_var} "${_file}")
10 | if(NOT EXISTS "${_file}")
11 | message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
12 | endif()
13 | endmacro()
14 |
15 | macro(check_required_components _NAME)
16 | foreach(comp ${${_NAME}_FIND_COMPONENTS})
17 | if(NOT ${_NAME}_${comp}_FOUND)
18 | if(${_NAME}_FIND_REQUIRED_${comp})
19 | set(${_NAME}_FOUND FALSE)
20 | endif()
21 | endif()
22 | endforeach()
23 | endmacro()
24 |
25 | ####################################################################################
26 | include(CMakeFindDependencyMacro)
27 | set(THREADS_PREFER_PTHREAD_FLAG ON)
28 | find_dependency(Threads REQUIRED)
29 |
30 | include("${PACKAGE_${CMAKE_FIND_PACKAGE_NAME}_COUNTER_1}/lib/cmake/glslang/glslang-targets.cmake")
31 |
32 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/glslang/glslang-targets-release.cmake:
--------------------------------------------------------------------------------
1 | #----------------------------------------------------------------
2 | # Generated CMake target import file for configuration "Release".
3 | #----------------------------------------------------------------
4 |
5 | # Commands may need to know the format version.
6 | set(CMAKE_IMPORT_FILE_VERSION 1)
7 |
8 | # Import target "glslang::OSDependent" for configuration "Release"
9 | set_property(TARGET glslang::OSDependent APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
10 | set_target_properties(glslang::OSDependent PROPERTIES
11 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
12 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOSDependent.a"
13 | )
14 |
15 | list(APPEND _cmake_import_check_targets glslang::OSDependent )
16 | list(APPEND _cmake_import_check_files_for_glslang::OSDependent "${_IMPORT_PREFIX}/lib/libOSDependent.a" )
17 |
18 | # Import target "glslang::glslang" for configuration "Release"
19 | set_property(TARGET glslang::glslang APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
20 | set_target_properties(glslang::glslang PROPERTIES
21 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
22 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libglslang.a"
23 | )
24 |
25 | list(APPEND _cmake_import_check_targets glslang::glslang )
26 | list(APPEND _cmake_import_check_files_for_glslang::glslang "${_IMPORT_PREFIX}/lib/libglslang.a" )
27 |
28 | # Import target "glslang::MachineIndependent" for configuration "Release"
29 | set_property(TARGET glslang::MachineIndependent APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
30 | set_target_properties(glslang::MachineIndependent PROPERTIES
31 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
32 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libMachineIndependent.a"
33 | )
34 |
35 | list(APPEND _cmake_import_check_targets glslang::MachineIndependent )
36 | list(APPEND _cmake_import_check_files_for_glslang::MachineIndependent "${_IMPORT_PREFIX}/lib/libMachineIndependent.a" )
37 |
38 | # Import target "glslang::GenericCodeGen" for configuration "Release"
39 | set_property(TARGET glslang::GenericCodeGen APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
40 | set_target_properties(glslang::GenericCodeGen PROPERTIES
41 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
42 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libGenericCodeGen.a"
43 | )
44 |
45 | list(APPEND _cmake_import_check_targets glslang::GenericCodeGen )
46 | list(APPEND _cmake_import_check_files_for_glslang::GenericCodeGen "${_IMPORT_PREFIX}/lib/libGenericCodeGen.a" )
47 |
48 | # Import target "glslang::glslang-default-resource-limits" for configuration "Release"
49 | set_property(TARGET glslang::glslang-default-resource-limits APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
50 | set_target_properties(glslang::glslang-default-resource-limits PROPERTIES
51 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
52 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libglslang-default-resource-limits.a"
53 | )
54 |
55 | list(APPEND _cmake_import_check_targets glslang::glslang-default-resource-limits )
56 | list(APPEND _cmake_import_check_files_for_glslang::glslang-default-resource-limits "${_IMPORT_PREFIX}/lib/libglslang-default-resource-limits.a" )
57 |
58 | # Import target "glslang::OGLCompiler" for configuration "Release"
59 | set_property(TARGET glslang::OGLCompiler APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
60 | set_target_properties(glslang::OGLCompiler PROPERTIES
61 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
62 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libOGLCompiler.a"
63 | )
64 |
65 | list(APPEND _cmake_import_check_targets glslang::OGLCompiler )
66 | list(APPEND _cmake_import_check_files_for_glslang::OGLCompiler "${_IMPORT_PREFIX}/lib/libOGLCompiler.a" )
67 |
68 | # Import target "glslang::SPIRV" for configuration "Release"
69 | set_property(TARGET glslang::SPIRV APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
70 | set_target_properties(glslang::SPIRV PROPERTIES
71 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
72 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libSPIRV.a"
73 | )
74 |
75 | list(APPEND _cmake_import_check_targets glslang::SPIRV )
76 | list(APPEND _cmake_import_check_files_for_glslang::SPIRV "${_IMPORT_PREFIX}/lib/libSPIRV.a" )
77 |
78 | # Commands beyond this point should not need to know the version.
79 | set(CMAKE_IMPORT_FILE_VERSION)
80 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/glslang/glslang-targets.cmake:
--------------------------------------------------------------------------------
1 | # Generated by CMake
2 |
3 | if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
4 | message(FATAL_ERROR "CMake >= 2.8.0 required")
5 | endif()
6 | if(CMAKE_VERSION VERSION_LESS "2.8.12")
7 | message(FATAL_ERROR "CMake >= 2.8.12 required")
8 | endif()
9 | cmake_policy(PUSH)
10 | cmake_policy(VERSION 2.8.12...3.27)
11 | #----------------------------------------------------------------
12 | # Generated CMake target import file.
13 | #----------------------------------------------------------------
14 |
15 | # Commands may need to know the format version.
16 | set(CMAKE_IMPORT_FILE_VERSION 1)
17 |
18 | # Protect against multiple inclusion, which would fail when already imported targets are added once more.
19 | set(_cmake_targets_defined "")
20 | set(_cmake_targets_not_defined "")
21 | set(_cmake_expected_targets "")
22 | foreach(_cmake_expected_target IN ITEMS glslang::OSDependent glslang::glslang glslang::MachineIndependent glslang::GenericCodeGen glslang::glslang-default-resource-limits glslang::OGLCompiler glslang::SPIRV)
23 | list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
24 | if(TARGET "${_cmake_expected_target}")
25 | list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
26 | else()
27 | list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
28 | endif()
29 | endforeach()
30 | unset(_cmake_expected_target)
31 | if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
32 | unset(_cmake_targets_defined)
33 | unset(_cmake_targets_not_defined)
34 | unset(_cmake_expected_targets)
35 | unset(CMAKE_IMPORT_FILE_VERSION)
36 | cmake_policy(POP)
37 | return()
38 | endif()
39 | if(NOT _cmake_targets_defined STREQUAL "")
40 | string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
41 | string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
42 | message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
43 | endif()
44 | unset(_cmake_targets_defined)
45 | unset(_cmake_targets_not_defined)
46 | unset(_cmake_expected_targets)
47 |
48 |
49 | # Compute the installation prefix relative to this file.
50 | get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
51 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
52 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
53 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
54 | if(_IMPORT_PREFIX STREQUAL "/")
55 | set(_IMPORT_PREFIX "")
56 | endif()
57 |
58 | # Create imported target glslang::OSDependent
59 | add_library(glslang::OSDependent STATIC IMPORTED)
60 |
61 | set_target_properties(glslang::OSDependent PROPERTIES
62 | INTERFACE_LINK_LIBRARIES "Threads::Threads"
63 | )
64 |
65 | # Create imported target glslang::glslang
66 | add_library(glslang::glslang STATIC IMPORTED)
67 |
68 | set_target_properties(glslang::glslang PROPERTIES
69 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
70 | INTERFACE_LINK_LIBRARIES "\$;\$;\$"
71 | )
72 |
73 | # Create imported target glslang::MachineIndependent
74 | add_library(glslang::MachineIndependent STATIC IMPORTED)
75 |
76 | set_target_properties(glslang::MachineIndependent PROPERTIES
77 | INTERFACE_LINK_LIBRARIES "\$;\$;\$"
78 | )
79 |
80 | # Create imported target glslang::GenericCodeGen
81 | add_library(glslang::GenericCodeGen STATIC IMPORTED)
82 |
83 | # Create imported target glslang::glslang-default-resource-limits
84 | add_library(glslang::glslang-default-resource-limits STATIC IMPORTED)
85 |
86 | set_target_properties(glslang::glslang-default-resource-limits PROPERTIES
87 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
88 | )
89 |
90 | # Create imported target glslang::OGLCompiler
91 | add_library(glslang::OGLCompiler STATIC IMPORTED)
92 |
93 | # Create imported target glslang::SPIRV
94 | add_library(glslang::SPIRV STATIC IMPORTED)
95 |
96 | set_target_properties(glslang::SPIRV PROPERTIES
97 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
98 | INTERFACE_LINK_LIBRARIES "\$"
99 | )
100 |
101 | # Load information for each installed configuration.
102 | file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/glslang-targets-*.cmake")
103 | foreach(_cmake_config_file IN LISTS _cmake_config_files)
104 | include("${_cmake_config_file}")
105 | endforeach()
106 | unset(_cmake_config_file)
107 | unset(_cmake_config_files)
108 |
109 | # Cleanup temporary variables.
110 | set(_IMPORT_PREFIX)
111 |
112 | # Loop over all imported files and verify that they actually exist
113 | foreach(_cmake_target IN LISTS _cmake_import_check_targets)
114 | if(CMAKE_VERSION VERSION_LESS "3.28"
115 | OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
116 | OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
117 | foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
118 | if(NOT EXISTS "${_cmake_file}")
119 | message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
120 | \"${_cmake_file}\"
121 | but this file does not exist. Possible reasons include:
122 | * The file was deleted, renamed, or moved to another location.
123 | * An install or uninstall procedure did not complete successfully.
124 | * The installation package was faulty and contained
125 | \"${CMAKE_CURRENT_LIST_FILE}\"
126 | but not all the files it references.
127 | ")
128 | endif()
129 | endforeach()
130 | endif()
131 | unset(_cmake_file)
132 | unset("_cmake_import_check_files_for_${_cmake_target}")
133 | endforeach()
134 | unset(_cmake_target)
135 | unset(_cmake_import_check_targets)
136 |
137 | # This file does not depend on other imported targets which have
138 | # been exported from the same project but in a separate export set.
139 |
140 | # Commands beyond this point should not need to know the version.
141 | set(CMAKE_IMPORT_FILE_VERSION)
142 | cmake_policy(POP)
143 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/glslangTargets.cmake:
--------------------------------------------------------------------------------
1 |
2 | message(WARNING "Using `glslangTargets.cmake` is deprecated: use `find_package(glslang)` to find glslang CMake targets.")
3 |
4 | if (NOT TARGET glslang::glslang)
5 | include("/home/runner/work/ncnn/ncnn/build-aarch64/install/lib/cmake/glslang/glslang-targets.cmake")
6 | endif()
7 |
8 | if(OFF)
9 | add_library(glslang ALIAS glslang::glslang)
10 | else()
11 | add_library(glslang ALIAS glslang::glslang)
12 | add_library(MachineIndependent ALIAS glslang::MachineIndependent)
13 | add_library(GenericCodeGen ALIAS glslang::GenericCodeGen)
14 | endif()
15 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/ncnn/ncnn-release.cmake:
--------------------------------------------------------------------------------
1 | #----------------------------------------------------------------
2 | # Generated CMake target import file for configuration "Release".
3 | #----------------------------------------------------------------
4 |
5 | # Commands may need to know the format version.
6 | set(CMAKE_IMPORT_FILE_VERSION 1)
7 |
8 | # Import target "ncnn" for configuration "Release"
9 | set_property(TARGET ncnn APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
10 | set_target_properties(ncnn PROPERTIES
11 | IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
12 | IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libncnn.a"
13 | )
14 |
15 | list(APPEND _cmake_import_check_targets ncnn )
16 | list(APPEND _cmake_import_check_files_for_ncnn "${_IMPORT_PREFIX}/lib/libncnn.a" )
17 |
18 | # Commands beyond this point should not need to know the version.
19 | set(CMAKE_IMPORT_FILE_VERSION)
20 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/ncnn/ncnn.cmake:
--------------------------------------------------------------------------------
1 | # Generated by CMake
2 |
3 | if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
4 | message(FATAL_ERROR "CMake >= 2.8.0 required")
5 | endif()
6 | if(CMAKE_VERSION VERSION_LESS "2.8.12")
7 | message(FATAL_ERROR "CMake >= 2.8.12 required")
8 | endif()
9 | cmake_policy(PUSH)
10 | cmake_policy(VERSION 2.8.12...3.27)
11 | #----------------------------------------------------------------
12 | # Generated CMake target import file.
13 | #----------------------------------------------------------------
14 |
15 | # Commands may need to know the format version.
16 | set(CMAKE_IMPORT_FILE_VERSION 1)
17 |
18 | # Protect against multiple inclusion, which would fail when already imported targets are added once more.
19 | set(_cmake_targets_defined "")
20 | set(_cmake_targets_not_defined "")
21 | set(_cmake_expected_targets "")
22 | foreach(_cmake_expected_target IN ITEMS ncnn)
23 | list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
24 | if(TARGET "${_cmake_expected_target}")
25 | list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
26 | else()
27 | list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
28 | endif()
29 | endforeach()
30 | unset(_cmake_expected_target)
31 | if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
32 | unset(_cmake_targets_defined)
33 | unset(_cmake_targets_not_defined)
34 | unset(_cmake_expected_targets)
35 | unset(CMAKE_IMPORT_FILE_VERSION)
36 | cmake_policy(POP)
37 | return()
38 | endif()
39 | if(NOT _cmake_targets_defined STREQUAL "")
40 | string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
41 | string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
42 | message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
43 | endif()
44 | unset(_cmake_targets_defined)
45 | unset(_cmake_targets_not_defined)
46 | unset(_cmake_expected_targets)
47 |
48 |
49 | # Compute the installation prefix relative to this file.
50 | get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
51 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
52 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
53 | get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
54 | if(_IMPORT_PREFIX STREQUAL "/")
55 | set(_IMPORT_PREFIX "")
56 | endif()
57 |
58 | # Create imported target ncnn
59 | add_library(ncnn STATIC IMPORTED)
60 |
61 | set_target_properties(ncnn PROPERTIES
62 | INTERFACE_COMPILE_OPTIONS "-fno-rtti;-fno-exceptions"
63 | INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/ncnn"
64 | INTERFACE_LINK_LIBRARIES "-fopenmp;-static-openmp;-Wl,-wrap,__kmp_affinity_determine_capable;Threads::Threads;\$;\$;\$;android;jnigraphics;log"
65 | INTERFACE_POSITION_INDEPENDENT_CODE "ON"
66 | )
67 |
68 | # Load information for each installed configuration.
69 | file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/ncnn-*.cmake")
70 | foreach(_cmake_config_file IN LISTS _cmake_config_files)
71 | include("${_cmake_config_file}")
72 | endforeach()
73 | unset(_cmake_config_file)
74 | unset(_cmake_config_files)
75 |
76 | # Cleanup temporary variables.
77 | set(_IMPORT_PREFIX)
78 |
79 | # Loop over all imported files and verify that they actually exist
80 | foreach(_cmake_target IN LISTS _cmake_import_check_targets)
81 | if(CMAKE_VERSION VERSION_LESS "3.28"
82 | OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
83 | OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
84 | foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
85 | if(NOT EXISTS "${_cmake_file}")
86 | message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
87 | \"${_cmake_file}\"
88 | but this file does not exist. Possible reasons include:
89 | * The file was deleted, renamed, or moved to another location.
90 | * An install or uninstall procedure did not complete successfully.
91 | * The installation package was faulty and contained
92 | \"${CMAKE_CURRENT_LIST_FILE}\"
93 | but not all the files it references.
94 | ")
95 | endif()
96 | endforeach()
97 | endif()
98 | unset(_cmake_file)
99 | unset("_cmake_import_check_files_for_${_cmake_target}")
100 | endforeach()
101 | unset(_cmake_target)
102 | unset(_cmake_import_check_targets)
103 |
104 | # Make sure the targets which have been exported in some other
105 | # export set exist.
106 | unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)
107 | foreach(_target "glslang::glslang" "glslang::SPIRV" )
108 | if(NOT TARGET "${_target}" )
109 | set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets} ${_target}")
110 | endif()
111 | endforeach()
112 |
113 | if(DEFINED ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)
114 | if(CMAKE_FIND_PACKAGE_NAME)
115 | set( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
116 | set( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "The following imported targets are referenced, but are missing: ${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}")
117 | else()
118 | message(FATAL_ERROR "The following imported targets are referenced, but are missing: ${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets}")
119 | endif()
120 | endif()
121 | unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)
122 |
123 | # Commands beyond this point should not need to know the version.
124 | set(CMAKE_IMPORT_FILE_VERSION)
125 | cmake_policy(POP)
126 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/cmake/ncnn/ncnnConfig.cmake:
--------------------------------------------------------------------------------
1 | set(NCNN_OPENMP ON)
2 | set(NCNN_THREADS ON)
3 | set(NCNN_VULKAN ON)
4 | set(NCNN_SHARED_LIB OFF)
5 | set(NCNN_SYSTEM_GLSLANG OFF)
6 | set(NCNN_SIMPLEVK ON)
7 |
8 | if(NCNN_OPENMP)
9 | find_package(OpenMP)
10 | endif()
11 |
12 | if(NCNN_THREADS)
13 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
14 | set(THREADS_PREFER_PTHREAD_FLAG TRUE)
15 | find_package(Threads REQUIRED)
16 | endif()
17 |
18 | if(NCNN_VULKAN)
19 | if(NOT NCNN_SIMPLEVK)
20 | find_package(Vulkan REQUIRED)
21 | endif()
22 |
23 | if(NOT NCNN_SHARED_LIB)
24 | if(NCNN_SYSTEM_GLSLANG)
25 | find_package(glslang QUIET)
26 | if(NOT glslang_FOUND)
27 | set(GLSLANG_TARGET_DIR "")
28 | include(${GLSLANG_TARGET_DIR}/OSDependentTargets.cmake)
29 | include(${GLSLANG_TARGET_DIR}/OGLCompilerTargets.cmake)
30 | if(EXISTS "${GLSLANG_TARGET_DIR}/HLSLTargets.cmake")
31 | # hlsl support can be optional
32 | include("${GLSLANG_TARGET_DIR}/HLSLTargets.cmake")
33 | endif()
34 | include(${GLSLANG_TARGET_DIR}/glslangTargets.cmake)
35 | include(${GLSLANG_TARGET_DIR}/SPIRVTargets.cmake)
36 | endif()
37 | else()
38 | set(glslang_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../lib/cmake/glslang")
39 | find_package(glslang QUIET)
40 | endif()
41 | endif()
42 | endif()
43 |
44 | include(${CMAKE_CURRENT_LIST_DIR}/ncnn.cmake)
45 |
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libGenericCodeGen.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libGenericCodeGen.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libMachineIndependent.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libMachineIndependent.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libOGLCompiler.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libOGLCompiler.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libOSDependent.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libOSDependent.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libSPIRV.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libSPIRV.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libglslang-default-resource-limits.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libglslang-default-resource-limits.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libglslang.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libglslang.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libncnn.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/libncnn.a
--------------------------------------------------------------------------------
/android/app/src/main/jni/ncnn-20240410-android-vulkan/arm64-v8a/lib/pkgconfig/ncnn.pc:
--------------------------------------------------------------------------------
1 | prefix=${pcfiledir}/../..
2 | librarydir=${prefix}/lib
3 | includedir=${prefix}/include
4 |
5 | Name: ncnn
6 | Description: high-performance neural network inference framework optimized for the mobile platform
7 | Version: 1.0.20240410
8 | URL: https://github.com/Tencent/ncnn
9 | Libs: -L"${librarydir}" -lncnn
10 | Cflags: -I"${includedir}"
11 |
12 |
--------------------------------------------------------------------------------
/android/app/src/main/res/layout/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
19 |
20 |
25 |
26 |
34 |
35 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | LLM
4 |
5 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | google()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:4.0.1'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | jcenter()
15 | google()
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EdVince/llm-cpp/7cea11654cbe3414123383ad2cc84efdd952814c/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat May 25 17:28:54 CST 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/android/local.properties:
--------------------------------------------------------------------------------
1 | ## This file must *NOT* be checked into Version Control Systems,
2 | # as it contains information specific to your local configuration.
3 | #
4 | # Location of the SDK. This is only used by Gradle.
5 | # For customization when using a Version Control System, please read the
6 | # header note.
7 | #Sun May 26 12:48:48 CST 2024
8 | sdk.dir=/Users/jinxuan/Library/Android/sdk
9 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/chat.cpp:
--------------------------------------------------------------------------------
1 | #include "qwen2_model.h"
2 | #include "getmem.h"
3 |
4 | int main(int argc, char **argv) {
5 | std::string modelpath = "Qwen1.5-1.8B-Chat-GPTQ-Int4-lite";
6 | std::string user_prompt = "Hello! How are you?";
7 |
8 | if (argc > 1) {
9 | modelpath = argv[1];
10 | }
11 | if (argc > 2) {
12 | user_prompt = argv[2];
13 | }
14 |
15 | GPT2Tokenizer tokenizer = GPT2Tokenizer::load(modelpath+"/vocab.json", modelpath+"/merges.txt");
16 |
17 | Model model(modelpath);
18 |
19 | std::vector chat_template = {"<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n","<|im_end|>\n<|im_start|>assistant\n"};
20 | user_prompt = chat_template[0] + user_prompt + chat_template[1];
21 |
22 | std::vector input_ids = tokenizer.encode_template(user_prompt);
23 |
24 | std::string output = model.generate(input_ids,tokenizer,1024,false,true,true);
25 | printf("CurrRSS: %zuM & PeakRSS: %zuM\n", getCurrentRSS()>>20, getPeakRSS()>>20);
26 |
27 | // model.benchmark(tokenizer,128);
28 |
29 | model.clear();
30 |
31 | return EXIT_SUCCESS;
32 | }
--------------------------------------------------------------------------------
/getmem.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Author: David Robert Nadeau
3 | * Site: http://NadeauSoftware.com/
4 | * License: Creative Commons Attribution 3.0 Unported License
5 | * http://creativecommons.org/licenses/by/3.0/deed.en_US
6 | */
7 |
8 | #if defined(_WIN32)
9 | #include
10 | #include
11 |
12 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
13 | #include
14 | #include
15 |
16 | #if defined(__APPLE__) && defined(__MACH__)
17 | #include
18 |
19 | #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
20 | #include
21 | #include
22 |
23 | #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
24 | #include
25 |
26 | #endif
27 |
28 | #else
29 | #error "Cannot define getPeakRSS( ) or getCurrentRSS( ) for an unknown OS."
30 | #endif
31 |
32 |
33 |
34 |
35 |
36 | /**
37 | * Returns the peak (maximum so far) resident set size (physical
38 | * memory use) measured in bytes, or zero if the value cannot be
39 | * determined on this OS.
40 | */
41 | size_t getPeakRSS()
42 | {
43 | #if defined(_WIN32)
44 | /* Windows -------------------------------------------------- */
45 | PROCESS_MEMORY_COUNTERS info;
46 | GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
47 | return (size_t)info.PeakWorkingSetSize;
48 |
49 | #elif (defined(_AIX) || defined(__TOS__AIX__)) || (defined(__sun__) || defined(__sun) || defined(sun) && (defined(__SVR4) || defined(__svr4__)))
50 | /* AIX and Solaris ------------------------------------------ */
51 | struct psinfo psinfo;
52 | int fd = -1;
53 | if ((fd = open("/proc/self/psinfo", O_RDONLY)) == -1)
54 | return (size_t)0L; /* Can't open? */
55 | if (read(fd, &psinfo, sizeof(psinfo)) != sizeof(psinfo))
56 | {
57 | close(fd);
58 | return (size_t)0L; /* Can't read? */
59 | }
60 | close(fd);
61 | return (size_t)(psinfo.pr_rssize * 1024L);
62 |
63 | #elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
64 | /* BSD, Linux, and OSX -------------------------------------- */
65 | struct rusage rusage;
66 | getrusage(RUSAGE_SELF, &rusage);
67 | #if defined(__APPLE__) && defined(__MACH__)
68 | return (size_t)rusage.ru_maxrss;
69 | #else
70 | return (size_t)(rusage.ru_maxrss * 1024L);
71 | #endif
72 |
73 | #else
74 | /* Unknown OS ----------------------------------------------- */
75 | return (size_t)0L; /* Unsupported. */
76 | #endif
77 | }
78 |
79 |
80 |
81 |
82 |
83 | /**
84 | * Returns the current resident set size (physical memory use) measured
85 | * in bytes, or zero if the value cannot be determined on this OS.
86 | */
87 | size_t getCurrentRSS()
88 | {
89 | #if defined(_WIN32)
90 | /* Windows -------------------------------------------------- */
91 | PROCESS_MEMORY_COUNTERS info;
92 | GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
93 | return (size_t)info.WorkingSetSize;
94 |
95 | #elif defined(__APPLE__) && defined(__MACH__)
96 | /* OSX ------------------------------------------------------ */
97 | struct mach_task_basic_info info;
98 | mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT;
99 | if (task_info(mach_task_self(), MACH_TASK_BASIC_INFO,
100 | (task_info_t)&info, &infoCount) != KERN_SUCCESS)
101 | return (size_t)0L; /* Can't access? */
102 | return (size_t)info.resident_size;
103 |
104 | #elif defined(__linux__) || defined(__linux) || defined(linux) || defined(__gnu_linux__)
105 | /* Linux ---------------------------------------------------- */
106 | long rss = 0L;
107 | FILE* fp = NULL;
108 | if ((fp = fopen("/proc/self/statm", "r")) == NULL)
109 | return (size_t)0L; /* Can't open? */
110 | if (fscanf(fp, "%*s%ld", &rss) != 1)
111 | {
112 | fclose(fp);
113 | return (size_t)0L; /* Can't read? */
114 | }
115 | fclose(fp);
116 | return (size_t)rss * (size_t)sysconf(_SC_PAGESIZE);
117 |
118 | #else
119 | /* AIX, BSD, Solaris, and Unknown OS ------------------------ */
120 | return (size_t)0L; /* Unsupported. */
121 | #endif
122 | }
--------------------------------------------------------------------------------
/make_lite_weight.py:
--------------------------------------------------------------------------------
1 | import os
2 | import shutil
3 | from glob import glob
4 | from tqdm import tqdm
5 | import argparse
6 | import numpy as np
7 |
8 | import torch
9 | from safetensors import safe_open
10 | from safetensors.torch import save_file
11 |
12 | if __name__ == '__main__':
13 |
14 | parser = argparse.ArgumentParser()
15 | parser.add_argument('--input_model', type=str)
16 | args = parser.parse_args()
17 |
18 | SRC = args.input_model
19 | DST = SRC + '-lite'
20 | if os.path.exists(DST):
21 | print('removing the old version...')
22 | shutil.rmtree(DST)
23 | print('copying...')
24 | shutil.copytree(SRC,DST)
25 |
26 | total_cnt = 0
27 | remove_cnt = 0
28 | transpose_cnt = 0
29 | quant_cnt = 0
30 | save_cnt = 0
31 |
32 | print('converting...')
33 | sts = sorted(glob(os.path.join(SRC,'*.safetensors')))
34 | for st in sts:
35 | st = os.path.basename(st)
36 |
37 | tensors = {}
38 | with safe_open(os.path.join(SRC,st), framework="pt", device="cpu") as f:
39 | total_cnt += len(f.keys())
40 |
41 | for key in tqdm(f.keys()):
42 |
43 | if 'g_idx' in key or 'qzeros' in key or 'o_proj.bias' in key or 'gate_proj.bias' in key or 'up_proj.bias' in key or 'down_proj.bias' in key:
44 | remove_cnt += 1
45 | continue
46 |
47 | if 'qweight' in key:
48 | qweight = f.get_tensor(key).t().contiguous()
49 |
50 | origin_size = qweight.shape
51 | qweight = qweight.cpu().numpy()
52 |
53 | qweight = qweight.reshape(-1,2)
54 |
55 | w0 = (qweight[:,0] >> 0).astype(np.int8)
56 | w1 = (qweight[:,0] >> 4).astype(np.int8)
57 | w2 = (qweight[:,0] >> 8).astype(np.int8)
58 | w3 = (qweight[:,0] >> 12).astype(np.int8)
59 | w4 = (qweight[:,0] >> 16).astype(np.int8)
60 | w5 = (qweight[:,0] >> 20).astype(np.int8)
61 | w6 = (qweight[:,0] >> 24).astype(np.int8)
62 | w7 = (qweight[:,0] >> 28).astype(np.int8)
63 | w8 = (qweight[:,1] >> 0).astype(np.int8)
64 | w9 = (qweight[:,1] >> 4).astype(np.int8)
65 | w10 = (qweight[:,1] >> 8).astype(np.int8)
66 | w11 = (qweight[:,1] >> 12).astype(np.int8)
67 | w12 = (qweight[:,1] >> 16).astype(np.int8)
68 | w13 = (qweight[:,1] >> 20).astype(np.int8)
69 | w14 = (qweight[:,1] >> 24).astype(np.int8)
70 | w15 = (qweight[:,1] >> 28).astype(np.int8)
71 |
72 | ww0 = (w0 & 0b00001111) | ( w8 << 4)
73 | ww1 = (w1 & 0b00001111) | ( w9 << 4)
74 | ww2 = (w2 & 0b00001111) | (w10 << 4)
75 | ww3 = (w3 & 0b00001111) | (w11 << 4)
76 | ww4 = (w4 & 0b00001111) | (w12 << 4)
77 | ww5 = (w5 & 0b00001111) | (w13 << 4)
78 | ww6 = (w6 & 0b00001111) | (w14 << 4)
79 | ww7 = (w7 & 0b00001111) | (w15 << 4)
80 |
81 | ww = np.concatenate([ww0[...,None],ww1[...,None],ww2[...,None],ww3[...,None],ww4[...,None],ww5[...,None],ww6[...,None],ww7[...,None]],axis=-1)
82 | ww = ww.view(np.int32)
83 |
84 | qweight = torch.from_numpy(ww).reshape(origin_size)
85 |
86 | tensors[key] = qweight
87 | transpose_cnt += 1
88 | continue
89 |
90 | if 'scales' in key:
91 | qweight = f.get_tensor(key).t().contiguous()
92 | tensors[key] = qweight
93 | transpose_cnt += 1
94 | continue
95 |
96 | if 'model.embed_tokens' in key or 'lm_head' in key:
97 | tensor = f.get_tensor(key).float()
98 | scale = (torch.max(torch.abs(tensor),dim=1,keepdim=True)[0] / 127.0).to(dtype=torch.float32)
99 | quant = torch.trunc(tensor / scale).to(dtype=torch.int8)
100 | tensors[key+'.scale'] = scale.squeeze()
101 | tensors[key+'.quant'] = quant
102 | quant_cnt += 1
103 | continue
104 |
105 | tensors[key] = f.get_tensor(key)
106 |
107 | save_cnt += len(tensors)
108 | save_file(tensors, os.path.join(DST,st))
109 |
110 | print(' total tensors: ',total_cnt)
111 | print(' remove tensors: ',remove_cnt)
112 | print('transpose tensors: ',transpose_cnt)
113 | print(' quant tensors: ',quant_cnt)
114 | print(' save tensors: ',save_cnt)
--------------------------------------------------------------------------------
/run.sh:
--------------------------------------------------------------------------------
1 | mkdir build
2 | cd build
3 | cmake ..
4 | make
5 | cd ..
6 | # export DYLD_LIBRARY_PATH=/opt/arm/armpl_24.04_flang-new_clang_18/lib
7 | ./build/chat
--------------------------------------------------------------------------------