Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Commit 5720f29

Browse files
authored
Merge pull request #81 from spacemeshos/list-gpu-providers-during-build
Fix m1 builds
2 parents 266f1f8 + 3e007b7 commit 5720f29

File tree

2 files changed

+55
-22
lines changed

2 files changed

+55
-22
lines changed

.github/workflows/build.yml

+40-22
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
- name: Copy library
3333
run: cp build/src/libgpu-setup.so build/test/libgpu-setup.so
3434

35+
- name: Unit tests - List providers
36+
run: build/test/gpu-setup-test --list
3537
- name: Unit tests - Golden vectors
3638
run: build/test/gpu-setup-test --test-vector-check
3739
- name: Unit tests - hash and bitstream
@@ -151,6 +153,8 @@ jobs:
151153
shell: bash
152154
run: cp build/src/gpu-setup.dll build/test/gpu-setup.dll
153155

156+
- name: Unit tests - List providers
157+
run: build/test/gpu-setup-test --list
154158
- name: Unit tests - Golden vectors
155159
run: build/test/gpu-setup-test --test-vector-check
156160
- name: Unit tests - hash and bitstream
@@ -241,9 +245,15 @@ jobs:
241245

242246
- name: Copy library
243247
run: cp build/src/libgpu-setup.dylib build/test/libgpu-setup.dylib
248+
- name: Copy ICD file
249+
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/MoltenVK_icd.json build/test/MoltenVK_icd.json
250+
- name: Copy libMoltenVK
251+
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/libMoltenVK.dylib build/test/libMoltenVK.dylib
244252
- name: Fix library import paths
245253
run: install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
246254

255+
- name: Unit tests - List providers
256+
run: VK_LOADER_DEBUG=all build/test/gpu-setup-test --list
247257
- name: Unit tests - Golden vectors
248258
run: build/test/gpu-setup-test --test-vector-check
249259
- name: Unit tests - hash and bitstream
@@ -280,12 +290,12 @@ jobs:
280290
uses: actions/upload-artifact@v3
281291
with:
282292
name: macos
283-
path: ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/libMoltenVK.dylib
293+
path: build/test/libMoltenVK.dylib
284294
- name: Upload MoltenVK config
285295
uses: actions/upload-artifact@v3
286296
with:
287297
name: macos
288-
path: ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/MoltenVK_icd.json
298+
path: build/test/MoltenVK_icd.json
289299
- name: Upload Vulkan
290300
uses: actions/upload-artifact@v3
291301
with:
@@ -311,25 +321,31 @@ jobs:
311321

312322
- name: Copy library
313323
run: cp build/src/libgpu-setup.dylib build/test/libgpu-setup.dylib
314-
324+
- name: Copy ICD file
325+
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/MoltenVK_icd.json build/test/MoltenVK_icd.json
326+
- name: Copy libMoltenVK
327+
run: cp ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/libMoltenVK.dylib build/test/libMoltenVK.dylib
315328
- name: Fix library import paths
316-
run: arch -arm64 install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
329+
run: install_name_tool -add_rpath @loader_path build/test/libgpu-setup.dylib
330+
331+
- name: Unit tests - List providers
332+
run: VK_LOADER_DEBUG=all build/test/gpu-setup-test --list
317333
- name: Unit tests - Golden vectors
318-
run: arch -arm64 build/test/gpu-setup-test --test-vector-check
334+
run: build/test/gpu-setup-test --test-vector-check
319335
- name: Unit tests - hash and bitstream
320-
run: arch -arm64 build/test/gpu-setup-test --unit-tests
336+
run: build/test/gpu-setup-test --unit-tests
321337
- name: Unit tests - PoW
322-
run: arch -arm64 build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
338+
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
323339
- name: Unit tests - PoW and Leafs
324-
run: arch -arm64 build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
340+
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
325341
- name: Unit tests - label lengths
326-
run: arch -arm64 build/test/gpu-setup-test -il
342+
run: build/test/gpu-setup-test -il
327343
- name: Unit tests - labels count
328-
run: arch -arm64 build/test/gpu-setup-test -in
344+
run: build/test/gpu-setup-test -in
329345
- name: Integration tests - concurrency test
330-
run: arch -arm64 build/test/gpu-setup-test -ip
346+
run: build/test/gpu-setup-test -ip
331347
- name: Integration tests - cancellation test
332-
run: arch -arm64 build/test/gpu-setup-test -ic
348+
run: build/test/gpu-setup-test -ic
333349

334350
- name: Upload library
335351
uses: actions/upload-artifact@v3
@@ -350,12 +366,12 @@ jobs:
350366
uses: actions/upload-artifact@v3
351367
with:
352368
name: macos-m1
353-
path: ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/libMoltenVK.dylib
369+
path: build/test/libMoltenVK.dylib
354370
- name: Upload MoltenVK config
355371
uses: actions/upload-artifact@v3
356372
with:
357373
name: macos-m1
358-
path: ${{ env.VULKAN_ROOT_LOCATION }}/MoltenVK/dylib/macOS/MoltenVK_icd.json
374+
path: build/test/MoltenVK_icd.json
359375
- name: Upload Vulkan
360376
uses: actions/upload-artifact@v3
361377
with:
@@ -376,20 +392,22 @@ jobs:
376392
- name: Copy library
377393
run: cp build/src/libgpu-setup.so build/test/libgpu-setup.so
378394

395+
- name: Unit tests - List providers
396+
run: build/test/gpu-setup-test --list
379397
- name: Unit tests - Golden vectors
380398
run: build/test/gpu-setup-test --test-vector-check
381-
# # Disabled because it's super slow on lavapipe
382-
# - name: Unit tests - hash and bitstream
383-
# run: build/test/gpu-setup-test --unit-tests
399+
# # Disabled because it's super slow on lavapipe
400+
# - name: Unit tests - hash and bitstream
401+
# run: build/test/gpu-setup-test --unit-tests
384402
- name: Unit tests - PoW
385403
run: build/test/gpu-setup-test -tp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
386404
- name: Unit tests - PoW and Leafs
387405
run: build/test/gpu-setup-test -tlp -d 18 -id 0xe26b543725490682675f6f84ea7689601adeaf14caa7024ec1140c82754ca339 --salt 0x165310acce39719148915c356f25c5cb78e82203222cccdf3c15a9c3684e08cb -si 126202
388-
# # Disabled because it's super slow on lavapipe
389-
# - name: Unit tests - label lengths
390-
# run: build/test/gpu-setup-test -il
391-
# - name: Unit tests - labels count
392-
# run: build/test/gpu-setup-test -in
406+
# # Disabled because it's super slow on lavapipe
407+
# - name: Unit tests - label lengths
408+
# run: build/test/gpu-setup-test -il
409+
# - name: Unit tests - labels count
410+
# run: build/test/gpu-setup-test -in
393411
- name: Integration tests - concurrency test
394412
run: build/test/gpu-setup-test -ip
395413
- name: Integration tests - cancellation test

src/vulkan/driver-vulkan.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,20 @@ static int vulkan_detect(struct cgpu_info *gpus, int *active)
266266
VK_API_VERSION_1_2
267267
};
268268

269+
#ifdef VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME
270+
const char* const extensions[1] = { VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME };
271+
272+
const VkInstanceCreateInfo instanceCreateInfo = {
273+
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
274+
0,
275+
VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR,
276+
&applicationInfo,
277+
0,
278+
NULL,
279+
1,
280+
extensions
281+
};
282+
#else
269283
const VkInstanceCreateInfo instanceCreateInfo = {
270284
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
271285
0,
@@ -276,6 +290,7 @@ static int vulkan_detect(struct cgpu_info *gpus, int *active)
276290
0,
277291
NULL
278292
};
293+
#endif
279294

280295
if (initVulkanLibrary()) {
281296
return 0;

0 commit comments

Comments
 (0)