modular icon indicating copy to clipboard operation
modular copied to clipboard

[BUG] When printing the same SIMD vector with multiple print args, SIMD vector values are different

Open VMois opened this issue 1 year ago • 2 comments

Bug description

Values are different when printing SIMD vector as a single argument in print vs second argument.

Steps to reproduce

alias simd_width = 16

fn main():
    print(SIMD[DType.uint8, simd_width](0, 0x0f))
    print("arg 1", SIMD[DType.uint8, simd_width](0, 0x0f))
    print("arg 1", "arg 2", SIMD[DType.uint8, simd_width](0, 0x0f))

Output:

[0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15]
arg 1 [0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
arg 1 arg 2 [0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15, 0, 15]

The correct output should be a second print (arg1 only).

System information

- What OS did you do install Mojo on ? macOS 12.6
- Provide version information for Mojo by pasting the output of `mojo -v` 24.2.1 (2f0dcf11)
- Provide Modular CLI version by pasting the output of `modular -v` 0.6.0 (04c05243)


Host Information
  ================

  Target Triple: aarch64-unknown-macosx
  CPU: apple-m1
  CPU Features: aes, complxnum, crc, dotprod, fp-armv8, fp16fml, fullfp16, jsconv, lse, neon, pauth, ras, rcpc, rdm, sha2, sha3

VMois avatar Apr 22 '24 05:04 VMois

I can't reproduce with mojo 2024.4.1618 (37a3e965), nightly

jayzhan211 avatar Apr 22 '24 06:04 jayzhan211

You didn't provide enough values for vector initialisation so I think it's suppose to be UB.

soraros avatar Apr 22 '24 18:04 soraros