Skip to content

Commit 68fcab8

Browse files
committed
Prevent generation of 1-element vectors
Signed-off-by: Dmitry Sidorov <[email protected]>
1 parent 2d5c967 commit 68fcab8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/Conversion/TritonGPUToLLVM/Utility.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ SmallVector<Value> unpackLLVector(Location loc, Value llvmVec,
736736

737737
Value packLLVector(Location loc, ValueRange vals, RewriterBase &rewriter) {
738738
assert(vals.size() > 0);
739+
// Return scalar directly instead of creating a 1-element vector
740+
if (vals.size() == 1) {
741+
return vals[0];
742+
}
739743
auto vecType = vec_ty(vals[0].getType(), vals.size());
740744
auto b = TritonLLVMOpBuilder(loc, rewriter);
741745
Value vec = b.undef(vecType);

0 commit comments

Comments
 (0)