Skip to content

[SPIR-V] Fix incorrect emission of G_SPLAT_VECTOR for fixed vectors #108534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

VyacheslavLevytskyy
Copy link
Contributor

This PR replaces MIRBuilder.buildSplatVector() by MIRBuilder.buildSplatBuildVector(), so that we emit G_BUILD_VECTOR instead of G_SPLAT_VECTOR: the latter is incorrect for fixed vectors and is limited to scalable vectors only.

@llvmbot
Copy link
Member

llvmbot commented Sep 13, 2024

@llvm/pr-subscribers-backend-spir-v

Author: Vyacheslav Levytskyy (VyacheslavLevytskyy)

Changes

This PR replaces MIRBuilder.buildSplatVector() by MIRBuilder.buildSplatBuildVector(), so that we emit G_BUILD_VECTOR instead of G_SPLAT_VECTOR: the latter is incorrect for fixed vectors and is limited to scalable vectors only.


Full diff: https://github.com/llvm/llvm-project/pull/108534.diff

1 Files Affected:

  • (modified) llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp (+1-1)
diff --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index 553d86efa3df34..ca3e47a4b78f23 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -496,7 +496,7 @@ Register SPIRVGlobalRegistry::getOrCreateIntCompositeOrNull(
     assignSPIRVTypeToVReg(SpvType, SpvVecConst, *CurMF);
     DT.add(CA, CurMF, SpvVecConst);
     if (EmitIR) {
-      MIRBuilder.buildSplatVector(SpvVecConst, SpvScalConst);
+      MIRBuilder.buildSplatBuildVector(SpvVecConst, SpvScalConst);
     } else {
       if (Val) {
         auto MIB = MIRBuilder.buildInstr(SPIRV::OpConstantComposite)

@VyacheslavLevytskyy VyacheslavLevytskyy merged commit 08f5f6d into llvm:main Sep 18, 2024
11 checks passed
tmsri pushed a commit to tmsri/llvm-project that referenced this pull request Sep 19, 2024
…lvm#108534)

This PR replaces MIRBuilder.buildSplatVector() by
MIRBuilder.buildSplatBuildVector(), so that we emit G_BUILD_VECTOR
instead of G_SPLAT_VECTOR: the latter is incorrect for fixed vectors and
is limited to scalable vectors only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants