Use SPV_EXT_long_vector extension for non-standard vector size#3777
Conversation
Multi-vendor extension must always have bigger priority, than a vendor extension if they do the same. |
c28dc3d to
82d13de
Compare
Yes, I'm prioritizing |
vmaksimo
left a comment
There was a problem hiding this comment.
LGTM
Nit: I'd add test case for a vector of arbitrary size (now we have only for 1-element vector.)
| unsigned NumElements = VecTy->getNumElements(); | ||
| bool IsNonStandardCount = | ||
| !(NumElements == 2 || NumElements == 3 || NumElements == 4 || | ||
| NumElements == 8 || NumElements == 16); | ||
| if (IsNonStandardCount && | ||
| !BM->isAllowedToUseExtension(ExtensionID::SPV_EXT_long_vector) && | ||
| !BM->isAllowedToUseExtension(ExtensionID::SPV_INTEL_vector_compute)) { | ||
| BM->getErrorLog().checkError( | ||
| false, SPIRVEC_RequiresExtension, | ||
| "SPV_EXT_long_vector or SPV_INTEL_vector_compute\n" | ||
| "NOTE: LLVM module contains a vector with an unsupported number of " | ||
| "components, translation of which requires one of these extensions"); | ||
| return nullptr; | ||
| } |
There was a problem hiding this comment.
Why have we started to need this?
There was a problem hiding this comment.
I've answered same the question for @vmaksimo : the same check in SRIRVType::validate() is done by assert enclosed by #ifndef NDEBUG block only; I thought adding this check should be more user friendly and make it easier for lit test.
Actually I think this piece of code should replace the assertion check in SPIRVType::validate() instead, but... I don't know if it can break anything or have any side effect by with such change.
If you think this is purely redundant or can cause regression, I'm ok to remove it.
There was a problem hiding this comment.
sounds reasonable to me. But I'm fine either way, I don't think it should block this PR.
Yes, I was going to suggest the same. I'd suggest to simply add another case to each test file. |
I agree adding another arbitrary size for each test, but since the emission of OpExtension is done per module, and there's no usage of |
Note, we want to rely on SPV_INTEL_vector_compute for vector compute modules (ESIMD) even when SPV_EXT_long_vector is enabled. |
vmaksimo
left a comment
There was a problem hiding this comment.
I'd merge vector_size_5,ll and negative_size_5.ll into one test, same for size 1.
Other than that, LGTM
YuriPlyakhin
left a comment
There was a problem hiding this comment.
LGTM. Few nits. And another nit: I would merge some of those tests, e.g. 2 negative into single test, 2 priority tests into single test, two size 5 and size 1 tests into single test.
@YuriPlyakhin Thanks for the review. I actually split them into different files on purpose, see this comment I replied to Sven: #3777 (comment) |
Qi-Ye-079
left a comment
There was a problem hiding this comment.
@vmaksimo @YuriPlyakhin Thanks, I've fixed all nits.
|
Planning to merge tomorrow unless anyone objects. Friendly ping @svenvh / @MrSidims / @maarquitos14 |
maarquitos14
left a comment
There was a problem hiding this comment.
Just a nit, otherwise LGTM.
#3829) #3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before #3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after #3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled. --------- Co-authored-by: Ye, Qi <qi.ye@intel.com>
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 22] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 21] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 20] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 19] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 18] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 17] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 16] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 15] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
…ector size (KhronosGroup#3777) For a vector type, add `SPV_EXT_long_vector` extension and prioritize it over `SPV_INTEL_vector_compute` whenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16). [Backport to 14] Keep VectorAnyINTEL for VectorCompute modules with SPV_EXT_long_vector (KhronosGroup#3829) KhronosGroup#3777 added `SPV_EXT_long_vector` and gave it priority over `SPV_INTEL_vector_compute`: when both extensions are enabled and a vector has a non-standard component count, the translator now emits `CapabilityLongVectorEXT` instead of `CapabilityVectorAnyINTEL`. This regresses `VectorCompute` modules. The offloading flow (producing both `VectorCompute` and non-`VectorCompute` modules) applies a single, fixed extension list uniformly to every device image, so a `VectorCompute` module is translated with both `SPV_INTEL_vector_compute` and `SPV_EXT_long_vector` enabled. Before KhronosGroup#3777 such a module emitted `VectorAnyINTEL` for its non-standard vectors; after KhronosGroup#3777 it emits `LongVectorEXT`. `VectorCompute` consumers require `VectorAnyINTEL`, so this is a functional regression. Hence, the enabled extension list does not identify a module as `VectorCompute` - the `VectorCompute` metadata (`VCFunction` /`VCGlobalVariable`) does. `IsVectorComputeModule` records the presence of that metadata before type translation. `VectorCompute` modules keep using `VectorAnyINTEL`, restoring the pre-KhronosGroup#3777 behavior; all other modules still prefer the multi-vendor `LongVectorEXT` when its extension is enabled.
For a vector type, add
SPV_EXT_long_vectorextension and prioritize it overSPV_INTEL_vector_computewhenever the vector type doesn't have a standard component size (2, 3, 4, 8, or 16).