Skip to content

Commit eed257d

Browse files
authored
ci update llvmpipe (#5954)
* check image fp16
1 parent ad30c7f commit eed257d

File tree

6 files changed

+66
-83
lines changed

6 files changed

+66
-83
lines changed

.ci/test-coverage.yml

-81
Original file line numberDiff line numberDiff line change
@@ -96,87 +96,6 @@ jobs:
9696
- name: codecov
9797
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
9898

99-
linux-gcc-gpu-lavapipe:
100-
name: linux-gcc-gpu-lavapipe
101-
runs-on:
102-
pool-name: docker
103-
container:
104-
image: bkci/ci:ubuntu
105-
steps:
106-
- name: checkout
107-
checkout: self
108-
with:
109-
strategy: FRESH_CHECKOUT
110-
enableGitLfs: false
111-
112-
- name: install-deps
113-
run: |
114-
apt-get update
115-
apt-get install -y lcov libvulkan-dev libxcb-shm0
116-
curl https://uploader.codecov.io/verification.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
117-
curl -Os https://uploader.codecov.io/latest/linux/codecov
118-
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
119-
curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig
120-
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
121-
shasum -a 256 -c codecov.SHA256SUM
122-
chmod +x codecov
123-
124-
- name: cache-lavapipe
125-
id: cache-lavapipe
126-
uses: cache@1.*
127-
with:
128-
cachePaths: lavapipe-install
129-
cacheKey: lavapipe-linux-install-20211127-4
130-
131-
- name: checkout-lavapipe
132-
if: steps.cache-lavapipe.outputs.cacheHit != 'true'
133-
checkout: https://github.com/mesa3d/mesa.git
134-
with:
135-
pullType: COMMIT_ID
136-
refName: cd39180cfab20734744b379b085cc3b5c2cecd3a
137-
localPath: mesa
138-
enableSubmodule: false
139-
enableGitLfs: false
140-
141-
- name: lavapipe
142-
if: steps.cache-lavapipe.outputs.cacheHit != 'true'
143-
run: |
144-
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye main' | tee -a /etc/apt/sources.list
145-
echo 'deb-src http://mirrors.cloud.tencent.com/debian bullseye-updates main' | tee -a /etc/apt/sources.list
146-
apt-get update
147-
apt-get build-dep -y mesa
148-
mkdir -p "${{ci.workspace}}/lavapipe-install"
149-
cd mesa
150-
mkdir build
151-
cd build
152-
meson -Dprefix="${{ci.workspace}}/lavapipe-install" -Dbuildtype=release -Db_lto=true -Db_ndebug=true -Dplatforms="x11" -Ddri3=enabled -Ddri-drivers="" -Dgallium-drivers=swrast -Dgallium-vdpau=disabled -Dgallium-xvmc=disabled -Dgallium-omx=disabled -Dgallium-va=disabled -Dgallium-xa=disabled -Dgallium-opencl=disabled -Dopencl-native=false -Dvulkan-drivers=swrast -Dshader-cache=disabled -Dgles1=disabled -Dgles2=disabled -Dopengl=false -Dgbm=disabled -Dglx=disabled -Degl=disabled -Dllvm=enabled -Dvalgrind=disabled -Dlibunwind=disabled -Dlmsensors=disabled ..
153-
ninja -j$(nproc)
154-
ninja install
155-
find ${{ci.workspace}}/lavapipe-install
156-
cat ${{ci.workspace}}/lavapipe-install/share/vulkan/icd.d/lvp_icd.x86_64.json
157-
158-
- name: build
159-
run: |
160-
mkdir build && cd build
161-
cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_AVX2=ON -DNCNN_AVX512=OFF -DNCNN_XOP=OFF -DNCNN_OPENMP=OFF -DNCNN_VULKAN=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
162-
cmake --build . -j 4
163-
- name: test
164-
run: |
165-
export LP_NUM_THREADS=4
166-
export VK_ICD_FILENAMES="${{ci.workspace}}/lavapipe-install/share/vulkan/icd.d/lvp_icd.x86_64.json"
167-
cd build
168-
ctest --output-on-failure -j 4
169-
- name: lcov-collect
170-
run: |
171-
cd build
172-
lcov -d ./src -c -o lcov.info
173-
lcov -r lcov.info '/usr/*' -o lcov.info
174-
lcov -r lcov.info '*/build/*' -o lcov.info
175-
lcov -r lcov.info '*/glslang/*' -o lcov.info
176-
lcov --list lcov.info
177-
- name: codecov
178-
run: ./codecov -t ${{settings.CODECOV_TOKEN.access_token}} -C ${{ ci.sha }} -B ${{ ci.head_ref }} -f build/lcov.info
179-
18099
linux-gcc-x64:
181100
name: linux-gcc-x64
182101
strategy:

.github/workflows/test-coverage.yml

+32
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,35 @@ jobs:
231231
disable_search: true
232232
plugins: noop
233233
files: build/lcov.info
234+
235+
linux-gcc-gpu-llvmpipe:
236+
runs-on: [self-hosted, linux, ubuntu24]
237+
steps:
238+
- uses: actions/checkout@v4
239+
with:
240+
submodules: true
241+
- name: build
242+
run: |
243+
mkdir build && cd build
244+
cmake -DCMAKE_BUILD_TYPE=debug -DNCNN_COVERAGE=ON -DNCNN_RUNTIME_CPU=OFF -DNCNN_AVX2=ON -DNCNN_AVXVNNI=OFF -DNCNN_AVXNECONVERT=OFF -DNCNN_AVX512=ON -DNCNN_AVX512VNNI=ON -DNCNN_AVX512BF16=OFF -DNCNN_AVX512FP16=OFF -DNCNN_XOP=OFF -DNCNN_OPENMP=OFF -DNCNN_VULKAN=ON -DNCNN_BUILD_TOOLS=OFF -DNCNN_BUILD_EXAMPLES=OFF -DNCNN_BUILD_TESTS=ON ..
245+
cmake --build . -j 8
246+
- name: test
247+
run: |
248+
export LP_NUM_THREADS=4
249+
cd build && ctest --output-on-failure -j 8
250+
- name: lcov-collect
251+
run: |
252+
cd build
253+
lcov -d ./src -c -o lcov.info
254+
lcov -r lcov.info '/usr/*' -o lcov.info
255+
lcov -r lcov.info '*/install/*' -o lcov.info
256+
lcov -r lcov.info '*/build/*' -o lcov.info
257+
lcov --list lcov.info
258+
259+
- name: codecov
260+
uses: codecov/codecov-action@v5
261+
with:
262+
token: ${{ secrets.CODECOV_TOKEN }}
263+
disable_search: true
264+
plugins: noop
265+
files: build/lcov.info

src/gpu.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,11 @@ bool GpuInfo::support_int8_arithmetic() const
14171417
return d->queryFloat16Int8Features.shaderInt8;
14181418
}
14191419

1420+
bool GpuInfo::support_fp16_image() const
1421+
{
1422+
return d->physicalDevicefeatures.shaderStorageImageExtendedFormats;
1423+
}
1424+
14201425
bool GpuInfo::support_ycbcr_conversion() const
14211426
{
14221427
return d->querySamplerYcbcrConversionFeatures.samplerYcbcrConversion;

src/gpu.h

+3
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ class NCNN_EXPORT GpuInfo
283283
bool support_int8_uniform() const;
284284
bool support_int8_arithmetic() const;
285285

286+
// r16f format in storage image
287+
bool support_fp16_image() const;
288+
286289
// ycbcr conversion feature
287290
bool support_ycbcr_conversion() const;
288291

src/net.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -1395,11 +1395,16 @@ int Net::load_param(const DataReader& dr)
13951395
if (!d->vkdev->info.support_int8_uniform()) opt.use_int8_uniform = false;
13961396
if (!d->vkdev->info.support_int8_arithmetic()) opt.use_int8_arithmetic = false;
13971397
if (!d->vkdev->info.support_cooperative_matrix()) opt.use_cooperative_matrix = false;
1398-
13991398
if (!d->vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false;
14001399

14011400
if (d->vkdev->info.bug_buffer_image_load_zero()) opt.use_image_storage = false;
14021401

1402+
if (opt.use_image_storage && !d->vkdev->info.support_fp16_image())
1403+
{
1404+
opt.use_fp16_storage = false;
1405+
opt.use_fp16_uniform = false;
1406+
}
1407+
14031408
// enable local memory optimization on discrete gpu only
14041409
if (d->vkdev->info.type() != 0) opt.use_shader_local_memory = false;
14051410

@@ -1693,11 +1698,16 @@ int Net::load_param_bin(const DataReader& dr)
16931698
if (!d->vkdev->info.support_int8_uniform()) opt.use_int8_uniform = false;
16941699
if (!d->vkdev->info.support_int8_arithmetic()) opt.use_int8_arithmetic = false;
16951700
if (!d->vkdev->info.support_cooperative_matrix()) opt.use_cooperative_matrix = false;
1696-
16971701
if (!d->vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false;
16981702

16991703
if (d->vkdev->info.bug_buffer_image_load_zero()) opt.use_image_storage = false;
17001704

1705+
if (opt.use_image_storage && !d->vkdev->info.support_fp16_image())
1706+
{
1707+
opt.use_fp16_storage = false;
1708+
opt.use_fp16_uniform = false;
1709+
}
1710+
17011711
// enable local memory optimization on discrete gpu only
17021712
if (d->vkdev->info.type() != 0) opt.use_shader_local_memory = false;
17031713

tests/testutil.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,13 @@ int test_layer_gpu(int typeindex, const ncnn::ParamDict& pd, const std::vector<n
726726
if (!vkdev->info.support_int8_uniform()) opt.use_int8_uniform = false;
727727
if (!vkdev->info.support_int8_arithmetic()) opt.use_int8_arithmetic = false;
728728
if (!vkdev->info.support_cooperative_matrix()) opt.use_cooperative_matrix = false;
729+
if (!vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false;
730+
731+
if (opt.use_image_storage && !vkdev->info.support_fp16_image())
732+
{
733+
opt.use_fp16_storage = false;
734+
opt.use_fp16_uniform = false;
735+
}
729736

730737
// FIXME fp16a may produce large error
731738
opt.use_fp16_arithmetic = false;
@@ -1085,6 +1092,13 @@ int test_layer_gpu(int typeindex, const ncnn::ParamDict& pd, const std::vector<n
10851092
if (!vkdev->info.support_int8_uniform()) opt.use_int8_uniform = false;
10861093
if (!vkdev->info.support_int8_arithmetic()) opt.use_int8_arithmetic = false;
10871094
if (!vkdev->info.support_cooperative_matrix()) opt.use_cooperative_matrix = false;
1095+
if (!vkdev->info.support_subgroup_ops()) opt.use_subgroup_ops = false;
1096+
1097+
if (opt.use_image_storage && !vkdev->info.support_fp16_image())
1098+
{
1099+
opt.use_fp16_storage = false;
1100+
opt.use_fp16_uniform = false;
1101+
}
10881102

10891103
// FIXME fp16a may produce large error
10901104
opt.use_fp16_arithmetic = false;

0 commit comments

Comments
 (0)