Skip to content

Remove Vulkan timeline semaphore emulation code. - #8018

Merged
ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:vk-timeline-semaphore-emulation
May 31, 2022
Merged

ScottTodd merged 1 commit into
iree-org:mainfrom
ScottTodd:vk-timeline-semaphore-emulation

Conversation

@ScottTodd

@ScottTodd ScottTodd commented Jan 5, 2022 •

Copy link
Copy Markdown
Member

Part of #4494 for migrating to Vulkan 1.2
Related to #2907 for enabling tests that were previously failing with emulation

This requires that all of our test configurations support timeline semaphores:

@ScottTodd ScottTodd added hal/vulkan Runtime Vulkan GPU HAL backend yolo ( ͡° ͜ʖ ͡°) cleanup 🧹 labels Jan 5, 2022
@ScottTodd
ScottTodd force-pushed the vk-timeline-semaphore-emulation branch from c302821 to 0e6664b Compare January 5, 2022 23:40
@antiagainst

Copy link
Copy Markdown
Member

Pixel 4 will be problematic; given we have an outdated driver there. Recent Qualcomm phones does start to contain newer drivers that support timeline semaphores. I bought one and will evaluate how stable it is for benchmarking. It's still under shipping. Likely will take some extra weeks before we can finalize the choice of a phone and buy them for the lab.

Trying to understand the timeline here. How soon are we expected to land this?

@ScottTodd

Copy link
Copy Markdown
Member Author

Trying to understand the timeline here. How soon are we expected to land this?

Pessimistically: within a year? It's already been one year since we filed #4494 and started looking at this :P

I put this PR together to see what would break, and it seems like we're actually pretty close to being able to make the flip. @benvanik is doing more real work with timeline semaphores now and being able to move the HAL the rest of the way to pure C with native timeline semaphore support assumed would definitely simplify things.

@benvanik

benvanik commented Jan 6, 2022

Copy link
Copy Markdown
Collaborator

It's hampering work on cleaning up semaphore and resource lifetime handling in the HAL - I've been putting off doing that for a year because of it and have run out of time that I can put it off. In the current form it may need a non-trivial rewrite that I'd much rather lose device support for devices we don't and won't ever ship on than keep kicking the can on getting things right :)

@benvanik

benvanik commented Jan 6, 2022 •

Copy link
Copy Markdown
Collaborator

We may be able to switch to the newer helpers I'm adding and maintain emulation for coverage but it wouldn't be with this code - so it's more of an issue of how to properly rewrite all of semaphore handling out from under the HAL while also maintaining this in a functioning state - that's been the mental block for me - so less about supporting emulation and more of me being unable to refactor things ;(

@benvanik

benvanik commented Jan 6, 2022

Copy link
Copy Markdown
Collaborator

Sorry - that was unclear - there's really two things here:
If we don't need to keep the existing emulation active during the reworking because we can use pixel 6 instead of pixel 4 that speeds things up/helps my mental block in getting the compiler/HAL interfaces/other backends in a good state.
If we never need non-timeline-semaphore paths again such that we don't need to hook emulation back up for Vulkan that reduces the amount of work required. Since we aren't shipping Android/Vulkan any time soon we can defer that work.

So we can still need emulation but if we don't need it now then that's a good reason to yank it.

@ScottTodd

Copy link
Copy Markdown
Member Author

Benchmarks completed on the Pixel 6 but failed (as expected I guess :P) on the Pixel 4: https://buildkite.com/iree/iree-benchmark/builds/1779. Looks like no comment gets posted with summary information if one phone fails.

Worth commenting out the Pixel 4 benchmarks and running again to easily see if this affects performance? https://github.com/google/iree/blob/0e39d8edbff08f47c2dc3c0f6d26bc27d0313e8d/build_tools/buildkite/cmake/android/arm64-v8a/benchmark2.yml#L26

@benvanik

benvanik commented Jan 6, 2022

Copy link
Copy Markdown
Collaborator

If it doesn't run on the pixel 6 then we have our answer as to whether we can get away without it :P

@ScottTodd

Copy link
Copy Markdown
Member Author

Err, I mean the Pixel 6 completed all benchmark runs successfully, but the Pixel 4 failed. Since one failed, there was no comment posted with summary data.

@antiagainst

Copy link
Copy Markdown
Member

@ScottTodd: Certainly no need to wait another year! :D As said there are new devices having native support; just need to find the right one for benchmarking. (Galaxy S20 really bit us hard; don't want to have another episode of that. So I'm cautious.)

@benvanik: What you said makes sense to me! I think we will need the emulation for supporting the broad range of phones given the notorious Android fragmentation issue. But that's quite far so makes sense to not anchor on it too much. The value of having it right now is being able to get benchmark numbers on Adreno GPUs. Though, I don't want to waste more of your time to handholding it given it's really close that we can find a phone with native support. I'm more from the perspective of understanding how soon this will happen and whether I can help to speed up by prioritizing certain things. (It depends on the logistics to order phones and get them shipped and set up, which is a bit uncontrollable by me. But I guess Google have the power of $$ to speed up a bit. Or at least I can order more than one and check them in parallel maybe. ;-P)

Let's sync up via GVC tomorrow so we can align up. :)

@benvanik

benvanik commented Jan 6, 2022

Copy link
Copy Markdown
Collaborator

Agreed! I'm going to put some thought into a way to swap it out with the new stuff - this was more of a speculative "if we could avoid having that PR being 10k LOC (and instead be like 5k) that'd be nice" :P
My hope is that the newer stuff will be easier to implement and be useful for implementations where we have to emulate (CUDA/ROCM). But I've been promising this working for so long no one should trust me until it lands :P

@iree-github-actions-bot

iree-github-actions-bot commented Jan 6, 2022 •

Copy link
Copy Markdown
Contributor

Abbreviated Benchmark Summary

@ commit 4975c0443a5c3ae3e34671d47b1881d289089dce (vs. base b4967867b2eff4434c0f2ffb8d6f04e2bd1fe48b)

Regressed Benchmarks 🚩

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileNetV3Small [fp32,imagenet] (TFLite) 1-thread,big-core,full-inference,default-flags with IREE-Dylib @ Pixel-4 (CPU-ARMv8.2-A) 12 (vs. 11, 9.09%↑) 12 0
PoseNet [fp32] (TFLite) full-inference,default-flags with IREE-Vulkan @ XT2201-2 (GPU-Adreno-730) 38 (vs. 36, 5.56%↑) 38 0
MobileBertSquad [fp32] (TFLite) 4-thread,big-core,full-inference,experimental-flags with IREE-Dylib @ Pixel-6-Pro (CPU-ARMv8.2-A) 454 (vs. 431, 5.34%↑) 454 6

Improved Benchmarks 🎉

Benchmark Name Average Latency (ms) Median Latency (ms) Latency Standard Deviation (ms)
MobileBertSquad [int8] (TFLite) 4-thread,big-core,full-inference,experimental-flags with IREE-Dylib @ Pixel-4 (CPU-ARMv8.2-A) 229 (vs. 249, 8.03%↓) 221 19

For more information:

@ScottTodd
ScottTodd force-pushed the vk-timeline-semaphore-emulation branch from 0ad8d39 to 4975c04 Compare May 28, 2022 00:57

@ScottTodd ScottTodd left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Synced to head. This passes presubmits.

- "tar -xzvf iree-android-tools-${BUILDKITE_BUILD_NUMBER}.tgz"
- "tar -xzvf tracy-capture-80f6a93d.tgz"
- "python3 build_tools/benchmarks/run_benchmarks_on_android.py --pin-cpu-freq --pin-gpu-freq --normal_benchmark_tool_dir=build-android/tools/ --traced_benchmark_tool_dir=build-android-trace/tools/ --trace_capture_tool=tracy-capture -o benchmark-results-pixel-4-${BUILDKITE_BUILD_NUMBER}.json --capture_tarball=trace-captures-pixel-4-${BUILDKITE_BUILD_NUMBER}.tgz --verbose build-host/"
- "python3 build_tools/benchmarks/run_benchmarks_on_android.py --pin-cpu-freq --pin-gpu-freq --normal_benchmark_tool_dir=build-android/tools/ --traced_benchmark_tool_dir=build-android-trace/tools/ --trace_capture_tool=tracy-capture -o benchmark-results-pixel-4-${BUILDKITE_BUILD_NUMBER}.json --capture_tarball=trace-captures-pixel-4-${BUILDKITE_BUILD_NUMBER}.tgz --driver_filter_regex='(?!vulkan).*' --verbose build-host/"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note that this disables Vulkan benchmarks on Pixel 4

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

However, we are now benchmarking on a Motorola Edge X30, which also has an Adreno GPU

@ScottTodd
ScottTodd marked this pull request as ready for review May 31, 2022 14:56
@ScottTodd
ScottTodd requested a review from benvanik May 31, 2022 14:59
@ScottTodd
ScottTodd merged commit cfed164 into iree-org:main May 31, 2022
@ScottTodd
ScottTodd deleted the vk-timeline-semaphore-emulation branch May 31, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup 🧹 hal/vulkan Runtime Vulkan GPU HAL backend yolo ( ͡° ͜ʖ ͡°)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants