Skip to content

Reland "[spirv] Switch to use common target description" - #17699

Merged
ScottTodd merged 8 commits into
iree-org:mainfrom
antiagainst:reland-vulkan-target
Jun 20, 2024
Merged

ScottTodd merged 8 commits into
iree-org:mainfrom
antiagainst:reland-vulkan-target

Conversation

@antiagainst

@antiagainst antiagainst commented Jun 19, 2024 •

Copy link
Copy Markdown
Member

This relands #17623.

This commit switches SPIR-V side to use the common #iree_gpu.target to describe the GPU characteristics. With it we can now remove the ad-hoc Vulkan attributes and dialects and unify how GPU are described across various GPU compiler backends in IREE.

SPIR-V has some additional requirements that we need to account for:

We have many vendors and APIs to handle there so this commit adds various AMD/ARM/NVIDIA/Qualcomm targets for
development purposes so that we can specify them with a shorthand.

In order to be extensible, leverage the feature field in #iree_gpu.target to specify additional capabilities with cap: prefix and extensions with ext: prefix. We also use the feature field to specify what SPIR-V version to target with the spirv:v1.x format.

Right now the SPIRVConvertGPUTarget pass is
invoked immediately before configuration. This is to stage the changes. As a next step we need to move
it immediately before ConvertToSPIRV pass.

--iree-vulkan-target-env is dropped given now we removed the whole Vulkan dialect and cannot control with a #vk.target_env attribute anymore.

The default --iree-vulkan-target-triple now becomes vp_android_baseline_2022, which is a a good lowest common denominator to guarantee the generated SPIR-V is widely accepted. We are not considering SwiftShader now anymore like previously due to testing purposes.

The --iree-vulkan-target-triple should be renamed given it's not a triple anymore--that will happen later together with other GPU backends (i.e., cuda/hip) to be consistent.

In order to support cooperative matrix conversion, we added WMMA_F16_16x16x16_F16. For NVIDIA GPUs
we are abusing it right now without considering the concrete explicit layout--that is fine given in Vulkan they are opaque anyway. But this need to be fixed if we are targeting WMMA in CUDA.

We now contruct a #iree_gpu.target to specify
the target to drive SPIR-V CodeGen.

Progress towards #16341

ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250, build_test_all_macos_arm64,build_and_test_android,test_on_moto-edge-x30

This relands iree-org#17623.

This commit switches SPIR-V side to use the common
`#iree_gpu.target` to describe the GPU characteristics.
With it we can now remove the ad-hoc Vulkan attributes and
dialects and unify how GPU are described across various GPU
compiler backends in IREE.

SPIR-V has some additional requirements that we need to
account for:

We have many vendors and APIs to handle there so this commit
adds various AMD/ARM/NVIDIA/Qualcomm targets for
development purposes so that we can specify them with
a shorthand.

In order to be extensible, leverage the `feature` field in
`#iree_gpu.target` to specify additional capabilities with
`cap:` prefix and extensions with `ext:` prefix. We also
use the `feature` field to specify what SPIR-V version to
target with the `spirv:v1.x` format.

Right now the `SPIRVConvertGPUTarget` pass is
invoked immediately before configuration. This is to
stage the changes. As a next step we need to move
it immediately before `ConvertToSPIRV` pass.

`--iree-vulkan-target-env` is dropped given now we
removed the whole Vulkan dialect and cannot control with
a `#vk.target_env` attribute anymore.

The default `--iree-vulkan-target-triple` now becomes
`vp_android_baseline_2022`, which is a a good lowest
common denominator to guarantee the generated SPIR-V
is widely accepted. We are not considering SwiftShader
now anymore like previously due to testing purposes.

The `--iree-vulkan-target-triple` should be renamed
given it's not a triple anymore--that will happen later
together with other GPU backends (i.e., cuda/hip) to
be consistent.

In order to support cooperative matrix conversion, we
added `WMMA_F16_16x16x16_F16`. For NVIDIA GPUs
we are abusing it right now without considering the
concrete explicit layout--that is fine given in Vulkan
they are opaque anyway. But this need to be fixed if
we are targeting WMMA in CUDA.

We now contruct a `#iree_gpu.target` to specify
the target to drive SPIR-V CodeGen.

Progress towards iree-org#16341

ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,
build_test_all_macos_arm64,build_and_test_android

Signed-off-by: Lei Zhang <[email protected]>
@antiagainst
antiagainst force-pushed the reland-vulkan-target branch from 498521f to efaeead Compare June 19, 2024 06:37
@antiagainst antiagainst added the benchmarks:android-gpu Run default Android GPU benchmarks label Jun 19, 2024
@github-actions

github-actions Bot commented Jun 19, 2024 •

Copy link
Copy Markdown

Abbreviated Benchmark Summary

@ commit 8291dfe5797d4cc41a29cfc2c8ac1c701e05be7c (vs. base 7c410492bdcbfdd4972de827d995bfb8482841a5)

Regressed Latencies 🚩

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileBertSquad\_int8(tflite) [arm-valhall-vulkan\_android31-vulkan\_spirv][default-flags] vulkan(none)[full-inference,default-flags] with default @ pixel-6-pro[gpu] 97.672 (vs. 85.114, 14.76%↑) 97.240 0.872
MobileBertSquad\_fp16(tflite) [arm-valhall-vulkan\_android31-vulkan\_spirv][experimental-flags,fuse-padding,max-concurrency,demote-f32-to-f16] vulkan(none)[full-inference,default-flags] with default @ pixel-6-pro[gpu] 102.534 (vs. 95.119, 7.80%↑) 102.345 3.090

No improved or regressed compilation metrics 🏖️

For more information:

Source Workflow Run

@antiagainst
antiagainst force-pushed the reland-vulkan-target branch from f96bc7d to 13328fb Compare June 19, 2024 15:06
@MacDue

MacDue commented Jun 19, 2024

Copy link
Copy Markdown
Member

(typo in PR title Raland -> Reland)

@ScottTodd ScottTodd changed the title Raland "[spirv] Switch to use common target description" Reland "[spirv] Switch to use common target description" Jun 19, 2024
@antiagainst

Copy link
Copy Markdown
Member Author

@ScottTodd @kuhar this should be good now--android tests and benchmarks are fixed.

Comment thread .git-blame-ignore-revs Resolved
This reverts commit e1d881f.

Signed-off-by: Lei Zhang <[email protected]>
@antiagainst
antiagainst requested a review from ScottTodd June 19, 2024 20:29

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, otherwise LGTM

@antiagainst

Copy link
Copy Markdown
Member Author

Looks test_amd_mi250 is just stuck there. That was fine in the previous patch already; so I'll just land this for now.

@antiagainst
antiagainst disabled auto-merge June 20, 2024 02:27
@ScottTodd

Copy link
Copy Markdown
Member

Looks test_amd_mi250 is just stuck there. That was fine in the previous patch already; so I'll just land this for now.

That runner went offline for maintenance yeah.

@ScottTodd
ScottTodd merged commit 90f29a6 into iree-org:main Jun 20, 2024
@antiagainst
antiagainst deleted the reland-vulkan-target branch June 20, 2024 02:48
LLITCHEV pushed a commit to LLITCHEV/iree that referenced this pull request Jul 30, 2024
)

This relands iree-org#17623.

This commit switches SPIR-V side to use the common `#iree_gpu.target` to
describe the GPU characteristics. With it we can now remove the ad-hoc
Vulkan attributes and dialects and unify how GPU are described across
various GPU compiler backends in IREE.

SPIR-V has some additional requirements that we need to account for:

We have many vendors and APIs to handle there so this commit adds
various AMD/ARM/NVIDIA/Qualcomm targets for
development purposes so that we can specify them with a shorthand.

In order to be extensible, leverage the `feature` field in
`#iree_gpu.target` to specify additional capabilities with `cap:` prefix
and extensions with `ext:` prefix. We also use the `feature` field to
specify what SPIR-V version to target with the `spirv:v1.x` format.

Right now the `SPIRVConvertGPUTarget` pass is
invoked immediately before configuration. This is to stage the changes.
As a next step we need to move
it immediately before `ConvertToSPIRV` pass.

`--iree-vulkan-target-env` is dropped given now we removed the whole
Vulkan dialect and cannot control with a `#vk.target_env` attribute
anymore.

The default `--iree-vulkan-target-triple` now becomes
`vp_android_baseline_2022`, which is a a good lowest common denominator
to guarantee the generated SPIR-V is widely accepted. We are not
considering SwiftShader now anymore like previously due to testing
purposes.

The `--iree-vulkan-target-triple` should be renamed given it's not a
triple anymore--that will happen later together with other GPU backends
(i.e., cuda/hip) to be consistent.

In order to support cooperative matrix conversion, we added
`WMMA_F16_16x16x16_F16`. For NVIDIA GPUs
we are abusing it right now without considering the concrete explicit
layout--that is fine given in Vulkan they are opaque anyway. But this
need to be fixed if we are targeting WMMA in CUDA.

We now contruct a `#iree_gpu.target` to specify
the target to drive SPIR-V CodeGen.

Progress towards iree-org#16341

ci-extra: test_nvidia_gpu,test_nvidia_a100,test_amd_mi250,
build_test_all_macos_arm64,build_and_test_android,test_on_moto-edge-x30

---------

Signed-off-by: Lei Zhang <[email protected]>
Signed-off-by: Lubo Litchev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

benchmarks:android-gpu Run default Android GPU benchmarks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants