Repository navigation
Add f16 e2e tests for vulkan - #5257
Conversation
| # Exclude f16 tests as it is not supported by vmla. | ||
| exclude = ["*_f16.mlir"], |
There was a problem hiding this comment.
This kind of contradicts the big comment at the top of this file saying that everything should run on VMLA. It is still our reference backend. I'm not sure if we still generate op coverage tables from this information, but that was part of the reason for standardized naming for these files. When I needed to do something similar for integer datatypes in matmul, I created a subdirectory for "partial" support: https://github.com/google/iree/commits/main/iree/test/e2e/xla_ops/partial. Maybe we should do that here.
There was a problem hiding this comment.
Makes sense. I'm not sure if we'll want to support float16 in VMLA I'll discuss this further with Ben and the rest of the team. I moved those tests in partial for now.
There was a problem hiding this comment.
I suspect we'll want to turn down VMLA instead 😛 But as long as we haven't replaced it with another reference backend I'd like to keep some invariants around it
e30ffa9 to
c320db7
Compare
c320db7 to
70d492a
Compare
| declare -a default_build_tag_filters=("-nokokoro") | ||
| declare -a default_test_tag_filters=("-nokokoro" "-driver=metal") | ||
|
|
||
| # vulkan f16 tests cannot run with swiftshaders. |
There was a problem hiding this comment.
| # vulkan f16 tests cannot run with swiftshaders. | |
| # vulkan f16 tests cannot run with Swiftshader. |
There was a problem hiding this comment.
(SwiftShader)
I'd actually rather mention the specific optional Vulkan extension (with links to the spec) throughout and not (just) SwiftShader. You could mention SwiftShader as the specific ICD that we run tests on which does not support that extension, but we should be very specific here.
There are 10s of Vulkan extensions that we could opt in to using where available, so we shouldn't be ambiguous with which features or tests require which extensions. That's also why I hesitate to add more environment variable-based or tag-based filtering to our test infrastructure without some broader plan for how to expand in the future. The specific set of extensions available on any particular test runner can vary so I'd like us to consider ways to "run all tests that are expected to pass, skip those missing support" along with ways to ensure that our aggregate coverage is still good.
We could group extensions by profile (e.g. Vulkan 1.1, Vulkan 1.2), if we don't actually end up using too many that aren't promoted to core (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_shader_float16_int8.html was promoted to Vulkan 1.2)
| declare -a default_build_tag_filters=("-nokokoro") | ||
| declare -a default_test_tag_filters=("-nokokoro" "-driver=metal") | ||
|
|
||
| # vulkan f16 tests cannot run with swiftshaders. |
There was a problem hiding this comment.
(SwiftShader)
I'd actually rather mention the specific optional Vulkan extension (with links to the spec) throughout and not (just) SwiftShader. You could mention SwiftShader as the specific ICD that we run tests on which does not support that extension, but we should be very specific here.
There are 10s of Vulkan extensions that we could opt in to using where available, so we shouldn't be ambiguous with which features or tests require which extensions. That's also why I hesitate to add more environment variable-based or tag-based filtering to our test infrastructure without some broader plan for how to expand in the future. The specific set of extensions available on any particular test runner can vary so I'd like us to consider ways to "run all tests that are expected to pass, skip those missing support" along with ways to ensure that our aggregate coverage is still good.
We could group extensions by profile (e.g. Vulkan 1.1, Vulkan 1.2), if we don't actually end up using too many that aren't promoted to core (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_shader_float16_int8.html was promoted to Vulkan 1.2)
| # Vulkan fp16 tests disabled by default as they don't run on swift shader. | ||
| export IREE_VULKAN_F16_DISABLE=${IREE_VULKAN_F16_DISABLE:-1} |
There was a problem hiding this comment.
SwiftShader + documentation could match the Bazel test runner script (or point to a common doc)
| driver = "vulkan", | ||
| tags = [ | ||
| "notap", | ||
| "vulkan_f16", |
There was a problem hiding this comment.
use the specific extension name(s)
these are both related to f16, and both are in different states of acceptance / adoption:
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_shader_float16_int8.html (vulkan_uses_vk_khr_shader_float16_int8, vk_khr_shader_float16_int8, vulkan_uses_shader_float16_int8 would be my recommended names... in that order)
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_KHR_16bit_storage.html
There was a problem hiding this comment.
changed the name to vulkan_uses_vk_khr_shader_float16_int8
| %result = "mhlo.add"(%0, %1) : (tensor<4xf16>, tensor<4xf16>) -> tensor<4xf16> | ||
| check.expect_almost_eq_const(%result, dense<[6.0, 8.0, 10.0, 12.0]> : tensor<4xf16>) : tensor<4xf16> |
There was a problem hiding this comment.
Eh.. this is tricky. We could (and probably will eventually) correctly execute these tests without native support for 16 bit floating point numbers by emulating in f32 or widening. Native support is just an optimization. I still see the point of these tests, but we should be careful with how we categorize them.
There was a problem hiding this comment.
Using f32 to emulate would work but we would still need some conversion to and from float 16 for data coming from user, this is what may make the support a bit more complex. But using float32 for computation should be valid indeed.
There was a problem hiding this comment.
Yeah I would hope that eventually these tests get put somewhere common to all backends. Eventually mhlo may not even be our input, so we'll probably change the way everything is organized (falls under our integration tests roadmap OKR for next quarter)
| %0 = iree.unfoldable_constant dense<[1.0, 2.0, 3.0, 4.0]> : tensor<4xf16> | ||
| %1 = iree.unfoldable_constant dense<[5.0, 6.0, 7.0, 8.0]> : tensor<4xf16> |
There was a problem hiding this comment.
not sure how we handle this in other tests, but if the test is specifically exercising floating point arithmetic, shouldn't the numbers used at least have some digits after the decimal point? :P
These tests could pass even if we truncate to i16 :P
There was a problem hiding this comment.
Added some decimals :)
| @@ -0,0 +1,7 @@ | |||
| func @tensor() attributes { iree.module.export } { | |||
There was a problem hiding this comment.
nit: also not sure how we name these in other tests, but func @add_f16() or func @test_add_f16() would be more descriptive
There was a problem hiding this comment.
I think we sometimes just let the file name stand on its own and make the function names describe the specific variant of the test (like "big tensor" or whatever). With such a simple case, that makes it hard to come up with a name :-D
Co-authored-by: Scott Todd <[email protected]>
Co-authored-by: Scott Todd <[email protected]>
* 6bd5658 Merge google -> main (#5319) * 2e5257d Merge branch 'main' into google-to-main * 6936ee7 Patch VMLA performance by reserving vector size before pushing to it. (#5316) * f2f0041 NFC: Cleanup ConcretizeTileAmongstWorkgroupsPass. (#5297) * f96726a Add tests to run few other (smaller) models with Linalg on tensors path. (#5306) * fd64070 Revert "Add wasm-micro-runtime submodule and get building with CMake." (#5312) * ce0285f Continue pruning abseil usage: switch from absl::InlinedVector to std::vector... * 71e24b6 Removing hal.buffer.fill and hal.buffer.copy. (#5307) * 3c611d3 Add Mako benchmark config template file. (#5200) * 4d1a394 Fix RFFT bugs in VMLA. (#5308) * 0d55c95 Add configure_bazel.py step to TensorFlow getting started doc. * 1386d2c Switch simple_embedding_test to include drivers explicitly. (#5304) * 402550b Add StripAsserts pass and handle tf.Identity ops on tensor lists. (#5294) * fbdb4ef Add new metrics to MobileNetV2 benchmarks. (#5301) * 99c8eac Implementing Vulkan dispatch tracing. (#5287) * 2681dff Insert clones prior to mutation and not where it originates. (#5292) * aeafd9e Fix CUDA HAL bug and enable more execution tests (#5296) * 2801780 [CUDA Codegen] Enable tiling and vectorization for MatMulOp (#5293) * c61fefe Extend AffineMin canonicalization to support scf.parallel (#5289) * e0ee3f3 Add directory for microbenchmarking (#5260) * b8da32c Set wasm-export-name attributes on exported functions again. (#5286) * e2a2f81 Canonicalize affine min before applying tile-and-vecotrize passes (#5285) * 23861f7 [CUDA codegen] add vectorization infrastructure (#5278) * 6f443c4 Drop deps on Abseil's core_headers, synchronization, macros. (#5275) * e5b9e8a Actually run MobileNet with fake weights to check correctness (#5284) * e56db9a Remove dead code in LinalgToSPIRV (#5281) * 8863aa1 [NFC] Fix typos in variable names. (#5279) * 9cd93ba Turn vectorization on by default for linalg on tensors path (#5280) * 894dac6 Merge google -> main #5276 * b738162 Changing HAL dialect syntax to express all types. (#5239) * 1ba4e88 Merge branch 'main' into google-to-main * 531c73e Fix yml syntax (#5274) * 494fe32 Bumping the tracy version to 0.7.7 (WIP). (#5272) * 3616323 Disable Vulkan float16 tests on Pixel4 (#5273) * ade7ff1 Disable running BERT on Vulkan (see Issue #5268) (#5269) * 25ddc10 Add tracing to allocations made from VMA. (#5271) * df454f4 Changing iree_vm_list_resize to grow by 2x. (#5270) * bd9a113 Adding command buffer queue affinity. (#5265) * de834ae Make status matcher print the message when it fails. (#5266) * 10f5eaf Add f16 e2e tests for vulkan (#5257) * 1bdc3a4 Actually make MobileBERT run in the test. (#5264) * 2e05313 Add support for module almost_eq check for f16 type (#5261) COPYBARA_INTEGRATE_REVIEW=#5321 from NatashaKnk:main-to-google 6bd5658 PiperOrigin-RevId: 366926967
* 6bd5658 Merge google -> main (#5319) * 2e5257d Merge branch 'main' into google-to-main * 6936ee7 Patch VMLA performance by reserving vector size before pushing to it. (#5316) * f2f0041 NFC: Cleanup ConcretizeTileAmongstWorkgroupsPass. (#5297) * f96726a Add tests to run few other (smaller) models with Linalg on tensors path. (#5306) * fd64070 Revert "Add wasm-micro-runtime submodule and get building with CMake." (#5312) * ce0285f Continue pruning abseil usage: switch from absl::InlinedVector to std::vector... * 71e24b6 Removing hal.buffer.fill and hal.buffer.copy. (#5307) * 3c611d3 Add Mako benchmark config template file. (#5200) * 4d1a394 Fix RFFT bugs in VMLA. (#5308) * 0d55c95 Add configure_bazel.py step to TensorFlow getting started doc. * 1386d2c Switch simple_embedding_test to include drivers explicitly. (#5304) * 402550b Add StripAsserts pass and handle tf.Identity ops on tensor lists. (#5294) * fbdb4ef Add new metrics to MobileNetV2 benchmarks. (#5301) * 99c8eac Implementing Vulkan dispatch tracing. (#5287) * 2681dff Insert clones prior to mutation and not where it originates. (#5292) * aeafd9e Fix CUDA HAL bug and enable more execution tests (#5296) * 2801780 [CUDA Codegen] Enable tiling and vectorization for MatMulOp (#5293) * c61fefe Extend AffineMin canonicalization to support scf.parallel (#5289) * e0ee3f3 Add directory for microbenchmarking (#5260) * b8da32c Set wasm-export-name attributes on exported functions again. (#5286) * e2a2f81 Canonicalize affine min before applying tile-and-vecotrize passes (#5285) * 23861f7 [CUDA codegen] add vectorization infrastructure (#5278) * 6f443c4 Drop deps on Abseil's core_headers, synchronization, macros. (#5275) * e5b9e8a Actually run MobileNet with fake weights to check correctness (#5284) * e56db9a Remove dead code in LinalgToSPIRV (#5281) * 8863aa1 [NFC] Fix typos in variable names. (#5279) * 9cd93ba Turn vectorization on by default for linalg on tensors path (#5280) * 894dac6 Merge google -> main #5276 * b738162 Changing HAL dialect syntax to express all types. (#5239) * 1ba4e88 Merge branch 'main' into google-to-main * 531c73e Fix yml syntax (#5274) * 494fe32 Bumping the tracy version to 0.7.7 (WIP). (#5272) * 3616323 Disable Vulkan float16 tests on Pixel4 (#5273) * ade7ff1 Disable running BERT on Vulkan (see Issue #5268) (#5269) * 25ddc10 Add tracing to allocations made from VMA. (#5271) * df454f4 Changing iree_vm_list_resize to grow by 2x. (#5270) * bd9a113 Adding command buffer queue affinity. (#5265) * de834ae Make status matcher print the message when it fails. (#5266) * 10f5eaf Add f16 e2e tests for vulkan (#5257) * 1bdc3a4 Actually make MobileBERT run in the test. (#5264) * 2e05313 Add support for module almost_eq check for f16 type (#5261) PiperOrigin-RevId: 366926967
No description provided.