Skip to content

Conversation

@mei-ye
Copy link
Contributor

@mei-ye mei-ye commented Feb 25, 2022

@masahi

[vulkan] Add integer dot product (4xint8, 4xuint8) tensorization for the vulkan SPIR-V target. Currently only autotvm path is supported.

Prerequisites for compilation: (1) Use VulkanSDK 1.2.198 release with SPIR-V integer dot product suppport (2) set(USE_SPIRV_KHR_INTEGER_DOT_PRODUCT ON) in config.cmake and build (3) Use a driver that supports VK_KHR_shader_integer_dot_product extension.

The compiled binary can only be run on a hardware that supports relevant ISA. This work is tested on AMD RDNA2 famillies (e.g., Rembrandt and RX6800).

To compile on a device that supports this extension, use target: vulkan -from_device=0

To compile on a device that supports int8 but does not support this extension, add "-supports_integer_dot_product=1" or "-mattr=+dotprod" to the target string.

To support pre-released vulkan and SPIR-V extensions, we need SPIR-V tool and header file from Khronos github, use the option: USE_KHRONOS_SPIRV in config.cmake.

Example to use this feature can be found in: gallery/how_to/deploy_models/deploy_prequantized.py and gallery/how_to/deploy_models/deploy_prequantized_tflite.py

@masahi
Copy link
Member

masahi commented Feb 25, 2022

@mei-ye Can you clean up the commit history? (reset to main and apply 7eea90b)

@masahi
Copy link
Member

masahi commented Feb 25, 2022

Please remove the change in deploy_prequantized.py and deploy_prequantized_tflite.py. They run on CI and we don't intend to run e2e models on vulkan target there.

@mei-ye mei-ye force-pushed the main branch 3 times, most recently from b3b0aa9 to e8b42df Compare February 26, 2022 07:37
@masahi masahi force-pushed the main branch 2 times, most recently from 1e337c2 to 0a2e8c8 Compare March 2, 2022 08:30
@masahi masahi self-assigned this Mar 3, 2022
@masahi masahi force-pushed the main branch 4 times, most recently from 8f6a79d to cf00438 Compare March 6, 2022 23:25
@masahi
Copy link
Member

masahi commented Mar 7, 2022

Ok @mei-ye the CI is green now. The changes I made are:

@masahi masahi merged commit 5c0ea30 into apache:main Mar 8, 2022
ziqiangxu8457 pushed a commit to ziqiangxu8457/tvm that referenced this pull request Mar 9, 2022
…the vulkan SPIR-V target. (apache#10391)

* [Vulkan] Add cmake change for spirv dot product

* add spirv and vk runtime change

* add back conv2d int8 related change

* add back dense and group conv2d change

* add back test_topi_conv2d_int8.py change (but don't test on vk)

* check dot prod availablity in batch matmul schedule

* do not run uint8 tensorization on arm

* add vulkan target to conv2d int8 test but comment out on CI

* do not run vk batch matmul test

* Fix performance regression due to missing of constant folding in the index expression.

Co-authored-by: Masahiro Masuda <[email protected]>
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
…the vulkan SPIR-V target. (apache#10391)

* [Vulkan] Add cmake change for spirv dot product

* add spirv and vk runtime change

* add back conv2d int8 related change

* add back dense and group conv2d change

* add back test_topi_conv2d_int8.py change (but don't test on vk)

* check dot prod availablity in batch matmul schedule

* do not run uint8 tensorization on arm

* add vulkan target to conv2d int8 test but comment out on CI

* do not run vk batch matmul test

* Fix performance regression due to missing of constant folding in the index expression.

Co-authored-by: Masahiro Masuda <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants